SSHルールに従わない

SSHルールに従わない

何らかの理由でSSHはもはや制限されません。どのユーザーでもログインして認証方法を選択できます。ホワイトリストにはありませんが、まだすべてのユーザーとしてログインし、認証方法を使用できるテストユーザーを作成しました。

この規則は以前に施行されましたが、現在は中止されました。 AlmaLinux 8システムで発生します。

利用可能な項目は次のとおりです。

PermitRootLogin no
PubkeyAuthentication no
PasswordAuthentication no

Match User nagios
    PasswordAuthentication no
    PubkeyAuthentication yes

Match User meta
    PasswordAuthentication yes
    PubkeyAuthentication yes

Match User yubi Address 10.10.0.201/32
    PasswordAuthentication no
    PubkeyAuthentication yes
    AllowUsers yubi

Match Address 10.10.0.0/24
        AllowUsers meta

Match Address 22.22.22.22
        AllowUsers nagios

この問題はAlmaLinux 9でも発生します。ユーザーの上書きが機能しなくなったようです。私のAlmaLinux 9ファイルの全項目は次のとおりです。/etc/ssh/sshd_config.d/sshd_custom_rules.conf

## Custom SSH rules
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication no

Match Address 192.168.68.0/22
    AllowUsers yubi repository-admin

Match User yubi
    PasswordAuthentication yes
    PubkeyAuthentication no

Match User repository-admin
    PasswordAuthentication no
    PubkeyAuthentication yes

主なsshd_config設定はデフォルトです。コメントアウトされていない行は次のとおりです。

Include /etc/ssh/sshd_config.d/*.conf
Port 22
AuthorizedKeysFile      .ssh/authorized_keys
Subsystem       sftp    /usr/libexec/openssh/sftp-server

ファイルの内容です。/etc/ssh/sshd_config.d/50-redhat.conf

# This system is following system-wide crypto policy. The changes to
# crypto properties (Ciphers, MACs, ...) will not have any effect in
# this or following included files. To override some configuration option,
# write it before this block or include it before this file.
# Please, see manual pages for update-crypto-policies(8) and sshd_config(5).
Include /etc/crypto-policies/back-ends/opensshserver.config

SyslogFacility AUTHPRIV

ChallengeResponseAuthentication yes

GSSAPIAuthentication yes
GSSAPICleanupCredentials no

UsePAM yes

X11Forwarding yes

# It is recommended to use pam_motd in /etc/pam.d/sshd instead of PrintMotd,
# as it is more configurable and versatile than the built-in version.
PrintMotd no

プロファイルからユーザーを削除すると、そのユーザーはログインできません。有効にすると、ユーザーはPubkeyAuthentication認証のみを許可しても、すべての認証方法を使用してアクセスできますPasswordAuthentication

ベストアンサー1

パスワード確認を無効にするには、にChallengeResponseAuthentication設定する必要がありますno

おすすめ記事