Merge remote-tracking branch 'origin/dev' into bookworm

This commit is contained in:
Alexandre Aubin 2023-11-24 22:35:25 +01:00
commit c216a3f246
7 changed files with 46 additions and 13 deletions

View file

@ -64,13 +64,40 @@ protocol imap {
mail_plugins = $mail_plugins imap_quota antispam
}
protocol lda {
auth_socket_path = /var/run/dovecot/auth-master
mail_plugins = quota sieve
postmaster_address = postmaster@{{ main_domain }}
}
namespace inbox {
inbox = yes
mailbox Drafts {
special_use = \Drafts
auto = subscribe
}
mailbox Junk {
special_use = \Junk
auto = subscribe
}
mailbox Trash {
special_use = \Trash
auto = subscribe
}
mailbox Sent {
special_use = \Sent
auto = subscribe
}
mailbox "Sent Messages" {
special_use = \Sent
}
mailbox "Archive" {
special_use = \Archive
auto = subscribe
}
}
protocol sieve {
}

View file

@ -53,8 +53,6 @@
# You can find some more explainations about how to make a regex here :
# https://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Filters
#
# Note that the logfile need to exist before to call this helper !!
#
# To validate your regex you can test with this command:
# ```
# fail2ban-regex /var/log/YOUR_LOG_FILE_PATH /etc/fail2ban/filter.d/YOUR_APP.conf
@ -102,6 +100,15 @@ ignoreregex =
ynh_add_config --template="f2b_jail.conf" --destination="/etc/fail2ban/jail.d/$app.conf"
ynh_add_config --template="f2b_filter.conf" --destination="/etc/fail2ban/filter.d/$app.conf"
# Create the folder and logfile if they doesn't exist,
# as fail2ban require an existing logfile before configuration
mkdir -p "/var/log/$app"
if [ ! -f "$logpath" ]; then
touch "$logpath"
chown -R "$app:$app" "/var/log/$app"
chmod -R u=rwX,g=rX,o= "/var/log/$app"
fi
ynh_systemd_action --service_name=fail2ban --action=reload --line_match="(Started|Reloaded) Fail2Ban Service" --log_path=systemd
local fail2ban_error="$(journalctl --no-hostname --unit=fail2ban | tail --lines=50 | grep "WARNING.*$app.*")"

View file

@ -99,6 +99,7 @@ $logfile {
EOF
mkdir --parents $(dirname "$logfile") # Create the log directory, if not exist
cat ${app}-logrotate | $customtee /etc/logrotate.d/$app >/dev/null # Append this config to the existing config file, or replace the whole config file (depending on $customtee)
chmod 644 "/etc/logrotate.d/$app" # Make sure permissions are correct (otherwise the config file could be ignored and the corresponding logs never rotated)
}
# Remove the app's logrotate config.

View file

@ -105,7 +105,7 @@
"backup_archive_broken_link": "Could not access the backup archive (broken link to {path})",
"backup_archive_cant_retrieve_info_json": "Could not load info for archive '{archive}'... The info.json file cannot be retrieved (or is not a valid json).",
"backup_archive_corrupted": "It looks like the backup archive '{archive}' is corrupted : {error}",
"backup_archive_name_exists": "A backup archive with this name already exists.",
"backup_archive_name_exists": "A backup archive with the name '{name}' already exists.",
"backup_archive_name_unknown": "Unknown local backup archive named '{name}'",
"backup_archive_open_failed": "Could not open the backup archive",
"backup_archive_system_part_not_available": "System part '{part}' unavailable in this backup",

View file

@ -23,7 +23,7 @@
"ask_password": "Mot de passe",
"backup_app_failed": "Impossible de sauvegarder {app}",
"backup_archive_app_not_found": "{app} n'a pas été trouvée dans l'archive de la sauvegarde",
"backup_archive_name_exists": "Une archive de sauvegarde avec ce nom existe déjà.",
"backup_archive_name_exists": "Une archive de sauvegarde avec le nom '{name}' existe déjà.",
"backup_archive_name_unknown": "L'archive locale de sauvegarde nommée '{name}' est inconnue",
"backup_archive_open_failed": "Impossible d'ouvrir l'archive de la sauvegarde",
"backup_cleaning_failed": "Impossible de nettoyer le dossier temporaire de sauvegarde",

View file

@ -2208,7 +2208,7 @@ def backup_create(
# Validate there is no archive with the same name
if name and name in backup_list()["archives"]:
raise YunohostValidationError("backup_archive_name_exists")
raise YunohostValidationError("backup_archive_name_exists", name=name)
# By default we backup using the tar method
if not methods:

View file

@ -1722,16 +1722,14 @@ class UserOption(BaseChoicesOption):
cls, value: Union[str, None], values: Values
) -> Union[str, None]:
# TODO remove calls to resources in validators (pydantic V2 should adress this)
from yunohost.domain import _get_maindomain
from yunohost.user import user_list, user_info
#from yunohost.domain import _get_maindomain
#from yunohost.user import user_list, user_info
if value is None:
# FIXME: this code is obsolete with the new admins group
# FIXME : in the past we looked for the user holding the "root@" alias
# but it's now obsolete...
# Should be replaced by something like "any first user we find in the admin group"
root_mail = "root@%s" % _get_maindomain()
for user in user_list()["users"].keys():
if root_mail in user_info(user).get("mail-aliases", []):
return user
pass
return value