File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 1
1
FROM debian:stretch
2
2
3
- RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install openssh-server
3
+ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install rsyslog openssh-server iptables vim
4
4
ADD run.sh /run.sh
5
5
RUN chmod +x /*.sh
6
6
RUN mkdir -p /var/run/sshd \
7
+ && sed -i "s/UsePrivilegeSeparation.*/UsePrivilegeSeparation no/g" /etc/ssh/sshd_config \
7
8
&& sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
9
+ && sed -i 's/#SyslogFacility AUTH/SyslogFacility AUTH/' /etc/ssh/sshd_config \
10
+ && sed -i 's/#LogLevel INFO/LogLevel INFO/' /etc/ssh/sshd_config \
8
11
&& touch /root/.Xauthority \
9
12
&& true
10
13
RUN echo "root:root" | chpasswd
Original file line number Diff line number Diff line change 1
1
run :
2
2
docker build -t debian-ssh .
3
- docker run -d -p 2222:22 debian-ssh
3
+ docker run --cap-add=NET_ADMIN - d -p 2222:22 debian-ssh
Original file line number Diff line number Diff line change 1
1
# Init :
2
2
3
- ` git clone git@ github.com: snroki/debian-ssh.git `
3
+ ` git clone https:// github.com/ snroki/debian-ssh.git `
4
4
5
5
` cd debian-ssh && make run `
6
6
17
17
- Ajouter un nouvel utilisateur :
18
18
` adduser caca `
19
19
20
- - Mettre à jour le mot de passe root :
20
+ - Mettre à jour le mot de passe root (on ne va pas le faire vu qu'on utilise docker) :
21
21
` passwd `
22
22
23
23
- Optionnel : Mettre en place les mises à jours de sécurité automatiques :
24
24
https://www.cyberciti.biz/faq/how-to-keep-debian-linux-patched-with-latest-security-updates-automatically/
25
25
26
26
## Openssh
27
27
28
- Dans le fichier suivant : ` vim /etc/ssh/sshd_config `
28
+ Dans le fichier suivant : ` vim /etc/ssh/sshd_config ` (on ne va pas le faire vu qu'on utilise docker)
29
29
30
30
- Désactiver le login en tant que root :
31
31
modifier la ligne ` PermitRootLogin yes ` en ` PermitRootLogin no `
@@ -59,6 +59,8 @@ modifier la ligne `#Port 22` en `Port *whatever*`
59
59
60
60
## Fail2ban
61
61
62
+ - Si docker : penser à démarrer le service rsyslog
63
+
62
64
- Installation du package : ` apt install fail2ban `
63
65
64
66
- Editer la configuration : ` vim /etc/fail2ban/jail.conf ` (vous pouvez changer la conf pour la connexion ssh)
You can’t perform that action at this time.
0 commit comments