FreeIPAにLinuxマシンを参加させます.

下準備

ホスト名をきちんとしておきます. 事前にDNS/dnsmasqとかにホストを登録しておくこと

[root@freeipa-client ~]# cat /etc/redhat-release
Rocky Linux release 9.1 (Blue Onyx)
 
[root@freeipa-client ~]# getenforce
Enforcing
[root@freeipa-client ~]# hostnamectl set-hostname `hostname -f`
[root@freeipa-client ~]# echo `hostname -I` `hostname -A` `hostname -s` >> /etc/hosts

パッケージインストール

パッケージをインストールします. 使用するコマンドは「dnf install ipa-client」です

[root@freeipa-client ~]# dnf install ipa-client

参加作業

FreeIPAサーバに参加するには「ipa-client-install」を使用しますが、DNSサーバ自身がFreeIPAサーバならすんなりですが、
DNSサーバが別で用意しているならそれを(FreeIPAサーバを)「--server」で示す必要がある. ここではDNSサーバとFreeIPAサーバが別なので、「--server」を使用します
*--serverの値は FQDN です

[root@freeipa-client ~]# ipa-client-install --server=freeipa.sybyl.local --domain=sybyl.local
This program will set up IPA client.
Version 4.10.0
 
Autodiscovery of servers for failover cannot work with this configuration.     <--- FreeIPAを複数用意しての耐障害がないけどいいの?って問われる. 
If you proceed with the installation, services will be configured to always (改行
access the discovered server for all operations and will not fail over to other servers in case of failure.
 
 
Proceed with fixed values and no DNS discovery? [no]: yes                  <-- DNSを他で管理しているので「yes」と返事
Do you want to configure chrony with NTP server or pool address? [no]:     <-- ntpはchronyで既に管理しているの「no」とそのまま返事
Client hostname: freeipa-client.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]: yes             <-- この構成で続けるので「yes」
Synchronizing time
No SRV records of NTP servers found and no NTP server or pool address was provided.
Using default chrony configuration.
Attempting to sync time with chronyc.
Time synchronization was successful.
User authorized to enroll computers: admin                     <--- freeipaとつないでチケットをもらうのですが、そのアカウントを指定
Password for admin@SYBYL.LOCAL:                                <--- 「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.pub
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-client ~]#

確認

ipa-client-installの完成後には sssd が動いていて下記のようになっている

[root@freeipa-client ~]# authselect current
Profile ID: sssd
Enabled features:
- with-sudo
 
[root@freeipa-client ~]#

っでこの段階で既にidとかは拾える 既に作ってればね

[root@freeipa-client ~]# id arcueid
uid=3001(arcueid) gid=2001(em) groups=2001(em)
 
[root@freeipa-client ~]# getent passwd arcueid
arcueid:*:3001:2001:Arcueid Brunestud:/home/arcueid:/bin/bash
 
[root@freeipa-client ~]#

FreeIPAサーバにてnfsサービスプリンシパルを作る

freeipa内でkrb5を使ったnfs mountをするにはクライアントに nfsサービスプリンシパル が必要.
なのでnfs-client向けのnfsサービスプリンシパルをfreeipaサーバにて作ります

まず管理者チケットを貰います

[root@freeipa ~]# kinit admin
Password for admin@SYBYL.LOCAL:
 
[root@freeipa ~]#

freeipa-clientへのサービス記述子がnfsのサービスプリンシパルを作る

[root@freeipa ~]# ipa service-add nfs/freeipa-client.sybyl.local
----------------------------------------------------------
Added service "nfs/freeipa-client.sybyl.local@SYBYL.LOCAL"
----------------------------------------------------------
  Principal name: nfs/freeipa-client.sybyl.local@SYBYL.LOCAL
  Principal alias: nfs/freeipa-client.sybyl.local@SYBYL.LOCAL
  Managed by: freeipa-client.sybyl.local
 
[root@freeipa ~]#
 
(確認)
[root@freeipa ~]# ipa service-find freeipa-client.sybyl.local
-----------------
1 service matched
-----------------
  Principal name: nfs/freeipa-client.sybyl.local@SYBYL.LOCAL
  Principal alias: nfs/freeipa-client.sybyl.local@SYBYL.LOCAL
  Keytab: False
----------------------------
Number of entries returned 1
----------------------------
[root@freeipa ~]#

krb5.keytabの更新

既にFreeIPAに参加しているので 既に /etc/krb5.keytab は持っている. これを更新して作ったnfsサービスプリンシパルを追記させます

[root@freeipa-client ~]# klist -ke /etc/krb5.keytab
Keytab name: FILE:/etc/krb5.keytab
KVNO Principal
---- --------------------------------------------------------------------------
   1 host/freeipa-client.sybyl.local@SYBYL.LOCAL (aes256-cts-hmac-sha384-192)
   1 host/freeipa-client.sybyl.local@SYBYL.LOCAL (aes128-cts-hmac-sha256-128)
   1 host/freeipa-client.sybyl.local@SYBYL.LOCAL (aes256-cts-hmac-sha1-96)
   1 host/freeipa-client.sybyl.local@SYBYL.LOCAL (aes128-cts-hmac-sha1-96)
 
[root@freeipa-client ~]# kinit admin
[root@freeipa-client ~]# ipa-getkeytab -s freeipa.sybyl.local -p nfs/freeipa-client.sybyl.local -k /etc/krb5.keytab
Keytab successfully retrieved and stored in: /etc/krb5.keytab
 
