centos7.9上安装linux系统审计工具Lynis
  nQkVcpdWfLDr 2023年11月02日 116 0

1.什么是 Lynis

Lynis是一个开源的安全审计工具,能够对Linux系统的安全进行检测,在对Linux系统进行扫描检测后,会生成报告。Lynis 是一套适用于各种 UNIX based system 的系统安全检测工具,以 Shell Script建构而成。它能找出系统安全需要补强的地方,同时提供许多提升系统安全的作法与建议,对于系统管理者来说是一套既实用,又能从中学习(或复习)到许多系统安全观念的好工具。不足之处:该款工具比较全面的涵盖了系统安全的审计内容,但每个审计项都不深入,需要具体的扩展,例如PHP、Apache,MySQL的安全配置,就需要细化。

运行 Lynis 后,你可以使用它的报告来定位每个项目的脚本,并了解 Lynis 是如何检查和报告每个问题的。你也可以使用相同的脚本代码来创建新的代码来自动解决。

2.下载Lynis

下载地址:​​https://cisofy.com/lynis/​

git地址: ​​https://github.com/CISOfy/lynis​

3.安装

Lynis安装非常简单,只需要解压后就可以使用了

tar -zxvf lynis-3.0.1.tar.gz
cd lynis

此时已经安装好了,查看帮助

[root@localhost lynis]# ./lynis --help

[ Lynis 3.0.1 ]

################################################################################
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-2020, 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:

Alternative system audit modes
--forensics : Perform forensics on a running or mounted system
--pentest : Non-privileged, show points of interest for pentesting

Layout options
--no-colors : Don't use colors in output
--quiet (-q) : No output
--reverse-colors : Optimize color display for light backgrounds
--reverse-colours : Optimize colour display for light backgrounds

Misc options
--debug : Debug logging to screen
--no-log : Don't create a log file
--profile <profile> : Scan the system with the given profile file
--view-manpage (--man) : View man page
--verbose : Show more details on screen
--version (-V) : Display version number and quit
--wait : Wait between a set of tests
--slow-warning <seconds> : Threshold for slow test warning in seconds (default 10)

Enterprise options
--plugindir <path> : Define path of available plugins
--upload : Upload data to central node

More options available. Run './lynis show options', or use the man page.

4.使用Lynis

执行以下命令扫描本地系统,扫描完成后退出

./lynis audit system -Q

一旦lynis开始扫描你的系统,它就会执行以下类别的审查工作:

category

类别

作用

System Tools

系统工具

扫描可用工具;检测系统二进制代码

Boot and Services

引导和服务

引导装入程序和启动服务

Kernel

内核

运行级别、已装入模块、内核配置和核心转储

Memory and Processes

内存和进程

僵尸进程和输入输出等待进程

Users,Groups and Authentication

用户、用户组和验证

用户组编号、sudoers文件、可插拔验证模块(PAM)配置、密码老化和默认掩码

Shells

 

 

File systems

文件系统

挂载点、临时文件和根文件系统

Storage存储

USB存储(usb-storage)和火线开放式主机控制器接口(firewire ohci)

 

NFS Check running NFS daemon

 

 

Name services

名称服务

DNS搜索

Ports and packages

端口和软件包

容易受到入侵/可以升级的程序包和安全存储库

Networking

网络

名称服务器、混杂接口和连接

Printers and Spools

打印机和假脱机

通用Unix打印系统(CUPS)配置

Software:email and messaging

软件:电子邮件和消息传送

Exim status、postfix status、dovecot status、qmail status、sendmail status

Software:firewalls

防火墙

Iptables、host based firewall

Software:webserver

网站服务器

Apache、nginx

SSH support

SSH支持

Checking running SSH daemon

SNMP Support

 

Checking running SNMP daemon

Databases

MySQL根密码

 

LDAP Services

 

Checking OpenLDA

PHP

 

 

Squid Support

 

 

Logging and files

日志和文件

syslog守护程序和日志目录

Insecure services

不安全服务

Checking inetd status

Banners and identificationBanner

信息和身份认证

 

Scheduled tasks

调度任务

Checking crontab/cronjob /vrontabs

Accounting

账号

Accounting information/sysstat accounting data/auditd

Time and Synchronization

时间和同步

ntp守护程序

Cryptography

密码学

Checking for expired SSL certificates

Virtualization虚拟化

 

 

Containers

 

 

Security frameworks

安全框架

AppArmor、SELinux、grsecurity、MAC framework

Software:file integrity

文件完整性

 

Software:system tooling

 

Checking automation tooling/Checing for IDS/IPS tooling

Software:Malware

恶意软件扫描工具

 

File permissions

 

 

Home directories

主目录

Checking shell history files

Kernel hardening

 

 

Hardening

 

Installed compiler Installed malware scanner

Custom tests

 

Running custom tests

扫描结果,5个警告,45个建议

centos7.9上安装linux系统审计工具Lynis_linux

同时可以通过链接 ​​https://cisofy.com/lynis/controls/KRNL-5830/​

去查看针对此条告警的具体表现及解决方案等信息。

一旦扫描完毕,系统的审查报告就会自动生成,并保存在/var/log/lynis.log中。如上图所示,具体的审查流程可以查看var/log/lynis-report.dat

more /var/log/lynis.log | grep Warning
more /var/log/lynis.log | grep Suggestion

参考链接:​​https://blog.csdn.net/ccccsy99/article/details/106009239​

​https://linux.cn/article-12696-1.html​

​https://my.oschina.net/u/4406182/blog/4664732​

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
nQkVcpdWfLDr