diff options
| author | Tim <timothyasir@gluster.com> | 2011-06-09 16:24:34 +0530 |
|---|---|---|
| committer | Tim <timothyasir@gluster.com> | 2011-06-09 16:24:34 +0530 |
| commit | e7fa3154115f72e3eefdb5790acbee1223de65a4 (patch) | |
| tree | c3ba5e3df455f437a49c865d46c4e321636633dc /src/com.gluster.storage.management.server.scripts | |
| parent | 85575ed19b0e76b4067636f007a14ef86adc906f (diff) | |
| parent | 88d3c1664d867df409589911afd42277cff5a1dc (diff) | |
Merge remote branch 'upstream/master'
Diffstat (limited to 'src/com.gluster.storage.management.server.scripts')
| -rwxr-xr-x | src/com.gluster.storage.management.server.scripts/src/disable-ssh-password-auth.sh | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/com.gluster.storage.management.server.scripts/src/disable-ssh-password-auth.sh b/src/com.gluster.storage.management.server.scripts/src/disable-ssh-password-auth.sh new file mode 100755 index 00000000..07ee1a3a --- /dev/null +++ b/src/com.gluster.storage.management.server.scripts/src/disable-ssh-password-auth.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +#----------------------------------------------------------------------------- +# disable-ssh-password-auth.sh +# Script for disabling SSH password authentication. This is used by the +# management gateway after installing the public key, so that the gluster +# node can be accessed (using ssh) only from the management gateway. +#----------------------------------------------------------------------------- + +CONFIG_FILE="/etc/ssh/sshd_config" +TIMESTAMP=`date +%d%m%Y%H%M%S` +BACKUP_FILE="${CONFIG_FILE}_${TIMESTAMP}" +TEMP_FILE="/tmp/new_sshd_config_${TIMESTAMP}" + +# Modify config file to disable password authentication, redirect to a temp file +# TODO: disable only if enabled! +sed "s/^PasswordAuthentication yes$/PasswordAuthentication no/g" ${CONFIG_FILE} > ${TEMP_FILE} + +# Secure the file by changing permissions (600) +chmod 600 ${TEMP_FILE} + +# Take backup of config file +cp ${CONFIG_FILE} ${BACKUP_FILE} + +# Overwrite config file with the modified one +mv ${TEMP_FILE} ${CONFIG_FILE} + +# Re-start ssh daemon +/etc/init.d/sshd restart + |
