Closed zhavranek closed 5 years ago
Hm, I tried to reproduce any problems, but for me, PostSRSd behaves exactly the same, regardless of trailing whitespace or commas. Can you give me more details about your setup?
Would it be possible to provide all local domains from a mysql table to SRS_EXCLUDE_DOMAINS
?
Or maybe using a flat file passed as SRS_EXCLUDE_DOMAINS=/etc/postfix/srs_excluded
populated from an SQL query and updated via a cronjob.
I'm also trying to exclude some domains from being rewrited without using postforward
This would make it much more scalable then using a flat file
Actually I've found #42, which seem to work as I expect. Thanks
Without last "," (or space " " maybe) postsrsd ignore last "example.org" without first dot.
if I run "ps -ax", I must see space before ending quotes. Without these space postsrsd ignore last domain in -X
/usr/sbin/postsrsd -f 10001 -r 10002 -d zskratka.cz -s /etc/postsrsd.secret -a = -n 4 -N 4 -u nobody -c /usr/lib/postsrsd -X".zskratka.cz zskratka.cz "
CentOS 7, SELINUX=permissive cmake -DCMAKE_INSTALL_PREFIX=/usr -DUSE_SELINUX=ON ../
1.4 postfix-2.10.1-6.el7.x86_64
I'm testing iRedMail.org
sender_canonical_maps = tcp:localhost:10001 sender_canonical_classes = envelope_sender recipient_canonical_maps = tcp:localhost:10002 recipient_canonical_classes= envelope_recipient,header_recipient
SRS_DOMAIN=zskratka.cz 14c14 < #SRS_EXCLUDE_DOMAINS=.example.com,example.org
SRS_EXCLUDE_DOMAINS=.zskratka.cz,zskratka.cz,
Same problem here on 1.4#11d04014fae2cf25f6ab0b6957b55e05add79f33 compiled under debian jessie
A trailing , fixes it!
This solution does only work partly for me. When I put a trailing comma to SRS_EXCLUDE_DOMAINS , all but the first domain will be excluded. The problem in my case seems the leading and trailing quotes in
postsrsd -X".example.com example.com"
In order to fix this I needed to remove the leading and trailing quotes from optarg if there are any:
325c325,335
< tmp = strtok(optarg, ",; \t\r\n");
---
> char *exc = strdup(optarg);
> int i, len = i = strlen(exc);
> if (exc[0] == '"') {
> for (i = 1; i < len - 1; i++) {
> exc[i - 1] = exc[i];
> }
> }
> if (exc[len - 1] == '"') {
> exc[i - 1] = '\0';
> }
> tmp = strtok(exc, ",; \t\r\n");
The problem is that systemd doesn't remove the double quotes because the opening quotes have to appear at the beginning of a word.
Thus the line https://github.com/roehling/postsrsd/blob/7d16fd13acb487840f8c26af9ed52d6f4a6511e6/init/postsrsd.systemd.in#L20
should be:
ExecStart=@CMAKE_INSTALL_PREFIX@/sbin/@POSTSRSD@ -f "${SRS_FORWARD_PORT}" -r "${SRS_REVERSE_PORT}" -d "${SRS_DOMAIN}" -s "${SRS_SECRET}" -a "${SRS_SEPARATOR}" -n "${SRS_HASHLENGTH}" -N "${SRS_HASHMIN}" -u "${RUN_AS}" -l "${SRS_LISTEN_ADDR}" -c "${CHROOT}" "-X${SRS_EXCLUDE_DOMAINS}"
Hi. I test SRS_EXCLUDE_DOMAINS settings and I found then it needs trailing comma (or space maybe). Correct example is:
SRS_EXCLUDE_DOMAINS=.example.com,example.org,
I think SRS_EXCLUDE_DOMAINS can be used to good operating postsrsd without need postforward. I can here simply enumerate all domains of my local users.