mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Tweaking postfix regen-conf to handle postsrsd conf
This commit is contained in:
parent
240158ffaf
commit
b1fdb39880
2 changed files with 54 additions and 1 deletions
|
@ -10,15 +10,25 @@ do_pre_regen() {
|
||||||
postfix_dir="${pending_dir}/etc/postfix"
|
postfix_dir="${pending_dir}/etc/postfix"
|
||||||
mkdir -p "$postfix_dir"
|
mkdir -p "$postfix_dir"
|
||||||
|
|
||||||
|
default_dir="${pending_dir}/etc/default/"
|
||||||
|
mkdir -p "$default_dir"
|
||||||
|
|
||||||
# install plain conf files
|
# install plain conf files
|
||||||
cp plain/* "$postfix_dir"
|
cp plain/* "$postfix_dir"
|
||||||
|
|
||||||
# prepare main.cf conf file
|
# prepare main.cf conf file
|
||||||
main_domain=$(cat /etc/yunohost/current_host)
|
main_domain=$(cat /etc/yunohost/current_host)
|
||||||
|
domain_list=$(sudo yunohost domain list --output-as plain --quiet)
|
||||||
|
|
||||||
cat main.cf \
|
cat main.cf \
|
||||||
| sed "s/{{ main_domain }}/${main_domain}/g" \
|
| sed "s/{{ main_domain }}/${main_domain}/g" \
|
||||||
> "${postfix_dir}/main.cf"
|
> "${postfix_dir}/main.cf"
|
||||||
|
|
||||||
|
cat postsrsd \
|
||||||
|
| sed "s/{{ main_domain }}/${main_domain}/g" \
|
||||||
|
| sed "s/{{ domain_list }}/${domain_list}/g" \
|
||||||
|
> "${default_dir}/postsrsd"
|
||||||
|
|
||||||
# adapt it for IPv4-only hosts
|
# adapt it for IPv4-only hosts
|
||||||
if [ ! -f /proc/net/if_inet6 ]; then
|
if [ ! -f /proc/net/if_inet6 ]; then
|
||||||
sed -i \
|
sed -i \
|
||||||
|
@ -34,7 +44,7 @@ do_post_regen() {
|
||||||
regen_conf_files=$1
|
regen_conf_files=$1
|
||||||
|
|
||||||
[[ -z "$regen_conf_files" ]] \
|
[[ -z "$regen_conf_files" ]] \
|
||||||
|| sudo service postfix restart
|
|| { sudo service postfix restart && sudo service postsrsd restart }
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCE=${2:-0}
|
FORCE=${2:-0}
|
||||||
|
|
43
data/templates/postfix/postsrsd
Normal file
43
data/templates/postfix/postsrsd
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# Default settings for postsrsd
|
||||||
|
|
||||||
|
# Local domain name.
|
||||||
|
# Addresses are rewritten to originate from this domain. The default value
|
||||||
|
# is taken from `postconf -h mydomain` and probably okay.
|
||||||
|
#
|
||||||
|
SRS_DOMAIN={{ main_domain }}
|
||||||
|
|
||||||
|
# Exclude additional domains.
|
||||||
|
# You may list domains which shall not be subjected to address rewriting.
|
||||||
|
# If a domain name starts with a dot, it matches all subdomains, but not
|
||||||
|
# the domain itself. Separate multiple domains by space or comma.
|
||||||
|
# We have to put some "dummy" stuff at start and end... see this comment :
|
||||||
|
# https://github.com/roehling/postsrsd/issues/64#issuecomment-284003762
|
||||||
|
SRS_EXCLUDE_DOMAINS=dummy {{ domain_list }} dummy
|
||||||
|
|
||||||
|
# First separator character after SRS0 or SRS1.
|
||||||
|
# Can be one of: -+=
|
||||||
|
SRS_SEPARATOR==
|
||||||
|
|
||||||
|
# Secret key to sign rewritten addresses.
|
||||||
|
# When postsrsd is installed for the first time, a random secret is generated
|
||||||
|
# and stored in /etc/postsrsd.secret. For most installations, that's just fine.
|
||||||
|
#
|
||||||
|
SRS_SECRET=/etc/postsrsd.secret
|
||||||
|
|
||||||
|
# Local ports for TCP list.
|
||||||
|
# These ports are used to bind the TCP list for postfix. If you change
|
||||||
|
# these, you have to modify the postfix settings accordingly. The ports
|
||||||
|
# are bound to the loopback interface, and should never be exposed on
|
||||||
|
# the internet.
|
||||||
|
#
|
||||||
|
SRS_FORWARD_PORT=10001
|
||||||
|
SRS_REVERSE_PORT=10002
|
||||||
|
|
||||||
|
# Drop root privileges and run as another user after initialization.
|
||||||
|
# This is highly recommended as postsrsd handles untrusted input.
|
||||||
|
#
|
||||||
|
RUN_AS=postsrsd
|
||||||
|
|
||||||
|
# Jail daemon in chroot environment
|
||||||
|
CHROOT=/var/lib/postsrsd
|
||||||
|
|
Loading…
Add table
Reference in a new issue