【问题标题】:Ranger policies don't work for HDFS NFS accessRanger 策略不适用于 HDFS NFS 访问
【发布时间】:2019-12-16 17:25:23
【问题描述】:

我有一个 HDFS 资源的游侠策略,看起来像...... 现在尝试以两个不同的用户身份通过​​ hadoop fs <path to the hdfs location> 访问该 HDFS 路径:

# as an unauthorized user
[ml1@HW04 ml1c]$ hadoop fs -ls <path to the hdfs location>
ls: Permission denied: user=ml1, access=EXECUTE, inode="<path to the hdfs location>"

# as an authorized user
[hph_etl@HW04 hph_etl]$ hadoop fs -ls <path to the hdfs location>
Found 4 items
drwxrwxr-x   - hph_etl hph_etl          0 2019-07-31 15:13 <path to the hdfs location>
drwxrwxr-x   - hph_etl hph_etl          0 2019-08-07 10:52 <path to the hdfs location>
drwxrwxr-x   - hph_etl hph_etl          0 2019-07-31 14:28 <path to the hdfs location>
drwxrwxr-x   - hph_etl hph_etl          0 2019-07-26 16:12 <path to the hdfs location>

按预期工作。现在尝试在本地文件系统上通过ls -lh &lt;nfs path to the hdfs location&gt;

# as an unauthorized user
[ml1@HW04 ml1c]$ ls -lh <nfs path to the hdfs location>
total 2.0K
drwxrwxr-x. 4 hph_etl hph_etl 128 Jul 31 15:13 export
drwxrwxr-x. 5 hph_etl hph_etl 160 Aug  7 10:52 import
drwxrwxr-x. 5 hph_etl hph_etl 160 Jul 31 14:28 storage
drwxrwxr-x. 3 hph_etl hph_etl  96 Jul 26 16:12 tests

# as an authorized user
[hph_etl@HW04 hph_etl]$ ls -lh <nfs path to the hdfs location>
total 2.0K
drwxrwxr-x. 4 hph_etl hph_etl 128 Jul 31 15:13 export
drwxrwxr-x. 5 hph_etl hph_etl 160 Aug  7 10:52 import
drwxrwxr-x. 5 hph_etl hph_etl 160 Jul 31 14:28 storage
drwxrwxr-x. 3 hph_etl hph_etl  96 Jul 26 16:12 tests

我们看到两个用户都能够通过 NFS 访问 HDFS 位置(即使只有 hph_etl 用户应该能够访问)。有人知道这里发生了什么吗?有任何调试提示或修复吗?

更新

显然,这并非意外行为。与 Hortonworks 的人交谈,目的是......

  • 通过 NFS 将 HDFS 的特定部分挂载到具有基于 POSIX 限制的权限的机器上
  • 然后让 NiFi(例如来自 HDF)不断监听这些位置,然后将数据加载到 HDFS 中的某个 其他 Ranger 保护位置

对我来说,这似乎是一个安全问题,因为我可以轻松地做这样的事情

$ cd /hdfs_nfs_mount/some/private/location
$ head some_private_file.txt
<shows all the contents>

# even when Ranger would rather this user not go there...
$ whoami
<some unauthorized user>
$ hadoop fs -ls /some/private/location
ls: Permission denied: user=<some unauthorized user>, access=EXECUTE, inode="/some/private/location"

如果在仅将所有 HDFS 安装到位于 HDFS 根目录的服务器的常规集群节点上。不写这个作为答案,因为有点希望这不是答案;将继续寻找。

【问题讨论】:

    标签: hdfs hdp apache-ranger


    【解决方案1】:

    显然,这不是意外行为。与 Hortonworks 的人交谈,目的是……

    通过 NFS 将 HDFS 的特定部分挂载到具有基于 POSIX 限制的权限的机器上 然后让 NiFi(例如来自 HDF)不断监听这些位置,然后将数据加载到 HDFS 中其他受 Ranger 保护的位置 对我来说,这似乎是一个安全问题,因为我可以轻松地做这样的事情

    $ cd /hdfs_nfs_mount/some/private/location
    $ head some_private_file.txt
    <shows all the contents>
    
    # even when Ranger would rather this user not go there...
    $ whoami
    <some unauthorized user>
    $ hadoop fs -ls /some/private/location
    ls: Permission denied: user=<some unauthorized user>, access=EXECUTE, inode="/some/private/location"
    

    如果在一个常规集群节点上,该节点仅将所有 HDFS 挂载到位于 HDFS 根目录的服务器上。

    似乎使用 NFS 的常规方式是......

    • 在边缘集群节点上安装 HDFS NFS 网关
    • 将此 NFS 安装到具有只写、POSIX 权限的客户端计算机(例如,通过 samba)(Apache Ranger 根本无法提供帮助)
    • 在边缘节点和自然SID上使用SSSD(基本上可以用来链接unix creds到active directory creds)或者在客户端节点(假设是Windows机器)上使用Active Directory来访问挂载的NFS共享在客户端机器上
    • 设置 NiFi(或其他 ETL)进程以检测放置在此共享中的数据并将其带到指定的 HDFS 位置(此时可以强制执行 Ranger 策略)

    因此,HDFS NFS 网关不适合读取文件或浏览 HDFS。为此,建议在 Ambari 中为各种 cluster users 创建用户帐户,并授予他们对 FileViews 的访问权限以浏览和下载文件(将受到 Ranger 策略的保护)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-10-13
      • 2020-07-10
      • 2017-04-09
      • 1970-01-01
      • 2020-11-10
      • 1970-01-01
      • 2019-04-30
      • 1970-01-01
      相关资源
      最近更新 更多