禁止telnet和ssh中的client dnsname 反向解析

You can disable reverse DNS lookups for all incoming telnet connections by putting this as the first uncommented line in /etc/hosts.allow

in.telnetd: ALL

You can also be more selective, and cause the reverse lookups only to happen for certain hosts:

in.telnetd: 137.22.

The reason that reverse DNS lookups are being done at all is that the TCP Wrappers are trying to find out if access is allowed, and will collect what information they need to determine this - the ALL: PARANOID rule in /etc/hosts.deny denies access to machines without a resolvable DNS address, so if the wrappers get that far in determining whether or not to grant access, a reverse DNS query will be generated. The suggested lines in /etc/hosts.allow let the tcp wrappers decide to give a host telnet access before getting to that rule, so a reverse DNS query is never necessary.

For SSH

Edit /etc/ssh/sshd_config file and add following option:

UseDNS no

In order to remove dns lookups completely, you have to use -u0 options when starting sshd server. You can easily add this options to /etc/default/ssh or /etc/sysconfig/sshd or elsewhere suitable for your distribution.

Notes:

Reverse DNS lookups are not made by telnetd but by tcpd.

man tcpd

HOST NAME VERIFICATION
  The authentication scheme of some protocols (rlogin,  rsh)
  relies  on  host  names.  Some implementations believe the
  host name that they get from any random name server; other
  implementations  are  more  careful but use a flawed algo­
  rithm.

  tcpd verifies the client host name that is returned by the
  address->name  DNS  server by looking at the host name and
  address that are returned by the name->address DNS server.
  If  any discrepancy is detected, tcpd concludes that it is
  dealing with a host that pretends to  have  someone  elses
  host name.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值