无法为nodemailer正确配置iptables

时间:2018-06-17 11:58:16

标签: node.js gmail ubuntu-16.04 iptables nodemailer

我坚持发送邮件的问题...... 我有一台运行Ubuntu 16.04的服务器,在这台服务器上,我运行(pm2}一个node.js服务器。我要求时,此服务器必须向我发送电子邮件。工作正常,但后来我配置了iptables,现在nodejs服务器不再发送邮件了...... 我配置了像这样的iptables:

Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ftp-data
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ftp
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:smtp
ACCEPT     icmp --  anywhere             anywhere

Chain FORWARD (policy DROP)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp flags:FIN,SYN,RST,ACK/SYN limit: avg 1/sec burst 5
ACCEPT     udp  --  anywhere             anywhere             limit: avg 1/sec burst 5
ACCEPT     icmp --  anywhere             anywhere             icmp echo-request limit: avg 1/sec burst 5
ACCEPT     tcp  --  anywhere             anywhere             tcp flags:FIN,SYN,RST,ACK/RST limit: avg 1/sec burst 5

Chain OUTPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
ACCEPT     all  --  anywhere             anywhere
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:http
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:https
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ftp-data
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ftp
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ssh
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:smtp
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:ntp
ACCEPT     icmp --  anywhere             anywhere

当我接受所有输出(iptables -P OUTPUT ACCEPT)时,邮件被正确发送,所以我认为问题出在链OUTPUT的某个地方,但我找不到它。我在互联网上尝试了很多解决方案,但在我的情况下没有人工作。 另外,我使用nodemailer发送邮件,并使用gmail作为服务。 这是我的电子邮件配置:

module.exports = {
    config: {

        service: 'gmail',
        secure: false,
        auth: {
            user: 'my.sender.adress@gmail.com',
            pass: '********'
        },
        tls: {
            rejectUnauthorized: false
        }
    },
    receiver: "my.personnal.adress@gmail.com"
};

我希望在这一点上有人会比我更清楚...... 感谢阅读,祝你有愉快的一天!

0 个答案:

没有答案