PAM設定について今更復習していろいろ検証してみるンゴ

 

■前提

本来はRHEL7の「システムレベルの認証ガイド」の中の下記を全部読めば書いてあるはず

 

あとRHEL7の「セキュリティーガイド」もダガヤ

だがおいらは市井のブログを漁るダニw

 

【テーマ1】

そもそもこれらって何?

/etc/pam.d/password-auth

/etc/pam.d/system-auth

 

まず、下記のCentOS7.9をインストールした直後の/etc/pam.d/直下ダニ

[centos7.9_2]# cat /etc/centos-release
CentOS Linux release 7.9.2009 (Core)

・minimumインストールした場合は、

[centos7.9_1]# cd /etc/pam.d;ls -l|cat -n
     1  合計 100
     2  -rw-r--r--. 1 root root  192 10月  1  2020 chfn
     3  -rw-r--r--. 1 root root  192 10月  1  2020 chsh
     4  -rw-r--r--. 1 root root  232  4月  1  2020 config-util
     5  -rw-r--r--. 1 root root  287  8月  9  2019 crond
     6  lrwxrwxrwx. 1 root root   19  9月  5 02:57 fingerprint-auth -> fingerprint-auth-ac
     7  -rw-r--r--. 1 root root  702  9月  5 02:57 fingerprint-auth-ac
     8  -rw-r--r--. 1 root root  796 10月  1  2020 login
     9  -rw-r--r--. 1 root root  154  4月  1  2020 other
    10  -rw-r--r--. 1 root root  188  4月  1  2020 passwd
    11  lrwxrwxrwx. 1 root root   16  9月  5 02:57 password-auth -> password-auth-ac
    12  -rw-r--r--. 1 root root 1033  9月  5 02:57 password-auth-ac
    13  -rw-r--r--. 1 root root  155  4月  1  2020 polkit-1
    14  lrwxrwxrwx. 1 root root   12  9月  5 02:57 postlogin -> postlogin-ac
    15  -rw-r--r--. 1 root root  330  9月  5 02:57 postlogin-ac
    16  -rw-r--r--. 1 root root  681 10月  1  2020 remote
    17  -rw-r--r--. 1 root root  143 10月  1  2020 runuser
    18  -rw-r--r--. 1 root root  138 10月  1  2020 runuser-l
    19  lrwxrwxrwx. 1 root root   17  9月  5 02:57 smartcard-auth -> smartcard-auth-ac
    20  -rw-r--r--. 1 root root  752  9月  5 02:57 smartcard-auth-ac
    21  lrwxrwxrwx. 1 root root   25  9月  5 02:51 smtp -> /etc/alternatives/mta-pam
    22  -rw-r--r--. 1 root root   76  4月  1  2020 smtp.postfix
    23  -rw-r--r--. 1 root root  904  8月  9  2019 sshd
    24  -rw-r--r--. 1 root root  540 10月  1  2020 su
    25  -rw-r--r--. 1 root root  137 10月  1  2020 su-l
    26  -rw-r--r--. 1 root root  200 10月  1  2020 sudo
    27  -rw-r--r--. 1 root root  178 10月  1  2020 sudo-i
    28  lrwxrwxrwx. 1 root root   14  9月  5 02:57 system-auth -> system-auth-ac
    29  -rw-r--r--. 1 root root 1031  9月  5 02:57 system-auth-ac
    30  -rw-r--r--. 1 root root  129 10月  2  2020 systemd-user
    31  -rw-r--r--. 1 root root   84 10月 31  2018 vlock
    32  -rw-r--r--. 1 root root  278 10月  2  2020 vmtoolsd

・minimumインストール後にgnome desktopをグループインストールした場合は、

