Skip to content

Commit

Permalink
hosts/common: import /etc/mail/aliases
Browse files Browse the repository at this point in the history
This also adds USERNAME to the list of variables substituted.
  • Loading branch information
khorben committed Dec 11, 2024
1 parent e29221a commit ab17783
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
56 changes: 56 additions & 0 deletions sysadmin/common/files/etc/mail/aliases.in
Original file line number Diff line number Diff line change
@@ -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"
7 changes: 6 additions & 1 deletion sysadmin/sysadmin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -79,6 +80,7 @@ SLAPPASSWD="slappasswd"
SSH="ssh"
SSH_ARGS="-T"
UNAME="uname"
WHOAMI="whoami"

#load local settings
[ -f "$SYSCONFDIR/$VENDOR/$PACKAGE/$PROGNAME.conf" ] &&
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ab17783

Please sign in to comment.