麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 服務器 > Linux服務器 > 正文

利用lynis如何進行linux漏洞掃描詳解

2024-09-05 23:04:47
字體:
來源:轉載
供稿:網友

前言

linux/197185.html">lynis 是一款運行在 Unix/Linux 平臺上的基于主機的、開源的安全審計軟件。Lynis是針對Unix/Linux的安全檢查工具,可以發現潛在的安全威脅。這個工具覆蓋可疑文件監測、漏洞、惡意程序掃描、配置錯誤等。下面一起來看看使用lynis進行linux漏洞掃描的相關內容吧

安裝lynis

在 archlinux 上可以直接通過 pacman 來安裝

sudo pacman -S lynis --noconfirm
resolving dependencies...looking for conflicting packages... Packages (1) lynis-2.6.4-1 Total Installed Size: 1.35 MiBNet Upgrade Size:  0.00 MiB :: Proceed with installation? [Y/n] (0/1) checking keys in keyring      [----------------------] 0%(1/1) checking keys in keyring      [######################] 100%(0/1) checking package integrity     [----------------------] 0%(1/1) checking package integrity     [######################] 100%(0/1) loading package files      [----------------------] 0%(1/1) loading package files      [######################] 100%(0/1) checking for file conflicts     [----------------------] 0%(1/1) checking for file conflicts     [######################] 100%(0/1) checking available disk space    [----------------------] 0%(1/1) checking available disk space    [######################] 100%:: Processing package changes...(1/1) reinstalling lynis       [----------------------] 0%(1/1) reinstalling lynis       [######################] 100%:: Running post-transaction hooks...(1/2) Reloading system manager configuration...(2/2) Arming ConditionNeedsUpdate...

使用lynis進行主機掃描

首先讓我們不帶任何參數運行 lynis, 這會列出 lynis 支持的那些參數

[lujun9972@T520 linux和它的小伙伴]$ lynis [ Lynis 2.6.4 ] ################################################################################ Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU General Public License. See the LICENSE file for details about using this software.  2007-2018, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools)################################################################################  [+] Initializing program------------------------------------   Usage: lynis command [options]   Command:  audit  audit system     : Perform local security scan  audit system remote <host> : Remote security scan  audit dockerfile <file>  : Analyze Dockerfile  show  show       : Show all commands  show version     : Show Lynis version  show help      : Show help  update  update info     : Show update details   Options:  --no-log       : Don't create a log file --pentest       : Non-privileged scan (useful for pentest) --profile <profile>    : Scan the system with the given profile file --quick (-Q)      : Quick mode, don't wait for user input  Layout options --no-colors      : Don't use colors in output --quiet (-q)      : No output --reverse-colors     : Optimize color display for light backgrounds  Misc options --debug       : Debug logging to screen --view-manpage (--man)   : View man page --verbose       : Show more details on screen --version (-V)     : Display version number and quit  Enterprise options --plugindir <path>    : Define path of available plugins --upload       : Upload data to central node  More options available. Run '/usr/bin/lynis show options', or use the man page.  No command provided. Exiting..

從上面可以看出,使用 lynis 進行主機掃描很簡單,只需要帶上參數 audit system 即可。 Lynis在審計的過程中,會進行多種類似的測試,在審計過程中會將各種測試結果、調試信息、和對系統的加固建議都被寫到 stdin 。 我們可以執行下面命令來跳過檢查過程,直接截取最后的掃描建議來看。

sudo lynis audit system |sed '1,/Results/d'

lynis將掃描的內容分成幾大類,可以通過 show groups 參數來獲取類別

lynis show groups

accounting
authentication
banners
boot_services
containers
crypto
databases
dns
file_integrity
file_permissions
filesystems
firewalls
hardening
homedirs
insecure_services
kernel
kernel_hardening
ldap
logging
mac_frameworks
mail_messaging
malware
memory_processes
nameservices
networking
php
ports_packages
printers_spools
scheduling
shells
snmp
squid
ssh
storage
storage_nfs
system_integrity
time
tooling
usb
virtualization
webservers

若指向掃描某幾類的內容,則可以通過 –tests-from-group 參數來指定。

比如我只想掃描 shells 和 networking 方面的內容,則可以執行

sudo lynis --tests-from-group "shells networking" --no-colors
[ Lynis 2.6.4 ] ################################################################################ Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU General Public License. See the LICENSE file for details about using this software.  2007-2018, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools)################################################################################  [+] Initializing program------------------------------------- Detecting OS...  [ DONE ]- Checking profiles... [ DONE ]- Detecting language and localization [ zh ]Notice: no language file found for 'zh' (tried: /usr/share/lynis/db/languages/zh)  --------------------------------------------------- Program version:   2.6.4 Operating system:   Linux Operating system name:  Arch Linux Operating system version: Rolling release Kernel version:   4.16.13 Hardware platform:   x86_64 Hostname:     T520 --------------------------------------------------- Profiles:     /etc/lynis/default.prf Log file:     /var/log/lynis.log Report file:    /var/log/lynis-report.dat Report version:   1.0 Plugin directory:   /usr/share/lynis/plugins --------------------------------------------------- Auditor:     [Not Specified] Language:     zh Test category:    all Test group:    shells networking ---------------------------------------------------- Program update status...  [ NO UPDATE ] [+] System Tools------------------------------------- Scanning available tools...- Checking system binaries... [+] Plugins (phase 1)------------------------------------Note: plugins have more extensive tests and may take several minutes to complete - Plugins enabled [ NONE ] [+] Shells------------------------------------- Checking shells from /etc/shellsResult: found 5 shells (valid shells: 5).- Session timeout settings/tools [ NONE ]- Checking default umask values- Checking default umask in /etc/bash.bashrc [ NONE ]- Checking default umask in /etc/profile [ WEAK ] [+] Networking------------------------------------- Checking IPv6 configuration [ ENABLED ]Configuration method [ AUTO ]IPv6 only [ NO ]- Checking configured nameservers- Testing nameserversNameserver: 202.96.134.33 [ SKIPPED ]Nameserver: 202.96.128.86 [ SKIPPED ]- Minimal of 2 responsive nameservers [ SKIPPED ]- Getting listening ports (TCP/UDP) [ DONE ]* Found 11 ports- Checking status DHCP client [ RUNNING ]- Checking for ARP monitoring software [ NOT FOUND ] [+] Custom Tests------------------------------------- Running custom tests...  [ NONE ] [+] Plugins (phase 2)------------------------------------ ================================================================================  -[ Lynis 2.6.4 Results ]-  Great, no warnings  Suggestions (1): ---------------------------- * Consider running ARP monitoring software (arpwatch,arpon) [NETW-3032]  https://cisofy.com/controls/NETW-3032/  Follow-up: ---------------------------- - Show details of a test (lynis show details TEST-ID) - Check the logfile for all details (less /var/log/lynis.log) - Read security controls texts (https://cisofy.com) - Use --upload to upload data to central system (Lynis Enterprise users) ================================================================================  Lynis security scan details:  Hardening index : 33 [######    ] Tests performed : 13 Plugins enabled : 0  Components: - Firewall    [X] - Malware scanner  [X]  Lynis Modules: - Compliance Status  [?] - Security Audit   [V] - Vulnerability Scan  [V]  Files: - Test and debug information  : /var/log/lynis.log - Report data      : /var/log/lynis-report.dat ================================================================================  Lynis 2.6.4  Auditing, system hardening, and compliance for UNIX-based systems (Linux, macOS, BSD, and others)  2007-2018, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools) ================================================================================  [TIP]: Enhance Lynis audits by adding your settings to custom.prf (see /etc/lynis/default.prf for all settings)

查看詳細說明

在查看審計結果時,你可以通過 show details 參數來獲取關于某條警告/建議的詳細說明。其對應的命令形式為:

lynis show details ${test_id}

比如,上面圖中有一個建議

* Consider running ARP monitoring software (arpwatch,arpon) [NETW-3032]

我們可以運行命令:

sudo lynis show details NETW-3032
2018-06-08 18:18:01 Performing test ID NETW-3032 (Checking for ARP monitoring software)2018-06-08 18:18:01 IsRunning: process 'arpwatch' not found2018-06-08 18:18:01 IsRunning: process 'arpon' not found2018-06-08 18:18:01 Suggestion: Consider running ARP monitoring software (arpwatch,arpon) [test:NETW-3032] [details:-] [solution:-]2018-06-08 18:18:01 Checking permissions of /usr/share/lynis/include/tests_printers_spools2018-06-08 18:18:01 File permissions are OK2018-06-08 18:18:01 ===---------------------------------------------------------------===

查看日志文件

lynis在審計完成后會將詳細的信息記錄在 /var/log/lynis.log 中.

sudo tail /var/log/lynis.log
2018-06-08 17:59:46 ================================================================================2018-06-08 17:59:46 Lynis 2.6.42018-06-08 17:59:46 2007-2018, CISOfy - https://cisofy.com/lynis/2018-06-08 17:59:46 Enterprise support available (compliance, plugins, interface and tools)2018-06-08 17:59:46 Program ended successfully2018-06-08 17:59:46 ================================================================================2018-06-08 17:59:46 PID file removed (/var/run/lynis.pid)2018-06-08 17:59:46 Temporary files: /tmp/lynis.sGxCR0hSPz2018-06-08 17:59:46 Action: removing temporary file /tmp/lynis.sGxCR0hSPz2018-06-08 17:59:46 Lynis ended successfully.

同時將報告數據被保存到 /var/log/lynis-report.dat 中.

sudo tail /var/log/lynis-report.dat

另外需要注意的是,每次審計都會覆蓋原日志文件.

檢查更新

審計軟件需要隨時進行更新從而得到最新的建議和信息,我們可以使用 update info 參數來檢查更新:

lynis update info --no-colors
== Lynis ==  Version   : 2.6.4 Status    : Up-to-date Release date  : 2018-05-02 Update location : https://cisofy.com/lynis/  2007-2018, CISOfy - https://cisofy.com/lynis/

自定義lynis安全審計策略

lynis的配置信息以 .prf 文件的格式保存在 /etc/lynis 目錄中。 其中,默認lynis自帶一個名為 default.prf 的默認配置文件。

不過我們無需直接修改這個默認的配置文件,只需要新增一個 custom.prf 文件將自定義的信息加入其中就可以了。

關于配置文件中各配置項的意義,在 default.prf 中都有相應的注釋說明,這里就不詳述了。

想了解lynis的更多信息,可以訪問它的官網.

總結

以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,如果有疑問大家可以留言交流,謝謝大家對VEVB武林網的支持。


注:相關教程知識閱讀請移步到服務器教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 精品国产一区二区三区蜜殿 | 精品国产91久久久久久 | 午夜国产在线 | 国产精品av久久久久久网址 | 国产精品欧美日韩一区二区 | 精品一区二区三区免费爱 | 中国精品久久 | 成人午夜看片 | 羞羞网站视频 | av电影免费在线看 | 久久精品视频黄色 | 91伊人久久 | 欧美一级黄色片在线观看 | 黄在线观看 | 国产精品视频导航 | 中文字幕精品久久 | 黄色网址电影 | 精品一区久久久 | 9999久久| 男女羞羞视频 | 毛片免费视频播放 | 久久久午夜电影 | 久久艹艹艹 | 国产一级片91 | 7777视频 | 性生活香蕉视频 | 国产精品亚洲一区二区三区在线观看 | 国产一区二区三区色淫影院 | 九九热在线视频免费观看 | 一级成人欧美一区在线观看 | 国产亚洲精品美女久久久 | 国产精品一区二区在线 | h视频免费在线观看 | 49vvv| 亚洲成人欧美在线 | 91情侣在线偷精品国产 | 国产毛片在线 | 亚洲第五色综合网 | 久久精品片 | 色视频在线播放 | 国产女厕一区二区三区在线视 |