Score:0

Postfix can not open file in home directory

cn flag

I am trying to setup email piping. I've created an alias that pipes the email to a php script where I can do my processing but I keep getting error Could not open input file: /home/domain/public_html/vault/email-reciever.php. I've tried countless permutations of permissions on the file and directories that contain it but none of them made a difference.

If I move my file to /usr/local/bin/ it starts working. It seems postfix can not access files in my /home/ directory? I'm stumped, how do I make this work? Having the file in usr/local/bin is not practical for my, I would much rather have them within a project's folder.


Here's some requested information:

Output of namei -l /home/domain/public_html/vault/email-reciever.php

drwxr-xr-x root     root     /
drwxr-xr-x root     root     home
drwxr-x--- domain   domain   domain
drwxr-x--- domain   domain   public_html
drwxr-xr-x domain   domain   vault
-rwxr-xr-x domain   domain   email-reciever.php

Output of postconf -M

smtp       inet  n       -       y       -       -       smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_security_level=may
pickup     unix  n       -       y       60      1       pickup
cleanup    unix  n       -       y       -       0       cleanup
qmgr       unix  n       -       n       300     1       qmgr
tlsmgr     unix  -       -       y       1000?   1       tlsmgr
rewrite    unix  -       -       y       -       -       trivial-rewrite
bounce     unix  -       -       y       -       0       bounce
defer      unix  -       -       y       -       0       bounce
trace      unix  -       -       y       -       0       bounce
verify     unix  -       -       y       -       1       verify
flush      unix  n       -       y       1000?   0       flush
proxymap   unix  -       -       n       -       -       proxymap
proxywrite unix  -       -       n       -       1       proxymap
smtp       unix  -       -       y       -       -       smtp
relay      unix  -       -       y       -       -       smtp -o syslog_name=postfix/$service_name
showq      unix  n       -       y       -       -       showq
error      unix  -       -       y       -       -       error
retry      unix  -       -       y       -       -       error
discard    unix  -       -       y       -       -       discard
local      unix  -       n       n       -       -       local
virtual    unix  -       n       n       -       -       virtual
lmtp       unix  -       -       y       -       -       lmtp
anvil      unix  -       -       y       -       1       anvil
scache     unix  -       -       y       -       1       scache
postlog    unix-dgram n  -       n       -       1       postlogd
maildrop   unix  -       n       n       -       -       pipe flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
uucp       unix  -       n       n       -       -       pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
ifmail     unix  -       n       n       -       -       pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp      unix  -       n       n       -       -       pipe flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix - n       n       -       2       pipe flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman    unix  -       n       n       -       -       pipe flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py ${nexthop} ${user}
submission inet  n       -       y       -       -       smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_security_level=may
smtps      inet  n       -       y       -       -       smtpd -o smtpd_sasl_auth_enable=yes -o smtpd_tls_security_level=may -o smtpd_tls_wrappermode=yes

SELinux and AppArmor are not installed. If its relevant, I'm using Virtualmin as my server software.

in flag
Please show the permissions. `namei -l /home/domain/public_html/vault/email-reciever.php`
Nikita Kipriyanov avatar
za flag
Please, show the `postconf -M` (`master.cf` contents), and yes, what the permissions are. Maybe your Postfix's daemon that tries to access the script is running in chroot so it doesn't have access to the path where the script lives, or something else like that.
in flag
Is it possible something like SELinux or AppArmor are stopping Postfix from reading files in /home ? ( it wouldn't normally need/want to ) (check system log files?) In other words, you're probably better off moving your email-receiver.php script into e.g. /etc/postfix/something ....
Whip avatar
cn flag
All asked information added to the question.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.