Hadoop安全学习


=Start=

缘由:

近期在内部红蓝对抗中出现了和HDFS安全有关的case,我个人对这块也比较感兴趣,不过因为之前对Hadoop安全这块了解的不多,所以近期也在各种查资料学习,快速填补这块的知识缺口,方便后面有需要的时候能用到。

另外就是不知道什么原因,现在搜索HDFS架构和原理能搜到的文章非常多,但是搜索HDFS安全就很少了,搜索Hadoop安全,能多搜出来一些,但在翻阅了很多文章之后,发现还是以前领导和同事在18年写的2篇文章会比较系统和全面(但时间久了,随着HDFS版本的更新和Hadoop生态的发展和变化,有些内容也有点过时了,不过一些底层的原理和逻辑还基本一样)。可能和大部分企业的Hadoop主要用在公司内部,通过网络隔离做了保护(对于那种连网络隔离都不做的这里不做评价,只能是祝她们好运了),如果出数据安全问题大概率是(熟悉大数据平台这一套的)内部人员所为,这种case爆出来的比较少,大家也就没那么重视(老板不重视,概率又不大,安全性又不是数据平台团队的主要考核指标,数据安全团队人员不多事情不少,所以这个问题的优先级只能是先往后排一排了,还有就是相关功能代码就算已经实现了,但是因为新增了认证和权限控制等机制很可能会影响原有的相关流程,所以安全功能机制的落地还需要较长的时间去灰度验证);还有就是国内这块的资料偏少,了解和熟悉的人也不多,能做的会做的就更少,愿意分享和能分享的极少,这个当前是没什么办法了,只能是随着时间的推移,整体的安全意识、能力水平、领导意愿提高了之后再来做这个吧。

简单来说就是,因为Hadoop集群基本都放在内网,有一层网络隔离做保护,懂这个且想利用和能利用这个做坏事的人比较少,一般不容易出问题;对于没放在内网或者没有做隔离的那些公司或团队,安全意识和能力肯定是有较大欠缺,数据泄露的渠道和方式很多,不缺这一个,都不需要用这种方式来搞数据;使用第三方云服务的公司或团队一般不需要操心底层服务的安全问题,只需要关注上层应用的账号安全和使用安全等问题就行。

正文:

参考解答:

Hadoop的相关知识

Hadoop版本

HDFS的版本基本是对应Hadoop的版本,了解Hadoop的版本历程简介也就是了解HDFS的版本历程,简而言之,Hadoop的大版本历程如下:

  • Hadoop 1.x
  • Hadoop 2.x
  • Hadoop 3.x

其中Hadoop2.x是目前大部分企业在使用的版本,Hadoop1.x基本很少新项目会考虑使用这个版本,Hadoop3.x是未来更多新项目会考虑使用的一个版本,这里要注意,不同的Hadoop版本存在蛮大的区别,在我们查阅网络资料或官方文档时都要额外注意,要找到对于的版本进行学习。

Hadoop 2.x在新特性中引入了NameNode Federation,解决了横向namenode扩展;引入了Namenode HA,解决了namenode单点故障。

Hadoop核心模块

当前官网列出了4个模块(相比下面多了一个Hadoop Common),其实Hadoop核心也就只有3个模块:

  • HDFS
  • YARN
  • MapReduce

为什么Hadoop底层只有这3个模块就可以打遍天下,号称为Hadoop平台呢?原因在于:Hadoop率先提供了大数据需要的底层基础组件——HDFS存储、YARN资源管理和任务调度、MapReduce离线计算,后来的其它框架基本都是基于这3个进行封装的,例如Hive、Hbase、Spark等。

HDFS架构图
关键词含义
namenode名字节点,管理文件系统命名空间的主服务器。
datanode数据节点,存储文件块
replication文件块的副本,目的是确保数据存储的可靠性
rack翻译为“机架”,可以理解为两个处于不同地方的集群,每个集群内部有自己的连接方式
Client凡是通过指令或代码操作的一端都是客户端
Client的Read从HDFS下载文件到本地
Client的Write上传文件到HDFS上
HDFS 文件读取过程

简单总结一下:

  1. Client 先与集群的 NameNode 进行一次 RPC 交互,获取文件 block 位置信息;
  2. NameNode 返回存储的每个块的 DataNode 列表;
  3. Client 再与列表中最近的 DataNode 进行交互;
  4. Client 开始从 DataNode 并行读取数据;
  5. 一旦 Client 获得了所有必须的 block,它就会将这些 block 组合起来形成一个文件。
其它

Cloudera 和 Hortonworks 在2018年10月份宣布了它们所谓的相对平等的合并(合并之后Cloudera占比60%,所以一般人们也认为是Cloudera把Hortonworks给合并了)。

