Make that it works in 90% of the cases. 3:30.
This commit is contained in:
4
harden
4
harden
@@ -114,7 +114,7 @@ services=()
|
|||||||
|
|
||||||
# The hardenSSH function will use sed to modify the sshd_config file to have the following settings:
|
# The hardenSSH function will use sed to modify the sshd_config file to have the following settings:
|
||||||
# - Allow ssh access to users in the sudo group only
|
# - Allow ssh access to users in the sudo group only
|
||||||
# - Change the port to 22121 if it is available
|
# - Change the port to 22100 if it is available
|
||||||
# - Configure idle timeout to 5 minutes
|
# - Configure idle timeout to 5 minutes
|
||||||
# - Limit the number of authentication attempts to 3
|
# - Limit the number of authentication attempts to 3
|
||||||
# - Disable root login
|
# - Disable root login
|
||||||
@@ -134,7 +134,7 @@ function hardenSSH {
|
|||||||
if [[ -e /etc/ssh/sshd_config ]] && [[ -r /etc/ssh/sshd_config ]]; then
|
if [[ -e /etc/ssh/sshd_config ]] && [[ -r /etc/ssh/sshd_config ]]; then
|
||||||
sed -i \
|
sed -i \
|
||||||
-e 's/^#AllowGroups.*/AllowGroups sudo/' \
|
-e 's/^#AllowGroups.*/AllowGroups sudo/' \
|
||||||
-e 's/^#Port.*/Port 22121/' \
|
-e 's/^#Port.*/Port 22100/' \
|
||||||
-e 's/^#ClientAliveInterval.*/ClientAliveInterval 300/' \
|
-e 's/^#ClientAliveInterval.*/ClientAliveInterval 300/' \
|
||||||
-e 's/^#ClientAliveCountMax.*/ClientAliveCountMax 3/' \
|
-e 's/^#ClientAliveCountMax.*/ClientAliveCountMax 3/' \
|
||||||
-e 's/^#PermitRootLogin.*/PermitRootLogin no/' \
|
-e 's/^#PermitRootLogin.*/PermitRootLogin no/' \
|
||||||
|
|||||||
@@ -1219,6 +1219,8 @@ def create_node(provider, name=None, location=None, size=None, image=None, confi
|
|||||||
print("\nIP: %s" % (node.public_ips[0]))
|
print("\nIP: %s" % (node.public_ips[0]))
|
||||||
print("\nssh command: ssh -i %s secdep@%s\n" % (SECDEP_SSH_PRIVATE_KEY, node.public_ips[0]))
|
print("\nssh command: ssh -i %s secdep@%s\n" % (SECDEP_SSH_PRIVATE_KEY, node.public_ips[0]))
|
||||||
print("If you ever change the port adjust the command accordingly")
|
print("If you ever change the port adjust the command accordingly")
|
||||||
|
print("If you used the --deploy flag we changed the port to 22100 so the command is:")
|
||||||
|
print("\nssh -p 22100 -i %s secdep@%s\n" % (SECDEP_SSH_PRIVATE_KEY, node.public_ips[0]))
|
||||||
return node
|
return node
|
||||||
|
|
||||||
def list_all_nodes(provider, filterIn=None, awsRegion=None):
|
def list_all_nodes(provider, filterIn=None, awsRegion=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user