要防止系统在未尝试对包进行解密的情况下将包转发至另一个接口,系统需要检查 IP 电子欺骗。一种预防方法是使用 ndd 命令设置 IP 严格目标多宿主参数。在 SMF 清单中设置了此参数时,系统重新引导时就会设置此参数。
在两个系统中执行此过程中的步骤。
在系统控制台上,承担主管理员角色或成为超级用户。
主管理员角色拥有主管理员配置文件。要创建该角色并将其指定给用户,请参见《系统管理指南:基本管理》中的第 2 章 “使用 Solaris Management Console(任务)”。
创建用于检查 IP 电子欺骗的站点专用 SMF 清单。
使用以下样例脚本 /var/svc/manifest/site/spoof_check.xml。
<?xml version="1.0"?> <!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> <service_bundle type='manifest' name='Custom:ip_spoof_checking'> <!-- This is a custom smf(5) manifest for this system. Place this file in /var/svc/manifest/site, the directory for local system customizations. The exec method uses an unstable interface to provide a degree of protection against IP spoofing attacks when this system is acting as a router. IP spoof protection can also be achieved by using ipfilter(5). If ipfilter is configured, this service can be disabled. Note: Unstable interfaces might be removed in later releases. See attributes(5). --> <service name='site/ip_spoofcheck' type='service' version='1'> <create_default_instance enabled='false' /> <single_instance /> <!-- Don't enable spoof protection until the network is up. --> <dependency name='basic_network' grouping='require_all' restart_on='none' type='service'> <service_fmri value='svc:/milestone/network' /> </dependency> <exec_method type='method' name='start' exec='/usr/sbin/ndd -set /dev/ip ip_strict_dst_multihoming 1' <!-- For an IPv6 network, use the IPv6 version of this command, as in: exec='/usr/sbin/ndd -set /dev/ip ip6_strict_dst_multihoming 1 --> timeout_seconds='60' /> <exec_method type='method' name='stop' exec=':true' timeout_seconds='3' /> <property_group name='startd' type='framework'> <propval name='duration' type='astring' value='transient' /> </property_group> <stability value='Unstable' /> </service> </service_bundle>
将此清单导入到 SMF 系统信息库。
# svccfg import /var/svc/manifest/site/spoof_check.xml |
启用 ip_spoofcheck 服务。
使用在清单中定义的名称 /site/ip_spoofcheck。
# svcadm enable /site/ip_spoofcheck |
检验 ip_spoofcheck 服务是否联机。
# svcs /site/ip_spoofcheck |