ask the user for inputs
This commit is contained in:
parent
8ac35be22c
commit
c869f67e3d
|
@ -0,0 +1,15 @@
|
|||
EMAIL_ADDR=$1
|
||||
if [ -z "$EMAIL_ADDR" ]; then
|
||||
echo
|
||||
echo "Set up your first email account..."
|
||||
read -e -i "user@`hostname`" -p "Email Address: " EMAIL_ADDR
|
||||
fi
|
||||
|
||||
EMAIL_PW=$2
|
||||
if [ -z "$EMAIL_PW" ]; then
|
||||
read -e -p "Email Password: " EMAIL_PW
|
||||
fi
|
||||
|
||||
echo "INSERT INTO users (email, password) VALUES ('$EMAIL_ADDR', '`sudo doveadm pw -s SHA512-CRYPT -p $EMAIL_PW`');" \
|
||||
| sqlite3 $STORAGE_ROOT/mail/users.sqlite
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
. scripts/system.sh
|
||||
. scripts/dns.sh
|
||||
. scripts/mail.sh
|
||||
. scripts/dkim.sh
|
||||
. scripts/dns_update.sh
|
||||
|
|
@ -6,12 +6,12 @@
|
|||
# Install packages.
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -q -y \
|
||||
postfix postgrey dovecot-core dovecot-imapd dovecot-lmtpd dovecot-sqlite
|
||||
postfix postgrey dovecot-core dovecot-imapd dovecot-lmtpd dovecot-sqlite sqlite3
|
||||
|
||||
# POSTFIX
|
||||
|
||||
mkdir -p $STORAGE_ROOT/mail
|
||||
|
||||
|
||||
# TLS configuration
|
||||
sed -i "s/#submission/submission/" /etc/postfix/master.cf # enable submission port (not in Drew Crawford's instructions)
|
||||
tools/editconf.py /etc/postfix/main.cf \
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
# Create a test user: testuser@testdomain.com with password "testpw"
|
||||
echo "INSERT INTO users (email, password) VALUES ('testuser@testdomain.com', '`sudo doveadm pw -s SHA512-CRYPT -p testpw`');" | sqlite3 storage/mail/users.sqlite
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
if [ -z "$PUBLIC_HOSTNAME" ]; then
|
||||
echo
|
||||
echo "Enter the hostname you want to assign to this machine."
|
||||
echo "We've guessed a value. Just backspace it if it's wrong."
|
||||
echo "Josh uses box.occams.info as his hostname. Yours should"
|
||||
echo "be similar."
|
||||
read -e -i "`hostname`" -p "Hostname: " PUBLIC_HOSTNAME
|
||||
fi
|
||||
|
||||
if [ -z "$PUBLIC_IP" ]; then
|
||||
echo
|
||||
echo "Enter the public IP address of this machine, as given to"
|
||||
echo "you by your ISP. We've guessed a value, but just backspace"
|
||||
echo "it if it's wrong."
|
||||
read -e -i "`hostname -i`" -p "Public IP: " PUBLIC_IP
|
||||
fi
|
||||
|
||||
if [ -z "$STORAGE_ROOT" ]; then
|
||||
if [ ! -d /home/user-data ]; then useradd -m user-data; fi
|
||||
STORAGE_ROOT=/home/user-data
|
||||
fi
|
||||
|
||||
. scripts/system.sh
|
||||
. scripts/dns.sh
|
||||
. scripts/mail.sh
|
||||
. scripts/dkim.sh
|
||||
. scripts/spamassassin.sh
|
||||
. scripts/dns_update.sh
|
||||
. scripts/add_mail_user.sh
|
||||
. scripts/users_update.sh
|
|
@ -3,10 +3,6 @@
|
|||
apt-get -q update
|
||||
apt-get -q -y upgrade
|
||||
|
||||
# Basic packages.
|
||||
|
||||
apt-get -q -y install sqlite3
|
||||
|
||||
# Turn on basic services:
|
||||
#
|
||||
# ntp: keeps the system time correct
|
||||
|
@ -19,10 +15,10 @@ apt-get install -q -y ntp fail2ban
|
|||
|
||||
# Turn on the firewall. First allow incoming SSH, then turn on the firewall. Additional open
|
||||
# ports will be set up in the scripts that set up those services.
|
||||
ufw allow ssh
|
||||
#ufw allow http
|
||||
#ufw allow https
|
||||
ufw --force enable
|
||||
if [ -z "$DISABLE_FIREWALL" ]; then
|
||||
ufw allow ssh;
|
||||
ufw --force enable;
|
||||
fi
|
||||
|
||||
# Mount the storage volume.
|
||||
export STORAGE_ROOT=/home/ubuntu/storage
|
||||
|
|
Loading…
Reference in New Issue