Cloudera & Hortonworks 合并,CDH & HDP 产品重合度如此之高,影响深远,特别是对社区开源软件。好处是Hadoop生态能相对更加统一标准化了(很多之前功能有重合或者是竞争关系的组件最后只会剩下少部分精品继续维护,其它的就退出历史舞台了)。坏处是社区开源生态平衡被打破,其他大数据发行版生存空间挤压。

Hadoop 安全

一般来说安全需要关注 CIA 三要素,即:机密性、完整性、可用性。对于安全整理来说确实需要保证这3个方面,但具体到公司内部,不同职责一般落在不同的团队身上,或者说各有侧重——比如数据的完整性和可用性一般是由数据平台团队来负责,因为平台是他们搭建的,他们最熟悉,而且他们需要保证平台的稳定性,而这两点也都包含在稳定性要求中;机密性主要是由数据安全团队来负责,因为数据安全需要对公司内部数据泄露的问题负责

Hadoop生态如此之大,组件很多,安全问题其实很复杂,一句话两句话说不清楚,但如果非要总结的话,也可以整理成如下6点(在原先5点总结的基础上加了1点):

  1. 安全认证(Authentication)——避免出了问题无法溯源和日常审计
  2. 权限控制(Authorization)——避免未授权访问/篡改、仿冒身份后操作
  3. 操作审计(Audit)——高危操作审计、异常操作审计
  4. 静态加密(Encrypting Data at Rest)——文件存储加密,避免文件被获取后的文件内容泄漏
  5. 动态加密(Encrypting Data in Transit)——数据传输加密
  6. 安全状态可见性(Visibility)——整体Hadoop安全大盘,大数据方面的安全水位和趋势变化情况

Perimeter – Access to the cluster must be protected from a variety of threats coming from internal and external networks and from a variety of actors. Network isolation can be provided by proper configuration of firewalls, routers, subnets, and the proper use of public and private IP addresses, for example. Authentication mechanisms ensure that people, processes, and applications properly identify themselves to the cluster and prove they are who they say they are, before gaining access to the cluster.
必须保护集群的外围访问不受来自内部和外部网络以及各种行为者的各种威胁。例如,可通过正确配置防火墙、路由器、子网以及正确使用公共和专用 IP 地址来实现网络隔离。身份验证机制可确保人员、进程和应用程序在访问群集之前向群集正确表明自己的身份,并证明自己的身份。

Data – Data in the cluster must always be protected from unauthorized exposure. Similarly, communications between the nodes in the cluster must be protected. Encryption mechanisms ensure that even if network packets are intercepted or hard-disk drives are physically removed from the system by bad actors, the contents are not usable.
必须始终保护集群中的数据,防止未经授权的数据泄露。同样,集群中节点之间的通信也必须受到保护。加密机制可确保即使网络数据包被截获或硬盘驱动器被坏人从系统中取出,其内容也无法使用。

Access – Access to any specific service or item of data within the cluster must be specifically granted. Authorization mechanisms ensure that once users have authenticated themselves to the cluster, they can only see the data and use the processes to which they have been granted specific permission.
访问权限 访问群集中的任何特定服务或数据项都必须经过专门授权。授权机制可确保用户在对群集进行身份验证后,只能查看获得特定权限的数据和使用获得特定权限的流程。

Visibility – Visibility means that the history of data changes is transparent and capable of meeting data governance policies. Auditing mechanisms ensure that all actions on data and its lineage—source, changes over time, and so on—are documented as they occur.
可见性 可见性意味着数据变化的历史是透明的,能够满足数据管理政策的要求。审计机制可确保在发生时记录对数据及其脉络(来源、随时间发生的变化等)的所有操作。

