Compare commits

...

17 commits

Author SHA1 Message Date
Jérémy Lecour fe1e66f79c
Merge branch 'unstable' into stable
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2745|0|2745|0|:zzz:
gitea/ansible-roles/pipeline/tag This commit looks good
2024-05-15 14:16:44 +02:00
Jérémy Lecour 2e529524f7
Release 24.05
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2745|0|2745|0|:zzz:
gitea/ansible-roles/pipeline/head This commit looks good
2024-05-15 14:16:03 +02:00
Jérémy Lecour f05c8c03c9
evomaintenance: move upstream files into upstream folder 2024-05-15 13:50:32 +02:00
Jérémy Lecour 24f1e72147
evomaintenance: upstream release 24.05 2024-05-15 11:33:44 +02:00
Jérémy Lecour 22f7a6b831
evobackup-client: upstream release 24.05.1 2024-05-14 08:24:57 +02:00
Jérémy Lecour 4128962d05
whitespaces 2024-05-13 10:22:03 +02:00
David Prevot c1dc380e85 Update nodesource repository 2024-05-10 17:50:37 +02:00
Jérémy Lecour 346317081e
evolinux-users: improve SSH configuration 2024-05-07 15:11:09 +02:00
Jérémy Lecour 5be04c36ee
comments 2024-05-07 15:08:42 +02:00
David Prevot e0f81f14d0 Changelog entry for previous commit 2024-05-06 17:02:46 +02:00
David Prevot 63c09e2ae5 apt: use archive.debian.org with Buster 2024-05-06 17:00:50 +02:00
Jérémy Lecour d4343833c9
evobackup-client: fix lib path 2024-05-06 10:33:47 +02:00
Jérémy Lecour cf430f286a
evolinux-base: use long version of grep -r instead of grep -R 2024-05-03 13:24:16 +02:00
Jérémy Lecour 38e498cf9a
apt: add version in mail headers for list-upgradable-held-packages.sh 2024-05-03 10:17:43 +02:00
Jérémy Lecour 5903ff8c81
evolinux-base: improve adding the current user to SSH AllowGroups of AllowUsers 2024-05-02 18:44:30 +02:00
Jérémy Lecour 145b279a12
Merge branch 'unstable' into stable
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2710|0|2710|0|:zzz:
gitea/ansible-roles/pipeline/tag This commit looks good
2024-04-30 17:42:11 +02:00
Jérémy Lecour 2a856d579e
Merge branch 'unstable' into stable
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2712|0|2712|0|:zzz:
gitea/ansible-roles/pipeline/tag This commit looks good
2024-03-01 09:06:08 +01:00
23 changed files with 500 additions and 216 deletions

View file

@ -13,18 +13,32 @@ The **patch** part is incremented if multiple releases happen the same month
### Added
* apt: add list-upgradable-held-packages.sh
### Changed
* evobackup-client: upstream release 24.05
### Fixed
### Removed
### Security
## [24.05] 2024-05-15
### Added
* apt: add list-upgradable-held-packages.sh
### Changed
* evobackup-client: upstream release 24.05.1
* evolinux-base: improve adding the current user to SSH AllowGroups of AllowUsers
* evolinux-users: improve SSH configuration
* evomaintenance: upstream release 24.05
* evomaintenance: move upstream files into upstream folder
### Fixed
* apt: use archive.debian.org with Buster
## [24.04] 2024-04-30
### Added

View file

@ -5,6 +5,8 @@
# but have available updates.
#####
readonly VERSION="24.05"
# set all programs to C language (english)
export LC_ALL=C
@ -48,6 +50,7 @@ Content-Type: text/plain; charset=UTF-8
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Script: ${PROGPATH}
X-Script-Version: ${VERSION}
To: ${EMAIL_CLIENT:-alert5@evolix.fr}
Subject: Mise a jour manuelle disponible

View file

@ -1,3 +1,3 @@
# {{ ansible_managed }}
deb http://mirror.evolix.org/debian buster-backports {{ apt_backports_components | mandatory }}
deb http://archive.debian.org/debian buster-backports {{ apt_backports_components | mandatory }}

View file

@ -1,5 +1,4 @@
# {{ ansible_managed }}
deb http://mirror.evolix.org/debian buster {{ apt_basics_components | mandatory }}
deb http://mirror.evolix.org/debian buster-updates {{ apt_basics_components | mandatory }}
deb http://archive.debian.org/debian buster {{ apt_basics_components | mandatory }}
deb http://security.debian.org/debian-security buster/updates {{ apt_basics_components | mandatory }}

View file

