ZFS 데이터 세트를 수신하기 위해 사용자에게 누락된 권한이 무엇인지 어떻게 확인할 수 있습니까?

ZFS 데이터 세트를 수신하기 위해 사용자에게 누락된 권한이 무엇인지 어떻게 확인할 수 있습니까?

저는 FreeNAS(11.1-U1)와 FreeBSD(11.1-RELEASE-p6) 시스템을 가지고 있습니다. FreeNAS에서 zfs receive위임된 권한을 가진 루트가 아닌 사용자로 스냅샷을 재귀적 으로 생성 하고 싶습니다 . 이는 대부분의 하위 데이터 세트에서 잘 작동하는 것으로 보입니다. 그러나 data감옥에 탑재되어 관리될 수 있는 iocage의 데이터 세트는 실패합니다.

root@freebsd:~> zfs send -RI "dozer@2018-02-21" "dozer@2018-03-08"  | ssh -T -i /root/backup_key backupuser@freenas zfs receive -dvuF neo/backups/freebsd
receiving incremental stream of dozer@2018-03-03 into neo/backups/freebsd@2018-03-03
received 312B stream in 1 seconds (312B/sec)
receiving incremental stream of dozer@2018-03-07 into neo/backups/freebsd@2018-03-07
received 312B stream in 1 seconds (312B/sec)
receiving incremental stream of dozer@2018-03-08 into neo/backups/freebsd@2018-03-08
received 312B stream in 1 seconds (312B/sec)
receiving incremental stream of dozer/ROOT@2018-03-03 into neo/backups/freebsd/ROOT@2018-03-03
.
.
.
receiving incremental stream of dozer/iocage/jails/owncloud/root@2018-03-08 into neo/backups/freebsd/iocage/jails/owncloud/root@2018-03-08
received 578MB stream in 110 seconds (5.25MB/sec)
receiving incremental stream of dozer/iocage/jails/owncloud/root/data@2018-03-03 into neo/backups/freebsd/iocage/jails/owncloud/root/data@2018-03-03
cannot receive incremental stream: permission denied
warning: cannot send 'dozer/iocage/jails/owncloud/root/data@2018-03-03': signal received
warning: cannot send 'dozer/iocage/jails/owncloud/root/data@2018-03-07': Broken pipe
warning: cannot send 'dozer/iocage/jails/owncloud/root/data@2018-03-08': Broken pipe

특정 하위 항목의 권한은 상위 데이터 세트의 권한과 정확히 동일합니다.

root@freenas:~ # zfs allow neo/backups/freebsd/iocage/jails/owncloud/root/data
---- Permissions on neo/backups/freebsd -----------------------------
Local+Descendent permissions:
        user backupuser atime,compression,create,dedup,exec,jailed,mount,mountpoint,quota,receive,rename,reservation,setuid,userprop

zfs receiveFreeNAS에서 루트로 실행하면 예상대로 작동합니다.

zfs receive내 사용자는 iocage의 감옥에 있는 데이터 세트를 받기 위해 어떤 위임된 권한이 필요하며, 더 일반적으로 는 어떤 권한이 누락되었는지 알려주는 보다 자세한 오류 메시지를 제공할 수 있는 방법이 있습니까 ?

답변1

zfs명령 으로 인해 발생하는 권한 문제를 해결할 때 zfs구성 요소 단계 측면에서 작업을 분석하십시오.

unpack 의 샘플 명령은 zfs receive -duvF여러 단계로 구성됩니다. 해당 플래그 중 두 개는 특별한 권한과 관련이 없습니다.

-d는 새 데이터 세트(있는 경우)의 이름 지정에 영향을 줍니다.
-v 자세한 출력을 활성화합니다.

나머지 두 명은 그렇습니다.

-F는 수신이 시작되기 전에 파일 시스템이 증분 전송의 초기 스냅샷으로 롤백됨을 의미합니다.
-u는 수신이 완료된 후 파일 시스템이 마운트되지 않음을 의미합니다.

내 직감은 롤백 권한이 누락된 것입니다. 명령의 -F 플래그는 a가 zfs rollback수행되고 zfs allow목록에 없음을 의미합니다 rollback.

일반적인 경우에는 주어진 zfs명령에 필요한 권한에 대해 연역적으로 추측할 수 있습니다.

맨 페이지에서는 zfs다음을 지적합니다.

권한 이름은 ZFS 하위 명령 및 등록 정보 이름과 동일합니다.

그리고 ...

