FreeIPAまたはipa-server/ipa-clientとして知られる、Linux環境でID管理を一元化するシステム。それがLinuxドメインです。
sudo vi /etc/resolv.conf
Input:nameserver 192.168.11.187
sudo yum -y upgrade
df -hT
bashrc
vi ~/.bashrc
Input:
unalias vi
alias ffd='find `pwd` -type d'
alias fff='find `pwd` -type f'
sudo vi /etc/bashrc
※PS1=のとこに\Aを入れる
pinn = private internal network の意
sudo hostnamectl set-hostname mf1.addrle.pinn
sudo hostnamectl set-hostname ms.addrle.pinn
sudo hostnamectl set-hostname idm0.addrle.pinn
sudo yum -y install ipa-server ipa-server-dns
- 初期設定
sudo ipa-server-install
IPA admin password: [adminPass]
エラーになった
ipa.ipapython.install.cli.install_tool(CompatServerMasterInstall): ERROR Integrated DNS requires 'ipa-server-dns' package
ipa.ipapython.install.cli.install_tool(CompatServerMasterInstall): ERROR The ipa-server-install command failed. See /var/log/ipaserver-install.log for more information
sudo yum -y install ipa-server-dns
sudo ipa-server-install
...続き
Do you want to configure DNS forwarders? [yes]:
The IPA Master Server will be configured with: Hostname: idm0.addrle.pinn IP address(es): 192.168.11.123 Domain name: addrle.pinn Realm name: ADDRLE.PINN
BIND DNS server will be configured to serve IPA domain with: Forwarders: 192.168.11.187 Forward policy: only Reverse zone(s): No reverse zone
Continue to configure the system with these values? [no]:
[yes]
エラーになった
ipa.ipapython.install.cli.install_tool(CompatServerMasterInstall): ERROR Certificate issuance failed (CA_UNREACHABLE)
ipa.ipapython.install.cli.install_tool(CompatServerMasterInstall): ERROR The ipa-server-install command failed. See /var/log/ipaserver-install.log for more information
yum list ipa-server
Loaded plugins: langpacks, priorities, update-motd
191 packages excluded due to repository priority protections
Installed Packages
ipa-server.x86_64 4.5.0-22.amzn2.0.1 @amzn2-core
参考:https://bugzilla.redhat.com/show_bug.cgi?id=1455561
参考:https://pagure.io/freeipa/c/9c1ab3ca5015317091f40ac8c352823a75849cef
バグやん・・・
version 4.6を待つか、手で直すか
2019-10-02 ここまで
さてさて、どうするか。
ipa-server.x86_64 4.6.5-11.el7.centos base
sudo visudo
%wheel ALL=(ALL) NOPASSWD: ALL
ssh-keygen -t rsa
vi ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
sudo vi /etc/bashrc
PS1に \A 追加
sudo mkdir /home/USERS
sudo vi /etc/fstab
Input:
192.168.11.122:/adrl/USERS /home/USERS nfs rw,intr 0 0
エラー:mount: /home/USERS: bad option; for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.
helper program.
パッケージが足りてないみたい。
sudo yum search nfs
これかな?:nfs-utils.x86_64
sudo yum -y install nfs-utils.x86_64
ついでにアップデート
sudo yum -y update
sudo reboot
サーバーパッケージインストール
sudo yum install epel-release.noarch
yum search ipa-server
Extra Packages for Enterprise Linux 8 - x86_64
一致する項目はありませんでした。
いない・・・だと?!
https://computingforgeeks.com/how-to-install-and-configure-freeipa-server-on-rhel-centos-8/
これを見ると、、、
モジュール検索してからパッケージインストール
sudo dnf module list idm
sudo dnf module info idm:DL1
sudo dnf -y install @idm:DL1
sudo dnf -y -y install freeipa-server ipa-server-dns bind-dyndb-ldap
... ipa-server-4.7.1-11.module_el8.0.0+79+bbd20d7b.x86_64
完了しました!
コマンド実行
sudo ipa-server-install
Continue to configure the system with these values? [no]: [yes]
============================================================================== Setup complete
Next steps:
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
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
やったぜ!!
kinit
sudo kinit admin
Password for admin@ADDRLE.PINN:
IPA admin PASS
sudo firewall-cmd --permanent --add-port=80/tcp
sudo firewall-cmd --permanent --add-port=80/udp
sudo firewall-cmd --permanent --add-port=443/tcp
sudo firewall-cmd --permanent --add-port=443/udp
sudo firewall-cmd --permanent --add-port=389/tcp
sudo firewall-cmd --permanent --add-port=389/udp
sudo firewall-cmd --permanent --add-port=636/tcp
sudo firewall-cmd --permanent --add-port=636/udp
sudo firewall-cmd --permanent --add-port=88/tcp
sudo firewall-cmd --permanent --add-port=88/udp
sudo firewall-cmd --permanent --add-port=464/tcp
sudo firewall-cmd --permanent --add-port=464/udp
sudo firewall-cmd --permanent --add-port=53/tcp
sudo firewall-cmd --permanent --add-port=53/udp
sudo firewall-cmd --permanent --add-port=123/tcp
sudo firewall-cmd --permanent --add-port=123/udp
sudo firewall-cmd --reload
sudo firewall-cmd --list-all
[AD]SSL販売の専門サイトだから、安心・格安にてご購入いただけます。【SSLセキュア】
クライアントインストール
当然だが/etc/resolv.confを編集
sudo vi /etc/resolv.conf
Change:nameserver 192.168.11.187 → nameserver 192.168.11.124
クライアントパッケージインストール
sudo yum -y install ipa-client
ipa-client-install ユーティリティー
sudo ipa-client-install
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: mf1.addrle.pinn
Realm: ADDRLE.PINN
DNS Domain: addrle.pinn
IPA Server: idm1.addrle.pinn
BaseDN: dc=addrle,dc=pinn
Continue to configure the system with these values? [no]:
[yes]
[admin]
IPA admin PASS
The ipa-client-install command was successful
sudo ipa-client-automount
[yes]
ID管理
HOMEディレクトリは自動作成されないらしい
@MF1 ipa config-mod
sudo ipa help config-mod
--homedirectory=STR Default location of home directories
sudo ipa config-mod --homedirectory=/home/USERS
ipa: ERROR: did not receive Kerberos credentials
クライアントでも kinit admin が必要
kinit admin
IPA admin PASS
ipa config-mod --homedirectory=/home/USERS
mailuser2 ユーザー作成
ipa user-add mailuser2
First name: [user2]
Last name: [mail]
Added user "mailuser2"
User login: mailuser2
First name: user2
Last name: mail
Full name: user2 mail
Display name: user2 mail
Initials: um
Home directory: /home/USERS/mailuser2
GECOS: user2 mail
Login shell: /bin/sh
Principal name: mailuser2@ADDRLE.PINN
Principal alias: mailuser2@ADDRLE.PINN
Email address: mailuser2@addrle.pinn
UID: 970600001
GID: 970600001
Password: False
Member of groups: ipausers
Kerberos keys available: False
sudo mkdir -p /home/USERS/mailuser2/Maildir
sudo chown -R mailuser2 /home/USERS/mailuser2
パスワード設定
ipa passwd mailuser2
ユーザー作成コマンドセット username:mailuser3 の場合
ipa user-add mailuser3 --first="user3" --last="日本語は?" --email="mailuser3@addrle.esxi.home.lan" --password
パスワード設定がインタラクティブ
sudo mkdir -p /home/USERS/mailuser3/Maildir
sudo chown -R mailuser3 /home/USERS/mailuser3
パスワードポリシー設定
初期値
ipa pwpolicy-show
Group: global_policy
Max lifetime (days): 90
Min lifetime (hours): 1
History size: 0
Character classes: 0
Min length: 8
Max failures: 6
Failure reset interval: 60
Lockout duration: 600
変更
ipa pwpolicy-mod --maxlife=99999 --minlength=12
ipa: ERROR: invalid 'maxlife': can be at most 20000
ipa pwpolicy-mod --minlife=0 --maxlife=20000 --minlength=12
Group: global_policy
Max lifetime (days): 20000
Min lifetime (hours): 1
History size: 0
Character classes: 0
Min length: 12
Max failures: 6
Failure reset interval: 60
Lockout duration: 600
サーバー管理
停止:ipactl stop
起動:ipactl start
再起動:ipactl restart
編集
sudo vi /etc/postfix/main.cf
Change:myhostname
いろいろ調べて、結果 dnssec-validation:no にすべし @idm1 ということに。
sudo vi /etc/named.conf
Change:dnssec-validation
やってみる
sudo su -
kinit admin
IPA admin PASS
vi /adrl/_bin/sysrepo.bash
#!/bin/bash
####Set mail HEADER
EXECDATE=$(date +%Y%m%dT%H%M)
echo "From: mailuser1@esxi.home.lan" > /adrl/_sysrepo/sysrepo-${EXECDATE}.log
echo "To: mailuser1@esxi.home.lan" >> /adrl/_sysrepo/sysrepo-${EXECDATE}.log
echo "Subject: DiskUsageReport ${EXECDATE}" >> /adrl/_sysrepo/sysrepo-${EXECDATE}.log
echo "" >> /adrl/_sysrepo/sysrepo-${EXECDATE}.log
####output
df -h /adrl/USERS >> /adrl/_sysrepo/sysrepo-${EXECDATE}.log
echo "" >> /adrl/_sysrepo/sysrepo-${EXECDATE}.log
ipa user-find | head -n 3 >> /adrl/_sysrepo/sysrepo-${EXECDATE}.log
####Sendmail
sendmail -i -f mailuser1@esxi.home.lan mailuser1@esxi.home.lan < /adrl/_sysrepo/sysrepo-${EXECDATE}.log
####CleanUP
find /adrl/_sysrepo -atime +3 > /adrl/_sysrepo/removefiles-${EXECDATE}.log
find /adrl/_sysrepo -atime +3 -type f -exec rm {} \;
####EndofScript
kerberosのチケットは何時間かで期限が切れるので、定期的にチケット取得(kinit)する処理が必要。
mailuser2でIMAPログインしようとしたらpassword expiredのログが。何で?
auth: pam_sss(dovecot:account): User info message: Password expired. Change your password now.
- パスワード再設定してみる
ipa passwd mailuser2
Oct 4 00:10:12 mf1 dovecot: auth-worker(7100): Error: pam(mailuser2,192.168.11.33): pam_acct_mgmt() failed: Authentication token is no longer valid; new one required
Oct 4 00:10:14 mf1 dovecot: imap-login: Aborted login (password expired): user=
, method=PLAIN, rip=192.168.11.33, lip=192.168.11.121, secured, session=<+UNn+wKU4gDAqAsh>
su - mailuser2
Password:
Password expired. Change your password now.
Current Password:
New password:
Retype new password:
-sh-4.2$
次回のログイン時にパスワード変更のプロンプトを表示しないでパスワードのリセットを有効化する方法: https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/7/html/linux_domain_identity_authentication_and_policy_guide/user-authentication#user-passwords-no-expiry
あった。
ldapmodify -x -D "cn=Directory Manager" -W -h idm1.addrle.pinn -p 389
Directory Manager PASS
dn: cn=ipa_pwd_extop,cn=plugins,cn=config
changetype: modify
add: passSyncManagersDNs
passSyncManagersDNs: uid=admin,cn=users,cn=accounts,dc=addrle,dc=pinn
※ここで改行を2つ
modifying entry "cn=ipa_pwd_extop,cn=plugins,cn=config"
Ctrl+Dで抜ける
ipa passwd mailuser3
OK。
mailuser4を作成 @idm1
ipa user-add mailuser4 --first="user4" --last="test4" --email="mailuser4@esxi.home.lan" --password
sudo mkdir -p /home/USERS/mailuser4/Maildir
sudo chown -R mailuser4 /home/USERS/mailuser4
chown: ユーザ指定が不正: `mailuser4'
ipa-clientをインストールしていないと、ユーザー認識されない。
sudo chown -R mailuser4 /home/USERS/mailuser4
Sylpheed でログインしてみる
いけた。
2019-10-03 ここまで
・・・糖分が欲しい
・・・プリン食べたい
[AD]高級プリンのお取り寄せ「プリン研究所」の通販サイトです
・・・あとチョコレイト
お疲れ様でした。