提问人:Bence Csókás 提问时间:11/1/2023 更新时间:11/2/2023 访问量:28
Postfix 管道别名未运行
Postfix pipe alias not getting run
问:
我想运行一个脚本,每当有人向我的 ArchLinux 服务器上的特定邮箱发送邮件时,该脚本就会执行。从我所读到的内容来看,我需要 Postfix 和一个文件,所以这就是我安装的。但是,我的脚本没有运行(临时文件没有被创建,请参阅下面的脚本),即使 Postfix 说它已交付给它(请参阅下面的系统日志)。主机名和帐户名称已被编辑,所有评论行也已编辑。我将Microsoft和Gmail列入白名单,这些IP我也保留在这里。alias
我:/etc/postfix/aliases
root: bence98
MAILER-DAEMON: postmaster
postmaster: root
# ... a whole bunch of default mappings to `root`
mymbox: |/usr/local/bin/my-script
我:/etc/postfix/main.cf
compatibility_level = 3.8
queue_directory = /var/spool/postfix
command_directory = /usr/bin
daemon_directory = /usr/lib/postfix/bin
data_directory = /var/lib/postfix
mail_owner = postfix
# setting this didn't help either
# scriptaccount is a normal user
default_privs = scriptaccount
# this is my correct public DNS
myhostname = my.public.domain.tld
unknown_local_recipient_reject_code = 550
mynetworks = 127.0.0.0/8 <local subnet> [::1]/128 [fe80::]/64 40.107.0.0/16 209.85.128.0/17
alias_database = $alias_maps
我/etc/postfix/master.cf
smtp inet n - n - - smtpd
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr unix n - n 300 1 qmgr
#qmgr unix n - n 300 1 oqmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
postlog unix-dgram n - n - 1 postlogd
/usr/local/bin/my-script
:
#!/bin/sh
echo "Execed as $USER" >/tmp/mail.log
cat >/tmp/incoming.eml
输出到 syslog:
postfix/qmgr[3476413]: 08571843540: from=<[email protected]>, size=7662, nrcpt=1 (queue active)
postfix/local[3476483]: 08571843540: to=<[email protected]>, relay=local, delay=0.06, delays=0.05/0.01/0/0, dsn=2.0.0, status=sent (delivered to command: /usr/local/bin/my-script)
postfix/qmgr[3476413]: 08571843540: removed
postfix/smtpd[3476466]: disconnect from mail-db3eur04on2105.outbound.protection.outlook.com[40.107.6.105] ehlo=1 mail=1 rcpt=1 bdat=1 quit=1 commands=5
答:
0赞
Bence Csókás
11/2/2023
#1
出于某种原因,即使所有配置文件都说不要chroot守护程序,systemd还是决定将其chroot到.在那里,我找到了我的文件。local
/tmp/systemd-private-*-postfix.service-*/
评论