Skip to content

Commit

Permalink
Update ssh config to handle scp users
Browse files Browse the repository at this point in the history
Signed-off-by: Geoff Franks <Geoff.Franks@allstate.com>
  • Loading branch information
Satheesh Uppalapati authored and geofffranks committed Jul 24, 2018
1 parent 42114c6 commit c2dd3a6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions jobs/jumpbox/templates/bin/pre-start
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,17 @@
set -e

# force ssh logins into the docker container unless the user is jumpbox or is coming from a bosh ssh session
if ! grep -e 'ForceCommand' /etc/ssh/sshd_config -q; then
echo "Match User *,!jumpbox,!bosh_*" >> /etc/ssh/sshd_config
if ! grep -e 'ForceCommand /var/vcap/jobs/jumpbox/bin/jumpbox' /etc/ssh/sshd_config -q; then
echo "Match User *,!jumpbox,!bosh_*,!*-scp" >> /etc/ssh/sshd_config
echo " ForceCommand /var/vcap/jobs/jumpbox/bin/jumpbox" >> /etc/ssh/sshd_config
service ssh restart
fi

# force sftp logins for all *-scp users
if ! grep -e 'ForceCommand internal-sftp' /etc/ssh/sshd_config -q; then
echo "Match User *-scp" >> /etc/ssh/sshd_config
echo " X11Forwarding no" >> /etc/ssh/sshd_config
echo " AllowTcpForwarding no" >> /etc/ssh/sshd_config
echo " ForceCommand internal-sftp" >> /etc/ssh/sshd_config
service ssh restart
fi

0 comments on commit c2dd3a6

Please sign in to comment.