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 f49a46b5 authored by Arthur BOUDREAULT's avatar Arthur BOUDREAULT
Browse files

fix: (YNH) sudo without password for admins

parent c9fd0a21
No related branches found
No related tags found
No related merge requests found
Pipeline #12099 passed with warnings
......@@ -61,6 +61,16 @@ 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/)). Vous pouvez aussi indiquer cette configuration dans votre fichier d'inventaire sinon Ansible ne pourra plus se connecter à votre serveur. (plus d'infos [ici](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-handle-different-machines-needing-different-user-accounts-or-ports-to-log-in-with)).
### Utilisation de sudo sans mot de passe
A partir de Yunohost 11.1, un nouveau groupe d'administrateurs est créé sur l'instance. Il s'agit d'un groupe Unix qui est intégré à YunoHost et son LDAP. Tous les utilisateurs dans ce groupe auront accès à la console d'administration en ligne YunoHost mais pourront également se connecter en SSH et utiliser la commande sudo (pour prendre temporairement les droits root).
Par défaut, l'utilisateur doit taper son mot de passe pour utiliser la commande sudo mais il est possible de désactiver cette vérification depuis l'interface web (`outils` > `Paramètres de YunoHost` > `Permettre aux administrateurs d'utiliser 'sudo' sans retaper leur mot de passe`) ou en modifiant la variable `ynh_sudo_passwordless` à `true` dans votre fichier de variables Ansible. Plus d'informations disponibles [ici](https://forum.yunohost.org/t/yunohost-11-1-release-sortie-de-yunohost-11-1/23378#sudo-sans-mot-de-passe-16).
```yml
ynh_sudo_passwordless: false
```
## Dépendances
Aucune.
......
......@@ -61,6 +61,16 @@ 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/)). You can indicate that configuration in your inventory file otherwise Ansible won't be able to connect to your server. (More info [here](https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-handle-different-machines-needing-different-user-accounts-or-ports-to-log-in-with)).
### Using sudo without password
Starting with Yunohost 11.1, a new administrator group is created on the instance. This is a Unix group that is integrated with YunoHost and its LDAP. All users in this group will have access to the YunoHost online administration console but will also be able to connect via SSH and use the sudo command (to temporarily take root rights).
By default, the user must type their password to use the sudo command but it is possible to disable this check from the web interface (`tools` > `YunoHost settings` > `Allow admins to use ‘sudo’ without re-typing their passwords`) or by changing the `ynh_sudo_passwordless` variable to `true` in your Ansible variables file. More information available [here](https://forum.yunohost.org/t/yunohost-11-1-release-sortie-de-yunohost-11-1/23378#passwordless-sudo-4).
``yml
ynh_sudo_passwordless: false
```
## Dependencies
None.
......
......@@ -39,4 +39,5 @@ ynh_autoupdate:
# system: True
# dest_script: "/usr/local/bin/"
# ynh_ssh_port: "22"
ynh_ssh_port: "22"
ynh_sudo_passwordless: false
......@@ -33,9 +33,8 @@
- yunohost
- update
- name: Configure Yunohost SSH port
ansible.builtin.include_tasks: sshd_configuration.yml
when: ynh_ssh_port
- name: Configure Yunohost SSH
ansible.builtin.include_tasks: ssh_configuration.yml
tags:
- yunohost
- ssh
......@@ -24,3 +24,10 @@
tags:
- yunohost
- ssh
- name: Enable sudo without password for admins
ansible.builtin.command:
"yunohost settings set security.password.passwordless_sudo -v {{ ynh_sudo_passwordless }}"
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