Skip to content

Instantly share code, notes, and snippets.

@Kloadut
Forked from TheConstructor/inetd.conf
Created February 19, 2014 12:56
Show Gist options
  • Save Kloadut/9091405 to your computer and use it in GitHub Desktop.
Save Kloadut/9091405 to your computer and use it in GitHub Desktop.
# 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
# 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
#!/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
#!/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