V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ViYun
V2EX  ›  问与答

请教大家:我有一台 postfix 邮件服务器,如何禁止 telnet 登录发送邮件

  •  
  •   ViYun · 2016-10-29 23:53:00 +08:00 · 3557 次点击
    这是一个创建于 2729 天前的主题,其中的信息可能已经有所发展或是发生改变。
    譬如邮件服务器域名为 example.com
    设置了
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    smtpd_sasl_local_domain = $myhostname
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions =
    permit_sasl_authenticated,
    permit_mynetworks,
    check_relay_domains

    但是在其他机器上 telnet example.com 25 是可以登录并且能发送邮件给本域名下所有用户,如 [email protected]
    我如何才能禁止他登录发送这样的邮件,并且本机可以发送接收邮件。
    第 1 条附言  ·  2016-10-30 02:25:33 +08:00
    譬如 postfix 服务器 example.com

    $ telnet example.com 25
    220 example ESMTP Postfix
    $ mail from:postfix
    250 2.1.0 Ok
    $ rcpt to:root
    250 2.1.5 Ok
    $ data
    354 End data with <CR><LF>.<CR><LF>
    $ This is a test message for postfix
    .
    250 2.0.0 Ok: queued as E1CFE413F

    如何禁止此操作。
    4 条回复    2016-10-30 18:06:28 +08:00
    Citrus
        1
    Citrus  
       2016-10-30 01:19:26 +08:00 via iPhone   ❤️ 1
    直接监听 127.0.0.1 不就好了?
    ViYun
        2
    ViYun  
    OP
       2016-10-30 02:17:21 +08:00
    @Citrus 你说的是将 inet_interfaces = all 设置成 inet_interfaces = 127.0.0.1, localhost 吧
    如果是这样,服务器将收不到任何其他域的邮件了。
    wevsty
        3
    wevsty  
       2016-10-30 03:08:08 +08:00   ❤️ 1
    楼主的需求是矛盾的
    如果不允许外网 telnet 25 端口,那么楼主肯定不能收信
    如果要收信就必须允许外网向内网发送邮件,那就是楼主提到的那一系列指令。 SMTP 协议就是这样传输邮件的,想禁止 SMTP 协议又能收到邮件这个事情是矛盾的。
    如果只是想阻止某个用户收到邮件可以设置邮件过滤,如果想阻止某个 ip 可以 iptables 屏蔽,如果想阻止不固定的 IP 向内网用户发送邮件也可以按照域名屏蔽邮件。如果这些都满足不了需求,那还是干脆关了端口得了。
    bigpigeon
        4
    bigpigeon  
       2016-10-30 18:06:28 +08:00   ❤️ 1
    我记得鸟哥私房菜有讲,装个登录验证的,不过我还是建议你用这个 https://github.com/tomav/docker-mailserver
    一部搞定,不过如果是有大量发送需求还是用 edm 把,也可以用 Amazon 的 ses 发送
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2949 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 03:44 · PVG 11:44 · LAX 20:44 · JFK 23:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.