diff --git a/roles/ynh_config/README-FR.md b/roles/ynh_config/README-FR.md index e23b0724c3de0d016eb9942df427ccf81d878677..defa612fe8dafb01c7437e510f741e576c40fc09 100644 --- a/roles/ynh_config/README-FR.md +++ b/roles/ynh_config/README-FR.md @@ -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. diff --git a/roles/ynh_config/README.md b/roles/ynh_config/README.md index e072a1c5f38436a893a9efc20335901f62fce53d..6158190699c96427c59d6997e27ef383f00cdf1a 100644 --- a/roles/ynh_config/README.md +++ b/roles/ynh_config/README.md @@ -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. diff --git a/roles/ynh_config/defaults/main.yml b/roles/ynh_config/defaults/main.yml index 1359ca39a782a098cd3687f0a132ccd0a1ac39c4..b4a053fd65382488f0501d1cf9936a2ec50a0f32 100644 --- a/roles/ynh_config/defaults/main.yml +++ b/roles/ynh_config/defaults/main.yml @@ -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 diff --git a/roles/ynh_config/tasks/main.yml b/roles/ynh_config/tasks/main.yml index 7f5af9343b1cd265793f4b315f4a17db934668ab..4fc696b9a2132c75a6fd462101d2ee55505678a7 100644 --- a/roles/ynh_config/tasks/main.yml +++ b/roles/ynh_config/tasks/main.yml @@ -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 diff --git a/roles/ynh_config/tasks/sshd_configuration.yml b/roles/ynh_config/tasks/ssh_configuration.yml similarity index 88% rename from roles/ynh_config/tasks/sshd_configuration.yml rename to roles/ynh_config/tasks/ssh_configuration.yml index 3b7970d3682c07ffd94acfc0e2094452bcb48704..a98b797a77b8f0e8d1f586ceecc920acc6a79194 100644 --- a/roles/ynh_config/tasks/sshd_configuration.yml +++ b/roles/ynh_config/tasks/ssh_configuration.yml @@ -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