mirror of
https://github.com/YunoHost/doc.git
synced 2024-09-03 20:06:26 +02:00
Merge pull request #675 from yunohost-bot/anonymous-2018-02-27_09-33-16
[Anonymous contrib] command to switch over to the new port by restarting SSH.
This commit is contained in:
commit
e93cec2537
2 changed files with 35 additions and 9 deletions
24
security.md
24
security.md
|
@ -41,7 +41,9 @@ PasswordAuthentication no
|
|||
```
|
||||
|
||||
Save and restart SSH daemon.
|
||||
|
||||
```bash
|
||||
systemctl restart ssh
|
||||
```
|
||||
---
|
||||
|
||||
### Modify SSH port
|
||||
|
@ -52,19 +54,27 @@ To prevent SSH connection attempts by robots that scan the Internet for any atte
|
|||
|
||||
```bash
|
||||
nano /etc/ssh/sshd_config
|
||||
|
||||
# Search line "Port" and remplace port number (by default 22) by another not used number
|
||||
```
|
||||
**Search line "Port" and replace** port number (by default 22) by another not used number
|
||||
```bash
|
||||
# What ports, IPs and protocols we listen for
|
||||
Port 22 # to replace by 9777 for example
|
||||
```
|
||||
|
||||
Save and restart SSH daemon.
|
||||
**Open the port** in firewall (you can use -6 option to limit forbid ipv4 connexion)
|
||||
```bash
|
||||
yunohost firewall allow TCP 9777
|
||||
```
|
||||
|
||||
Save and restart SSH daemon. Switch over to the new port by restarting SSH.
|
||||
```bash
|
||||
systemctl restart ssh
|
||||
```
|
||||
Then restart the iptables firewall and close the old port in iptables.
|
||||
|
||||
```bash
|
||||
yunohost firewall reload
|
||||
yunohost firewall disallow <your_old_ssh_port_number> # port by default 22
|
||||
yunohost firewall disallow --ipv6 TCP <your_new_ssh_port_number> # for ipv6
|
||||
```
|
||||
|
||||
**For the next SSH connections ** you need to add the `-p` option followed by the SSH port number.
|
||||
|
@ -106,7 +116,9 @@ AllowUsers user_name
|
|||
Only users listed in the AllowUsers directive will then be allowed to connect via SSH, which excludes the admin user.
|
||||
|
||||
Save and restart SSH daemon.
|
||||
|
||||
```bash
|
||||
systemctl restart ssh
|
||||
```
|
||||
---
|
||||
|
||||
### Disable YunoHost API
|
||||
|
|
|
@ -50,6 +50,9 @@ PasswordAuthentication no
|
|||
```
|
||||
|
||||
Sauvegardez et relancez le démon SSH.
|
||||
```bash
|
||||
systemctl restart ssh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
@ -61,19 +64,27 @@ Pour éviter des tentatives de connexion SSH par des robots qui scannent tout In
|
|||
|
||||
```bash
|
||||
nano /etc/ssh/sshd_config
|
||||
|
||||
# Recherchez la ligne « Port » et remplacez le numéro du port (par défaut 22) par un autre numéro non utilisé
|
||||
```
|
||||
**Recherchez la ligne « Port »** et remplacez le numéro du port (par défaut 22) par un autre numéro non utilisé
|
||||
```bash
|
||||
Port 22 # à remplacer par exemple par 9777
|
||||
```
|
||||
|
||||
**Ouvrez le port** choisi dans le parefeu (vous pouvez utiliser l'option -6 pour interdire la connexion via ipv4)
|
||||
+```bash
|
||||
+yunohost firewall allow TCP <votre_numero_de_port_ssh>
|
||||
+```
|
||||
```
|
||||
Sauvegardez et relancez le démon SSH.
|
||||
```bash
|
||||
systemctl restart ssh
|
||||
```
|
||||
|
||||
Ensuite redémarrez le firewall iptables et fermez l’ancien port dans iptables.
|
||||
|
||||
```bash
|
||||
yunohost firewall reload
|
||||
yunohost firewall disallow TCP <votre numéro de port> # port par défaut 22
|
||||
yunohost firewall disallow --ipv6 TCP <votre numéro de port> # pour ipv6
|
||||
```
|
||||
|
||||
**Pour les prochaines connexions SSH** il faudra ajouter l’option -p suivie du numéro de port SSH.
|
||||
|
@ -115,6 +126,9 @@ AllowUsers nom_utilisateur
|
|||
Seuls les utilisateurs mentionnés dans la directive AllowUsers seront alors autorisés à se connecter via SSH, ce qui exclut donc l’utilisateur admin.
|
||||
|
||||
Sauvegardez et relancez le démon SSH.
|
||||
```bash
|
||||
systemctl restart ssh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
|
Loading…
Reference in a new issue