どのように構成されているか

どのように構成されているか

ssh信頼できるバイナリを実行するために空のパスワードで適切に安全なアカウントを作成するにはどうすればよいですか? SSH「偽ユーザー」の背後にある「デモアプリケーション」を制限しながら、任意のユーザーのための一種の「ダミーSSHキオスク」を作成したいと思います。

「セキュリティ」とは、「ランダム訪問者のためにデモアプリケーションを実行するサーバーのセキュリティ」を意味します。デフォルトでは、https Webサイトを提供するのと同様に、SSHアカウントの背後にあるサービスとしてアプリケーションを提供します。

(この質問の目的に応じて、私たちは信頼していると仮定しています。/bin/catまたは/usr/bin/catサーバーシステムに従ってあなたのシステムを確認してください。which echo

働いている間https://goo.gl/TjhrWd、パスワードを空白に設定中に問題が発生しました。 PAMはこれを拒否します。

どのように構成されているか

これは私が使用する設定で、ユーザーのパスワードを設定するときに機能しますcathttps://goo.gl/TjhrWd:

# below configured on Ubuntu Server 14.04 LTS
addgroup catonly
CHROOT=/var/chroot/cat
# now let's make pseudo-shell binary, executing your ForceCommand (check source)
# you can use bash as default shell instead, I prefer sth less bloated.
cd /tmp
wget 'https://gist.githubusercontent.com/gwpl/abcbc74c2bf377945a49097237edfb9b/raw/1993e8acc4bd66329959b1a658fcce4296d2a80c/only_exec_command.c'
gcc only_exec_command.c -static -o only_exec_command
mkdir -p "$CHROOT"/{bin,lib,lib64,dev/pts,home/cat}
chown root:root /var/chroot "$CHROOT"
# dependig on distro it might be /usr/bin/cat -> check with `which cat`
useradd -d /home/cat -s /bin/only_exec_command -M -N -g catonly cat
passwd -d cat
# Let's make chroot
cp /tmp/only_exec_command "$CHROOT"/bin/
cp /bin/cat "$CHROOT"/bin/
mknod -m 666 "$CHROOT"/dev/null c 1 3
ldd /bin/cat # tells us which libraries to copy
cp /lib/x86_64-linux-gnu/libc.so.6 "$CHROOT"/lib
cp /lib64/ld-linux-x86-64.so.2 "$CHROOT"/lib64
chown cat:catonly "$CHROOT"/home/cat
chown root:root /var/chroot/cat /var/chroot /var
$ $EDITOR /etc/ssh/sshd_config # add:
Match user cat
       ChrootDirectory /var/chroot/cat
       X11Forwarding no
       AllowTcpForwarding no
       # dependig on distro it might be /usr/bin/cat -> check with `which cat`
       ForceCommand /bin/cat
       PasswordAuthentication yes
       PermitEmptyPasswords yes

症状はPAMを示します。

ただし、試してみるとsshパスワードが要求され、拒否された場合は空の結果が得られます。

ssh [email protected]
[email protected]'s password:
Permission denied, please try again.

デバッグモードで実行されるサーバー側では、ログに興味深い内容はありません。ログイン中に空のパスワードを入力した後、サーバー側の部分を引用します。

/usr/sbin/sshd -ddd -p 1234
(...)
debug1: userauth-request for user echo service ssh-connection method password [preauth]
debug1: attempt 2 failures 1 [preauth]
debug2: input_userauth_request: try method password [preauth]
debug3: mm_auth_password entering [preauth]
debug3: mm_request_send entering: type 12 [preauth]
debug3: mm_auth_password: waiting for MONITOR_ANS_AUTHPASSWORD [preauth]
debug3: mm_request_receive_expect entering: type 13 [preauth]
debug3: mm_request_receive entering [preauth]
debug3: mm_request_receive entering
debug3: monitor_read: checking request 12
debug3: PAM: sshpam_passwd_conv called with 1 messages
debug1: PAM: password authentication failed for echo: Authentication failure
debug3: mm_answer_authpassword: sending result 0
debug3: mm_request_send entering: type 13
Failed password for echo from 192.168.1.1 port 43816 ssh2
debug3: mm_auth_password: user not authenticated [preauth]
debug3: userauth_finish: failure partial=0 next methods="publickey,password" [preauth]

ベストアンサー1

PAMまた、空のパスワードを許可することを知らせる必要があります。いくつかあります古いチュートリアルこれについて説明します。しかし、簡単に言うと:

sudo sed -i 's/nullok_secure/nullok/' /etc/pam.d/common-auth

仕事をしなければなりません。

おすすめ記事