From ab177837f46e363b83c64b19d2559a31e43a19ec Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 12 Dec 2024 00:10:40 +0100 Subject: [PATCH] hosts/common: import /etc/mail/aliases This also adds USERNAME to the list of variables substituted. --- sysadmin/common/files/etc/mail/aliases.in | 56 +++++++++++++++++++++++ sysadmin/sysadmin.sh | 7 ++- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 sysadmin/common/files/etc/mail/aliases.in diff --git a/sysadmin/common/files/etc/mail/aliases.in b/sysadmin/common/files/etc/mail/aliases.in new file mode 100644 index 0000000..5118151 --- /dev/null +++ b/sysadmin/common/files/etc/mail/aliases.in @@ -0,0 +1,56 @@ +# $NetBSD: aliases,v 1.22 2010/08/25 15:38:44 reed Exp $ +# +# from: @(#)aliases 8.2 (Berkeley) 3/5/94 +# +# Aliases in this file will NOT be expanded in the header from +# Mail, but WILL be visible over networks or from /usr/bin/mail. +# +# >>>>>>>>>> The program "newaliases" must be run after +# >> NOTE >> this file is updated for any changes to +# >>>>>>>>>> show through to sendmail. +# + +# Basic system aliases -- these MUST be present. +MAILER-DAEMON: postmaster +postmaster: root + +# General redirections for pseudo accounts. +toor: root +daemon: root +bin: root +games: root +postfix: postmaster +named: root +ntpd: root +sshd: root +nobody: root + +# Well-known aliases -- these should be filled in! +root: @@USERNAME@@ +operator: root + +# Standard aliases defined by rfc2142 +# address to report network abuse (like spam) +abuse: postmaster +# reports of network infrastructure difficulties +noc: root +# address to report security problems +security: root +# DNS administrator (DNS SOA records should use this) +hostmaster: root +# Usenet news service administrator +usenet: root +news: usenet +# http/web service administrator +webmaster: root +www: webmaster +# UUCP service administrator +uucp: root +# FTP administrator (especially anonymous FTP) +ftp: root + +# don't enable this. +# decode: /dev/null + +# uncomment this for msgs(1): +# msgs: "|/usr/bin/msgs -s" diff --git a/sysadmin/sysadmin.sh b/sysadmin/sysadmin.sh index af87fc1..ce0c8e6 100755 --- a/sysadmin/sysadmin.sh +++ b/sysadmin/sysadmin.sh @@ -59,6 +59,7 @@ PKGSRC_PREFIX="/usr/pkg" PKGSRC_SYSCONFDIR="$PKGSRC_PREFIX/etc" PKGSRC_VARBASE="$PKGSRC_PREFIX/var" POSTFIX_EMAIL_MESSAGE_SIZE_LIMIT=20480000 +USERNAME= #executables CAT="cat" @@ -79,6 +80,7 @@ SLAPPASSWD="slappasswd" SSH="ssh" SSH_ARGS="-T" UNAME="uname" +WHOAMI="whoami" #load local settings [ -f "$SYSCONFDIR/$VENDOR/$PACKAGE/$PROGNAME.conf" ] && @@ -99,8 +101,9 @@ _sysadmin() shift #initialize variables as required - [ -z "$LDAP_ADMIN_PASSWORD_HASH" ] && + [ -n "$LDAP_ADMIN_PASSWORD_HASH" ] || LDAP_ADMIN_PASSWORD_HASH=$($DEBUG $SLAPPASSWD -s "$LDAP_ADMIN_PASSWORD") + [ -n "$USERNAME" ] || USERNAME=$($WHOAMI) case "$command" in apply|import|preview) @@ -304,6 +307,7 @@ _apply_host_files() -e "s,@@PKGSRC_SYSCONFDIR@@,$PKGSRC_SYSCONFDIR," \ -e "s,@@PKGSRC_VARBASE@@,$PKGSRC_VARBASE," \ -e "s,@@POSTFIX_EMAIL_MESSAGE_SIZE_LIMIT@@,$POSTFIX_EMAIL_MESSAGE_SIZE_LIMIT," \ + -e "s/@@USERNAME@@/$USERNAME/g" \ "$filename" > "$tmpfile" if [ $? -ne 0 ]; then ret=8 @@ -614,6 +618,7 @@ _preview_host_files() -e "s,@@PKGSRC_SYSCONFDIR@@,$PKGSRC_SYSCONFDIR," \ -e "s,@@PKGSRC_VARBASE@@,$PKGSRC_VARBASE," \ -e "s,@@POSTFIX_EMAIL_MESSAGE_SIZE_LIMIT@@,$POSTFIX_EMAIL_MESSAGE_SIZE_LIMIT," \ + -e "s/@@USERNAME@@/$USERNAME/g" \ "$filename" > "$tmpfile" if [ $? -ne 0 ]; then ret=8