60 likes | 68 Views
Learn about the essential SSH configuration settings and network security measures in Linux, including TCP Wrappers, access control, iptables firewall, and packet matching rules.
E N D
CIS 290LINUX Security Application and Network Security Part 1
SSH • /etc/ssh/sshd_config AllowTcpForwarding no AllowAgentForwarding No DenyUsers, AllowUsers, DenyGroups, AllowGroups AllowTcpForwarding No Banner No ChrootDirectory No ClientAliveInterval 600 ClientAliveCountMax 0 ForceCommand HostbasedAuthentication no IgnoreRhosts yes ListenAddress LoginGraceTime MaxAuthTries MaxSessions MaxStartups PermitEmptyPasswords no PermitRootLogin No PermitTunnel No Port Protocol 2,1 SubSystem (see SFTP chroot jail) UseDNS UsePAM – if yes, disable PasswordAuthentication or ChallengeREsponse Authentication X11Forwarding no
Original Sentry Tools (Psionic) • Logcheck (still an RPM) • Portsentry http://sourceforge.net/projects/sentrytools/ • Tcplogd • See also netstat –an or ss -a
Network Security • TCP Wrappers – hosts.allow, hosts.deny • /etc/security/access.conf • Iptables 2.4 - formerly ipfwadm <2.0, ipchains, 2.1) • /etc/sysctl.conf: net.ipv4.conf.all.log_martians = 1 net.ipv4.conf.default.accept_source_route = 0 net.ipv4.conf.default.accept_redirects = 0 net.ipv4.conf.default.secure_redirects = 0 net.ipv4.icmp_echo_ignore_broadcasts = 1 net.ipv4.icmp_ignore_bogus_error_messages = 0 net.ipv4.tcp_syncookies = 1 net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.default.rp_filter = 1
Firewall - Iptables • /etc/sysconfig/iptables • Commands: iptables, iptables-save, iptables-restore • There are total 4 chains: INPUT - The default chain is used for packets addressed to the system. Use this to open or close incoming ports (such as 80,25, and 110 etc) and ip addresses / subnet (such as 202.54.1.20/29). OUTPUT - The default chain is used when packets are generating from the system. Use this open or close outgoing ports and ip addresses / subnets. FORWARD - The default chains is used when packets send through another interface. Usually used when you setup Linux as router. For example, eth0 connected to ADSL/Cable modem and eth1 is connected to local LAN. Use FORWARD chain to send and receive traffic from LAN to the Internet. RH-Firewall-1-INPUT - This is a user-defined custom chain. It is used by the INPUT, OUTPUT and FORWARD chains.
iptables • Packet Matching Rules Each packet starts at the first rule in the chain. A packet proceeds until it matches a rule. If a match found, then control will jump to the specified target (such as REJECT, ACCEPT, DROP). • Target Meanings The target ACCEPT means allow packet. The target REJECT means to drop the packet and send an error message to remote host. The target DROP means drop the packet and do not send an error message to remote host or sending host.