send email announcing ship creation

This commit is contained in:
James Tomasino 2018-11-22 00:00:39 -05:00
parent fd67d56a8e
commit f274429552
4 changed files with 14 additions and 1 deletions

View File

@ -14,6 +14,7 @@ if [ "$run_user" -eq 0 ]; then
mkdir "$path"
chmod 755 "$path"
chown -R "${n}" "$path"
sed -e "s/username/${n}/g" -e "s/shipname/${s}/" /etc/newship.tmpl | sendmail "${n}" "tomasino"
else
owner=$(stat -c %U "$path")
printf "That ship or colony already exists and is owned by %s\\n" "$owner"

View File

@ -11,7 +11,7 @@ if [ "$run_user" -eq 0 ]; then
newpw=$(pwgen -1B 10)
pwcrypt=$(perl -e "print crypt('${newpw}', 'sa');")
useradd -m -G users,www-data -p "$pwcrypt" -s /bin/bash "${n}" || exit 1
sed -e "s/newusername/$1/g" -e "s/newpassword/$newpw/" /etc/welcomemail.tmpl | sendmail "${n}" "tomasino"
sed -e "s/newusername/${n}/g" -e "s/newpassword/${newpw}/" /etc/welcomemail.tmpl | sendmail "${n}" "tomasino"
fi
if [ ! -z "${k}" ]; then
printf "%s\\n" "${k}" >> "/home/${n}/.ssh/authorized_keys"

View File

@ -20,3 +20,7 @@ fi
if [ ! -L "/etc/welcomemail.tmpl" ]; then
ln -s "${DIR}/welcomemail.tmpl" "/etc/welcomemail.tmpl"
fi
if [ ! -L "/etc/newship.tmpl" ]; then
ln -s "${DIR}/newship.tmpl" "/etc/newship.tmpl"
fi

8
newship.tmpl Normal file
View File

@ -0,0 +1,8 @@
Subject: Your new ship/colony/outpost is ready
Hi ~username,
"shipname" has been created and placed in your control. We'll be
listening from Relay One to hear her stories.
~tomasino