-
-
Save baudetail/b2f58ad2cb34d70453313c921712024b to your computer and use it in GitHub Desktop.
Postfix SRS-support under Debian "Wheezy".
Using http://packages.debian.org/wheezy/srs, http://packages.debian.org/wheezy/liburi-perl and http://packages.debian.org/wheezy/openbsd-inetd File paths are:
- /opt/srs/srs-encode.sh
- /opt/srs/srs-decode.sh
- /etc/inetd.conf (should be appended to)
- /etc/postfix/main.cf (should be appended to)
- /etc…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SRS | |
127.0.0.1:10001 stream tcp nowait root /opt/srs/srs-encode.sh /opt/srs/srs-encode.sh | |
127.0.0.1:10002 stream tcp nowait root /opt/srs/srs-decode.sh /opt/srs/srs-decode.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SRS | |
recipient_canonical_maps = proxy:hash:/etc/postfix/pfix-srs.norewrite, proxy:tcp:127.0.0.1:10002 | |
recipient_canonical_classes = envelope_recipient | |
sender_canonical_maps = proxy:hash:/etc/postfix/pfix-srs.norewrite, proxy:tcp:127.0.0.1:10001 | |
sender_canonical_classes = envelope_sender |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# We want to be shure not to rewrite these | |
# For vom.tc | |
[email protected] [email protected] | |
[email protected] [email protected] | |
[email protected] [email protected] | |
# For pinch.vom.tc | |
[email protected] [email protected] | |
[email protected] [email protected] | |
[email protected] [email protected] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while read line; do | |
email="${line#get }" | |
email="$(perl -MURI::Escape -e 'print uri_unescape($ARGV[0]);' "${email}")" | |
if [[ "${line}" == "${email}" ]]; then | |
echo "400 Empty input" | |
else | |
unset t_std t_err t_ret | |
eval "$( srs --secretfile=/etc/postfix/srs.secrets --reverse "${email}" 2> >(t_err=$(cat); typeset -p t_err) > >(t_std=$(cat); typeset -p t_std); t_ret=$?; typeset -p t_ret )" | |
if [[ $t_ret -eq 0 ]]; then | |
echo "200 $(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "${t_std}")" | |
else | |
echo "500 $(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "${t_err}")" | |
fi | |
fi | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while read line; do | |
email="${line#get }" | |
email="$(perl -MURI::Escape -e 'print uri_unescape($ARGV[0]);' "${email}")" | |
if [[ "${line}" == "${email}" ]]; then | |
echo "400 Empty input" | |
else | |
unset t_std t_err t_ret | |
if [[ "${email}" =~ @(vom\.tc|pinch\.vom\.tc)$ ]]; then | |
t_err="${email}" | |
t_ret=1 | |
else | |
eval "$( srs --alias=vom.tc --secretfile=/etc/postfix/srs.secrets "${email}" 2> >(t_err=$(cat); typeset -p t_err) > >(t_std=$(cat); typeset -p t_std); t_ret=$?; typeset -p t_ret )" | |
fi | |
if [[ $t_ret -eq 0 ]]; then | |
echo "200 $(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "${t_std}")" | |
else | |
echo "500 $(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "${t_err}")" | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment