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

create an no-reply user to use with SMTP from ownCloud

This commit is contained in:
jkaberg 2014-08-12 10:09:44 +02:00
parent 17c4edb58d
commit a6ba2da68b
2 changed files with 17 additions and 13 deletions

View File

@ -41,23 +41,20 @@ $CONFIG = array (
"memcached_servers" => array (
array('localhost', 11211),
),
'mail_smtpmode' => 'smtp',
'mail_smtpsecure' => 'ssl',
'mail_from_address' => 'no-reply@$PRIMARY_HOSTNAME',
'mail_domain' => '$PRIMARY_HOSTNAME',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpauth' => true,
'mail_smtphost' => 'localhost',
'mail_smtpport' => '587',
'mail_smtpname' => 'no-reply@$PRIMARY_HOSTNAME',
'mail_smtppassword' => '$SECRET_PASSWORD',
);
?>
EOF
fi
# TODO: Insert the following above (owncloud config generation) when we found a good solution:
# 'mail_smtpmode' => 'smtp',
# 'mail_smtpsecure' => 'ssl',
# 'mail_from_address' => '**** need to figure this one out, nornamly: <user>@<domain>.<tld> ****',
# 'mail_domain' => '**** need to figure this one out, nornamly: <domain>.<tld> ****',
# 'mail_smtpauthtype' => 'LOGIN',
# 'mail_smtpauth' => true,
# 'mail_smtphost' => 'localhost',
# 'mail_smtpport' => '587',
# 'mail_smtpname' => '**** need to figure this one out, nornamly: <user>@<domain>.<tld> ****',
# 'mail_smtppassword' => '**** need to figure this one out ****',
# Set permissions
mkdir -p $STORAGE_ROOT/owncloud
chown -R www-data.www-data $STORAGE_ROOT/owncloud /usr/local/lib/owncloud

View File

@ -250,11 +250,15 @@ if [ -z "$STORAGE_ROOT" ]; then
chown $STORAGE_USER.$STORAGE_USER $STORAGE_ROOT/mailinabox.version
fi
# Generate a secret password to use with no-reply user (mainly for ownCloud SMTP atm)
SECRET_PASSWORD=$(dd if=/dev/random bs=20 count=1 2>/dev/null | base64 | fold -w 24 | head -n 1)
# Save the global options in /etc/mailinabox.conf so that standalone
# tools know where to look for data.
cat > /etc/mailinabox.conf << EOF;
STORAGE_USER=$STORAGE_USER
STORAGE_ROOT=$STORAGE_ROOT
SECRET_PASSWORD=$SECRET_PASSWORD
PRIMARY_HOSTNAME=$PRIMARY_HOSTNAME
PUBLIC_IP=$PUBLIC_IP
PUBLIC_IPV6=$PUBLIC_IPV6
@ -319,5 +323,8 @@ if [ -z "`tools/mail.py user`" ]; then
# Create an alias to which we'll direct all automatically-created administrative aliases.
tools/mail.py alias add administrator@$PRIMARY_HOSTNAME $EMAIL_ADDR
# Create an no-reply user to use with ownCloud
tools/mail.py user add no-reply@$PRIMARY_HOSTNAME $SECRET_PASSWORD
fi