Level 级别Security 安全Characteristics 特点
0Non-secure 非安全No security configured. Non-secure clusters should never be used in production environments because they are vulnerable to any and all attacks and exploits. 未配置安全性。生产环境中绝对不要使用不安全的集群,因为它们容易受到任何攻击和利用。
1Minimal 最低限度Configured for authentication, authorization, and auditing. Authentication is first configured to ensure that users and services can access the cluster only after proving their identities. Next, authorization mechanisms are applied to assign privileges to users and user groups. Auditing procedures keep track of who accesses the cluster (and how). 配置了身份验证、授权和审计。首先配置身份验证,以确保用户和服务只有在证明其身份后才能访问群集。然后,应用授权机制为用户和用户组分配权限。审计程序可跟踪谁访问了群集(以及如何访问)。
2More 更进一步Sensitive data is encrypted. Key management systems handle encryption keys. Auditing has been setup for data in metastores. System metadata is reviewed and updated regularly. Ideally, cluster has been setup so that lineage for any data object can be traced (data governance). 对敏感数据进行加密。密钥管理系统处理加密密钥。对元数据库中的数据进行审计。定期审查和更新系统元数据。理想情况下,集群的设置可追溯任何数据对象的来源(数据管理)。
3Most 尽其所能The secure enterprise data hub (EDH) is one in which all data, both data-at-rest and data-in-transit, is encrypted and the key management system is fault-tolerant. Auditing mechanisms comply with industry, government, and regulatory standards (PCI, HIPAA, NIST, for example), and extend from the EDH to the other systems that integrate with it. Cluster administrators are well-trained, security procedures have been certified by an expert, and the cluster can pass technical review. 在安全的企业数据中心(EDH)中,所有数据(包括静态数据和传输中的数据)都经过加密,密钥管理系统具有容错性。审计机制符合行业、政府和监管标准(如 PCI、HIPAA 和 NIST),并从 EDH 扩展到与其集成的其他系统。集群管理员训练有素,安全程序经过专家认证,集群可通过技术审查。
Hadoop平台安全成熟度
一些开源的安全解决方案

Apache Ranger 的愿景是在Apache Hadoop生态系统中提供全面的安全性
https://ranger.apache.org/
https://ranger.apache.org/faq.html

Apache Atlas 为组织提供开放可扩展的元数据管理和治理功能,以构建数据资产的目录,对这些资产进行分类和治理,并为数据科学家、分析师和数据治理团队提供围绕这些数据资产的协作功能。
https://atlas.apache.org/#/

Apache Falcon 这个项目已经不维护了(Last Published: 2018-03-12. Apache Falcon moved into the Attic in June 2019.)
https://falcon.apache.org/
https://attic.apache.org/projects/falcon.html

Apache Eagle 这个项目已经不维护了(Apache Eagle moved into the Attic in 2020-11.)
https://eagle.apache.org/
https://attic.apache.org/projects/eagle.html

参考链接:

Cloudera Security Overview
https://docs.cloudera.com/documentation/enterprise/latest/topics/sg_edh_overview.html

【技术分享】谈谈Hadoop安全的那些事儿
https://mp.weixin.qq.com/s/bThdTMGUZDXQzI0ts2IGEw

HADOOP安全基础篇
https://www.freebuf.com/articles/database/190734.html

Hadoop安全问题介绍以及安全加固!
https://mp.weixin.qq.com/s/nK0RlAhDCd7FZTgHfhCIZA

浅谈Hadoop安全(下)
https://mp.weixin.qq.com/s/ZAsssxshRHlgUp6WVUaweQ

浅谈Hadoop安全(上)
https://mp.weixin.qq.com/s/zmmL0yIQ2Lm66JUh8nRYgA

【数据安全推荐书籍1】Hadoop安全 大数据平台隐私保护
https://mp.weixin.qq.com/s/7ipPvx8Nfr2bTn4fb779rg

腾讯——大数据安全体系介绍
https://mp.weixin.qq.com/s/KrtVbG7mjXlR7tC5PszuiQ

滴滴大数据安全权限实践
https://mp.weixin.qq.com/s/-0PGwGZ_fcssP0SxGe04xg

【技术分享】同程旅游Hadoop安全实践
https://www.anquanke.com/post/id/85343

Hadoop 2.10.1 HDFS 透明加密原理 + 实战 + 验证
https://mp.weixin.qq.com/s/gjEqu_hx3GunlkNlmHiX2g

数据仓库之Hadoop安全初探
https://mp.weixin.qq.com/s/HMuAe9cFFl6zGltka6QZlQ

=END=