@ -23,6 +23,12 @@ The **patch** part changes is incremented if multiple releases happen the same m
### Security
## [24.05.1] - 2022-05-14
### Fixed
* client: fix shell syntax error
## [24.05] - 2022-05-02
### Added

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# shellcheck disable=SC2034,SC2317
readonly VERSION="24.05"
readonly VERSION="24.05.1"
# set all programs to C language (english)
export LC_ALL=C

View file

@ -105,7 +105,7 @@ test_server() {
pick_server() {
local -i increment=${1:-0}
local -i list_length=${#SERVERS[@]}
local sync_name=${2:""}
local sync_name=${2:-""}
if (( increment >= list_length )); then
# We've reached the end of the list

View file

@ -14,7 +14,7 @@
- name: copy evobackup libs
ansible.builtin.copy:
src: upstream/lib
src: upstream/lib/
dest: "{{ evobackup_client__lib_dir }}/"
force: True
mode: "0644"

View file

@ -37,6 +37,6 @@ Main variables are:
* `evolinux_postfix_purge_exim`: purge Exim packages (default: `True`) ;
* `evolinux_ssh_password_auth_addresses`: list of addresses that can authenticate with a password (default: `[]`)
* `evolinux_ssh_disable_root`: disable SSH access for root (default: `False`)
* `evolinux_ssh_allow_current_user`: don't lock yourself out (default: `False`)
* `evolinux_ssh_allow_current_user`: don't lock yourself out is there is an AllowUsers or AllowGroups directive (default: `False`)
The full list of variables (with default values) can be found in `defaults/main.yml`.

View file

@ -16,34 +16,78 @@
dest: /etc/ssh/sshd_config.d/z-evolinux-defaults.conf
mode: "0644"
- name: "Get current user's group"
ansible.builtin.command:
cmd: logname
changed_when: False
register: logname
check_mode: no
when: evolinux_ssh_allow_current_user | bool
# Should we allow the current user?
- name: Allow the current user
block:
- name: "Get current user's login"
ansible.builtin.command:
cmd: logname
changed_when: False
register: _logname
check_mode: no
- name: verify AllowUsers directive
ansible.builtin.command:
cmd: "grep -ER '^AllowUsers' /etc/ssh"
failed_when: False
changed_when: False
register: grep_allowusers_ssh
check_mode: no
when: evolinux_ssh_allow_current_user | bool
- name: verify AllowUsers directive
ansible.builtin.command:
cmd: "grep --extended-regexp --recursive --files-with-matches '^AllowUsers' /etc/ssh/sshd_config /etc/ssh/sshd_config.d"
failed_when: False
changed_when: False
register: grep_allowusers_ssh
check_mode: no
- name: "Add AllowUsers sshd directive for current user"
ansible.builtin.lineinfile:
dest: /etc/ssh/sshd_config.d/allow_evolinux_user.conf
create: yes
line: "AllowUsers {{ logname.stdout }}"
insertafter: 'Subsystem'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when: evolinux_ssh_allow_current_user and grep_allowusers_ssh.rc != 0
- name: verify AllowGroups directive
ansible.builtin.command:
cmd: "grep --extended-regexp --recursive --files-with-matches '^AllowGroups' /etc/ssh/sshd_config /etc/ssh/sshd_config.d"
failed_when: False
changed_when: False
register: grep_allowgroups_ssh
check_mode: no
# If we have AllowUsers but not AllowGroups, append the user to the list
# (in the first file where we found the directive)
- name: "Append user to existing AllowUsers sshd directive"
ansible.builtin.replace:
dest: "{{ grep_allowusers_ssh.stdout_lines[0] }}"
regexp: '^(AllowUsers ((?!{{ _logname.stdout }}).)*)$'
replace: '\1 {{ _logname.stdout }}'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when:
- grep_allowusers_ssh.rc == 0
- grep_allowgroups_ssh.rc != 0
# If we have AllowGroups but not AllowUsers, add the user to the group and append the group to the list
# (in the first file where we found the directive)
- name: "Append evolinux ssh group to AllowGroups sshd directive"
ansible.builtin.replace:
dest: "{{ grep_allowgroups_ssh.stdout_lines[0] }}"
regexp: '^(AllowGroups ((?!{{ evolinux_ssh_group }}).)*)$'
replace: '\1 {{ evolinux_ssh_group }}'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when:
- grep_allowusers_ssh.rc != 0
- grep_allowgroups_ssh.rc == 0
- name: "evolinux ssh group is present"
ansible.builtin.group:
name: "{{ evolinux_ssh_group }}"
when:
- grep_allowusers_ssh.rc != 0
- grep_allowgroups_ssh.rc == 0
- name: "Add current user to evolinux ssh group"
ansible.builtin.user:
name: "{{ _logname.stdout }}"
group: "{{ evolinux_ssh_group }}"
append: yes
when:
- grep_allowusers_ssh.rc != 0
- grep_allowgroups_ssh.rc == 0
# If we don't have AllowGroups nor AllowUsers, do nothing
when: evolinux_ssh_allow_current_user | bool
- ansible.builtin.meta: flush_handlers
# TODO si allowusers et allowgroups, ajouter utilisateur aux deux
# TODO si allowgroups, ajouter groupe de lutilisateur

View file

@ -61,40 +61,66 @@
notify: reload sshd
when: ansible_distribution_major_version is version('9', '>=')
- name: "Get current user"
ansible.builtin.command:
cmd: logname
changed_when: False
register: logname
check_mode: no
# Should we allow the current user?
- name: Allow the current user
block:
- name: "Get current user"
ansible.builtin.command:
cmd: logname
changed_when: False
register: _logname
check_mode: no
- name: verify AllowUsers directive
ansible.builtin.command:
cmd: "grep -E '^AllowUsers' /etc/ssh/sshd_config"
failed_when: False
changed_when: False
register: grep_allowusers_ssh
check_mode: no
- name: verify AllowGroups directive
ansible.builtin.command:
cmd: "grep -E '^AllowGroups' /etc/ssh/sshd_config"
failed_when: False
changed_when: False
register: grep_allowgroups_ssh
check_mode: no
# If we have AllowUsers but not AllowGroups, append the user to the list
- name: "Modify AllowUsers sshd directive for current user"
ansible.builtin.replace:
dest: /etc/ssh/sshd_config
regexp: '^(AllowUsers ((?!{{ _logname.stdout }}).)*)$'
replace: '\1 {{ _logname.stdout }}'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when:
- grep_allowusers_ssh.rc == 0
- grep_allowgroups_ssh.rc != 0
# If we have AllowGroups but not AllowUsers, add the user to the group and append the group to the list
- name: "Add current user to {{ evolinux_ssh_group }} group"
ansible.builtin.user:
name: "{{ _logname.stdout }}"
group: "{{ evolinux_ssh_group }}"
append: yes
when:
- grep_allowusers_ssh.rc != 0
- grep_allowgroups_ssh.rc == 0
- name: "Append '{{ evolinux_ssh_group }}' to AllowGroups sshd directive"
ansible.builtin.replace:
dest: "/etc/ssh/sshd_config"
regexp: '^(AllowGroups ((?!{{ evolinux_ssh_group }}).)*)$'
replace: '\1 {{ evolinux_ssh_group }}'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when:
- grep_allowusers_ssh.rc != 0
- grep_allowgroups_ssh.rc == 0
when: evolinux_ssh_allow_current_user | bool
# we must double-escape caracters, because python
- name: verify AllowUsers directive
ansible.builtin.command:
cmd: "grep -E '^AllowUsers' /etc/ssh/sshd_config"
failed_when: False
changed_when: False
register: grep_allowusers_ssh
check_mode: no
when: evolinux_ssh_allow_current_user | bool
- name: "Add AllowUsers sshd directive for current user"
ansible.builtin.lineinfile:
dest: /etc/ssh/sshd_config
line: "\nAllowUsers {{ logname.stdout }}"
insertafter: 'Subsystem'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when: evolinux_ssh_allow_current_user and grep_allowusers_ssh.rc != 0
- name: "Modify AllowUsers sshd directive for current user"
ansible.builtin.replace:
dest: /etc/ssh/sshd_config
regexp: '^(AllowUsers ((?!{{ logname.stdout }}).)*)$'
replace: '\1 {{ logname.stdout }}'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when: evolinux_ssh_allow_current_user and grep_allowusers_ssh.rc == 0
- ansible.builtin.meta: flush_handlers

View file

@ -1,8 +1,23 @@
---
- name: Fetch SSHd config files
ansible.builtin.command:
cmd: "find /etc/ssh -type f \\( -name 'sshd_config' -o -path '/etc/ssh/sshd_config.d/*.conf' \\)"
changed_when: False
check_mode: no
register: _ssh_config_paths
- ansible.builtin.debug:
var: _ssh_config_paths
verbosity: 1
############################
# AllowUsers or AllowGroups
############################
- name: verify AllowGroups directive
ansible.builtin.command:
cmd: "grep -Er '^AllowGroups' /etc/ssh"
cmd: "grep --extended-regexp --recursive --files-with-matches '^AllowGroups' {{ _ssh_config_paths.stdout_lines | join(' ') }}"
changed_when: False
failed_when: False
check_mode: no
@ -14,7 +29,7 @@
- name: verify AllowUsers directive
ansible.builtin.command:
cmd: "grep -Er '^AllowUsers' /etc/ssh"
cmd: "grep --extended-regexp --recursive --files-with-matches '^AllowUsers' {{ _ssh_config_paths.stdout_lines | join(' ') }}"
changed_when: False
failed_when: False
check_mode: no
@ -42,12 +57,14 @@
var: ssh_allowusers
verbosity: 1
- ansible.builtin.include: ssh_allowgroups.yml
- name: Configure SSH in AllowGroups mode
ansible.builtin.include: ssh_allowgroups.yml
when:
- ssh_allowgroups
- not ssh_allowusers
- ansible.builtin.include: ssh_allowusers.yml
- name: Configure SSH in AllowUsers mode
ansible.builtin.include: ssh_allowusers.yml
vars:
user: "{{ item.value }}"
loop: "{{ evolinux_users | dict2items }}"
@ -56,7 +73,24 @@
- ssh_allowusers
- not ssh_allowgroups
- name: disable root login
# Do this again, to update the value
- name: Fetch SSHd config files
ansible.builtin.command:
cmd: "find /etc/ssh -type f \\( -name 'sshd_config' -o -path '/etc/ssh/sshd_config.d/*.conf' \\)"
changed_when: False
check_mode: no
register: _ssh_config_paths
##################
# PermitRootLogin
##################
### For Debian < 12
# if there is a commented value for PermitRootLogin
# we replace it with a "no"
- name: Root login is disabled (Debian < 12)
ansible.builtin.replace:
dest: /etc/ssh/sshd_config
regexp: '^#PermitRootLogin (yes|without-password|prohibit-password)'
@ -64,11 +98,15 @@
notify: reload sshd
when:
- evolinux_root_disable_ssh | bool
- ansible_distribution_major_version is version('11', '<=')
- ansible_distribution_major_version is version('12', '<')
### For Debian >= 12
# if there is no value for PermitRootLogin (anywhere)
# we add a "no" in z-evolinux-users.conf
- name: verify PermitRootLogin directive (Debian >= 12)
ansible.builtin.command:
cmd: "grep -Er '^PermitRootLogin' /etc/ssh"
cmd: "grep --extended-regexp --recursive --files-with-matches '^PermitRootLogin' {{ _ssh_config_paths.stdout_lines | join(' ') }}"
changed_when: False
failed_when: False
check_mode: no
@ -76,12 +114,7 @@
when:
- ansible_distribution_major_version is version('12', '>=')
# TODO avertir lorsque PermitRootLogin est déjà configuré?
- ansible.builtin.debug:
var: grep_permitrootlogin_ssh
verbosity: 1
- name: disable root login (Debian >= 12)
- name: Root login is disabled (Debian >= 12)
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config.d/z-evolinux-users.conf
line: "PermitRootLogin no"
@ -93,6 +126,48 @@
when:
- evolinux_root_disable_ssh | bool
- ansible_distribution_major_version is version('12', '>=')
- grep_permitrootlogin_ssh.rc == 1
- grep_permitrootlogin_ssh.rc != 0
#####################
# Allow current user
#####################
- name: Allow current user
block:
- name: Check if evolinux ssh group is used
ansible.builtin.command:
cmd: "grep --extended-regexp --recursive --files-with-matches '^AllowGroups.+{{ evolinux_ssh_group }}' {{ _ssh_config_paths.stdout_lines | join(' ') }}"
changed_when: False
failed_when: False
check_mode: no
register: grep_evolinux_group_ssh
- debug:
var: grep_evolinux_group_ssh
- name: "Get current user's login"
ansible.builtin.command:
cmd: logname
changed_when: False
register: _logname
check_mode: no
- debug:
var: evolinux_ssh_group
- debug:
var: evolinux_ssh_allow_current_user
- name: "Add current user ({{ _logname.stdout }}) to {{ evolinux_ssh_group }} group"
ansible.builtin.user:
name: "{{ _logname.stdout }}"
groups: "{{ evolinux_ssh_group }}"
append: yes
when:
- grep_evolinux_group_ssh.rc == 0
when:
- evolinux_ssh_group is defined
- evolinux_ssh_group | length > 0
- evolinux_ssh_allow_current_user | bool
- ansible.builtin.meta: flush_handlers

View file

@ -1,18 +1,27 @@
---
###
# this check must be repeated for each user
# even if it's been done before
- name: Fetch SSHd config files
ansible.builtin.command:
cmd: "find /etc/ssh -type f \\( -name 'sshd_config' -o -path '/etc/ssh/sshd_config.d/*.conf' \\)"
changed_when: False
check_mode: no
register: _ssh_config_paths
- name: verify AllowGroups directive
ansible.builtin.command:
cmd: "grep -Er '^AllowGroups' /etc/ssh"
cmd: "grep --extended-regexp --recursive --files-with-matches '^AllowGroups' {{ _ssh_config_paths.stdout_lines | join(' ') }}"
changed_when: False
failed_when: False
check_mode: no
register: grep_allowgroups_ssh
when:
- ansible_distribution_major_version is version('11', '<=')
- name: "Add AllowGroups sshd directive with '{{ evolinux_ssh_group }}'"
###
- name: "Add AllowGroups sshd directive with '{{ evolinux_ssh_group }}' (Debian < 12)"
ansible.builtin.lineinfile:
dest: /etc/ssh/sshd_config
line: "\nAllowGroups {{ evolinux_ssh_group }}"
@ -21,25 +30,25 @@
notify: reload sshd
when:
- ansible_distribution_major_version is version('11', '<=')
- grep_allowgroups_ssh.rc != 0
- grep_allowgroups_ssh.rc == 1 # Not found
- name: "Add AllowGroups sshd directive with '{{ evolinux_ssh_group }}' (Debian >= 12)"
ansible.builtin.lineinfile:
dest: /etc/ssh/sshd_config.d/z-evolinux-users.conf
line: "\nAllowGroups {{ evolinux_ssh_group }}"
validate: '/usr/sbin/sshd -t -f %s'
create: yes
notify: reload sshd
when:
- ansible_distribution_major_version is version('12', '>=')
- grep_allowgroups_ssh.rc == 1 # Not found
- name: "Append '{{ evolinux_ssh_group }}' to AllowGroups sshd directive"
ansible.builtin.replace:
dest: /etc/ssh/sshd_config
dest: "{{ grep_allowgroups_ssh.stdout_lines[0] }}"
regexp: '^(AllowGroups ((?!\b{{ evolinux_ssh_group }}\b).)*)$'
replace: '\1 {{ evolinux_ssh_group }}'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when:
- ansible_distribution_major_version is version('11', '<=')
- grep_allowgroups_ssh.rc == 0
- name: "Add AllowGroups sshd directive with '{{ evolinux_ssh_group }}'"
ansible.builtin.lineinfile:
path: /etc/ssh/sshd_config.d/z-evolinux-users.conf
line: "AllowGroups {{ evolinux_ssh_group }}"
create: yes
mode: "0644"
validate: '/usr/sbin/sshd -t -f %s'
when:
- ansible_distribution_major_version is version('12', '>=')
- grep_allowgroups_ssh.rc == 0 or grep_allowgroups_ssh.rc == 2 # Found, return code can be 0 or 2

View file

@ -1,55 +1,84 @@
---
# this check must be repeated for each user
###
# these checks must be repeated for each user
# even if it's been done before
- name: verify AllowUsers directive
- name: Fetch SSHd config files
ansible.builtin.command:
cmd: "grep -E '^AllowUsers' /etc/ssh/sshd_config"
cmd: "find /etc/ssh -type f \\( -name 'sshd_config' -o -path '/etc/ssh/sshd_config.d/*.conf' \\)"
changed_when: False
check_mode: no
register: _ssh_config_paths
- name: Verify AllowUsers directive
ansible.builtin.command:
cmd: "grep --extended-regexp --recursive --files-with-matches '^AllowUsers' {{ _ssh_config_paths.stdout_lines | join(' ') }}"
changed_when: False
failed_when: False
check_mode: no
register: grep_allowusers_ssh
- name: "Add AllowUsers sshd directive with '{{ user.name }}'"
###
- name: "Add AllowUsers sshd directive with '{{ user.name }}' (Debian < 12)"
ansible.builtin.lineinfile:
dest: /etc/ssh/sshd_config
line: "\nAllowUsers {{ user.name }}"
insertafter: 'Subsystem'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when: grep_allowusers_ssh.rc != 0
when:
- grep_allowusers_ssh.rc != 0
- ansible_distribution_major_version is version('12', '<')
- name: "Add AllowUsers sshd directive with '{{ user.name }}' (Debian >= 12)"
ansible.builtin.lineinfile:
dest: /etc/ssh/sshd_config.d/z-evolinux-users.conf
line: "\nAllowUsers {{ user.name }}"
insertafter: 'Subsystem'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when:
- grep_allowusers_ssh.rc != 0
- ansible_distribution_major_version is version('12', '>=')
- name: "Append '{{ user.name }}' to AllowUsers sshd directive"
ansible.builtin.replace:
dest: /etc/ssh/sshd_config
dest: "{{ grep_allowusers_ssh.stdout_lines[0] }}"
regexp: '^(AllowUsers ((?!\b{{ user.name }}\b).)*)$'
replace: '\1 {{ user.name }}'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when: grep_allowusers_ssh.rc == 0
when:
- grep_allowusers_ssh.rc == 0
- name: "verify Match User directive"
ansible.builtin.command:
cmd: "grep -E '^Match User' /etc/ssh/sshd_config"
cmd: "grep --extended-regexp --recursive --files-with-matches '^Match User' {{ _ssh_config_paths.stdout_lines | join(' ') }}"
changed_when: False
failed_when: False
check_mode: no
register: grep_matchuser_ssh
- name: "Add Match User sshd directive with '{{ user.name }}'"
- name: "Add Match User sshd directive with '{{ user.name }}' (Debian <= 10)"
ansible.builtin.lineinfile:
dest: /etc/ssh/sshd_config
line: "\nMatch User {{ user.name }}\n PasswordAuthentication no"
insertafter: "# END EVOLINUX PASSWORD RESTRICTIONS BY ADDRESS"
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when: grep_matchuser_ssh.rc != 0
when:
- grep_matchuser_ssh.rc != 0
- ansible_distribution_major_version is version('10', '<=')
- name: "Append '{{ user.name }}' to Match User's sshd directive"
- name: "Append '{{ user.name }}' to Match User's sshd directive (Debian <= 10)"
ansible.builtin.replace:
dest: /etc/ssh/sshd_config
dest: "{{ grep_matchuser_ssh.stdout_lines[0] }}"
regexp: '^(Match User ((?!{{ user.name }}).)*)$'
replace: '\1,{{ user.name }}'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when: grep_matchuser_ssh.rc == 0
when:
- grep_matchuser_ssh.rc == 0
- ansible_distribution_major_version is version('10', '<=')

View file

@ -1,33 +0,0 @@
From: __FULLFROM__
Content-Type: text/plain; charset=UTF-8
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
To: __TO__
Subject: [evomaintenance] Intervention sur __HOSTNAME__ (__USER__)
Bonjour,
Une intervention vient de se terminer sur votre serveur.
Voici les renseignements sur l'intervention :
Nom du serveur : __HOSTNAME__
Personne ayant réalisée l'intervention : __USER__
Intervention réalisée depuis : __IP__
Début de l'intervention : __BEGIN_DATE__
Fin de l'intervention : __END_DATE__
###
Renseignements sur l'intervention :
__TEXTE__
###
__GIT_COMMITS__
Pour réagir à cette intervention, vous pouvez répondre à ce message
(sur l'adresse mail __FROM__). En cas d'urgence, utilisez
l'adresse __URGENCYFROM__ ou notre téléphone portable d'astreinte
(__URGENCYTEL__)
Cordialement,
--
__FULLFROM__

View file

@ -0,0 +1,100 @@
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project **does not adhere to [Semantic Versioning](http://semver.org/spec/v2.0.0.html)**.
## [Unreleased]
### Added
Add missing (but documented) `--(no-)evocheck` options
### Changed
### Deprecated
### Removed
### Fixed
### Security
## [23.10.1] - 2023-10-09
### Fixed
* Use a special variable name since USER is always defined from the environment
## [23.10] - 2023-10-09
### Added
* Force a user name with `-u,--user` option (default is still `logname(1)`).
* More people credited
### Deprecated
* `--autosysadmin` is replaced by `--user autosysadmin`
## [22.07] - 2022-07-05
### Added
* Add `--autosysadmin` flag
* Commit change in /etc of lxc containers
### Changed
### Deprecated
### Removed
### Fixed
### Security
## [22.01] - 2022-01-25
### Added
* version/host/user headers in sent email
### Changed
New version pattern
## [0.6.4] - 2021-06-17
### Added
* fallback if findmnt is absent
## [0.6.3] - 2020-02-02
### Added
* Notify syslog when partitions are re-mounted (Linux)
## [0.6.2] - 2020-02-02
### Fixed
* better detection of read-only partitions (Linux)
## [0.6.0] - 2019-11-05
### Added
* commit changes in /usr/share/scripts/ if needed
## Previous changelog
* 0.5.0 : options et mode interactif pour l'exécution des actions, meilleure compatibilité POSIX
* 0.4.1 : Utilisation de "printf" à la place de "echo" pour mieux gérer les sauts de ligne
* 0.4.0 : Amélioration de la récupération d'information (plus de cas gérés). Infos Git avant la saisie.
* 0.3.0 : Écriture dans un fichier de log, amélioration de la récupération d'informations, amélioration de la syntaxe shell
* 0.2.7 : Correction d'un bug lors de l'utilisation de '&' dans le texte
* 0.2.6 : Precision du charset dans les entetes du mail
* 0.2.5 : Correction d'un bug avec le path de sendmail sous OpenBSD
* 0.2.4 : Correction d'un bug lors de l'utilisation de '/' dans le texte
* 0.2.3 : Correction d'un bug avec $REALM

View file

@ -0,0 +1,30 @@
# Evomaintenance
```.plain
$ evomaintenance --help
evomaintenance is a program that helps reporting what you've done on a server
Usage: evomaintenance
or evomaintenance --message="add new host"
or evomaintenance --no-api --no-mail --no-commit
or echo "add new vhost" | evomaintenance
Options
-m, --message=MESSAGE set the message from the command line
--mail enable the mail hook (default)
--no-mail disable the mail hook
--db enable the database hook
--no-db disable the database hook (default)
--api enable the API hook (default)
--no-api disable the API hook
--commit enable the commit hook (default)
--no-commit disable the commit hook
--evocheck enable evocheck execution (default)
--no-evocheck disable evocheck execution
--auto use "auto" mode
--no-auto use "manual" mode (default)
-v, --verbose increase verbosity
-n, --dry-run actions are not executed
--help print this message and exit
--version print version and exit
```

View file

@ -1,12 +1,12 @@
#!/bin/sh
VERSION="23.10.1"
VERSION="24.05"
show_version() {
cat <<END
evomaintenance version ${VERSION}
Copyright 2007-2023 Evolix <info@evolix.fr>,
Copyright 2007-2024 Evolix <info@evolix.fr>,
Gregory Colpart <reg@evolix.fr>,
Jérémy Lecour <jlecour@evolix.fr>,
Brice Waegeneire <bwaegeneire@evolix.fr>,
@ -437,6 +437,14 @@ while :; do
printf 'ERROR: "--message" requires a non-empty option argument.\n' >&2
exit 1
;;
--no-evocheck)
# disable evocheck hook
EVOCHECK=0
;;
--evocheck)
# enable evocheck hook
EVOCHECK=1
;;
--no-commit)
# disable commit hook
HOOK_COMMIT=0
@ -581,7 +589,7 @@ GIT_REPOSITORIES="/etc /etc/bind /usr/share/scripts"
# Add /etc directories from lxc containers if they are git directories
if [ -d /var/lib/lxc ]; then
GIT_REPOSITORIES="${GIT_REPOSITORIES} $(find /var/lib/lxc/ -maxdepth 3 -name 'etc' | tr '\n' ' ' | sed 's/[[:space:]]\+$//')"
GIT_REPOSITORIES="${GIT_REPOSITORIES} $(find -L /var/lib/lxc/ -maxdepth 3 -name 'etc' | tr '\n' ' ' | sed 's/[[:space:]]\+$//')"
fi
# initialize variable

View file

@ -35,15 +35,12 @@
- name: Evomaintenance script and template are installed
ansible.builtin.copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
src: "upstream/evomaintenance.sh"
dest: "/usr/share/scripts/"
owner: root
group: root
mode: "{{ item.mode }}"
mode: "0700"
force: true
backup: yes
loop:
- { src: 'evomaintenance.sh', dest: '/usr/share/scripts/', mode: '0700' }
- { src: 'evomaintenance.tpl', dest: '/usr/share/scripts/', mode: '0600' }
tags:
- evomaintenance
- evomaintenance

View file

@ -1,52 +1,29 @@
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1
Comment: GPGTools - https://gpgtools.org
mQINBFObJLYBEADkFW8HMjsoYRJQ4nCYC/6Eh0yLWHWfCh+/9ZSIj4w/pOe2V6V+
W6DHY3kK3a+2bxrax9EqKe7uxkSKf95gfns+I9+R+RJfRpb1qvljURr54y35IZgs
fMG22Np+TmM2RLgdFCZa18h0+RbH9i0b+ZrB9XPZmLb/h9ou7SowGqQ3wwOtT3Vy
qmif0A2GCcjFTqWW6TXaY8eZJ9BCEqW3k/0Cjw7K/mSy/utxYiUIvZNKgaG/P8U7
89QyvxeRxAf93YFAVzMXhoKxu12IuH4VnSwAfb8gQyxKRyiGOUwk0YoBPpqRnMmD
Dl7SdmY3oQHEJzBelTMjTM8AjbB9mWoPBX5G8t4u47/FZ6PgdfmRg9hsKXhkLJc7
C1btblOHNgDx19fzASWX+xOjZiKpP6MkEEzq1bilUFul6RDtxkTWsTa5TGixgCB/
G2fK8I9JL/yQhDc6OGY9mjPOxMb5PgUlT8ox3v8wt25erWj9z30QoEBwfSg4tzLc
Jq6N/iepQemNfo6Is+TG+JzI6vhXjlsBm/Xmz0ZiFPPObAH/vGCY5I6886vXQ7ft
qWHYHT8jz/R4tigMGC+tvZ/kcmYBsLCCI5uSEP6JJRQQhHrCvOX0UaytItfsQfLm
EYRd2F72o1yGh3yvWWfDIBXRmaBuIGXGpajC0JyBGSOWb9UxMNZY/2LJEwARAQAB
tB9Ob2RlU291cmNlIDxncGdAbm9kZXNvdXJjZS5jb20+iQI4BBMBAgAiBQJTmyS2
AhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRAWVaCraFdigHTmD/9OKhUy
jJ+h8gMRg6ri5EQxOExccSRU0i7UHktecSs0DVC4lZG9AOzBe+Q36cym5Z1di6JQ
kHl69q3zBdV3KTW+H1pdmnZlebYGz8paG9iQ/wS9gpnSeEyx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aeBbJaPNXL9wpJ
YBJbiMjkAFaz4B95FOqZm3r7oHugiCGsHX0AEQEAAYkBHwQYAQIACQUCV0M3UAIb
DAAKCRAvWbX5mxvgtE/OB/0VN88DR3Y3fuqy7lq/dthkn7Dqm9YXdorZl3L152eE
IF882aG8FE3qZdaLGjQO4oShAyNWmRfSGuoH0XERXAI9n0r8m4mDMxE6rtP7tHet
y/5M8x3CTyuMgx5GLDaEUvBusnTD+/v/fBMwRK/cZ9du5PSG4R50rtst+oYyC2ao
x4I2SgjtF/cY7bECsZDplzatN3gv34PkcdIg8SLHAVlL4N5tzumDeizRspcSyoy2
K2+hwKU4C4+dekLLTg8rjnRROvplV2KtaEk6rxKtIRFDCoQng8wfJuIMrDNKvqZw
FRGt7cbvW5MCnuH8MhItOl9Uxp1wHp6gtav/h8Gp6MBa
=MARt
-----END PGP PUBLIC KEY BLOCK-----

View file

@ -24,7 +24,7 @@
- name: Add NodeJS repository (Debian <12)
ansible.builtin.apt_repository:
repo: "deb [signed-by={{ apt_keyring_dir }}/nodesource.asc] https://deb.nodesource.com/{{ nodejs_apt_version }} {{ ansible_distribution_release }} main"
repo: "deb [signed-by={{ apt_keyring_dir }}/nodesource.asc] https://deb.nodesource.com/{{ nodejs_apt_version }} nodistro main"
filename: nodesource
update_cache: yes
state: present

View file

@ -2,7 +2,7 @@
Types: deb
URIs: https://deb.nodesource.com/{{ nodejs_apt_version }}
Suites: {{ ansible_distribution_release }}
Suites: nodistro
Components: main
Signed-by: {{ apt_keyring_dir }}/nodesource.asc
Enabled: yes
Enabled: yes

View file

@ -31,11 +31,11 @@
marker: "## {mark} ANSIBLE MANAGED INPUT RULES FOR VRID {{ vrrp_address.id }}"
block: |
{% if vrrp_address.peers | default([]) | length <= 0 %}
/sbin/iptables -A INPUT -i {{ vrrp_address.interface }} -d 224.0.0.0/8 -j ACCEPT # Allow VRRP input on {{ vrrp_address.interface }} for VRID {{ vrrp_address.id }}
/sbin/iptables -A INPUT -i {{ vrrp_address.interface }} -d 224.0.0.0/8 -j ACCEPT # Allow VRRP input on {{ vrrp_address.interface }} for VRID {{ vrrp_address.id }}
{% else %}
{% for peer in vrrp_address.peers %}
/sbin/iptables -A INPUT -i {{ vrrp_address.interface }} -s {{ peer }} -d 224.0.0.0/8 -j ACCEPT # Allow VRRP input on {{ vrrp_address.interface }} from {{ peer }} for VRID {{ vrrp_address.id }}
{% endfor %}
{% for peer in vrrp_address.peers %}
/sbin/iptables -A INPUT -i {{ vrrp_address.interface }} -s {{ peer }} -d 224.0.0.0/8 -j ACCEPT # Allow VRRP input on {{ vrrp_address.interface }} from {{ peer }} for VRID {{ vrrp_address.id }}
{% endfor %}
{% endif %}
create: yes
mode: "0600"