1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-22 02:17:26 +00:00

ask the user for inputs

This commit is contained in:
Joshua Tauberer 2013-08-26 21:01:48 +00:00
parent 8ac35be22c
commit c869f67e3d
6 changed files with 51 additions and 19 deletions

15
scripts/add_mail_user.sh Normal file
View File

@ -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

View File

@ -1,6 +0,0 @@
. scripts/system.sh
. scripts/dns.sh
. scripts/mail.sh
. scripts/dkim.sh
. scripts/dns_update.sh

View File

@ -6,7 +6,7 @@
# Install packages. # Install packages.
DEBIAN_FRONTEND=noninteractive apt-get install -q -y \ 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 # POSTFIX

View File

@ -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

30
scripts/start.sh Executable file
View File

@ -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

View File

@ -3,10 +3,6 @@
apt-get -q update apt-get -q update
apt-get -q -y upgrade apt-get -q -y upgrade
# Basic packages.
apt-get -q -y install sqlite3
# Turn on basic services: # Turn on basic services:
# #
# ntp: keeps the system time correct # 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 # 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. # ports will be set up in the scripts that set up those services.
ufw allow ssh if [ -z "$DISABLE_FIREWALL" ]; then
#ufw allow http ufw allow ssh;
#ufw allow https ufw --force enable;
ufw --force enable fi
# Mount the storage volume. # Mount the storage volume.
export STORAGE_ROOT=/home/ubuntu/storage export STORAGE_ROOT=/home/ubuntu/storage