Skip to content
This repository was archived by the owner on Mar 4, 2019. It is now read-only.

Commit 7802d26

Browse files
committed
Tighten remote login through ssh.
1 parent 6e72174 commit 7802d26

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

install/scripts/system-config.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,25 @@ update-locale
9494
### enable apache2 as a webserver
9595
dev_scripts="$drupal_dir/profiles/btr_client/dev"
9696
$dev_scripts/webserver.sh apache2
97+
98+
### customize the configuration of sshd
99+
sed -i /etc/ssh/sshd_config \
100+
-e 's/^Port/#Port/' \
101+
-e 's/^PasswordAuthentication/#PasswordAuthentication/' \
102+
-e 's/^X11Forwarding/#X11Forwarding/'
103+
104+
sed -i /etc/ssh/sshd_config \
105+
-e '/^### custom config/,$ d'
106+
107+
sshd_port=${sshd_port:-2201}
108+
cat <<EOF >> /etc/ssh/sshd_config
109+
### custom config
110+
Port $sshd_port
111+
PasswordAuthentication no
112+
X11Forwarding no
113+
EOF
114+
115+
### generate public/private keys for ssh
116+
mkdir ~/.ssh
117+
chmod 700 ~/.ssh
118+
ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''

install/settings.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@ oauth2_client_secret='0123456789'
2929

3030
### Install also extra things that are useful for development.
3131
development='true'
32+
33+
### Login through ssh.
34+
### Only login through private keys is allowed.
35+
### See also this:
36+
### http://dashohoxha.blogspot.com/2012/08/how-to-secure-ubuntu-server.html
37+
sshd_port=2201

0 commit comments

Comments
 (0)