■ドキュメント
④第3章 IDENTITY MANAGEMENT クライアントのインストールおよびアンインストール
■前提条件
上記④の「3.1. クライアントインストールの前提条件」参照
■インストール準備
・クライアント側のリゾルバ設定
[centos7copy]$ hostnamectl set-hostname centos7copy.dagyah.com
[centos7copy]$ hostname
centos7copy.dagyah.com
[centos7copy]$ cat /etc/resolv.conf
# Generated by NetworkManager
search localdomain dagyah.com
nameserver 192.168.100.1
nameserver fe80::96d0:dff:fe8f:84d4%ens34
nameserver 192.168.47.2
[centos7copy]$ nmtui
---(編集)---
[centos7copy]$ systemctl restart NetworkManager
[centos7copy]$ cat /etc/resolv.conf
# Generated by NetworkManager
search localdomain dagyah.com
nameserver 192.168.100.1
nameserver 192.168.19.200
nameserver 192.168.47.2
→この順序だと192.168.100.1と通信できてしまえば192.168.19.200は引かないので、centos7.dagyah.comの名前は解決できないのでリゾルバ上で192.168.19.200の方が192.168.100.1より上位になるように設定する。
[centos7copy]$ nmtui
---(編集)---
[centos7copy]$ systemctl restart NetworkManager
[centos7copy]$ cat /etc/resolv.conf
# Generated by NetworkManager
search localdomain dagyah.com
nameserver 192.168.19.200
nameserver 192.168.100.1
nameserver fe80::96d0:dff:fe8f:84d4%ens34
[centos7copy]$ dig centos7.dagyah.com
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-16.P2.el7_8.6 <<>> centos7.dagyah.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 20827
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 1, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;centos7.dagyah.com. IN A
;; ANSWER SECTION:
centos7.dagyah.com. 1200 IN A 192.168.19.200
centos7.dagyah.com. 1200 IN A 192.168.101.200
centos7.dagyah.com. 1200 IN A 192.168.122.1
;; AUTHORITY SECTION:
dagyah.com. 86400 IN NS centos7.dagyah.com.
;; ADDITIONAL SECTION:
centos7.dagyah.com. 1200 IN AAAA 2001:268:c0ce:1430:94d0:d8f:84d4:4
centos7.dagyah.com. 1200 IN AAAA 2001:268:c0ce:1430:3ae3:6e25:5599:dcb4
;; Query time: 0 msec
;; SERVER: 192.168.19.200#53(192.168.19.200)
;; WHEN: Sun Nov 08 13:38:54 PST 2020
;; MSG SIZE rcvd: 165
[centos7copy]$ dig www.yahoo.co.jp
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-16.P2.el7_8.6 <<>> www.yahoo.co.jp
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 46869
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;www.yahoo.co.jp. IN A
;; ANSWER SECTION:
www.yahoo.co.jp. 222 IN CNAME edge12.g.yimg.jp.
edge12.g.yimg.jp. 56 IN A 183.79.250.123
;; Query time: 69 msec
;; SERVER: fe80::96d0:dff:fe8f:84d4%3#53(fe80::96d0:dff:fe8f:84d4%3)
;; WHEN: Sun Nov 08 13:46:25 PST 2020
;; MSG SIZE rcvd: 88
・サーバ側でチャラい設定
[centos7]$ setenforce 0
[centos7]$ iptables -F
・ipa client
[centos7copy]$ rpm -qa | grep ipa-client
ipa-client-common-4.6.6-11.el7.centos.noarch
ipa-client-4.6.6-11.el7.centos.x86_64
[centos7]$ which ipa-client-install
/usr/sbin/ipa-client-install
■インストール
[centos7copy]$ ipa-client-install --enable-dns-updates --no-krb5-offline-passwords
WARNING: ntpd time&date synchronization service will not be configured as
conflicting service (chronyd) is enabled
Use --force-ntpd option to disable it and force configuration of ntpd
Discovery was successful!
Client hostname: centos7copy.dagyah.com
Realm: DAGYAH.COM
DNS Domain: dagyah.com
IPA Server: centos7.dagyah.com
BaseDN: dc=dagyah,dc=com
Continue to configure the system with these values? [no]: yes
Skipping synchronizing time with NTP server.
User authorized to enroll computers: admin
Password for admin@DAGYAH.COM:Password123
Successfully retrieved CA cert
Subject: CN=Certificate Authority,O=DAGYAH.COM
Issuer: CN=Certificate Authority,O=DAGYAH.COM
Valid From: 2020-11-08 18:58:06
Valid Until: 2040-11-08 18:58:06
Enrolled in IPA realm DAGYAH.COM
Created /etc/ipa/default.conf
New SSSD config will be created
Configured sudoers in /etc/nsswitch.conf
Configured /etc/sssd/sssd.conf
Configured /etc/krb5.conf for IPA realm DAGYAH.COM
trying https://centos7.dagyah.com/ipa/json
[try 1]: Forwarding 'schema' to json server 'https://centos7.dagyah.com/ipa/json'
trying https://centos7.dagyah.com/ipa/session/json
[try 1]: Forwarding 'ping' to json server 'https://centos7.dagyah.com/ipa/session/json'
[try 1]: Forwarding 'ca_is_enabled' to json server 'https://centos7.dagyah.com/ipa/session/json'
Systemwide CA database updated.
Hostname (centos7copy.dagyah.com) does not have A/AAAA record.
Missing reverse record(s) for address(es): 192.168.101.201, 2001:268:c0ce:1430:94d0:d8f:84d4:3, 2001:268:c0ce:1430:fb85:cf3b:630d:5e8c.
Adding SSH public key from /etc/ssh/ssh_host_rsa_key.pub
Adding SSH public key from /etc/ssh/ssh_host_ed25519_key.pub
Adding SSH public key from /etc/ssh/ssh_host_ecdsa_key.pub
[try 1]: Forwarding 'host_mod' to json server 'https://centos7.dagyah.com/ipa/session/json'
SSSD enabled
Configured /etc/openldap/ldap.conf
Configured /etc/ssh/ssh_config
Configured /etc/ssh/sshd_config
Configuring dagyah.com as NIS domain.
Client configuration complete.
The ipa-client-install command was successful
・クライアントのインストール後の検討事項
[centos7copy]$ cat /etc/openldap/ldap.conf
# File modified by ipa-client-install
# We do not want to break your existing configuration, hence:
# URI, BASE, TLS_CACERT and SASL_MECH
# have been added if they were not set.
# In case any of them were set, a comment has been inserted and
# "# CONF_NAME modified by IPA" added to the line above.
# To use IPA server with openLDAP tools, please comment out your
# existing configuration for these options and uncomment the
# corresponding lines generated by IPA.
#
# LDAP Defaults
#
# See ldap.conf(5) for details
# This file should be world readable but not world writable.
#BASE dc=example,dc=com
#URI ldap://ldap.example.com ldap://ldap-master.example.com:666
#SIZELIMIT 12
#TIMELIMIT 15
#DEREF never
TLS_CACERTDIR /etc/openldap/certs
# Turning this off breaks GSSAPI used with krb5 when rdns = false
SASL_NOCANON on
URI ldaps://centos7.dagyah.com
BASE dc=dagyah,dc=com
TLS_CACERT /etc/ipa/ca.crt
SASL_MECH GSSAPI
[centos7copy]$ cat /etc/ipa/ca.crt
-----BEGIN CERTIFICATE-----
MIIDiDCCAnCgAwIBAgIBATANBgkqhkiG9w0BAQsFADA1MRMwEQYDVQQKDApEQUdZ
QUguQ09NMR4wHAYDVQQDDBVDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMjAxMTA4
MTg1ODA2WhcNNDAxMTA4MTg1ODA2WjA1MRMwEQYDVQQKDApEQUdZQUguQ09NMR4w
HAYDVQQDDBVDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUA
A4IBDwAwggEKAoIBAQDBGJ3mhZmzVQbLZGCxPLS1hYpHLrpNTqBcCO0lJzLWLUGb
S7GZds/0VzOemezyUX85/0ACa8HQ1sBPWeS5yu+BeK1AnIqm4BvnQjr8XiMYFSo4
dBuEPfWht5FGM95BnDC7FW/1JM/aOYJgzAgEIl5crN3oZODEBwh2dRAgqIY/6EKE
WCVc7l7k8JpCLTjM9Wg4BqbmobQl9BkJvrcArVXbgABwhWwkruUbbLJ+XCGrMBjc
y+VuQE4R6HinHIRtDfQEVG/+QAVhi4LkHLSg2gsvYrYqKWdtwJn2FaAbfZrSnJj5
G1sSEEbIOvrO692o4u7D7sysSvszJmgUOiYttWWtAgMBAAGjgaIwgZ8wHwYDVR0j
BBgwFoAUXK4UzU69yBUEbGZu1uhAeHL3koAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
HQ8BAf8EBAMCAcYwHQYDVR0OBBYEFFyuFM1OvcgVBGxmbtboQHhy95KAMDwGCCsG
AQUFBwEBBDAwLjAsBggrBgEFBQcwAYYgaHR0cDovL2lwYS1jYS5kYWd5YWguY29t
L2NhL29jc3AwDQYJKoZIhvcNAQELBQADggEBAGKSsO8CAtQdov/NqaC850hqvssx
Yjs0VDx7QB/YGpdvPJL4M6aqHa5Tt9fqsZdK2pTe/CePF15hfzx8l+D92d11Z/+J
4PJHVnw56cEPw8TEOcirJVTTXc+ONR5bJF7Qz0hOlK0ar4hAVFD2Sy0WlHRrA2KM
XqBUSuxSrgTbxegNp7fZW4OSlcy/TN2WtEIgbImCw8X2UEE8S3pbmeQQr+arNKrD
0MtKnEK+cqLkzTLMMPi1sutXpFPkR0vnwXUU7FhByvJc8Bv4XgxMBVceL0shv3+n
EOqRrplVwdpXTpCyRG83Y04fGZ4TqTKPlAfWmMoAl6R6aWN2Ml/6jrXDXzI=
-----END CERTIFICATE-----
[centos7copy]$ cat /etc/sssd/sssd.conf
[domain/dagyah.com]
cache_credentials = True
ipa_domain = dagyah.com
id_provider = ipa
auth_provider = ipa
access_provider = ipa
ipa_hostname = centos7copy.dagyah.com
chpass_provider = ipa
dyndns_update = True
ipa_server = _srv_, centos7.dagyah.com
dyndns_iface = ens33
ldap_tls_cacert = /etc/ipa/ca.crt
[sssd]
services = nss, sudo, pam, ssh
domains = dagyah.com
[nss]
homedir_substring = /home
[pam]
[sudo]
[autofs]
[ssh]
[pac]
[ifp]
[secrets]
[session_recording]
[centos7copy]$ dig centos7.dagyah.com
; <<>> DiG 9.11.4-P2-RedHat-9.11.4-16.P2.el7_8.6 <<>> centos7.dagyah.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 32334
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 1, ADDITIONAL: 3
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;centos7.dagyah.com. IN A
;; ANSWER SECTION:
centos7.dagyah.com. 1200 IN A 192.168.19.200
centos7.dagyah.com. 1200 IN A 192.168.101.200
centos7.dagyah.com. 1200 IN A 192.168.122.1
;; AUTHORITY SECTION:
dagyah.com. 86400 IN NS centos7.dagyah.com.
;; ADDITIONAL SECTION:
centos7.dagyah.com. 1200 IN AAAA 2001:268:c0ce:1430:94d0:d8f:84d4:4
centos7.dagyah.com. 1200 IN AAAA 2001:268:c0ce:1430:3ae3:6e25:5599:dcb4
;; Query time: 1 msec
;; SERVER: 192.168.19.200#53(192.168.19.200)
;; WHEN: Mon Nov 09 06:57:39 JST 2020
;; MSG SIZE rcvd: 165
[centos7copy]$ ll /etc/krb5.keytab
-rw-------. 1 root root 180 Nov 9 06:42 /etc/krb5.keytab
[centos7copy]$ file /etc/krb5.keytab
/etc/krb5.keytab: data
[centos7copy]$ cat /etc/krb5.keytab
]
?俣#`μ空\兼/η・{/M7copy.dagyah.com_・N 痺週
DAGYAH.COMhostcentos7copy.dagyah.com_・N・\
2y^
?[centos7copy]$
[centos7copy]$ cat /etc/nsswitch.conf
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
#
# The entry '[NOTFOUND=return]' means that the search for an
# entry should stop if the search in the previous entry turned
# up nothing. Note that if the search failed due to some other reason
# (like no NIS server responding) then the search continues with the
# next entry.
#
# Valid entries include:
#
# nisplus Use NIS+ (NIS version 3)
# nis Use NIS (NIS version 2), also called YP
# dns Use DNS (Domain Name Service)
# files Use the local files
# db Use the local database (.db) files
# compat Use NIS on compat mode
# hesiod Use Hesiod for user lookups
# [NOTFOUND=return] Stop searching if not found so far
#
# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:
#passwd: db files nisplus nis
#shadow: db files nisplus nis
#group: db files nisplus nis
passwd: files sss
shadow: files sss
group: files sss
#initgroups: files
#hosts: db files nisplus nis dns
hosts: files dns myhostname
# Example - obey only what nisplus tells us...
#services: nisplus [NOTFOUND=return] files
#networks: nisplus [NOTFOUND=return] files
#protocols: nisplus [NOTFOUND=return] files
#rpc: nisplus [NOTFOUND=return] files
#ethers: nisplus [NOTFOUND=return] files
#netmasks: nisplus [NOTFOUND=return] files
bootparams: nisplus [NOTFOUND=return] files
ethers: files
netmasks: files
networks: files
protocols: files
rpc: files
services: files sss
netgroup: files sss
publickey: nisplus
automount: files
aliases: files nisplus
sudoers: files sss
[centos7copy]$ ls -ltr /etc/pam.d/ | tail
-rw-r--r--. 1 root root 510 Aug 7 02:18 pluto
-rw-r--r--. 1 root root 97 Aug 7 02:26 subscription-manager
-rw-r--r--. 1 root root 214 Aug 7 02:26 sssd-shadowutils
-rw-r--r--. 1 root root 129 Aug 7 02:30 systemd-user
lrwxrwxrwx. 1 root root 25 Sep 1 02:44 smtp -> /etc/alternatives/mta-pam
-rw-r--r--. 1 root root 1386 Nov 9 06:43 system-auth-ac
-rw-r--r--. 1 root root 330 Nov 9 06:43 postlogin-ac
-rw-r--r--. 1 root root 1388 Nov 9 06:43 password-auth-ac
-rw-r--r--. 1 root root 807 Nov 9 06:43 fingerprint-auth-ac
-rw-r--r--. 1 root root 857 Nov 9 06:43 smartcard-auth-ac
[centos7copy]$ ll /etc/sudoers
-r--r-----. 1 root root 4328 Nov 28 2019 /etc/sudoers
[centos7copy]$ ll /etc/sudoers.d
total 0
・新規クライアントのテスト
[centos7copy]$ id admin
uid=1942000000(admin) gid=1942000000(admins) groups=1942000000(admins)
[centos7copy]$ kinit admin@DAGYAH.COM
Password for admin@DAGYAH.COM:
[centos7copy]$ echo $?
0