《 “Hadoop安全学习” 》 有 6 条评论

  1. Hadoop Security
    https://www.scaler.com/topics/hadoop-security/
    `
    # Overview 概述

    In today’s data-driven world, organizations face difficulty managing and securing massive amounts of data. This is where Hadoop, a free and open-source platform, comes into play. Hadoop enables enterprises to handle and store massive volumes of data across commodity hardware clusters. However, as data becomes more complicated and valuable, maintaining its security becomes increasingly important. Hadoop security refers to the methods, tools, and procedures used to safeguard data stored and processed within a Hadoop ecosystem.
    在当今数据驱动的世界中,企业面临着管理和保护海量数据的困难。这就是 Hadoop 这一免费开源平台发挥作用的地方。Hadoop 使企业能够通过商品硬件集群处理和存储海量数据。然而,随着数据变得越来越复杂和有价值,维护其安全性也变得越来越重要。Hadoop 安全性是指用于保护在 Hadoop 生态系统中存储和处理的数据的方法、工具和程序。

    # Introduction 导言

    With the increasing incidence of cyber-attacks and data breaches, businesses must establish strong security measures to protect their data assets.
    随着网络攻击和数据泄露事件的不断增加,企业必须建立强大的安全措施来保护其数据资产。

    Authentication and access control are critical components of Hadoop security. It entails validating users’ identities and allowing them suitable levels of data access. This guarantees that only authorized individuals access sensitive information, reducing the danger of unauthorized data exposure.
    身份验证和访问控制是 Hadoop 安全性的关键组成部分。它需要验证用户身份,并允许他们进行适当级别的数据访问。这就保证了只有经过授权的人才能访问敏感信息,减少了未经授权的数据暴露的危险。

    Data encryption is another critical feature of Hadoop security. Data is protected via encryption by transforming it into an unreadable format, rendering it useless to unauthorized parties. Organizations can prevent unauthorized access to data even if it falls into the wrong hands by employing encryption mechanisms.
    数据加密是 Hadoop 安全性的另一个关键特征。通过加密将数据转换为无法读取的格式,使其对未经授权的各方毫无用处,从而保护数据。即使数据落入不法分子之手,企业也可以通过采用加密机制来防止对数据的非法访问。

    Furthermore, audits and monitoring are critical components of Hadoop security. Organizations must monitor Hadoop ecosystem activity to detect unusual behavior or potential security breaches. Logging and auditing tools keep a detailed record of user activity, allowing for quick discovery and reaction to security incidents.
    此外,审计和监控也是 Hadoop 安全的关键组成部分。企业必须监控 Hadoop 生态系统的活动,以发现异常行为或潜在的安全漏洞。日志和审计工具可详细记录用户活动,以便快速发现安全事件并做出反应。

    In addition, Hadoop security entails safeguarding communication links within the Hadoop cluster. Encryption and secure network protocols ensure that data sent between nodes or clusters is not intercepted or tampered with.
    此外,Hadoop 的安全性还包括保护 Hadoop 集群内的通信链路。加密和安全网络协议可确保节点或集群之间发送的数据不被拦截或篡改。

    As the volume and sensitivity of data grow, Hadoop security becomes an essential component of a company’s data management strategy. By deploying comprehensive security measures, businesses may protect their digital assets, comply with regulatory standards, and develop confidence with their stakeholders.
    随着数据量和敏感性的增长,Hadoop 安全性已成为公司数据管理战略的重要组成部分。通过部署全面的安全措施,企业可以保护其数字资产,遵守监管标准,并增强利益相关者的信心。

    # Why Hadoop Security? 为什么需要 Hadoop 安全性?

    Data loss may be disastrous for any business. For example, backup and disaster recovery techniques are critical in guaranteeing data integrity and availability. Hadoop provides redundancy by replicating data across numerous nodes, which protects against hardware failures and enables speedy recovery in the case of a system crash or data loss.
    数据丢失对任何企业来说都可能是灾难性的。例如,备份和灾难恢复技术对于保证数据的完整性和可用性至关重要。Hadoop 通过在多个节点之间复制数据来提供冗余,从而防止硬件故障,并在系统崩溃或数据丢失时实现快速恢复。

    Security concerns are not uncommon in the big data arena. Advanced monitoring and auditing tools are included in Hadoop security framework to detect suspicious activity and potential security breaches. Hadoop enables organizations to quickly discover and respond to security events by leveraging technology like encryption and intrusion detection systems. These proactive procedures aid in risk mitigation, data confidentiality, integrity, and availability.
    安全问题在大数据领域并不少见。Hadoop 安全框架中包含先进的监控和审计工具,用于检测可疑活动和潜在的安全漏洞。通过利用加密和入侵检测系统等技术,Hadoop 使企业能够快速发现和应对安全事件。这些积极主动的程序有助于降低风险,提高数据的保密性、完整性和可用性。

    Compliance has become a primary responsibility for organizations as the number of data protection rules grows. Hadoop security features help with legal compliance, such as the General Data Protection Regulation (GDPR) and the Health Insurance Portability and Accountability Act (HIPAA). Hadoop assists organizations in maintaining compliance and avoiding expensive penalties by integrating strong authentication, encryption, and auditing procedures.
    随着数据保护规则的增多,合规性已成为企业的首要责任。Hadoop 的安全功能有助于遵守法律规定,如《通用数据保护条例》(GDPR)和《健康保险可携性和责任法案》(HIPAA)。Hadoop 通过集成强大的身份验证、加密和审计程序,帮助企业保持合规性并避免昂贵的处罚。

    The importance of Hadoop security cannot be emphasized as big data becomes increasingly important for businesses and organizations. Hadoop security measures defend against potential vulnerabilities by securing sensitive information, preventing data loss, identifying threats, and guaranteeing compliance. Implementing these security measures assures your data infrastructure’s confidentiality, integrity, and availability, providing peace of mind and allowing you to concentrate on getting relevant insights from your big data environment.
    随着大数据对企业和组织的重要性与日俱增,Hadoop 安全性的重要性不言而喻。Hadoop 安全措施通过保护敏感信息、防止数据丢失、识别威胁和保证合规性来抵御潜在漏洞。实施这些安全措施可确保数据基础架构的机密性、完整性和可用性,让您高枕无忧,集中精力从大数据环境中获取相关见解。

    Organizations must prioritize the three core security principles known as the 3A’s: Authentication, Authorization, and Auditing to manage security concerns in a Hadoop environment effectively.
    企业必须优先考虑被称为 3A 的三个核心安全原则:认证、授权和审计,以有效管理 Hadoop 环境中的安全问题。

    1. Authentication: 1.验证:
    The authentication process ensures that only authorized users can access the Hadoop cluster. It entails authenticating users’ identities using various mechanisms such as usernames and passwords, digital certificates, or biometric authentication. Organizations can reduce the risk of unauthorized access and secure their data from dangerous actors by establishing strong authentication protocols.
    身份验证过程可确保只有授权用户才能访问 Hadoop 集群。这需要使用用户名和密码、数字证书或生物特征认证等各种机制来验证用户身份。企业可以通过建立强大的身份验证协议来降低未经授权访问的风险,并保护数据免受危险行为者的破坏。

    2. Authorization: 2.授权:
    Authorization governs the actions an authenticated user can take within the Hadoop cluster. It entails creating access restrictions and permissions depending on the roles and responsibilities of the users. Organizations can enforce the concept of least privilege by allowing users only the privileges required to complete their tasks, if adequate authorization procedures are in place. This reduces the possibility of unauthorized data tampering or exposure.
    授权管理已通过身份验证的用户在 Hadoop 集群中可以采取的行动。这需要根据用户的角色和职责创建访问限制和权限。如果有适当的授权程序,企业可以执行最小特权概念,只允许用户拥有完成任务所需的权限。这就降低了未经授权篡改或暴露数据的可能性。

    3. Auditing: 3.审计:
    Auditing is essential for monitoring and tracking user activity in the Hadoop cluster. Organizations can investigate suspicious or unauthorized activity by keeping detailed audit logs. Auditing also aids in compliance reporting, allowing organizations to demonstrate conformity with regulatory standards. Implementing real-time audit log monitoring and analysis provides for the timely detection of security incidents and the facilitation of proactive measures.
    审计对于监控和跟踪 Hadoop 集群中的用户活动至关重要。企业可以通过保存详细的审计日志来调查可疑或未经授权的活动。审计还有助于合规性报告,使组织能够证明其符合监管标准。实施实时审计日志监控和分析可及时发现安全事故,并促进采取主动措施。

    # Hadoop 安全配置

    Authentication and Authorization: 认证和授权

    Encryption: (静态存储和动态传输)加密

    Auditing and Monitoring: 审计和监控

    Secure Network Communication: 网络隔离创建安全边界

    Regular Updates and Patches: 定期更新和补丁
    `

  2. Hadoop 安全简介
    https://www.bmc.com/blogs/hadoop-security/
    `
    When Hadoop was first released in 2007 it was intended to manage large amounts of web data in a trusted environment, so security was not a significant concern or focus. As adoption rose and Hadoop evolved into an enterprise technology, it developed a reputation as an unsecure platform. Most of the original Hadoop security shortcomings have been addressed in subsequent releases, but perceptions are slow to change. Hadoop’s security reputation has outlasted its reality.
    **2007 年 Hadoop 首次发布时,其目的是在受信任的环境中管理大量网络数据,因此安全性并不是一个重要的关注点。**随着采用率的上升和 Hadoop 逐渐成为一种企业技术,它逐渐被认为是一种不安全的平台。Hadoop 最初的大部分安全缺陷已在后续版本中得到解决,但人们对它的看法却迟迟没有改变。Hadoop 的安全声誉已经超过了现实。

    Security is actually quite inconsistent among Hadoop implementations because the built-in security and available options are inconsistent among release versions. It is also important to note that the commercial Hadoop distributions from software vendors (e.g. Cloudera, Hortonworks, MapR) have additional, proprietary security that is not included in the free Hadoop releases that are available from the Apache Foundation.
    Hadoop 实现之间的安全性实际上很不一致,因为不同版本的内置安全性和可用选项并不一致。还必须注意的是,软件供应商(如 Cloudera、Hortonworks、MapR)的商业 Hadoop 发行版具有额外的专有安全性,而 Apache 基金会提供的免费 Hadoop 发行版不包含这些安全性。

    New Hadoop deployments can be extremely secure but many legacy Hadoop implementations may still have security gaps. This section highlights historical Hadoop security vulnerabilities and identifies the resources and tactics available to address them.
    新的 Hadoop 部署可能非常安全,但许多传统 Hadoop 实施可能仍存在安全漏洞。本节重点介绍历史上的 Hadoop 安全漏洞,并确定可用于解决这些问题的资源和策略。

    It is easy to quickly get lost in the details when talking about information security. To minimize confusion we will focus on three fundamental areas:
    在谈论信息安全时,人们很容易很快迷失在细节中。为了减少混淆,我们将重点关注三个基本方面:

    加密
    认证
    授权

    Knox、Ranger 简化了安全管理
    Hadoop 生态系统拥有支持安全的资源。Knox 和 Ranger 是两个重要的 Apache 开源项目。
    `

    Apache Knox
    https://knox.apache.org/

  3. Apache Sentry 对比 Ranger
    https://www.wtlizzz.com/Apache-Sentry-vs-Ranger/
    `
    # 背景

    在大数据生态中,一直都是三分天下,不收费的Hadoop版本主要有三个,分别是:

    Apache(最原始的版本,所有发行版均基于这个版本进行改进)
    Cloudera版本(Cloudera’s Distribution Including Apache Hadoop,简称CDH)
    Hortonworks版本(Hortonworks Data Platform,简称HDP)

    但是在2018年10月初,Cloudera收购了Hortonworks公司,所以两者合并,在产品上将CDH与HDP合并成为CDP(Cloudera Data Platform),并将它们两者之间的技术进行了淘汰+融合+互补+共享。

    # Sentry 和 Ranger

    Sentry是一个基于角色的粒度授权模块,提供了对Hadoop集群上经过身份验证的用户提供了控制和强制访问数据或数据特权的能力。它可以和Hive/Hcatalog、Apache Solr 和Cloudera Impala等集成,未来可以扩展到其他Hadoop生态系统组件,如HDFS和HBase。

    Ranger的中文释义是“园林管理员”。正如其名,Apache Ranger很好的承担了Hadoop这个大园林的管理员职责。Ranger提供了一个集中式的安全管理框架,用户可以通过操作Ranger控制台来配置各种策略,从而实现对Hadoop生态组件如HDFS、Hive、HBase、Yarn等进行细粒度的数据访问控制。

    # 架构比较

    Sentry架构:
    通过Sentry Client,来收集生态中的各个组件信息,并传递到Sentry Server中,再与Sentry Store进行交互。

    Renger架构:
    首先看核心,和Sentry一致,都是有一个Client,如下图所示指的是Ranger Plugin,相当于在Hadoop生态组件中的插件。
    然后Ranger的核心主要包括Ranger Audit Server,Ranger Policy Server, Ranger Administration Protal。

    # 选择Sentry还是Ranger

    选择Ranger。

    原因一:
    Sentry目前在Apache中已经不再更新和维护了,已经放到Apache阁楼中。
    Ranger目前还在Apache中正常更新维护。

    原因二:
    根据对Hadoop组件生态支持情况,选择Ranger。

    原因三:
    在Cloudera和Hortonworks合并之后,决定对Ranger标准化,并且在新Hadoop云环境CDP中使用Ranger。

    原因四:
    Sentry并不是很成熟。
    `

  4. 大数据权限授权管理框架:Apache Sentry和Ranger
    https://blog.csdn.net/Androidlushangderen/article/details/85649735

    Apache Ranger对HDFS的访问权限控制的原理分析(一)
    https://www.cnblogs.com/qiuyuesu/p/6774520.html
    `
    Aapche Ranger是以插件的形式集成到HDFS中,由Ranger Admin管理访问策略,Ranger插件定期轮询Admin更新策略到本地,并根据策略信息进行用户访问权限的判定。

    # Ranger对HDFS访问控制的实现原理
    HDFS本身是有访问控制机制的,即在身份认证机制之后通过查询ACLs来对用户的权限检查,该权限检查的实现代码是INodeAttributeProvider抽象类中接口AccessControlEnforcer的checkPermission方法。Ranger将HDFS NameNode 的Inode attribute的提供类即INodeAttributeProvider抽象类修改为Ranger自己写的类,该类继承了INodeAttributeProvider抽象类。即在hdfs-site.xml文件中修改如下配置项。
    `

    How to choose between apache ranger and sentry
    https://stackoverflow.com/questions/39326456/how-to-choose-between-apache-ranger-and-sentry

    Sentry to Ranger – A Concise Guide
    https://blog.cloudera.com/sentry-to-ranger-a-concise-guide/
    Sentry到Ranger—简明指南
    https://mp.weixin.qq.com/s/ZcLXzEQRhWGIy3YqA700mQ

  5. Cloudera数据平台安全参考架构总结 Security Reference Architecture Summary for Cloudera Data Platform
    安全工程最佳实践的四大支柱:边界、数据、访问和可见性 The Four Security Engineering Best Practice Pillars: Perimeter, Data, Access and Visibility.
    https://blog.cloudera.com/security-reference-architecture-summary-for-cloudera-data-platform/
    `
    本博客将总结CDP Private Cloud Base集群的安全架构。该架构反映了安全工程最佳实践的四大支柱:边界、数据、访问和可见性。CDP私有云基础的发布对安全架构进行了许多重大增强,包括:
    * 用于安全策略管理的 Apache Ranger
    * 更新 Ranger 密钥管理服务

    # 安全架构改进

    为了符合Level3级监管标准,客户将创建网络拓扑,确保只有特权管理员才能访问核心 CDP 服务,而应用程序、分析师和开发人员仅限于适当的网关服务(例如 Hue)以及适当的管理和监控 Web 界面。Apache Knox 的添加极大地简化了安全访问的配置,使用户受益于强大的单点登录。Apache Ranger 将安全策略管理与基于标签的访问控制、强大的审核以及与现有企业目录的集成相整合。

    ## Authentication – Kerberos
    ## Encryption
    Encryption At Rest

    Key Security Services

    * Apache Ranger
    * Security Zones
    * Apache Atlas
    * Apache Knox

    ## Apache Atlas

    Atlas is a scalable and extensible set of core foundational governance services – enabling enterprises to effectively and efficiently meet their compliance requirements within CDP and allows integration with the whole enterprise data ecosystem.
    Atlas 是一套可扩展的核心基础治理服务,使企业能够切实有效地满足其在 CDP 中的合规要求,并允许与整个企业数据生态系统集成。

    Organizations can build a catalog of their data assets, classify and govern these assets and provide collaboration capabilities around these data assets for data scientists, analysts and the data governance team.
    企业可以建立数据资产目录,对这些资产进行分类和管理,并为数据科学家、分析师和数据管理团队提供围绕这些数据资产的协作能力。

    ## Apache Knox

    Apache Knox simplifies access to the cluster Interfaces by providing Single Sign-on for CDP Web UIs and APIs by acting as a proxy for all remote Apache Knox simplifies access to the cluster Interfaces by providing Single Sign-on for CDP Web UIs and APIs by acting as a proxy for all remote access events. Many of these APIs are useful for monitoring and issuing on the fly configuration changes.
    Apache Knox 作为所有远程访问事件的代理,为 CDP Web UI 和 API 提供单点登录功能,从而简化了对集群接口的访问。其中许多 API 对于监控和发布即时配置更改非常有用。

    As a stateless reverse proxy framework, Knox can be deployed as multiple instances that route requests to CDP’s REST APIs. It scales linearly by adding more Knox nodes as the load increases. A load balancer can route requests to multiple Knox instances.
    作为一个无状态反向代理框架,Knox 可以部署为多个实例,将请求路由到 CDP 的 REST API。当负载增加时,可通过添加更多 Knox 节点来线性扩展。负载平衡器可将请求路由到多个 Knox 实例。

    Knox also intercepts REST/HTTP calls and provides authentication, authorization, audit, URL rewriting, web vulnerability removal and other security services through a series of extensible interceptor pipelines.
    Knox 还拦截 REST/HTTP 调用,并通过一系列可扩展的拦截器管道提供身份验证、授权、审计、URL 重写、网络漏洞清除和其他安全服务。

    Each CDP cluster that is protected by Knox has its set of REST APIs represented by a single cluster specific application context path. This allows the Knox Gateway to both protect multiple clusters and present the REST API consumer with a single endpoint for access to all of the services required, across the multiple clusters.
    受 Knox 保护的每个 CDP 集群都有一套 REST API,由一个特定于集群的应用程序上下文路径表示。这样,Knox 网关既能保护多个集群,又能为 REST API 消费者提供一个单一的端点,以访问多个集群所需的所有服务。

    In CDP certain providers (sso, pam, admin, manager) and topologies (cdp-proxy, cdp-proxy-api) are already pre-configured and are mostly integrated into the configuration UI of Cloudera Manager. Furthermore CDP ships with a useful pre-configured home page for users.
    在 CDP 中,某些提供程序(sso、pam、admin、manager)和拓扑(cdp-proxy、cdp-proxy-api)已经预先配置好,并主要集成到 Cloudera Manager 的配置用户界面中。此外,CDP 还为用户提供了一个有用的预配置主页。
    `

  6. 0784-CDP安全管理工具介绍
    https://mp.weixin.qq.com/s/xnPFwQND-b_7XRBOdkAOKw
    `
    # 安全管理工具介绍
    本文档描述如何使用多种安全管理工具来保护CDP环境。重点介绍安全管理工具与CDP环境之间的集成点,但不会探讨这些工具的核心功能。
    CDP在内部将这些工具整合到一个全面的、统一的安全架构中,同时支持与其他第三方主流工具进行外部集成。

    ## 1.1身份认证

    身份认证意味着我们能够验证用户身份。**没有身份认证,所有其他安全措施均无效。**例如:由于无法验证用户的身份,则用户可以把自己指定为系统管理员,而我们只能信任他。要解决上述安全问题,满足条件的技术是Kerberos。

    ### 1.1.1 Kerberos
    我们在这里不会深入介绍Kerberos体系结构。Kerberos的主要组件是KDC(Key Distribution Center)。它负责将票证传递给身份认证模块。
    每个节点上运行的CDP组件都需要与Kerberos集成在一起,以便可以接受Kerberos票证。接下来,客户端(用户或服务)需要通过KDC进行一次身份验证(命令行kinit)以获得票证,然后票证就可以传递给在任何节点上运行的任何服务,而无需再次进行身份验证。
    这样一来,身份认证就可以从Linux系统中删除,这意味着,成为一个节点上的root用户并不意味着拥有访问集群的特权。同时,用户进入集群后只需要输入一次密码。

    ## 1.2 用户授权

    ### 1.2.1 Apache Ranger
    Ranger使用基于角色的访问控制(RBAC)策略和基于属性的访问控制(ABAC)策略。也就是说,Ranger通过角色或属性将组映射到数据访问权限。

    ### 1.2.2 Apache Atlas
    Apache Atlas可以用来定义属性,也称为标签(Tags)。标签非常灵活,可以标记表,列,行,topic,consumer group和几乎其他所有数据对象。

    ### 1.2.3 组成员
    以上两种方式都有一个基本思路:通过组成员身份来管理访问。

    ### 1.2.4 Kerberos+LDAP目录服务
    Cloudera 建议通过Kerberos进行身份验证,然后通过基于目录服务的用户组进行授权。
    HDFS,YARN和其他CDP组件会使用“ id -gr” Linux命令,Apache Ranger也会使用类似的Linux命令。
    这些组件通过从Kerberos用户名中剔除Kerberos Realm来提取OS用户。例如, Kerberos用户名为[email protected], fayson将被提取出来作为OS用户,由此衍生出组成员身份。
    在Linux环境,“ id”命令可用于查询组成员身份。那么如何将目录服务中的用户和用户组映射到Linux环境呢?一般使用SSSD或者Centrify。SSSD或者Centrify允许将用户/用户组从目录服务引入Linux OS级别,更重要的是,它允许CDP组件直接从Linux OS级别获取组成员身份,而无需再访问目录服务。

    ### 1.2.5 Microsoft Active Directory 和Redhat IPA (IDM)

    ## 1.3 通过Web界面进行身份认证和授权

    ### 1.3.1Apache Knox

    ## 1.4 数据加密

    ### 1.4.1 网络加密
    Cloudera集群可以使用传输层安全性(TLS)进行加密。

    ### 1.4.2 静态数据加密
    Cloudera也可以使用透明数据加密(TDE),在数据写到磁盘之前对数据进行加密。

    HDFS数据加密是其中最核心的内容。因为在HDFS上有大量的CSV文件或其他纯文本文件,则这些纯文本内容默认是没有加密的,在Linux文件系统中处于可读状态。

    ## 1.5 审计和监控
    安全管理有一项基本原则是“充分信任用户行为但必须进行审计跟踪”。

    ### 1.5.1 Apache Ranger
    即便是安全集群,也仍然需要启用审计服务。CDP使用Apache Ranger来提供审计报告,以便更深入地控制生产环境。Ranger插件从用户日常操作中收集审计日志,并通过一个独立的线程汇聚到Ranger Audit Server。Ranger在后台使用Solr存储审计日志,并通过Ranger Admin UI提供自助式搜索。在默认情况下,Solr Audit Collection的保存周期为90天。
    Ranger审计记录同时也会写入HDFS。因为合规要求,企业往往需要保留很长时间的安全审计记录,因此HDFS中存储的审计记录可以导出到任何SIEM系统或外部离线存储中。
    Ranger审计报告通常用来查看用户访问轨迹及其结束状态。同时,还能用来调整Ranger现有的访问策略或者定义新的访问策略。
    基于以上方式,我们可以对集群中发生的事件进行监控和审计,以便在发生重大安全事故时进行取证分析。
    `

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注