[centos7.9_2]# cd /etc/pam.d;ls -l|cat -n
     1  合計 132
     2  -rw-r--r--. 1 root root  192 10月  1  2020 chfn
     3  -rw-r--r--. 1 root root  192 10月  1  2020 chsh
     4  -rw-r--r--. 1 root root  232  4月  1  2020 config-util
     5  -rw-r--r--. 1 root root  287  8月  9  2019 crond
     6  lrwxrwxrwx. 1 root root   19  9月  4 21:08 fingerprint-auth -> fingerprint-auth-ac
     7  -rw-r--r--. 1 root root  702  9月  4 17:25 fingerprint-auth-ac
     8  -rw-r--r--. 1 root root  545 11月 19  2020 gdm-autologin
     9  -rw-r--r--. 1 root root  561 11月 19  2020 gdm-fingerprint
    10  -rw-r--r--. 1 root root  307 11月 19  2020 gdm-launch-environment
    11  -rw-r--r--. 1 root root  787 11月 19  2020 gdm-password
    12  -rw-r--r--. 1 root root  800 11月 19  2020 gdm-pin
    13  -rw-r--r--. 1 root root  553 11月 19  2020 gdm-smartcard
    14  -rw-r--r--. 1 root root   97 10月  2  2020 liveinst
    15  -rw-r--r--. 1 root root  796 10月  1  2020 login
    16  -rw-r--r--. 1 root root  154  4月  1  2020 other
    17  -rw-r--r--. 1 root root  188  4月  1  2020 passwd
    18  lrwxrwxrwx. 1 root root   16  9月  4 21:08 password-auth -> password-auth-ac
    19  -rw-r--r--. 1 root root 1033  9月  4 17:25 password-auth-ac
    20  -rw-r--r--. 1 root root  510  8月  7  2020 pluto
    21  -rw-r--r--. 1 root root  155  4月  1  2020 polkit-1
    22  lrwxrwxrwx. 1 root root   12  9月  4 21:08 postlogin -> postlogin-ac
    23  -rw-r--r--. 1 root root  330  9月  4 21:08 postlogin-ac
    24  -rw-r--r--. 1 root root  681 10月  1  2020 remote
    25  -rw-r--r--. 1 root root  143 10月  1  2020 runuser
    26  -rw-r--r--. 1 root root  138 10月  1  2020 runuser-l
    27  lrwxrwxrwx. 1 root root   17  9月  4 21:08 smartcard-auth -> smartcard-auth-ac
    28  -rw-r--r--. 1 root root  752  9月  4 17:25 smartcard-auth-ac
    29  lrwxrwxrwx. 1 root root   25  9月  4 21:05 smtp -> /etc/alternatives/mta-pam
    30  -rw-r--r--. 1 root root   76  4月  1  2020 smtp.postfix
    31  -rw-r--r--. 1 root root  904  8月  9  2019 sshd
    32  -rw-r--r--. 1 root root  540 10月  1  2020 su
    33  -rw-r--r--. 1 root root  137 10月  1  2020 su-l
    34  -rw-r--r--. 1 root root  200 10月  1  2020 sudo
    35  -rw-r--r--. 1 root root  178 10月  1  2020 sudo-i
    36  lrwxrwxrwx. 1 root root   14  9月  4 21:08 system-auth -> system-auth-ac
    37  -rw-r--r--. 1 root root 1031  9月  4 17:25 system-auth-ac
    38  -rw-r--r--. 1 root root  129  2月  3  2021 systemd-user
    39  -rw-r--r--. 1 root root   84 10月 31  2018 vlock
    40  -rw-r--r--. 1 root root  278 10月  2  2020 vmtoolsd

→gnome desktopがインストールされている場合、minimumインストールした場合より上記の赤字のファイルが余計に作成される

上記の青字がpassword-authとsystem-authだがいずれもシンボリックリンクだ。

 

 

 

 

 

 

 

 

 

環境:CentOS7.4にマージされているsendmail-8.14.7-6.el7.x86_64

 

■mailertable

 

 

■accessDBでリレーのアクセスコントロール

タグの種類はFrom、To、Connectの三種類。Fromタグをつけてもenvelop fromでリレーの許可設定はできなかった。

ちなみにToタグは利用可

Connectタグも利用可。ただしConnectタグでIPアドレス指定では設定できるが、FQDN設定では、hostsで名前解決できるFQDNは許可設定できたが、DNS正引きでしか名前解決できないFQDNは許可設定できなかった。(要再調査)

 

■ドメイン

OSにホスト名が設定されていないとsendmail自体の起動ができない(ようだ)

①OSのhostnameにhoge.fugaのようなFQDN表記で設定してる場合

②sendmail.mcのDOMAIN(generic)で設定してる場合

③sendmail.mcのdefine(confDOMAIN_NAME)で設定してる場合

④sendmail.mcのFEATURE(masquerade_envelope)で設定してる場合

⑤local-host-namesで設定してる場合

下記のドメインはどうなるか?

a.HELOやEHLOコマンドの引数に付与される自ホストのドメイン名

b.envelope fromのメールアドレスに付与指される送信元メールアドレスのドメイン名

c.自ドメイン宛のメールメッセージと認識して受信する際に評価されるドメイン名

 c-1.

 

 

 

■masquerade

 

 

 

 

■virtusertable