#!/usr/bin/env bash # Basic Server Security Hardening # Min. Requirement : GNU/Linux Ubuntu 14.04 # Last Build : 01/07/2019 # Author : ESLabs.ID (eslabs.id@gmail.com) # Since Version : 1.0.0 # Include helper functions. if [ "$(type -t run)" != "function" ]; then BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd ) # shellchechk source=scripts/helper.sh # shellcheck disable=SC1090 . "${BASEDIR}/helper.sh" fi # Make sure only root can run this installer script. requires_root # Securing SSH server. function securing_ssh() { #SSH_PASSWORDLESS=${SSH_PASSWORDLESS:-true} if "${SSH_PASSWORDLESS}"; then echo " Before starting, let's create a pair of keys that some hosts ask for during installation of the server. On your local machine, open new terminal and create an SSH key pair using the ssh-keygen tool, use the following command: ssh-keygen -t rsa -b ${HASH_LENGTH} After this step, you will have the following files: id_rsa and id_rsa.pub (private and public keys). Never share your private key. " read -rt 60 -p "Press [Enter] to continue..." > /home/lemper/.ssh/authorized_keys <