Juniper路由器安全配置方案
一. 路由器网络服务安全配置:
默认情况下,系统启动了许多无用服务,这些服务在占用系统资源的同时也造成一定的安全隐患,应该在尽可能的情况下停止或限制这些服务
1. SNMP服务
使用如下命令来停止SNMP服务:
setsystemprocessessnmpdisable
使用如下命令来设置SNMP通讯字符串:
setsnmpcommunitymysnmpauthorizationread-only
使用如下命令来在接口上设备SNMP通讯字符串:
setsnmpinterfacefxp0communitymysnmp
使用如下命令来在接口上禁止SNMP服务trap:
setinterfacesfxp0unit0trapsdisable
使用如下命令来限制SNMP的访问客户端:
setsnmpcommunitymysnmpclients192.168.0.0/24
setsnmpcommunitymysnmpclients0.0.0.0/0restrict
上述命令只允许192.168.0.0/24网段访问路由器的SNMP服务
2. 停止接口广播转发:
广播转发容易造成smurf攻击,因此应该使用如下命令停止:
setsystemno-redirects
接口级别停止广播转发使用如下命令:
setinterfacesfxp0unit0familyinetno-redirects
3. 停止dhcp-relay服务,dhcp-relay服务用于在不同网段使用同一个dhcp服务器,如果没有使用,则应该使用如下命令停止:
setsystemdhcp-relaydisable
4. 禁止IGMP服务,IGMP服务如果在没有使用的情况下应该使用如下命令禁止:
setprotocolsigmpinterfacealldisable
5. 禁止PIM服务(?),PIM服务如果在没有使用的情况下应该使用如下命令禁止:
setprotocolspimdisable
6. 禁止SAP服务(?),SAP服务如果在没有使用的情况下应该使用如下命令禁止:
setprotocolssapdisable
7.禁止IPSourceRouting源路由
setchassisno-source-route
二. 路由器登录控制:
1. 设置系统登录Banner:
setsystemloginmessageWarning:ifyouNOTauthorizedtoaccessthissystem,disconnectNOW!
2. 设置登录超时时间:
默认情况下,系统登录没有登录超时时间限制,应该将登录超时时间设置为15分钟:
setcliidle-timeout15
3. 建议采取用户权限分级管理策略
setsystemloginclasstier1idle-timeout15
setsystemloginclasstier1permissions[configureinterfacenetworkroutingsnmpsystemtraceviewfirewall]
setsystemloginclasstier2idle-timeout15
setsystemloginclasstier2permissionsall
setsystemloginuseradminfull-nameAdministrator
setsystemloginuseradminuid2000
setsystemloginuseradminclasstier2
setsystemloginuseradminauthenticationencrypted-password
setsystemloginusertier1uid2001
setsystemloginusertier1classtier1
setsystemloginusertier2uid2002
setsystemloginusertier2classtier2
4. 限制系统ssh、telnet服务连接数量:
以下配置将ssh,telnet连接最大数量限制为10个,并且每分钟最多有5个可以连接:
setsystemservicessshconnection-limit10rate-limit5
setsystemservicestelnetconnection-limit10rate-limit5
以下特性JUNOS5.0以上支持:
setsystemservicesroot-logindeny(禁止root远程登陆)
setsystemservicesprotocol-versionv2(使用sshv2)
三. 配置系统日志服务:
1. 设置系统kernel级警告发到console上
setsystemsyslogconsolekernelwarning
2. 配置登录系统日志到单独的auth.log文件中
setsystemsyslogfileauth.logauthorizationinfo
3. 配置系统配置更改日志到单独的change.log文件中
setsystemsyslogfilechange.logchange-loginfo
4. 配置系统所有日志到日志服务器
setsystemsysloghostx.x.x.x.anyinfo
四. 路由策略安全
1.配置以下保留地址的黑洞路由
setrouting-optionsoptionsno-resolve
setrouting-optionsoptionssyslogleveldebug
setrouting-optionsstaticroute0.0.0.0/8discard
setrouting-optionsstaticroute10.0.0.0/8discard
setrouting-optionsstaticroute20.20.20.0/24discard
setrouting-optionsstaticroute127.0.0.0/8discard
setrouting-optionsstaticroute169.254.0.0/16discard
setrouting-optionsstaticroute172.16.0.0/12discard
setrouting-optionsstaticroute192.0.2.0/24discard
setrouting-optionsstaticroute192.168.0.0/16discard
setrouting-optionsstaticroute204.152.64.0/23discard
setrouting-optionsstaticroute224.0.0.0/4discard
2.设置strict模式的unicastRPF
setinterfacesso-0/0/0unit0familyinetrpf-check
3.设置相应prefix-list,禁止保留地址访问
setpolicy-optionsprefix-listreserved0.0.0.0/8
setpolicy-optionsprefix-listreserved10.0.0.0/8
setpolicy-optionsprefix-listreserved20.20.20.0/24
setpolicy-optionsprefix-listreserved127.0.0.0/8
setpolicy-optionsprefix-listreserved169.254.0.0/16
setpolicy-optionsprefix-listreserved172.16.0.0/12
setpolicy-optionsprefix-listreserved192.0.2.0/24
setpolicy-optionsprefix-listreserved204.152.64.0/23
setpolicy-optionsprefix-listreserved224.0.0.0/4
setfirewallfilterinbound-filterterm1fromprefix-listreserved
setfirewallfilterinbound-filterterm1thencountspoof-inbound-reserved
setfirewallfilterinbound-filterterm1thendiscard
setinterfacesge-0/0/0unit0familyinetfilterinputinbound-filter
五. Firewall-Policy设置
Firewall-Policy可以限制进入及流量主机数据包的来源、目标地址、协议、端口号、流量等,应用Firewall-Policy可以实现类似于防火墙的性能,但一般不建议在骨干路由器上使用,以下是Firewall-Policy的使用方法:
1. 创建Firewall-Policy:
setfirewallfilterlocal-sectermsec-in1fromdestination-porttelnet
setfirewallfilterlocal-sectermsec-in1fromdestination-address172.16.0.1/32
setfirewallfilterlocal-sectermsec-in1fromsource-address192.168.0.0/24
setfirewallfilterlocal-sectermsec-in1thenaccept
setfirewallfilterlocal-sectermsec-in2fromdestination-porttelnet
setfirewallfilterlocal-sectermsec-in2fromdestination-address172.16.0.1/32
setfirewallfilterlocal-sectermsec-in2thendiscard
setfirewallfilterlocal-sectermsec-in3from
setfirewallfilterlocal-sectermsec-in1thenaccept
2. 应用到路由器的端口上:
setinterfacesfxp0unit0familyinetfilterinputlocal-sec
以上例子不允许除192.168.0.0/24网段外所有地址telnet访问172.16.0.1,但允许其它任何包通过。