권한은 일반적으로 ZFS 하위 명령을 사용하거나 ZFS 등록 정보를 변경하는 기능입니다. 다음 권한을 사용할 수 있습니다:

   NAME              TYPE          NOTES
   allow             subcommand    Must also have the permission
                                   that is being allowed
   clone             subcommand    Must also have the 'create'
                                   ability and 'mount' ability in
                                   the origin file system
   create            subcommand    Must also have the 'mount'
                                   ability
   destroy           subcommand    Must also have the 'mount'
                                   ability
   diff              subcommand    Allows lookup of paths within a
                                   dataset given an object number,
                                   and the ability to create
                                   snapshots necessary to 'zfs diff'
   hold              subcommand    Allows adding a user hold to a
                                   snapshot
   mount             subcommand    Allows mount/umount of ZFS
                                   datasets
   promote           subcommand    Must also have the 'mount' and
                                   'promote' ability in the origin
                                   file system
   receive           subcommand    Must also have the 'mount' and
                                   'create' ability
   release           subcommand    Allows releasing a user hold
                                   which might destroy the snapshot
   rename            subcommand    Must also have the 'mount' and
                                   'create' ability in the new
                                   parent
   rollback          subcommand    Must also have the 'mount'
                                   ability
   send              subcommand
   share             subcommand    Allows sharing file systems over
                                   the NFS protocol
   snapshot          subcommand    Must also have the 'mount'
                                   ability
   groupquota        other         Allows accessing any
                                   groupquota@... property
   groupused         other         Allows reading any groupused@...
                                   property
   userprop          other         Allows changing any user property
   userquota         other         Allows accessing any
                                   userquota@... property
   userused          other         Allows reading any userused@...
                                   property
   aclinherit        property
   aclmode           property
   atime             property
   canmount          property
   casesensitivity   property
   checksum          property
   compression       property
   copies            property
   dedup             property
   devices           property
   exec              property
   filesystem_limit  property
   logbias           property
   jailed            property
   mlslabel          property
   mountpoint        property
   nbmand            property
   normalization     property
   primarycache      property
   quota             property
   readonly          property
   recordsize        property
   refquota          property
   refreservation    property
   reservation       property
   secondarycache    property
   setuid            property
   sharenfs          property
   sharesmb          property
   snapdir           property
   snapshot_limit    property
   sync              property
   utf8only          property
   version           property
   volblocksize      property
   volsize           property
   vscan             property
   xattr             property

현재 예제에는 -u플래그가 포함되어 있으므로 파일 시스템은 수신 작업이 끝날 때 마운트되지 않습니다. 그러나 -u없는 경우 파일 시스템은 수신 프로세스가 끝날 때 마운트됩니다. 즉, receive허가에는 허가가 필요합니다 mount.

작업 zfs mount을 수행하면 필요한 마운트 지점이 자동으로 생성되므로 사용자가 zfs데이터 세트를 마운트할 수 있는 권한은 있지만 마운트 지점을 생성할 수 있는 파일 시스템 권한은 없을 수 있습니다. 의 경우 zfs mount마운트가 실패합니다. zfs create또는 작업 에서 rename파일 시스템이 생성되거나 이름이 변경되지만 사용자에게 마운트 지점을 생성할 수 있는 충분한 파일 시스템 권한이 없으면 마운트 해제된 상태로 유지됩니다.

마찬가지로 zfs rename이름 바꾸기 작업 내의 여러 지점에서 권한이 부족하여 명령이 실패할 수 있습니다. 느슨하게 표현하면 구성 요소 단계는 다음과 같습니다.

1) 파일 시스템 마운트 해제( mount권한)
2) 새 파일 시스템 생성( create권한)
3) 파일 시스템 메타데이터를 새 이름에 매핑( rename권한)

네 번째 단계는 새로 이름이 지정된 파일 시스템을 변경된 새 마운트 지점에 다시 마운트하는 것입니다. 그러면 권한 mount과 파일 시스템 권한을 다시 사용하여 새 마운트 지점을 생성합니다.

이러한 트릭을 테스트하지는 않았지만 와 권한, 그리고 과 권한을 zfs구별하는 것을 볼 수 있습니다 . 사용자가 새 파일 시스템을 생성하도록 허용할 수 있지만 일단 생성되면 사용자는 이름을 바꿀 수 없다고 상상합니다. 상속된 마운트 지점이 있는 파일 시스템의 경우 파일 시스템의 이름을 바꾸면 파일 시스템의 마운트 지점 이름도 바뀌는 경우가 많습니다 . 예를 들어 이름을 바꾸면 마운트 지점이 에서 로 변경됩니다 .createrenamemountmountpointtank/usr/localtank/usr/local.OLD/usr/local/usr/local.OLD

mount권한 의 분리는 rename사용자 mountpoint가 파일 시스템의 이름을 바꿀 수는 있지만 마운트 지점을 변경할 수는 없다는 것을 의미합니다. 또는 그 반대로, 파일 시스템이 마운트된 위치를 변경할 수 있지만 파일 시스템 이름은 변경할 수 없습니다.

파일 시스템 작업의 풍부함과 해당 작업의 위임은 권한의 세분화와 결합되어 zfs다소 어려울 수 있지만 매우 강력합니다.

답변2

권한이 누락된 스냅샷이 있는 것 같습니다.

receive에 대한 권한을 설정해 보십시오 neo/backups/freebsd/iocage/jails/owncloud/root/data@2018-03-03.

볼륨에는 올바르게 설정된 것처럼 보이지만 스냅샷에는 없습니다.

관련 정보