SSH接続とパブリックSFTPにopensshを使用する

SSH接続とパブリックSFTPにopensshを使用する

一部のユーザーが通常のSSHを介して接続する必要があるシステムがあります。私はそれらを「特権ユーザー」と命名しました。さらに、システムは「匿名」ユーザーにSFTPサーバーを提供する必要があります(パスワードや認証方法はありません)。

現在私が持っているものは次のとおりですsshd_config

########################################################################
# Common conofigurations for both Privileged Users and Anonymous
########################################################################
PermitRootLogin no
StrictModes yes
PrintMotd yes
AcceptEnv LANG LC_*
banner /etc/banner
AllowUsers fauve libidiloup anonymous

########################################################################
# Desired connfigurations for Privileged Users (who are not Anonymous)
########################################################################

Match User fauve, libidiloup
    Protocol 2
    IgnoreRhosts yes
    RhostsRSAAuthentication no
    HostbasedAuthentication no
    Port 17129
    PasswordAuthentication no
    PermitEmptyPasswords no
    UsePAM yes
    UsePrivilegeSeparation yes
    ChallengeResponseAuthentication no
    PrintLastLog no
    Subsystem sftp internal-sftp
    KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256
    Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
    X11Forwarding yes


########################################################################
# Configuration for Anonymous
########################################################################

Match User anonymous
    PasswordAuthentication yes
    PermitEmptyPasswords yes
    ChrootDirectory /mnt/bibliotheque
    AllowTcpForwarding no
    ForceCommand internal-sftp
    X11Forwarding no

安全が気になるだけです。 Anonymousのブロック構成で十分ですか?

特にProtocol、、、、、RhostsRSAAuthenticationオプションHostbasedAuthenticationの場合UsePrivilegeSeparationUsePAM

この構成は、匿名ゲストの機能を特権ユーザーと完全に分離しますか?

ベストアンサー1

まあ、私はいくつかのテストを実行し、次のフィードバックを受けました。

まず、これが私が得る最終的な機能ですsshd_config

########################################################################
# Common conofigurations for both Privileged Users and Anonymous
########################################################################
Protocol 2
PermitRootLogin no
StrictModes yes
PrintMotd yes
AcceptEnv LANG LC_*
banner /etc/banner
AllowUsers fauve anonymous
#AllowGroups sshprivileged

# The following directives could NOT be set on a Match block
UsePAM yes
ChallengeResponseAuthentication no
UsePrivilegeSeparation yes
Ciphers [email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr
PrintLastLog no
Subsystem sftp internal-sftp
KexAlgorithms [email protected],diffie-hellman-group-exchange-sha256

#########################################################################
## Desired connfigurations for Privileged Users (who are not Anonymous)
#########################################################################

Match User fauve
    IgnoreRhosts yes
    RhostsRSAAuthentication no
    HostbasedAuthentication no
    PasswordAuthentication no
    PermitEmptyPasswords no
    X11Forwarding yes

#########################################################################
## Configuration for Anonymous
#########################################################################

Match User anonymous
    PasswordAuthentication yes
    PermitEmptyPasswords yes
    ChrootDirectory /mnt/bibliotheque
    AllowTcpForwarding no
    ForceCommand internal-sftp
    X11Forwarding no

主に最初の作業では不可能だった2つのことがありましたsshd_config

  1. 「次のディレクティブは一致ブロックに設定できません」という説明以下のブロックには、一致ブロック内にはないディレクティブが含まれています。
  2. AllowGroups彼らはとの間に衝突がありますAllowUsers。最初のディレクティブは2番目のディレクティブよりも優先されます。

おすすめ記事