Minor and temp. workaround for panel
parent
686df83a34
commit
53b6662aea
|
@ -1,91 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Postfix smtp_tls_security_level should be set to "may" to try an
|
||||
# encrypted connection.
|
||||
|
||||
if [ "$EUID" -ne 0 ]
|
||||
then echo "Please run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Find script directory and move to base directory of mailcow-dockerized
|
||||
# so docker-compose is executed from the right location
|
||||
DIR=$(echo $( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | sed 's/data\/misc.*//')
|
||||
cd $DIR
|
||||
|
||||
if [[ ${1} == "reset" ]]; then
|
||||
# Reset modified values to their defaults
|
||||
sed -i "s/^relayhost\ \=.*/relayhost\ \=/" data/conf/postfix/main.cf
|
||||
sed -i "s/^smtp\_sasl\_password\_maps.*/smtp\_sasl\_password\_maps\ \=/" data/conf/postfix/main.cf
|
||||
sed -i "s/^smtp\_sasl\_security\_options.*/smtp\_sasl\_security\_options\ \=\ noplaintext\,\ noanonymous/" data/conf/postfix/main.cf
|
||||
sed -i "s/^smtp\_sasl\_auth\_enable.*/smtp\_sasl\_auth\_enable\ \=\ no/" data/conf/postfix/main.cf
|
||||
# Also delete the plaintext password file
|
||||
rm -f data/conf/postfix/smarthost_passwd*
|
||||
docker-compose exec postfix-mailcow postfix reload
|
||||
# Exit last exit code
|
||||
exit $?
|
||||
elif [[ ${1} == "restore-string" ]]; then
|
||||
# Set parameter value of smtp_sasl_password_maps
|
||||
SMTPSASLPWDMAP="data/conf/postfix/smarthost_passwd"
|
||||
# Get parameter value of relayhost
|
||||
RELAYHOSTCFG=$(grep "relayhost\ =" data/conf/postfix/main.cf | awk '{print $3}')
|
||||
# Exit if empty/unset
|
||||
[[ -z ${RELAYHOSTCFG} ]] && exit 0
|
||||
# Replace ':' by ' ' (white space)
|
||||
RELAYHOSTCFG=${RELAYHOSTCFG//\:/ }
|
||||
# Replace '[' by '' (empty)
|
||||
RELAYHOSTCFG=${RELAYHOSTCFG//\[/}
|
||||
# Replace ']' by '' (empty) and create array of result
|
||||
RELAYHOSTCFGARR=(${RELAYHOSTCFG//\]/})
|
||||
# Get 'username:password' from SASL password maps
|
||||
# Grep relayhost without port and '[', ']' or ':' from SASL password map file without map type (e.g. 'hash:')
|
||||
USRPWD=$(grep ${RELAYHOSTCFGARR[0]} $SMTPSASLPWDMAP | awk {'print $2'})
|
||||
# Replace ':' by ' ' and create array of result
|
||||
USRPWDARR=(${USRPWD//:/ })
|
||||
# Echo script name, all values in RELAYHOSTCFGARR, first and second value in USRPWDARR
|
||||
# Why?
|
||||
# Host and port are required, so we can print the whole array RELAYHOSTCFGARR.
|
||||
# Password might be empty, so we print them separately.
|
||||
echo ${0} ${RELAYHOSTCFGARR[@]} \'${USRPWDARR[0]}\' \'${USRPWDARR[1]}\'
|
||||
exit 0
|
||||
elif [[ -z ${1} ]] || [[ -z ${2} ]]; then
|
||||
# Exit with code 1 if host and port are missing
|
||||
echo "Usage: ${0} relayhost port (username) (password)"
|
||||
echo "Username and password are optional parameters."
|
||||
exit 1
|
||||
else
|
||||
# Try a simple connection to host:port but don't recieve any data
|
||||
# Abort after 3 seconds
|
||||
if ! nc -z -v -w3 ${1} ${2} 2>/dev/null; then
|
||||
echo "Connection to relayhost ${1} failed, aborting..."
|
||||
exit 1
|
||||
fi
|
||||
# Use exact hostname as relayhost, don't lookup the MX record of relayhost
|
||||
sed -i "s/relayhost\ \=.*/relayhost\ \=\ \[${1}\]\:${2}/" data/conf/postfix/main.cf
|
||||
if grep -q "smtp_sasl_password_maps" data/conf/postfix/main.cf
|
||||
then
|
||||
sed -i "s/^smtp\_sasl\_password\_maps.*/smtp\_sasl\_password\_maps\ \=\ hash\:\/opt\/postfix\/conf\/smarthost\_passwd/" data/conf/postfix/main.cf
|
||||
else
|
||||
echo "smtp_sasl_password_maps = hash:/opt/postfix/conf/smarthost_passwd" >> data/conf/postfix/main.cf
|
||||
fi
|
||||
if grep -q "smtp_sasl_auth_enable" data/conf/postfix/main.cf
|
||||
then
|
||||
sed -i "s/^smtp\_sasl\_auth\_enable.*/smtp\_sasl\_auth\_enable\ \=\ yes/" data/conf/postfix/main.cf
|
||||
else
|
||||
echo "smtp_sasl_auth_enable = yes" >> data/conf/postfix/main.cf
|
||||
fi
|
||||
if grep -q "smtp_sasl_security_options" data/conf/postfix/main.cf
|
||||
then
|
||||
sed -i "s/^smtp\_sasl\_security\_options.*/smtp\_sasl\_security\_options\ \=/" data/conf/postfix/main.cf
|
||||
else
|
||||
echo "smtp_sasl_security_options =" >> data/conf/postfix/main.cf
|
||||
fi
|
||||
if [[ ! -z ${3} ]]; then
|
||||
echo ${1} ${3}:${4} > data/conf/postfix/smarthost_passwd
|
||||
docker-compose exec postfix-mailcow postmap /opt/postfix/conf/smarthost_passwd
|
||||
fi
|
||||
docker-compose exec postfix-mailcow chown root:postfix /opt/postfix/conf/smarthost_passwd /opt/postfix/conf/smarthost_passwd.db
|
||||
docker-compose exec postfix-mailcow chmod 660 /opt/postfix/conf/smarthost_passwd /opt/postfix/conf/smarthost_passwd.db
|
||||
docker-compose exec postfix-mailcow postfix reload
|
||||
exit $?
|
||||
fi
|
|
@ -183,11 +183,11 @@ $tfa_data = get_tfa();
|
|||
</div>
|
||||
|
||||
<h4><span class="glyphicon glyphicon-wrench" aria-hidden="true"></span> <?=$lang['admin']['configuration'];?></h4>
|
||||
|
||||
<div class="panel-group" id="accordion_access">
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><?=$lang['admin']['dkim_keys'];?></div>
|
||||
<div id="collapseDKIM" class="panel-collapse">
|
||||
<div class="panel-body">
|
||||
<p style="margin-bottom:40px"><?=$lang['admin']['dkim_key_hint'];?></p>
|
||||
<?php
|
||||
|
@ -299,13 +299,9 @@ $tfa_data = get_tfa();
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div style="cursor:pointer;" class="panel-heading" data-toggle="collapse" data-parent="#accordion_access" data-target="#collapseForwardingHosts">
|
||||
<span class="accordion-toggle"><?=$lang['admin']['forwarding_hosts'];?></span>
|
||||
</div>
|
||||
<div id="collapseForwardingHosts" class="panel-collapse collapse">
|
||||
<div class="panel-heading"><?=$lang['admin']['forwarding_hosts'];?></div>
|
||||
<div class="panel-body">
|
||||
<p style="margin-bottom:40px"><?=$lang['admin']['forwarding_hosts_hint'];?></p>
|
||||
<form method="post">
|
||||
|
@ -349,9 +345,8 @@ $tfa_data = get_tfa();
|
|||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<small>
|
||||
<legend><?=$lang['admin']['add_forwarding_host'];?></legend>
|
||||
<p style="margin-bottom:10px"><?=$lang['admin']['forwarding_hosts_add_hint'];?></p>
|
||||
<p class="help-block"><?=$lang['admin']['forwarding_hosts_add_hint'];?></p>
|
||||
<form class="form-horizontal" role="form" method="post">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-sm-2" for="hostname"><?=$lang['edit']['host'];?>:</label>
|
||||
|
@ -365,10 +360,9 @@ $tfa_data = get_tfa();
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div> <!-- /container -->
|
||||
|
|
|
@ -3,7 +3,7 @@ function init_db_schema() {
|
|||
try {
|
||||
global $pdo;
|
||||
|
||||
$db_version = "20042017_1926";
|
||||
$db_version = "23042017_1807";
|
||||
|
||||
$stmt = $pdo->query("SHOW TABLES LIKE 'versions'");
|
||||
$num_results = count($stmt->fetchAll(PDO::FETCH_ASSOC));
|
||||
|
|
Loading…
Reference in New Issue