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.1 を使ってます
#code(nonumber){{
[root@freeipa-nfs ~]# cat /etc/redhat-release
Rocky Linux release 9.1 (Blue Onyx)
[root@freeipa-nfs ~]# getenforce
Enforcing
[root@freeipa-nfs ~]#
}}
まずはnfsサーバをFreeIPAに参加させます.
ホスト名をきちんとして
#code(nonumber){{
[root@freeipa-nfs ~]# hostnamectl set-hostname `hostname ...
[root@freeipa-nfs ~]# echo `hostname -I` `hostname -A` `h...
[root@freeipa-nfs ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 lo...
::1 localhost localhost.localdomain localhost6 lo...
192.168.0.149 freeipa-nfs.sybyl.local freeipa-nfs
[root@freeipa-nfs ~]# hostname
freeipa-nfs.sybyl.local
[root@freeipa-nfs ~]#
}}
それからFreeIPAのclientパッケージを入れます
&size(10){DNSにFreeIPA向けのSRVがあれば--serverとかは不要...
#code(nonumber){{
[root@freeipa-nfs ~]# dnf install ipa-client -y
}}
っで「ipa-client-install」コマンドでfreeipaの傘下に入ります
#code(nonumber){{
[root@freeipa-nfs ~]# ipa-client-install --server=freeipa...
This program will set up IPA client.
Version 4.10.0
Autodiscovery of servers for failover cannot work with th...
If you proceed with the installation, services will be co...
Proceed with fixed values and no DNS discovery? [no]: yes...
Do you want to configure chrony with NTP server or pool a...
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]:...
Synchronizing time
No SRV records of NTP servers found and no NTP server or ...
Using default chrony configuration.
Attempting to sync time with chronyc.
Time synchronization was successful.
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: 2023-01-04 16:40:05 ...
Valid Until: 2043-01-04 16:40:05
Enrolled in IPA realm SYBYL.LOCAL
Created /etc/ipa/default.conf
Configured sudoers in /etc/authselect/user-nsswitch.conf
Configured /etc/sssd/sssd.conf
Configured /etc/krb5.conf for IPA realm SYBYL.LOCAL
Systemwide CA database updated.
Adding SSH public key from /etc/ssh/ssh_host_ed25519_key....
Adding SSH public key from /etc/ssh/ssh_host_ecdsa_key.pub
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
Configuring sybyl.local as NIS domain.
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...
freeipaサーバにて作業します
#code(nonumber){{
[root@freeipa ~]# kinit
[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 ~]# klist
[root@freeipa-nfs ~]# ipa-getkeytab -s freeipa.sybyl.loca...
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) mklabelgpt
(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 ~]# mkdir /nfs && mount -a
[root@freeipa-nfs ~]# df -lTh /nfs
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdb1 xfs 32G 261M 32G 1% /nfs
[root@freeipa-nfs ~]# mkdir /nfs/{home,apps}
(SELinux対応)
[root@freeipa-nfs ~]# semanage fcontext -a -t home_root_t...
[root@freeipa-nfs ~]# restorecon -R /nfs/home
[root@freeipa-nfs ~]# vi /etc/exports
/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)
#
/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 --now
}}
あとfirewallに穴をあける
#code(nonumber){{
[root@freeipa-nfs ~]# firewall-cmd --add-service=nfs --pe...
[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 freeipa-nfs:/home
/apps -rw freeipa-nfs:/apps
}}
下記コマンドを実行します.
#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,nfs4,se...
#code(nonumber){{
[root@freeipa ~]# ipa automountkey-mod default auto.direc...
}}
***ユーザのホームディレクトリを作成 [#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.1 を使ってます
#code(nonumber){{
[root@freeipa-nfs ~]# cat /etc/redhat-release
Rocky Linux release 9.1 (Blue Onyx)
[root@freeipa-nfs ~]# getenforce
Enforcing
[root@freeipa-nfs ~]#
}}
まずはnfsサーバをFreeIPAに参加させます.
ホスト名をきちんとして
#code(nonumber){{
[root@freeipa-nfs ~]# hostnamectl set-hostname `hostname ...
[root@freeipa-nfs ~]# echo `hostname -I` `hostname -A` `h...
[root@freeipa-nfs ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 lo...
::1 localhost localhost.localdomain localhost6 lo...
192.168.0.149 freeipa-nfs.sybyl.local freeipa-nfs
[root@freeipa-nfs ~]# hostname
freeipa-nfs.sybyl.local
[root@freeipa-nfs ~]#
}}
それからFreeIPAのclientパッケージを入れます
&size(10){DNSにFreeIPA向けのSRVがあれば--serverとかは不要...
#code(nonumber){{
[root@freeipa-nfs ~]# dnf install ipa-client -y
}}
っで「ipa-client-install」コマンドでfreeipaの傘下に入ります
#code(nonumber){{
[root@freeipa-nfs ~]# ipa-client-install --server=freeipa...
This program will set up IPA client.
Version 4.10.0
Autodiscovery of servers for failover cannot work with th...
If you proceed with the installation, services will be co...
Proceed with fixed values and no DNS discovery? [no]: yes...
Do you want to configure chrony with NTP server or pool a...
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]:...
Synchronizing time
No SRV records of NTP servers found and no NTP server or ...
Using default chrony configuration.
Attempting to sync time with chronyc.
Time synchronization was successful.
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: 2023-01-04 16:40:05 ...
Valid Until: 2043-01-04 16:40:05
Enrolled in IPA realm SYBYL.LOCAL
Created /etc/ipa/default.conf
Configured sudoers in /etc/authselect/user-nsswitch.conf
Configured /etc/sssd/sssd.conf
Configured /etc/krb5.conf for IPA realm SYBYL.LOCAL
Systemwide CA database updated.
Adding SSH public key from /etc/ssh/ssh_host_ed25519_key....
Adding SSH public key from /etc/ssh/ssh_host_ecdsa_key.pub
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
Configuring sybyl.local as NIS domain.
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...
freeipaサーバにて作業します
#code(nonumber){{
[root@freeipa ~]# kinit
[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 ~]# klist
[root@freeipa-nfs ~]# ipa-getkeytab -s freeipa.sybyl.loca...
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) mklabelgpt
(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 ~]# mkdir /nfs && mount -a
[root@freeipa-nfs ~]# df -lTh /nfs
Filesystem Type Size Used Avail Use% Mounted on
/dev/sdb1 xfs 32G 261M 32G 1% /nfs
[root@freeipa-nfs ~]# mkdir /nfs/{home,apps}
(SELinux対応)
[root@freeipa-nfs ~]# semanage fcontext -a -t home_root_t...
[root@freeipa-nfs ~]# restorecon -R /nfs/home
[root@freeipa-nfs ~]# vi /etc/exports
/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)
#
/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 --now
}}
あとfirewallに穴をあける
#code(nonumber){{
[root@freeipa-nfs ~]# firewall-cmd --add-service=nfs --pe...
[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 freeipa-nfs:/home
/apps -rw freeipa-nfs:/apps
}}
下記コマンドを実行します.
#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,nfs4,se...
#code(nonumber){{
[root@freeipa ~]# ipa automountkey-mod default auto.direc...
}}
***ユーザのホームディレクトリを作成 [#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