FreeIPAでは dns は他のマシンで動いている dnsmasq に任せる形で作ってます.
ここでは、FreeIPAサーバにdnsの機能も載せる場合を紹介します
まずfreeipaサーバはdhcp由来ではなく固定IPで設定して、FQDNでホスト名(/etc/hostname)を定義してます
ここでのFreeIPAサーバは 192.168.0.146 を持たせてます.
[root@freeipa ~]# nmcli connection modify enp6s18 ipv4.method manual ipv4.addresses 192.168.0.146/24 ipv4.gateway 192.168.0.1 ipv4.dns 192.168.0.3 ipv6.method disabled
[root@freeipa ~]# nmcli connection down enp6s18; nmcli connection up enp6s18
[root@freeipa ~]# hostnamectl set-hostname freeipa.sybyl.local
[root@freeipa ~]# echo `hostname -i` `hostname -f` `hostname -s` >> /etc/hosts
[root@freeipa ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.0.146 freeipa.sybyl.local freeipa
[root@freeipa ~]#FreeIPAのパッケージをインストールします
[root@freeipa ~]# dnf install ipa-server ipa-server-dns -yFreeIPAと同じようにFreeIPAが担当するUID/GIDはともに 2000 番からとしてます. 1000-1999は/etc/passwdで定義されるって感じにしてます
[root@freeipa ~]# vi /etc/login.defs
:
UID_MAX 1999 <-- 修正
:
GID_MAX 1999 <-- 修正
:
[root@freeipa ~]#DNS機能を持たせるので「--setup-dns」を加えて、上位のDNSサーバを「--forwarder」として指定します.
[root@freeipa ~]# ipa-server-install --setup-dns --forwarder=192.168.0.3 --ntp-server=192.168.0.3 --mkhomedir --idstart=2000
The log file for this installation can be found in /var/log/ipaserver-install.log
==============================================================================
This program will set up the IPA Server.
Version 4.12.2
This includes:
* Configure a stand-alone CA (dogtag) for certificate management
* Configure the NTP client (chronyd)
* Create and configure an instance of Directory Server
* Create and configure a Kerberos Key Distribution Center (KDC)
* Configure Apache (httpd)
* Configure DNS (bind)
* Configure SID generation
* Configure the KDC to enable PKINIT
To accept the default shown in brackets, press the Enter key.
Enter the fully qualified domain name of the computer
on which you're setting up server software. Using the form
<hostname>.<domainname>
Example: master.example.com
Server host name [freeipa.sybyl.local]: <-- ホスト名は正しいのでそのままリターン
Warning: skipping DNS resolution of host freeipa.sybyl.local
The domain name has been determined based on the host name.
Please confirm the domain name [sybyl.local]: <-- ドメイン名は正しいのでそのままリターン
The kerberos protocol requires a Realm name to be defined.
This is typically the domain name converted to uppercase.
Please provide a realm name [SYBYL.LOCAL]: <-- そのままリターン
Certain directory server operations require an administrative user.
This user is referred to as the Directory Manager and has full access
to the Directory for system management tasks and will be added to the
instance of directory server created for IPA.
The password must be at least 8 characters long.
Directory Manager password: <--- Directory Managerのパスワード
Password (confirm):
Checking DNS domain sybyl.local., please wait ...
Checking DNS forwarders, please wait ... (指定したDNSがDNSSEC対応でないので)
DNS server 192.168.0.3 does not support DNSSEC: answer to query '. SOA' is missing DNSSEC signatures (no RRSIG data)
Please fix forwarder configuration to enable DNSSEC support.
DNS server 192.168.0.3: answer to query '. SOA' is missing DNSSEC signatures (no RRSIG data)
Please fix forwarder configuration to enable DNSSEC support.
WARNING: DNSSEC validation will be disabled
Do you want to search for missing reverse zones? [yes]: <--- FreeIPAサーバ内に逆引きzone(0.168.192.in-addr.arpa.)を用意するか?
Kerberos認証やSSHのGSSAPI認証で問題を起こしたくないのでYesとして作ります
Reverse record for IP address 192.168.0.146 already exists <-- 指定したDNS 192.160.0.3 はdnsmasqなのだが、192.168.0.146の逆引きがあると判断されてしまった..存在しないのに
Trust is configured but no NetBIOS domain name found, setting it now.
Enter the NetBIOS name for the IPA domain.
Only up to 15 uppercase ASCII letters, digits and dashes are allowed.
Example: EXAMPLE.
NetBIOS domain name [SYBYL]: <-- NetBios名. そのままでいいのでリターン
The IPA Master Server will be configured with:
Hostname: freeipa.sybyl.local
IP address(es): 192.168.0.146
Domain name: sybyl.local
Realm name: SYBYL.LOCAL
The CA will be configured with:
Subject DN: CN=Certificate Authority,O=SYBYL.LOCAL
Subject base: O=SYBYL.LOCAL
Chaining: self-signed
BIND DNS server will be configured to serve IPA domain with:
Forwarders: 192.168.0.3
Forward policy: only
Reverse zone(s): No reverse zone <-- 逆引きzone(0.168.192.in-addr.arpa.)は作らないと判断されました
スクリプトが 192.168.0.1 で既に逆引きを管理しているっぽいと判断してFreeIPA内に用意しないとしたみたい
--> あとで手動で逆引きzoneをFreeIPA内に作るようにします.
NTP server: 192.168.0.3
Continue to configure the system with these values? [no]: Yes <-- 内容を確認して Yes とします
The following operations may take some minutes to complete.
Please wait until the prompt is returned.
:
:
:
==============================================================================
Setup complete
Next steps:
1. You must make sure these network ports are open:
TCP Ports:
* 80, 443: HTTP/HTTPS
* 389, 636: LDAP/LDAPS
* 88, 464: kerberos
* 53: bind
UDP Ports:
* 88, 464: kerberos
* 53: bind
* 123: ntp
2. You can now obtain a kerberos ticket using the command: 'kinit admin'
This ticket will allow you to use the IPA tools (e.g., ipa user-add)
and the web user interface.
Be sure to back up the CA certificates stored in /root/cacert.p12
These files are required to create replicas. The password for these
files is the Directory Manager password
The ipa-server-install command was successful
[root@freeipa ~]#ここでは上位のDNSとして同じネットワークに既に存在する dnsmasqサーバ を指定しました。
dnsmasqは逆引きも提供しているため「0.168.192.in-addr.arpa.」は既に存在していて、FreeIPA内部のDNSとしては作って頂けないみたい.
「--forwarder」に所属ネットワーク以外のDNSサーバを指定するとすんなり逆引きも用意されるみたいです
プロバイダーのDNSとか施設の対外向けDNSを指定すれば行けるかと思う
この構築段階で「/etc/resolv.conf」に修正が入って
[root@freeipa ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search sybyl.local
nameserver 127.0.0.1
[root@freeipa ~]#と自分自身がDNS参照先になる
サービスとして freeipa dns ntp を開けます
[root@freeipa ~]# firewall-cmd --add-service={freeipa-4,dns,ntp} --zone=public --permanent
[root@freeipa ~]# firewall-cmd --reloadあとntpサービスをchronyで展開してますが、他のクライアントからの要求を受け入れるには firewall 以外にも 「/etc/chrony.conf」に「allow 192.168.0.0/24」を有効にする必要がある
[root@freeipa ~]# echo "allow 192.168.0.0/24" >> /etc/chrony.conf
[root@freeipa ~]# systemctl restart chronyd一応DNSSECをサポートする上位のDNS(プロバイダーのDNSや施設の対外向けDNS)を指定した際は作ってくれる. 思想的にはネットワーク全体をこのFreeIPAでディレクトリ管理するって意志なのね
その際のログは下記のようになる
:
Checking DNS domain sybyl.local., please wait ...
Checking DNS forwarders, please wait ...
Do you want to search for missing reverse zones? [yes]: <--逆引きの存在確認を行う
Checking DNS domain 0.168.192.in-addr.arpa., please wait ...
Do you want to create reverse zone for IP 192.168.0.146 [yes]: <--- 逆引きが存在しなかったので作りますか?
Please specify the reverse zone name [0.168.192.in-addr.arpa.]: <--- 逆引きの名称は「0.168.192.in-addr.arpa.」でいいよね?
Checking DNS domain 0.168.192.in-addr.arpa., please wait ...
Using reverse zone(s) 0.168.192.in-addr.arpa.
:ですが、前段のようにすでに指定していた「--forwarder」が同じネットワークに存在して逆引きを提供していたので構築段階では作れませんでした。
なので、手動で逆引きを用意してみます
まず既存のzoneの確認.
[root@freeipa ~]# kinit admin
Password for admin@SYBYL.LOCAL:
[root@freeipa ~]#
[root@freeipa ~]# ipa dnszone-find
Zone name: sybyl.local.
Active zone: True
Authoritative nameserver: freeipa.sybyl.local.
Administrator e-mail address: hostmaster.sybyl.local.
SOA serial: 1766858706
SOA refresh: 3600
SOA retry: 900
SOA expire: 1209600
SOA minimum: 3600
BIND update policy: grant SYBYL.LOCAL krb5-self * A; grant SYBYL.LOCAL krb5-self * AAAA; grant SYBYL.LOCAL krb5-self * SSHFP;
Dynamic update: True <-- 自動更新が有効で作られている
Allow query: any;
Allow transfer: none;
----------------------------
Number of entries returned 1
----------------------------
[root@freeipa ~]#と「freeipa.sybyl.local.」の正引きのみ. っで作られていない逆引き(0.168.192.in-addr.arpa.)を作る.
[root@freeipa ~]# ipa dnszone-add 0.168.192.in-addr.arpa. \
--name-server=freeipa.sybyl.local. \
--admin-email=hostmaster.sybyl.local.
ipa: WARNING: Semantic of setting Authoritative nameserver was changed. It is used only for setting the SOA MNAME attribute.
NS record(s) can be edited in zone apex - '@'.
Zone name: 0.168.192.in-addr.arpa.
Active zone: True
Authoritative nameserver: freeipa.sybyl.local.
Administrator e-mail address: hostmaster.sybyl.local.
SOA serial: 1766859617
SOA refresh: 3600
SOA retry: 900
SOA expire: 1209600
SOA minimum: 3600
BIND update policy: grant SYBYL.LOCAL krb5-subdomain 0.168.192.in-addr.arpa. PTR;
Dynamic update: False <-- ここを Trueにしないとクライアント参加時に逆引きを作ってくれない
Allow query: any;
Allow transfer: none;
[root@freeipa ~]#
(自動更新ができるように調整)
[root@freeipa ~]# ipa dnszone-mod 0.168.192.in-addr.arpa --dynamic-update=TRUEその後に freeipaサーバの逆引きを登録します
[root@freeipa ~]# ipa dnsrecord-add 0.168.192.in-addr.arpa. 146 --ptr-rec=freeipa.sybyl.local.これでnslookupで正、逆ともに引けます
[root@freeipa ~]# nslookup freeipa
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: freeipa.sybyl.local
Address: 192.168.0.146
[root@freeipa ~]# nslookup 192.168.0.146
146.0.168.192.in-addr.arpa name = freeipa.sybyl.local.
[root@freeipa ~]#nfsサーバを別途用意してそこで/home/を提供してみる. nfsサーバをログインノードにするのがいいかなと思う. ACLが使えるから. ログインノードとnfsサーバを別にすると面倒くさい nfs4-acl-tools を使う羽目になる
FreeIPAの参加になってnfsサービスを提供しますので、まずはFreeIPAに参加させます
DNS参照先を FreeIPAサーバ[192.168.0.146] に向けさせます. nmtuiとかで指定します.
[root@freeipa-nfs ~]# hostnamectl set-hostname freeipa-nfs.sybyl.local
[root@freeipa-nfs ~]# nmcli connection modify enp6s18 ipv4.method manual ipv4.addresses 192.168.0.149/24 ipv4.gateway 192.168.0.1 ipv4.dns 192.168.0.146 ipv6.method disabled
[root@freeipa-nfs ~]# nmcli connection down enp6s18; nmcli connection up enp6s18
[root@freeipa-nfs ~]# echo `hostname -i` `hostname -f` `hostname -s` >> /etc/hostsそしてFreeIPAの参加へ入ります
[root@freeipa-nfs ~]# dnf install ipa-client -y
[root@freeipa-nfs ~]# ipa-client-install --mkhomedir --enable-dns-updates --ntp-server=192.168.0.146
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
NTP server: 192.168.0.146
Continue to configure the system with these values? [no]: Yes <-- この内容で正しいので yes
Synchronizing time
Configuration of chrony was changed by installer.
Attempting to sync time with chronyc.
Time synchronization was successful.
User authorized to enroll computers: admin <--- admin
Password for admin@SYBYL.LOCAL: <-- FreeIPAサーバ構築時の管理者パスワードを入力
Successfully retrieved CA cert
Subject: CN=Certificate Authority,O=SYBYL.LOCAL
Issuer: CN=Certificate Authority,O=SYBYL.LOCAL
Valid From: 2025-12-30 16:12:33+00:00
Valid Until: 2045-12-30 16:12:33+00:00
Enrolled in IPA realm SYBYL.LOCAL
Created /etc/ipa/default.conf
Configured /etc/sssd/sssd.conf
Systemwide CA database updated.
Hostname (freeipa-nfs.sybyl.local) does not have A/AAAA record.
Missing reverse record(s) for address(es): 192.168.0.149.
Adding SSH public key from /etc/ssh/ssh_host_ecdsa_key.pub
Adding SSH public key from /etc/ssh/ssh_host_ed25519_key.pub
Adding SSH public key from /etc/ssh/ssh_host_rsa_key.pub
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 ~]#っで確認
[root@freeipa-nfs ~]# nslookup freeipa-nfs
Server: 192.168.0.146
Address: 192.168.0.146#53
Name: freeipa-nfs.sybyl.local
Address: 192.168.0.149
[root@freeipa-nfs ~]#と成功するが、逆引きはだめ
[root@freeipa-nfs ~]# nslookup 192.168.0.149
** server can't find 149.0.168.192.in-addr.arpa: NXDOMAINなのでFreeIPAサーバで逆引きを登録する
[root@freeipa ~]# ipa dnsrecord-add 0.168.192.in-addr.arpa. 149 --ptr-rec=freeipa-nfs.sybyl.local.
Record name: 149
PTR record: freeipa-nfs.sybyl.local.
[root@freeipa ~]#あとのnfsサービスプリンシパルの作成、/etc/krb5.keytabの更新、nfsサービスの開始らはFreeIPA/nfs参照で. nfsサーバはindirectで作った方がいいみたい
[root@freeipa-client ~]# hostnamectl set-hostname freeipa-client.sybyl.local
[root@freeipa-client ~]# nmcli connection modify enp6s18 ipv4.method manual ipv4.addresses 192.168.0.147/24 ipv4.gateway 192.168.0.1 ipv4.dns 192.168.0.146 ipv6.method disabled
[root@freeipa-client ~]# nmcli connection down enp6s18; nmcli connection up enp6s18
[root@freeipa-client ~]# echo `hostname -i` `hostname -f` `hostname -s` >> /etc/hostsそしてFreeIPAの参加へ入ります
[root@freeipa-client ~]# dnf install ipa-client -y
[root@freeipa-client ~]# ipa-client-install --mkhomedir --enable-dns-updates --ntp-server=192.168.0.146
This program will set up IPA client.
Version 4.12.2
Discovery was successful!
Client hostname: freeipa-client.sybyl.local
Realm: SYBYL.LOCAL
DNS Domain: sybyl.local
IPA Server: freeipa.sybyl.local
BaseDN: dc=sybyl,dc=local
NTP server: 192.168.0.146
Continue to configure the system with these values? [no]: yes
Synchronizing time
Configuration of chrony was changed by installer.
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: 2025-12-30 16:12:33+00:00
Valid Until: 2045-12-30 16:12:33+00:00
Enrolled in IPA realm SYBYL.LOCAL
Created /etc/ipa/default.conf
Configured /etc/sssd/sssd.conf
Systemwide CA database updated.
Hostname (freeipa-client.sybyl.local) does not have A/AAAA record.
Missing reverse record(s) for address(es): 192.168.0.147.
Adding SSH public key from /etc/ssh/ssh_host_ecdsa_key.pub
Adding SSH public key from /etc/ssh/ssh_host_ed25519_key.pub
Adding SSH public key from /etc/ssh/ssh_host_rsa_key.pub
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-client ~]#
[root@freeipa-client ~]# nslookup freeipa-client
Server: 192.168.0.146
Address: 192.168.0.146#53
Name: freeipa-client.sybyl.local
Address: 192.168.0.147
[root@freeipa-client ~]# nslookup 192.168.0.147
** server can't find 147.0.168.192.in-addr.arpa: NXDOMAIN
[root@freeipa-client ~]# ipa dnsrecord-add 0.168.192.in-addr.arpa. 147 --ptr-rec=freeipa-client.sybyl.local.[root@freeipa ~]# ipa service-add nfs/freeipa-client.sybyl.local
[root@freeipa-client ~]# ipa-getkeytab -s freeipa.sybyl.local -p nfs/freeipa-client.sybyl.local -k /etc/krb5.keytab[root@freeipa-client ~]# ipa-client-automount
Searching for IPA server...
IPA server: DNS discovery
Location: default
Continue to configure the system with these values? [no]: yes
Configured /etc/idmapd.conf
Restarting sssd, waiting for it to become available.
Started autofs
[root@freeipa-client ~]#FreeIPAを構築すると /home/pkiuser が用意される。これは他のFreeIPAクライアントで共有する必要はない。
なら usermod で /opt らへ移動させればと考えるが、これもやめた方がいいようで、ipa-server-upgrade とかで元に戻ってしまうそうな.
もしFreeIPAサーバで /home を nfs 公開するなら /home/pkiuser を除外してexportが必要みたい. そうなると一般ユーザのホームディレクトリを/home/配下ではなく/home/users/配下とかにする必要がある
FreeIPAでは ホームディレクトリを作成する際のデフォ値も変更できるそうな
ipa config-mod --homedir=/home/users
(手順的には)
mkdir /home/users
echo "/home/users 192.168.0.0/24(rw,sync)" > /etc/exports
systemctl enable nfs-server --now
ipa config-mod --homedir=/home/usersFreeIPAサーバに一般ユーザのログインを許可しないなら 別途nfsサーバを立てることで /home/配下のホームディレクトリが可能かもしれない.
まぁ最悪 FreeIPAサーバで nfs サーバも兼ねて、/home/を共有することが必要なら /home/pkiuser を含めてexportも仕方ないかなと思う.
FreeIPA謹製のDNSだからnfsのsec=krb5もすんなり行けるかなと思って構築してみたが、結果は同じでした。sshログイン・ログアウトに遅延がどうしても発生してしまいました。
当然 sec=sys ならそのような遅延は一切なく問題なく使えました。
chatgptからpamとか指摘されましたが、調整しても改善なく、、
「dnsmasq+FreeIPA」vs「FreeIPA(with DNS)」ですが、ディレクトリ管理として行うなら後者がいいのでしょう。ですが、同一ネットワークにFreeIPAに所属しないホストとかの面等を考えると平文テキストベースで構築できるdnsmasqは便利なんだよなぁ。slurmとの連携もdnsmasqは楽.