nerdexam
Red_Hat

RH302 · Question #129

Configure to match following conditions. i. Deny the ssh from outside the example.com domain members. ii. If any denied hosts tried for ssh then send the information through mail with client;s…

1. Edit /etc/hosts.deny to deny ssh from outside example.com and log attempts: sshd:ALL EXCEPT .example.com: spawn echo "Logging attempt from %c to %s" | mail -s "Login from denied hosts" root Explanation: We can secure services using tcp_wrappers, which use /etc/hosts.allow…

Security

Question

Configure to match following conditions. i. Deny the ssh from outside the example.com domain members. ii. If any denied hosts tried for ssh then send the information through mail with client;s information.

Explanation

  1. Edit /etc/hosts.deny to deny ssh from outside example.com and log attempts: sshd:ALL EXCEPT .example.com: spawn echo "Logging attempt from %c to %s" | mail -s "Login from denied hosts" root

Explanation: We can secure services using tcp_wrappers, which use /etc/hosts.allow and /etc/hosts.deny. Access checking proceeds in three stages:

  1. Is access explicitly permitted in /etc/hosts.allow?
  2. Otherwise, is access explicitly denied in /etc/hosts.deny?
  3. Otherwise, by default, permit access if neither condition matched. To deny services, configure /etc/hosts.deny using ALL and EXCEPT. The pattern for /etc/hosts.allow and /etc/hosts.deny is: Demon_list:client_list:options. Client lists can use domain names or IP addresses.

Topics

#TCP wrappers#SSH access control#hosts.deny#mail notification

Community Discussion

No community discussion yet for this question.

Full RH302 Practice