github.com/hashicorp/packer@v1.14.3/examples/_common/sshd.sh (about) 1 #!/bin/sh -eux 2 3 SSHD_CONFIG="/etc/ssh/sshd_config" 4 5 # ensure that there is a trailing newline before attempting to concatenate 6 sed -i -e '$a\' "$SSHD_CONFIG" 7 8 USEDNS="UseDNS no" 9 if grep -q -E "^[[:space:]]*UseDNS" "$SSHD_CONFIG"; then 10 sed -i "s/^\s*UseDNS.*/${USEDNS}/" "$SSHD_CONFIG" 11 else 12 echo "$USEDNS" >>"$SSHD_CONFIG" 13 fi 14 15 GSSAPI="GSSAPIAuthentication no" 16 if grep -q -E "^[[:space:]]*GSSAPIAuthentication" "$SSHD_CONFIG"; then 17 sed -i "s/^\s*GSSAPIAuthentication.*/${GSSAPI}/" "$SSHD_CONFIG" 18 else 19 echo "$GSSAPI" >>"$SSHD_CONFIG" 20 fi