FreeIPA/nfs をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
ディレクトリサーバのFreeIPA、ログインノード、計算ノード、...
ログインノード、計算ノードにnfsでストレージを供給するスト...
&ref(2022y04m29d_014741674.png,nolink,noborder);
&size(10){やっていることは[[samba/NFS]]と同じくサービス記...
&size(10){もちろんこの操作をしなくてもsysな従来からのuid...
参照先 [[https://blog.delouw.ch/2015/03/14/using-ipa-to-p...
***nfsサーバをFreeIPAドメイン参加させる [#a0d0678c]
nfsサーバには RockyLinux 9.6 を使ってます
#code(nonumber){{
[root@freeipa-nfs ~]# cat /etc/redhat-release
Rocky Linux release 9.6 (Blue Onyx)
[root@freeipa-nfs ~]# getenforce
Enforcing
[root@freeipa-nfs ~]#
}}
FreeIPAのclientパッケージを入れます
#code(nonumber){{
[root@freeipa-nfs ~]# dnf install ipa-client -y
}}
chronyの設定を施します
#code(nonumber){{
[root@freeipa-nfs ~]# echo "server c.sybyl.local" > /etc/...
[root@freeipa-nfs ~]# systemctl restart chronyd
}}
っで「ipa-client-install」コマンドでfreeipaの傘下に入りま...
#code(nonumber){{
[root@freeipa-nfs ~]# ipa-client-install --no-ntp <-- ...
This program will set up IPA client.
Version 4.12.2
Discovery was successful!
Client hostname: freeipa-nfs.sybyl.local
Realm: SYBYL.LOCAL
DNS Domain: sybyl.local
IPA Server: freeipa.sybyl.local
BaseDN: dc=sybyl,dc=local
Continue to configure the system with these values? [no]:...
Skipping chrony configuration
User authorized to enroll computers: admin <-...
Password for admin@SYBYL.LOCAL: <-...
Successfully retrieved CA cert
Subject: CN=Certificate Authority,O=SYBYL.LOCAL
Issuer: CN=Certificate Authority,O=SYBYL.LOCAL
Valid From: 2025-09-27 19:27:06+00:00
Valid Until: 2045-09-27 19:27:06+00:00
Enrolled in IPA realm SYBYL.LOCAL
Created /etc/ipa/default.conf
Configured /etc/sssd/sssd.conf
Systemwide CA database updated.
Adding SSH public key from /etc/ssh/ssh_host_ecdsa_key.pub
Adding SSH public key from /etc/ssh/ssh_host_ed25519_key....
Adding SSH public key from /etc/ssh/ssh_host_rsa_key.pub
Could not update DNS SSHFP records.
SSSD enabled
Configured /etc/openldap/ldap.conf
Configured /etc/ssh/ssh_config
Configured /etc/ssh/sshd_config.d/04-ipa.conf
Configuring sybyl.local as NIS domain.
Configured /etc/krb5.conf for IPA realm SYBYL.LOCAL
Client configuration complete.
The ipa-client-install command was successful
[root@freeipa-nfs ~]#
}}
これでkrb5.keytabが貰える
#code(nonumber){{
[root@freeipa-nfs ~]# klist -ke
Keytab name: FILE:/etc/krb5.keytab
KVNO Principal
---- ----------------------------------------------------...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes256-cts...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes128-cts...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes256-cts...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes128-cts...
[root@freeipa-nfs ~]#
}}
だが、、nfsサービスプリンシパルがないとnfsサーバにはなれ...
***freeipaサーバで nfsサービスプリンシパル を作る [#k093f...
mount optionで src=krb5とかするなら「nfsサービスプリンシ...
freeipaサーバにて作業します
まずはkrbチケットを貰って
#code(nonumber){{
[root@freeipa ~]# kinit admin
Password for admin@SYBYL.LOCAL: <--- 登録管理者admin...
[root@freeipa ~]#
}}
nfsサービスプリンシパルを作ります
#code(nonumber){{
[root@freeipa ~]# ipa service-add nfs/freeipa-nfs.sybyl.l...
-------------------------------------------------------
Added service "nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL"
-------------------------------------------------------
Principal name: nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL
Principal alias: nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL
Managed by: freeipa-nfs.sybyl.local
[root@freeipa ~]#
}}
これで freeipa-nfs は nfsサービスプリンシパルを持つことに...
***nfsサービスプリンシパルを受け取る [#p16d92cd]
そしてFreeIPAサーバからnfsサービスプリンシパルを受け取り...
#code(nonumber){{
[root@freeipa-nfs ~]# kinit admin
Password for admin@SYBYL.LOCAL: <--- 登録管理者admin...
[root@freeipa-nfs ~]# ipa-getkeytab -p nfs/freeipa-nfs.sy...
Keytab successfully retrieved and stored in: /etc/krb5.ke...
[root@freeipa-nfs ~]#
(確認)
[root@freeipa-nfs ~]# klist -ke /etc/krb5.keytab
Keytab name: FILE:/etc/krb5.keytab
KVNO Principal
---- ----------------------------------------------------...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes256-cts...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes128-cts...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes256-cts...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes128-cts...
1 nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes256-cts-...
1 nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes128-cts-...
1 nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes256-cts-...
1 nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes128-cts-...
[root@freeipa-nfs ~]#
}}
***nfsサービスを開始 [#x6fdfaae]
次にnfsとして供出する場所を準備します. ここでは/etc/sdbを...
#code(nonumber){{
[root@freeipa-nfs ~]# parted /dev/sdb
(parted) mklabel gpt
(parted) mkpart primary 0% 100%
(parted) quit
[root@freeipa-nfs ~]# mkfs.xfs -L nfs /dev/sdb1
[root@freeipa-nfs ~]# echo "LABEL=nfs /nfs xfs defaults 0...
[root@freeipa-nfs ~]# systemctl daemon-reload
[root@freeipa-nfs ~]# mkdir /nfs && mount -a
[root@freeipa-nfs ~]# df -lTh /nfs
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdb1 xfs 50G 389M 50G 1% /nfs
[root@freeipa-nfs ~]# mkdir /nfs/{home,apps} /apps
[root@freeipa-nfs ~]# echo "/nfs/home /home none bind 0 0...
[root@freeipa-nfs ~]# echo "/nfs/apps /apps none bind 0 0...
[root@freeipa-nfs ~]# systemctl daemon-reload
[root@freeipa-nfs ~]# mount -a
[root@freeipa-nfs ~]# touch /apps/_apps_ /home/_home_
(SELinux対応)
[root@freeipa-nfs ~]# semanage fcontext -a -t home_root_t...
[root@freeipa-nfs ~]# restorecon -R /nfs/home
[root@freeipa-nfs ~]# vi /etc/exports
# sec=sys向け
#/nfs 192.168.0.0/255.255.255.0(rw,sync,fsid=0)
#/nfs/home 192.168.0.0/255.255.255.0(rw,sync,nohide)
#/nfs/apps 192.168.0.0/255.255.255.0(rw,sync,nohide)
#
# sec=krb5向け
/nfs gss/krb5(rw,sync,sec=krb5,fsid=0)
/nfs/home gss/krb5(rw,sync,sec=krb5,nohide)
/nfs/apps gss/krb5(rw,sync,sec=krb5,nohide)
[root@freeipa-nfs ~]# systemctl enable nfs-server rpcbind...
}}
「/dev/sdb1」が「/home」として運用なら
#code(nonumber){{
#/ 192.168.0.0/255.255.255.0(rw,sync,fsid=0)
#/home 192.168.0.0/255.255.255.0(rw,sync,nohide)
/ gss/krb5(rw,sync,sec=krb5,fsid=0)
/home gss/krb5(rw,sync,sec=krb5,nohide)
}}
とします
あとfirewallに穴をあける
#code(nonumber){{
[root@freeipa-nfs ~]# firewall-cmd --add-service=nfs --ad...
[root@freeipa-nfs ~]# firewall-cmd --reload
}}
***freeipaサーバにてautomount mapを作る [#z4eaaf5c]
freeipaサーバでの作業です. 「nis automount」のようにautof...
FreeIPAドメインを作った時に既に用意されているlocationがあ...
#code(nonumber){{
[root@freeipa ~]# ipa automountlocation-find
(略
Location: default
(略
[root@freeipa ~]#
}}
このlocation「default」で持っているmapは下記のように「aut...
#code(nonumber){{
[root@freeipa ~]# ipa automountmap-find default
(略
Map: auto.direct
Map: auto.master
(略
[root@freeipa ~]#
}}
っで既定で用意されていたこの「auto.master」と「auto.direc...
#code(nonumber){{
[root@freeipa ~]# ipa automountkey-find default auto.master
-----------------------
1 automount key matched
-----------------------
Key: /-
Mount information: auto.direct
----------------------------
Number of entries returned 1
----------------------------
[root@freeipa ~]# ipa automountkey-find default auto.direct
------------------------
0 automount keys matched
------------------------
----------------------------
Number of entries returned 0
----------------------------
[root@freeipa ~]#
}}
っと、「auto.master」の中身は /etc/auto.master で例えれば
#code(nonumber){{
/- auto.direct
}}
な感じ. っでauto.directの中身は今はない状態. っで例えば a...
#code(nonumber){{
/home -rw,sec=krb5 freeipa-nfs:/home
/apps -rw,sec=krb5 freeipa-nfs:/apps
}}
下記コマンドを実行して「auto.direct」マップを修正します。
#code(nonumber){{
[root@freeipa ~]# ipa automountkey-add default auto.direc...
[root@freeipa ~]# ipa automountkey-add default auto.direc...
(確認)
[root@freeipa ~]# ipa automountkey-find default auto.direct
------------------------
2 automount keys matched
------------------------
Key: /apps
Mount information: -rw freeipa-nfs:/apps
Key: /home
Mount information: -rw freeipa-nfs:/home
----------------------------
Number of entries returned 2
----------------------------
[root@freeipa ~]#
}}
修正の場合は下記のようにします. 下記は「/home -rw,&color(...
#code(nonumber){{
[root@freeipa ~]# ipa automountkey-mod default auto.direc...
[root@freeipa ~]# ipa automountkey-mod default auto.direc...
}}
内容を消したい場合は
#code(nonumber){{
[root@freeipa ~]# ipa automountkey-del default auto.direc...
[root@freeipa ~]# ipa automountkey-del default auto.direc...
}}
とします
***indirectで作るなら [#o8aa8d5c]
「/home」とかならこちらで設定した方がいいみたい. &size(10...
#code(nonumber){{
[root@freeipa ~]# ipa automountkey-find default auto.master
:
Key: /-
Mount information: auto.direct
:
[root@freeipa ~]# ipa automountkey-del default auto.maste...
[root@freeipa ~]# ipa automountmap-del default auto.direc...
[root@freeipa ~]# ipa automountmap-find default
:
Map: auto.master (auto.masterマップのみ)
:
[root@freeipa ~]# ipa automountmap-add default auto.home ...
[root@freeipa ~]# ipa automountmap-add default auto.apps
[root@freeipa ~]# ipa automountmap-find default
:
Map: auto.master (これで3つのマップが存在します)
Map: auto.apps
Map: auto.home
:
[root@freeipa ~]# ipa automountkey-find default auto.mast...
(none)
[root@freeipa ~]#
[root@freeipa ~]# ipa automountkey-add default auto.maste...
[root@freeipa ~]# ipa automountkey-add default auto.maste...
(確認)
[root@freeipa ~]# ipa automountkey-find default auto.mast...
:
Key: /apps
Mount information: auto.apps
Key: /home
Mount information: auto.home
:
(新たに用意したauto.home、auto.appsマップに値を入れる)
[root@freeipa ~]# ipa automountkey-add default auto.home ...
[root@freeipa ~]# ipa automountkey-add default auto.apps ...
(確認)
[root@freeipa ~]# ipa automountkey-find default auto.home
Key: *
Mount information: -sec=krb5,rw freeipa-nfs:/home/&
[root@freeipa ~]# ipa automountkey-find default auto.apps
Key: *
Mount information: -sec=krb5,rw freeipa-nfs:/apps/&
[root@freeipa ~]#
(修正なら)
[root@freeipa ~]# ipa automountkey-mod default auto.home ...
}}
***nfsクライアントからmount [#g9b325a6]
既にFreeIPAの参加に入っているとします。
確認箇所「/etc/nsswitch.conf」で「automount: sss files」...
次に、「/etc/sssd/sssd.conf」で[domain/sybyl.local]欄で「...
#code(nonumber){{
:
[domain/sybyl.local]
:
id_provider = ipa
automount_provider = ipa <--これがあるか
:
[sssd]
services = nss, pam, ssh, sudo, autofs <--このautofsが...
domains = sybyl.local
:
}}
FreeIPAsサーバからマップの取得が上手く行っているかは「aut...
#code(nonumber){{
[root@freeipa-client ~]# systemctl restart sssd
[root@freeipa-client ~]# automount -m
:
Mount point: /apps
source(s):
instance type(s): sss
map: auto.apps
* | -sec=krb5,rw freeipa-nfs:/apps/&
Mount point: /home
source(s):
instance type(s): sss
map: auto.home
* | -sec=krb5,rw freeipa-nfs:/home/&
[root@freeipa-client ~]#
}}
ここまで確認出来たらautofsを開始させます
#code(nonumber){{
[root@freeipa-client ~]# systemctl enable autofs --now
}}
「indirect」で作ると「ls /home」としても全部が見えません...
「/apps」も同じで「ls /apps」では何も表示されません。「ls...
この方式の利点は、nfsクライアントに既にアカウントが合って...
そのマシンでしか存在しない/home/ABCを消さなない。見えなく...
/appsならdirectっでいいのでしょうけど、ライセンスアプリが...
***「sec=krb5」の意味 [#qfba9c4e]
krbチケットがないとmountできません.
代わりに「sec=sys」ならuid/gidでmountしてその場所に行けま...
よりセキュアなnfs環境となるとこの「sec=krb5」で行うのが望...
krbチケットは認証しないと貰えませんから.
あとこちらにするとログイン/ログアウトが遅くなる現象があり...
&size(10){「/etc/exports」でmount可能なipを指定して阻止、...
***ユーザのホームディレクトリを作成 [#s9b44ef0]
クライアント参加時の「ipa-client-install」にオプションと...
作ってくれるけど、それがnfs先、しかもautofsでもできるの?...
っで、nfsサーバで作る
#code(nonumber){{
[root@freeipa-nfs ~]# mkhomedir_helper arcueid 0022 /etc/...
[root@freeipa-nfs ~]# mkhomedir_helper illya 0022 /etc/...
[root@freeipa-nfs ~]# ls -l /home
total 0
drwxr-xr-x. 2 arcueid em 62 Apr 29 22:22 arcueid
drwxr-xr-x. 2 illya em 62 Apr 29 22:22 illya
[root@freeipa-nfs ~]#
}}
&size(10){作れなかったら原因はSELinuxかも. 「restorecon -...
終了行:
ディレクトリサーバのFreeIPA、ログインノード、計算ノード、...
ログインノード、計算ノードにnfsでストレージを供給するスト...
&ref(2022y04m29d_014741674.png,nolink,noborder);
&size(10){やっていることは[[samba/NFS]]と同じくサービス記...
&size(10){もちろんこの操作をしなくてもsysな従来からのuid...
参照先 [[https://blog.delouw.ch/2015/03/14/using-ipa-to-p...
***nfsサーバをFreeIPAドメイン参加させる [#a0d0678c]
nfsサーバには RockyLinux 9.6 を使ってます
#code(nonumber){{
[root@freeipa-nfs ~]# cat /etc/redhat-release
Rocky Linux release 9.6 (Blue Onyx)
[root@freeipa-nfs ~]# getenforce
Enforcing
[root@freeipa-nfs ~]#
}}
FreeIPAのclientパッケージを入れます
#code(nonumber){{
[root@freeipa-nfs ~]# dnf install ipa-client -y
}}
chronyの設定を施します
#code(nonumber){{
[root@freeipa-nfs ~]# echo "server c.sybyl.local" > /etc/...
[root@freeipa-nfs ~]# systemctl restart chronyd
}}
っで「ipa-client-install」コマンドでfreeipaの傘下に入りま...
#code(nonumber){{
[root@freeipa-nfs ~]# ipa-client-install --no-ntp <-- ...
This program will set up IPA client.
Version 4.12.2
Discovery was successful!
Client hostname: freeipa-nfs.sybyl.local
Realm: SYBYL.LOCAL
DNS Domain: sybyl.local
IPA Server: freeipa.sybyl.local
BaseDN: dc=sybyl,dc=local
Continue to configure the system with these values? [no]:...
Skipping chrony configuration
User authorized to enroll computers: admin <-...
Password for admin@SYBYL.LOCAL: <-...
Successfully retrieved CA cert
Subject: CN=Certificate Authority,O=SYBYL.LOCAL
Issuer: CN=Certificate Authority,O=SYBYL.LOCAL
Valid From: 2025-09-27 19:27:06+00:00
Valid Until: 2045-09-27 19:27:06+00:00
Enrolled in IPA realm SYBYL.LOCAL
Created /etc/ipa/default.conf
Configured /etc/sssd/sssd.conf
Systemwide CA database updated.
Adding SSH public key from /etc/ssh/ssh_host_ecdsa_key.pub
Adding SSH public key from /etc/ssh/ssh_host_ed25519_key....
Adding SSH public key from /etc/ssh/ssh_host_rsa_key.pub
Could not update DNS SSHFP records.
SSSD enabled
Configured /etc/openldap/ldap.conf
Configured /etc/ssh/ssh_config
Configured /etc/ssh/sshd_config.d/04-ipa.conf
Configuring sybyl.local as NIS domain.
Configured /etc/krb5.conf for IPA realm SYBYL.LOCAL
Client configuration complete.
The ipa-client-install command was successful
[root@freeipa-nfs ~]#
}}
これでkrb5.keytabが貰える
#code(nonumber){{
[root@freeipa-nfs ~]# klist -ke
Keytab name: FILE:/etc/krb5.keytab
KVNO Principal
---- ----------------------------------------------------...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes256-cts...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes128-cts...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes256-cts...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes128-cts...
[root@freeipa-nfs ~]#
}}
だが、、nfsサービスプリンシパルがないとnfsサーバにはなれ...
***freeipaサーバで nfsサービスプリンシパル を作る [#k093f...
mount optionで src=krb5とかするなら「nfsサービスプリンシ...
freeipaサーバにて作業します
まずはkrbチケットを貰って
#code(nonumber){{
[root@freeipa ~]# kinit admin
Password for admin@SYBYL.LOCAL: <--- 登録管理者admin...
[root@freeipa ~]#
}}
nfsサービスプリンシパルを作ります
#code(nonumber){{
[root@freeipa ~]# ipa service-add nfs/freeipa-nfs.sybyl.l...
-------------------------------------------------------
Added service "nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL"
-------------------------------------------------------
Principal name: nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL
Principal alias: nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL
Managed by: freeipa-nfs.sybyl.local
[root@freeipa ~]#
}}
これで freeipa-nfs は nfsサービスプリンシパルを持つことに...
***nfsサービスプリンシパルを受け取る [#p16d92cd]
そしてFreeIPAサーバからnfsサービスプリンシパルを受け取り...
#code(nonumber){{
[root@freeipa-nfs ~]# kinit admin
Password for admin@SYBYL.LOCAL: <--- 登録管理者admin...
[root@freeipa-nfs ~]# ipa-getkeytab -p nfs/freeipa-nfs.sy...
Keytab successfully retrieved and stored in: /etc/krb5.ke...
[root@freeipa-nfs ~]#
(確認)
[root@freeipa-nfs ~]# klist -ke /etc/krb5.keytab
Keytab name: FILE:/etc/krb5.keytab
KVNO Principal
---- ----------------------------------------------------...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes256-cts...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes128-cts...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes256-cts...
1 host/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes128-cts...
1 nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes256-cts-...
1 nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes128-cts-...
1 nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes256-cts-...
1 nfs/freeipa-nfs.sybyl.local@SYBYL.LOCAL (aes128-cts-...
[root@freeipa-nfs ~]#
}}
***nfsサービスを開始 [#x6fdfaae]
次にnfsとして供出する場所を準備します. ここでは/etc/sdbを...
#code(nonumber){{
[root@freeipa-nfs ~]# parted /dev/sdb
(parted) mklabel gpt
(parted) mkpart primary 0% 100%
(parted) quit
[root@freeipa-nfs ~]# mkfs.xfs -L nfs /dev/sdb1
[root@freeipa-nfs ~]# echo "LABEL=nfs /nfs xfs defaults 0...
[root@freeipa-nfs ~]# systemctl daemon-reload
[root@freeipa-nfs ~]# mkdir /nfs && mount -a
[root@freeipa-nfs ~]# df -lTh /nfs
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdb1 xfs 50G 389M 50G 1% /nfs
[root@freeipa-nfs ~]# mkdir /nfs/{home,apps} /apps
[root@freeipa-nfs ~]# echo "/nfs/home /home none bind 0 0...
[root@freeipa-nfs ~]# echo "/nfs/apps /apps none bind 0 0...
[root@freeipa-nfs ~]# systemctl daemon-reload
[root@freeipa-nfs ~]# mount -a
[root@freeipa-nfs ~]# touch /apps/_apps_ /home/_home_
(SELinux対応)
[root@freeipa-nfs ~]# semanage fcontext -a -t home_root_t...
[root@freeipa-nfs ~]# restorecon -R /nfs/home
[root@freeipa-nfs ~]# vi /etc/exports
# sec=sys向け
#/nfs 192.168.0.0/255.255.255.0(rw,sync,fsid=0)
#/nfs/home 192.168.0.0/255.255.255.0(rw,sync,nohide)
#/nfs/apps 192.168.0.0/255.255.255.0(rw,sync,nohide)
#
# sec=krb5向け
/nfs gss/krb5(rw,sync,sec=krb5,fsid=0)
/nfs/home gss/krb5(rw,sync,sec=krb5,nohide)
/nfs/apps gss/krb5(rw,sync,sec=krb5,nohide)
[root@freeipa-nfs ~]# systemctl enable nfs-server rpcbind...
}}
「/dev/sdb1」が「/home」として運用なら
#code(nonumber){{
#/ 192.168.0.0/255.255.255.0(rw,sync,fsid=0)
#/home 192.168.0.0/255.255.255.0(rw,sync,nohide)
/ gss/krb5(rw,sync,sec=krb5,fsid=0)
/home gss/krb5(rw,sync,sec=krb5,nohide)
}}
とします
あとfirewallに穴をあける
#code(nonumber){{
[root@freeipa-nfs ~]# firewall-cmd --add-service=nfs --ad...
[root@freeipa-nfs ~]# firewall-cmd --reload
}}
***freeipaサーバにてautomount mapを作る [#z4eaaf5c]
freeipaサーバでの作業です. 「nis automount」のようにautof...
FreeIPAドメインを作った時に既に用意されているlocationがあ...
#code(nonumber){{
[root@freeipa ~]# ipa automountlocation-find
(略
Location: default
(略
[root@freeipa ~]#
}}
このlocation「default」で持っているmapは下記のように「aut...
#code(nonumber){{
[root@freeipa ~]# ipa automountmap-find default
(略
Map: auto.direct
Map: auto.master
(略
[root@freeipa ~]#
}}
っで既定で用意されていたこの「auto.master」と「auto.direc...
#code(nonumber){{
[root@freeipa ~]# ipa automountkey-find default auto.master
-----------------------
1 automount key matched
-----------------------
Key: /-
Mount information: auto.direct
----------------------------
Number of entries returned 1
----------------------------
[root@freeipa ~]# ipa automountkey-find default auto.direct
------------------------
0 automount keys matched
------------------------
----------------------------
Number of entries returned 0
----------------------------
[root@freeipa ~]#
}}
っと、「auto.master」の中身は /etc/auto.master で例えれば
#code(nonumber){{
/- auto.direct
}}
な感じ. っでauto.directの中身は今はない状態. っで例えば a...
#code(nonumber){{
/home -rw,sec=krb5 freeipa-nfs:/home
/apps -rw,sec=krb5 freeipa-nfs:/apps
}}
下記コマンドを実行して「auto.direct」マップを修正します。
#code(nonumber){{
[root@freeipa ~]# ipa automountkey-add default auto.direc...
[root@freeipa ~]# ipa automountkey-add default auto.direc...
(確認)
[root@freeipa ~]# ipa automountkey-find default auto.direct
------------------------
2 automount keys matched
------------------------
Key: /apps
Mount information: -rw freeipa-nfs:/apps
Key: /home
Mount information: -rw freeipa-nfs:/home
----------------------------
Number of entries returned 2
----------------------------
[root@freeipa ~]#
}}
修正の場合は下記のようにします. 下記は「/home -rw,&color(...
#code(nonumber){{
[root@freeipa ~]# ipa automountkey-mod default auto.direc...
[root@freeipa ~]# ipa automountkey-mod default auto.direc...
}}
内容を消したい場合は
#code(nonumber){{
[root@freeipa ~]# ipa automountkey-del default auto.direc...
[root@freeipa ~]# ipa automountkey-del default auto.direc...
}}
とします
***indirectで作るなら [#o8aa8d5c]
「/home」とかならこちらで設定した方がいいみたい. &size(10...
#code(nonumber){{
[root@freeipa ~]# ipa automountkey-find default auto.master
:
Key: /-
Mount information: auto.direct
:
[root@freeipa ~]# ipa automountkey-del default auto.maste...
[root@freeipa ~]# ipa automountmap-del default auto.direc...
[root@freeipa ~]# ipa automountmap-find default
:
Map: auto.master (auto.masterマップのみ)
:
[root@freeipa ~]# ipa automountmap-add default auto.home ...
[root@freeipa ~]# ipa automountmap-add default auto.apps
[root@freeipa ~]# ipa automountmap-find default
:
Map: auto.master (これで3つのマップが存在します)
Map: auto.apps
Map: auto.home
:
[root@freeipa ~]# ipa automountkey-find default auto.mast...
(none)
[root@freeipa ~]#
[root@freeipa ~]# ipa automountkey-add default auto.maste...
[root@freeipa ~]# ipa automountkey-add default auto.maste...
(確認)
[root@freeipa ~]# ipa automountkey-find default auto.mast...
:
Key: /apps
Mount information: auto.apps
Key: /home
Mount information: auto.home
:
(新たに用意したauto.home、auto.appsマップに値を入れる)
[root@freeipa ~]# ipa automountkey-add default auto.home ...
[root@freeipa ~]# ipa automountkey-add default auto.apps ...
(確認)
[root@freeipa ~]# ipa automountkey-find default auto.home
Key: *
Mount information: -sec=krb5,rw freeipa-nfs:/home/&
[root@freeipa ~]# ipa automountkey-find default auto.apps
Key: *
Mount information: -sec=krb5,rw freeipa-nfs:/apps/&
[root@freeipa ~]#
(修正なら)
[root@freeipa ~]# ipa automountkey-mod default auto.home ...
}}
***nfsクライアントからmount [#g9b325a6]
既にFreeIPAの参加に入っているとします。
確認箇所「/etc/nsswitch.conf」で「automount: sss files」...
次に、「/etc/sssd/sssd.conf」で[domain/sybyl.local]欄で「...
#code(nonumber){{
:
[domain/sybyl.local]
:
id_provider = ipa
automount_provider = ipa <--これがあるか
:
[sssd]
services = nss, pam, ssh, sudo, autofs <--このautofsが...
domains = sybyl.local
:
}}
FreeIPAsサーバからマップの取得が上手く行っているかは「aut...
#code(nonumber){{
[root@freeipa-client ~]# systemctl restart sssd
[root@freeipa-client ~]# automount -m
:
Mount point: /apps
source(s):
instance type(s): sss
map: auto.apps
* | -sec=krb5,rw freeipa-nfs:/apps/&
Mount point: /home
source(s):
instance type(s): sss
map: auto.home
* | -sec=krb5,rw freeipa-nfs:/home/&
[root@freeipa-client ~]#
}}
ここまで確認出来たらautofsを開始させます
#code(nonumber){{
[root@freeipa-client ~]# systemctl enable autofs --now
}}
「indirect」で作ると「ls /home」としても全部が見えません...
「/apps」も同じで「ls /apps」では何も表示されません。「ls...
この方式の利点は、nfsクライアントに既にアカウントが合って...
そのマシンでしか存在しない/home/ABCを消さなない。見えなく...
/appsならdirectっでいいのでしょうけど、ライセンスアプリが...
***「sec=krb5」の意味 [#qfba9c4e]
krbチケットがないとmountできません.
代わりに「sec=sys」ならuid/gidでmountしてその場所に行けま...
よりセキュアなnfs環境となるとこの「sec=krb5」で行うのが望...
krbチケットは認証しないと貰えませんから.
あとこちらにするとログイン/ログアウトが遅くなる現象があり...
&size(10){「/etc/exports」でmount可能なipを指定して阻止、...
***ユーザのホームディレクトリを作成 [#s9b44ef0]
クライアント参加時の「ipa-client-install」にオプションと...
作ってくれるけど、それがnfs先、しかもautofsでもできるの?...
っで、nfsサーバで作る
#code(nonumber){{
[root@freeipa-nfs ~]# mkhomedir_helper arcueid 0022 /etc/...
[root@freeipa-nfs ~]# mkhomedir_helper illya 0022 /etc/...
[root@freeipa-nfs ~]# ls -l /home
total 0
drwxr-xr-x. 2 arcueid em 62 Apr 29 22:22 arcueid
drwxr-xr-x. 2 illya em 62 Apr 29 22:22 illya
[root@freeipa-nfs ~]#
}}
&size(10){作れなかったら原因はSELinuxかも. 「restorecon -...
ページ名:
1