[root@freeipa-client ~]# klist -ke /etc/krb5.keytab
Keytab name: FILE:/etc/krb5.keytab
KVNO Principal
---- --------------------------------------------------------------------------
   1 host/freeipa-client.sybyl.local@SYBYL.LOCAL (aes256-cts-hmac-sha384-192)
   1 host/freeipa-client.sybyl.local@SYBYL.LOCAL (aes128-cts-hmac-sha256-128)
   1 host/freeipa-client.sybyl.local@SYBYL.LOCAL (aes256-cts-hmac-sha1-96)
   1 host/freeipa-client.sybyl.local@SYBYL.LOCAL (aes128-cts-hmac-sha1-96)
   1 nfs/freeipa-client.sybyl.local@SYBYL.LOCAL (aes256-cts-hmac-sha384-192)
   1 nfs/freeipa-client.sybyl.local@SYBYL.LOCAL (aes128-cts-hmac-sha256-128)
   1 nfs/freeipa-client.sybyl.local@SYBYL.LOCAL (aes256-cts-hmac-sha1-96)
   1 nfs/freeipa-client.sybyl.local@SYBYL.LOCAL (aes128-cts-hmac-sha1-96)
[root@freeipa-client ~]#

次に「ipa-client-automount」を実行する

[root@freeipa-client ~]# ipa-client-automount --server=freeipa.sybyl.local --location=default
IPA server: freeipa.sybyl.local
Location: default
Continue to configure the system with these values? [no]: yes      <--- IPAサーバの値とlocationの値が正しいなら[yes]
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
 
[root@freeipa-client ~]# 
 
(確認)
[root@freeipa-client ~]# ls -l /apps /home
[root@freeipa-client ~]# df -Th /home /apps
Filesystem        Type  Size  Used Avail Use% Mounted on
freeipa-nfs:/home nfs4   32G  261M   32G   1% /home
freeipa-nfs:/apps nfs4   32G  261M   32G   1% /apps
[root@freeipa-client ~]#
[root@freeipa-client ~]# mount |grep -e apps -e home
auto.direct on /home type autofs (rw,relatime,fd=5,pgrp=12785,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=42109)
auto.direct on /apps type autofs (rw,relatime,fd=5,pgrp=12785,timeout=300,minproto=5,maxproto=5,direct,pipe_ino=42109)
freeipa-nfs:/apps on /apps type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.0.147,local_lock=none,addr=192.168.0.149)
freeipa-nfs:/home on /home type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.0.147,local_lock=none,addr=192.168.0.149)
[root@freeipa-client ~]#
 
[root@freeipa-client ~]# setsebool -P use_nfs_home_dirs 1     <-- SELinux対応

「sec=krb5」が入っているのでkerberosでnfsが行っているみたい.
「sec=krb5i」で繋ぎたければ「ipa automountkey-mod default auto.direct」で修正します
sec欄がkrb5iならチェックサム付き、krb5pならnfsトラフィックの暗号化が行えます

めも

設定を変更するには一度「ipa-client-install --uninstall」を実行してから行う事. すぐさま再起動を要求されます.
ホームディレクトリを設けるなら「ipa-client-install」のオプションとして更に「--mkhomedir」を付けて設定を行います

ですがホームディレクトリ先をnfsで受けるなら、nfsサーバを作ってそこで「mkhomedir_helper」コマンドでホームディレクトリを作ったほうがいい.
「ipa-client-install」の「--mkhomedir」はローカルにホームディレクトリを作る際のお話かなと.

[root@freeipa-client ~]# ls -l /home
total 0
[root@freeipa-client ~]# su - arcueid
Creating home directory for arcueid.
 
[arcueid@freeipa-client ~]$ pwd
/home/arcueid
 
[arcueid@freeipa-client ~]$

クライアントを設定するとおおもとのFreeIPAサーバにも設定されます.

[root@freeipa ~]# ipa host-show freeipa-client
  Host name: freeipa-client.sybyl.local
  Platform: x86_64
  Operating system: 4.18.0-348.20.1.el8_5.x86_64
  Principal name: host/freeipa-client.sybyl.local@SYBYL.LOCAL
  Principal alias: host/freeipa-client.sybyl.local@SYBYL.LOCAL
  SSH public key fingerprint: SHA256:FQFbBT68Hd8ZD+zRcj4FqcWOwhVPuQQhq+vdcbVgixs (ssh-ed25519),
                              SHA256:FTworyCvpf4r3hHgOvPEbyNULWtJGV4PNhifSOHhQXw (ecdsa-sha2-nistp256),
                              SHA256:3U7UaLHp+yx9Xq6qfVXd96hEv04VYE18NBWQm8WxiFI (ssh-rsa)
  Password: False
  Keytab: True
  Managed by: freeipa-client.sybyl.local
[root@freeipa ~]#

ログイン

クライアントを設定す

[llya@c ~]$ ssh -l illya freeipa-client
Password:                                      <--- 初期パスワードが問われます
Password expired. Change your password now.
Current Password:
New password:
Retype new password:
Last failed login: Fri Apr 29 22:24:42 JST 2022 from 192.168.0.3 on ssh:notty
[illya@freeipa-client ~]$
最新の60件
2025-01-13 2025-01-12 2025-01-08 2024-12-30 2024-12-29 2024-12-24 2024-12-22 2024-12-20 2024-12-17 2024-12-15 2024-12-14 2024-12-12 2024-12-11 2024-12-10 2024-12-09 2024-12-08 2024-12-04 2024-11-28 2024-11-22 2024-11-15 2024-11-14 2024-11-12 2024-11-06 2024-11-05 2024-11-04 2024-11-02 2024-11-01 2024-10-29 2024-10-28 2024-10-27 2024-10-23 2024-10-18 2024-10-17 2024-10-15 2024-10-14 2024-10-13 2024-10-11 2024-10-10 2024-10-09 2024-10-08 2024-10-05 2024-10-04 2024-10-03

edit


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2023-01-05 (木) 02:43:59