Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit 89da094c authored by Arthur BOUDREAULT's avatar Arthur BOUDREAULT
Browse files

feat(ynh_config): add the posibility to change SSH Port

parent b5a8a7a7
No related branches found
No related tags found
1 merge request!43Resolve "feat(ynh_config): add the posibility to change SSH Port"
......@@ -50,6 +50,16 @@ Si des mises à jour sont disponibles, elles sont faites automatiquement. En cas
Pour en savoir plus sur le fonctionnement des mises à jour dans Yunohost vous pouvez vous rendre [ici](https://yunohost.org/fr/update). Le changelog des versions de Yunohost est aussi disponible [ici](https://forum.yunohost.org/tag/ynh_release).
### Modification du port SSH
Parmi les paramètres proposés dans YunoHost, il est possible de modifier le port SSH. Vous devez juste créer la variable `ynh_ssh_port` et le rôle se chargera d'aller récupérer le port SSH et de le modifier si nécessaire. Il va aussi effectuer les changements appropriés pour fail2ban et le firewall interne de YunoHost.
Si votre instance YunoHost est derrière un firewall applicatif ou propre à votre fournisseur cloud, il faudra également ouvrir le groupe de sécurité approprié.
```yml
ynh_ssh_port: "812"
```
⚠️ Attention, à partir du moment où le port SSH est modifié, la prochaine fois que vous voudrez vous connecter en SSH sur le serveur YunoHost, il faudra renseigner le port SSH utilisé (par exemple `ssh -p 812 username@hostname`). Vous pouvez également externaliser cette configuration vers un fichier de configuration SSH (plus d'infos [ici](https://linuxize.com/post/using-the-ssh-config-file/)).
## Dépendances
Aucune.
......
......@@ -50,6 +50,17 @@ If available, updates are done automatically. In case of problems following an a
To learn more about how updates work in Yunohost you can go [here](https://yunohost.org/fr/update). The changelog of Yunohost versions is also available [here](https://forum.yunohost.org/tag/ynh_release).
### SSH port modification
Among the settings available in YunoHost, it is possible to change the SSH port. You just have to create the `ynh_ssh_port` variable and the role will retrieve the SSH port and modify it if necessary. It will also perform the adequate modifications regarding fail2ban and the internal firewall of YunoHost.
In your YunoHost host is behind a firewall, you may consider creating the appropriate security group.
``yml
ynh_ssh_port: "812"
```
⚠️ Be careful, from the moment the SSH port is modified, the next time you want to connect to the YunoHost server with SSH, you will have to specify the SSH port to be used (for example `ssh -p 812 username@hostname`). You can also externalize this configuration to an SSH configuration file (more info [here](https://linuxize.com/post/using-the-ssh-config-file/)).
## Dependencies
None.
......
......@@ -26,9 +26,27 @@
- yunohost
- smtp
- name: Configures Yunohost autoupdate
- name: Configure Yunohost autoupdate
ansible.builtin.include_tasks: autoupdate.yml
when: ynh_autoupdate.scheduled
tags:
- yunohost
- update
- name: Change SSH port
block:
- name: Get current SSH setting
ansible.builtin.command:
yunohost settings get security.ssh.port
register: _ynh_ssh_current_value
changed_when: False
- name: Set new SSH setting
ansible.builtin.command:
"yunohost settings set security.ssh.port -v {{ ynh_ssh_port }}"
when: _ynh_ssh_current_value != ynh_ssh_port
changed_when: False
when: ynh_ssh_port
tags:
- yunohost
- ssh
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment