赞
踩
本文重点介绍如何使用Nessus工具进行基线的定制和管理。
安全基线是一组配置设置要求,它由多个元子化的基线条目组成,每一个基线条目均会对安全设置产生影响。 企业的安全配置要求可能来自于您企业内部的信息安全政策,合规性要求,安全团队,甚至是产品组、合作伙伴和客户的反馈。您将这些安全配置要求组合在一起,就可以初步形成能满足您企业运行要求的安全基线。
Nessus进行基线扫描,根据Nessus的部署方式不同,有2种方法:
在Linux下,基线扫描的本质是检查各个配置文件的键和值,因此必须进行登陆扫描。(Windows下主要是检查注册表的键值)
操作步骤:
扫描任务保存后,无需再次配置,可以进行多次扫描。
您也可以下载.audit文件,您可以修改.audit做好预配置,扫描时直接上传该文件。
前提: 必须安装Nessus Manager并在环境中部署Nessus Agent。
优势: 扫描时无需在扫描器上输入密码,且扫描速度快,网络流量低。
上文提到了Nessus进行基线扫描时,可以加载.audit文件。.audit文件是Nessus专用的基线检查脚本文件,该文件使用YML语言定义了一系列基线检查条目,感兴趣的同学可以点击此处下载。
解压下载的audits.tar.gz包,以CIS_Google_Chrome_L1_v2.1.0.audit文件为例。
以下截取部分内容:
<check_type:"Windows" version:"2"> <group_policy:"Google Chrome"> <if> <condition type:"OR"> <custom_item> type : REG_CHECK description : "Check if Chrome is installed - ApplicationName" value_type : POLICY_TEXT value_data : "HKLM\Software\Clients\Startmenuinternet\Google Chrome\Capabilities" reg_option : MUST_EXIST key_item : "ApplicationName" </custom_item> <custom_item> type : REG_CHECK description : "Check if Chrome is installed - DisplayName" value_type : POLICY_TEXT value_data : "HKLM\Software\Microsoft\Windows\Currentversion\Uninstall\Google Chrome" reg_option : MUST_EXIST key_item : "DisplayName" </custom_item> </condition> <then> <custom_item> type : REGISTRY_SETTING description : "1.1.1 Ensure 'Cross-origin HTTP Authentication prompts' is set to 'Disabled'" info : "This setting controls whether third-party sub-content can open a HTTP Basic Auth dialog and is typically disabled. The recommended state for this setting is: Disabled (0) Rationale: This setting is typically disabled to help combat phishing attempts. Impact: None - This is the default behavior." solution : "To establish the recommended configuration via GP, set the following UI path to Disabled: Computer Configuration\Policies\Administrative Templates\Google\Google Chrome\HTTP authentication\Cross-origin HTTP Authentication prompts Default Value: Unset (Same as Disabled, but user can change)" reference : "800-171|3.4.2,800-53|CM-6b.,CIS_Recommendation|1.1.1,CN-L3|8.1.10.6(d),CSF|PR.IP-1,ITSG-33|CM-6b.,LEVEL|1A,NESA|T3.2.1,SWIFT-CSCv1|2.3" see_also : "https://workbench.cisecurity.org/files/3653" value_type : POLICY_DWORD value_data : 0 reg_key : "HKLM\Software\Policies\Google\Chrome" reg_item : "AllowCrossOriginAuthPrompt" reg_option : CAN_NOT_BE_NULL </custom_item> </then> <else> <report type:"WARNING"> description : "CIS_Google_Chrome_L1_v2.1.0.audit from CIS Google Chrome Benchmark v2.1.0" info : "NOTE: Nessus has not identified that the chosen audit applies to the target device." see_also : "https://workbench.cisecurity.org/files/3653" </report> </else> </if> </group_policy> </check_type>
以上文为例,整个.audit文件的基本结构,如下:
<check_type> </check_type>
定义了检查脚本文件的类型,如<check_type:"Windows" version:"2">
则定义了检查类型为"Windows",版本号为"2"。<group_policy></group_policy>
定义了检查策略,如"Google Chrome",此项为非必需项。如:CIS_CentOS_7_v3.1.2_Server_L1.audit文件中没有此项定义。<if><then></then><else></else></if>
类似于编程语言中的if …else…,<if><then>
之间为条件检查,nessus读取.audit文件后首先会运行此检查,如果之间的检查条件不满足,则运行 <else></else>
中的内容。<condition type:"OR"> </condition>
指定为OR(或)检查,也可以为AND(与)。<custom_item> </custom_item>
中定义了检查的具体内容,.audit文件由多个<custom_item></custom_item>
组成。<custom_item> type : REGISTRY_SETTING #定义了检查类型为注册表设置 description : "1.1.1 Ensure 'Cross-origin HTTP Authentication prompts' is set to 'Disabled'" #定义检查项的名称 info : "This setting controls whether third-party sub-content can open a HTTP Basic Auth dialog and is typically disabled. The recommended state for this setting is: Disabled (0) Rationale: This setting is typically disabled to help combat phishing attempts. Impact: None - This is the default behavior." solution : "To establish the recommended configuration via GP, set the following UI path to Disabled: Computer Configuration\Policies\Administrative Templates\Google\Google Chrome\HTTP authentication\Cross-origin HTTP Authentication prompts Default Value: Unset (Same as Disabled, but user can change)" #定义了检查项的描述信息 reference : "800-171|3.4.2,800-53|CM-6b.,CIS_Recommendation|1.1.1,CN-L3|8.1.10.6(d),CSF|PR.IP-1,ITSG-33|CM-6b.,LEVEL|1A,NESA|T3.2.1,SWIFT-CSCv1|2.3" #参考资料 see_also : "https://workbench.cisecurity.org/files/3653" #参考网站 value_type : POLICY_DWORD #检查值类型 value_data : 0 #注册表值 reg_key : "HKLM\Software\Policies\Google\Chrome" #注册表位置 reg_item : "AllowCrossOriginAuthPrompt" #注册表键 reg_option : CAN_NOT_BE_NULL #不能为空
以Linux下检查日志接收服务器配置为例:
<custom_item> system : "Linux" type : CMD_EXEC description : "4.2.1.5 Ensure rsyslog is configured to send logs to a remote log host" info : "The rsyslog utility supports the ability to send logs it gathers to a remote log host running syslogd(8) or to receive messages from remote hosts, reducing administrative overhead. Note: Ensure that the selection of logfiles being sent follows local site policy Rationale: Storing log data on a remote host protects log integrity from local attacks. If an attacker gains root access on the local system, they could tamper with or remove log data that is stored on the local system NOTE: Nessus did not detect that rsyslogd was listening on any open ports, and as a result has scanned this target as a rsyslog client." solution : "Edit the /etc/rsyslog.conf and /etc/rsyslog.d/*.conf files and add one of the following lines: Newer syntax: <files to sent to the remote log server> action(type='omfwd' target='<FQDN or ip of loghost>' port='<port number>' protocol='tcp' action.resumeRetryCount='<number of re-tries>' queue.type='LinkedList' queue.size=<number of messages to queue>') Example: *.* action(type='omfwd' target='192.168.2.100' port='514' protocol='tcp' action.resumeRetryCount='100' queue.type='LinkedList' queue.size='1000') Older syntax: *.* @@<FQDN or ip of loghost> Example: *.* @@192.168.2.100 Run the following command to reload the rsyslog configuration: # systemctl restart rsyslog" reference : "800-171|3.3.8,800-53|AU-9(2),CIS_Recommendation|4.2.1.5,CN-L3|8.1.3.5(d),CN-L3|8.1.4.3(c),CSCv7|6.6,CSCv7|6.8,CSF|PR.PT-1,ISO/IEC-27001|A.12.4.2,ITSG-33|AU-9(2),LEVEL|1A,NESA|M5.2.3,NESA|M5.5.2,NIAv2|SS13e,QCSC-v1|8.2.1,QCSC-v1|13.2" see_also : "https://workbench.cisecurity.org/files/3490" # Note: Variable @SYSLOG_SERVER@ replaced with "10\\.0\\.0\\.2" in field "cmd". cmd : "/usr/bin/egrep '^\\*\\.\\*[^I][^I]*\\@\\@10\\.0\\.0\\.2' /etc/rsyslog.conf /etc/rsyslog.d/*.conf | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'" expect : "pass" </custom_item>
此项定义了日志服务器的IP和端口,默认情况下检查脚本会检查rsyslog.conf文件中是否配置了*.* @10.0.0.2
,这基本上不符合您组织的实际需求,此时则需要修改.audit文件,以符合您组织的实际情况。
例如,您组织的syslog服务器IP为192.168.1.100,则需要您修改@10\\.0\\.0\\.2
部分为@192\\.168\\.1\\.100
。
最终结果为:cmd : "/usr/bin/egrep '^\\*\\.\\*[^I][^I]*\\@\\@192\\.168\\.1\\.100' /etc/rsyslog.conf /etc/rsyslog.d/*.conf | /usr/bin/awk '{print} END {if (NR != 0) print \"pass\" ; else print \"fail\"}'"
,修改完毕保存该文件,重新上传到Nessus扫描器。
此外,如果只是修改一个条目就要运行一次Nessus扫描,工作效率较低,您也可以将以上命令复制出来,注意去掉命令中的转义反斜杠。在命令行下运行:
[root@rsyslog_uatdevice ~]# /usr/bin/egrep '^\\*\\.\\*[^I][^I]*\\@\\@10\\.0\\.0\\.2' /etc/rsyslog.conf /etc/rsyslog.d/*.conf | /usr/bin/awk '{print} END {if (NR != 0) print "pass" ; else print "fail"}'
fail
赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。