linux安全审计和加固工具-lynis
0x00前言
lynis是一款开源的unix-based平台的审计工具。可以帮助审计员扫描unix系统以及可用的软件。程序主要探测,系统上安装的程序包,配置上的错误,以及安全问题和系统信息。
0x01 下载与安装
1 通过直接下载进行安装
步骤一:建立下载的目录
root@kali:~# mkdir -p /usr/local/lynis && cd /usr/local
步骤二:下载lynis
方式一:root@kali:~# wget https://cisofy.com/files/lynis-2.2.0.tar.gz
方式二:root@kali:~# curl https://cisofy.com/files/lynis-2.2.0.tar.gz -o lynis.tar.gz
方式三:直接使用浏览器打开页面:https://cisofy.com/download/lynis/ , 然后选择下载
步骤三:解压
方式一:root@kali:~# tar xfvz lynis.tar.gz
方式二:直接使用系统的解压软件直接进行解压(或者在win7解压,再拖入虚拟机)
2 通过 Git 进行安装
克隆项目
root@kali:~# cd /usr/local
root@kali:~# git clone https://github.com/CISOfy/lynis
root@kali:~# cd lynis
3. 通过包进行安装
Red Hat $ yum install lynis
Debian $ apt-get install lynis
openSUSE $ zypper install lynis
4. 通过 Homebrew进行安装
对于Mac OS 用户来说, Homebrew 是可供选择的手工安装方式以及使用GIt
$ brew install lynis
0x02 运行
1 查看帮助
如果我们是通过包形式进行安装的话,我们可以在任何目录调用lynis,例如root@kali:~# lynis -h,否则我们需要通过以下方式进行使用:
root@kali:~/lynis# ./lynis -h #进入解压后的lynis目录,然后查看帮助信息;root@kali:~/lynis# ./lynis --man 该命令查看详细使用帮助
2 审计系统
root@kali:~/lynis# ./lynis audit system #该方式需要人工进行手动确认,确认后才能进行下一步检查
root@kali:~/lynis# ./lynis audit system -Q #该方式可以避免人工确认
root@kali:~/lynis# ./lynis -c -Q#全部检查(最常用)
root@kali:~/lynis# ./lynis -c -Q --pentest
root@kali:~# lynis -c -Q -q --auditor "yy mm" #只显示告警输出
root@kali:~/lynis#./lynis -c -Q --auditor "yy mm" --cronjob > /var/log/lynis/report.txt
3停止和暂停
CTRL + C 去停止该程序的运行;
4 小技巧
4.1 如果lynis 不是通过带有man 页面的包进行安装的话,可以输入root@kali:~# man lynis
4.2 对于那些SHELL终端背景是浅色的某些系统,可以使用root@kali:~# lynis --nocolors 后者root@kali:~# lynis --reverse-colors
4.3 可以使用-h 选项去显示所有可用参数,即是root@kali:~# lynis -h
0x03 报告和日志
1 屏幕输出:
OK or Warning
Found or Not found
A value
2. 日志文件
默认的日志文件位置:/var/log/lynis.log
该日志文件包含以下方面的内容:
每次行为/时间的时间
测试失败或者被忽略的原因
测试的输出
关于配置选项或者怎样去修补/改善问题的建议
威胁/影响分数
root@kali:~# leafpad /var/log/lynis.log
3 报告文件
默认的报告文件位置:/var/log/lynis-report.dat.
root@kali:~# leafpad /var/log/lynis-report.dat
4 命令参数
lynis [scan mode] [other options]
FIRST TIME USAGE
When running Lynis for the first time, run: lynis audit system --quick
OPTIONS
--auditor <full name> Define the name of the auditor/pen-tester. When a full name is used, add double quotes, like "Your Name".
--checkall (or -c) Lynis performs a full check of the system,
--config Show which settings file or profile is being used, then quit.
--cronjob Perform automatic scan with cron safe options (no colors, no questions, no breaks).
--debug Display debug information to screen for troubleshooting purposes.
--dump-options Show all available parameters.
--logfile </path/to/logfile> Defines location and name of log file, instead of default /var/log/lynis.log.
--no-colors Do not use colors for messages, warnings and sections.
--no-log Redirect all logging information to /dev/null, prevent sensitive information to be written to disk.
--pentest Run a non-privileged scan, usually for penetration testing. Some of the tests will be skipped if they require root permissions.
--plugin-dir </path/to/plugins> Define location where plugins can be found.
--profile </path/to/profile> Provide alternative profile to perform the scan.
--quick (-Q) Do a quick scan (don't wait for user input).
--quiet (-q) Try to run as silent as possible, showing only warnings. This option activates --quick as well.
--report-file </path/to/report> Provide an alternative name for report file.
--reverse-colors Optimize screen output for light backgrounds.
--tests TEST-IDs Only run the specific test(s). When using multiple tests,add quotes around the line.
--tests-category <category> Only perform tests from particular tests. Use --view-categories to determine valid options.
--upload Upload data to Lynis Enterprise server.
--view-categories Display all available test categories.
Multiple parameters are allowed, though some parameters can only be
used together with others. When running Lynis without any parameters,
help will be shown and the program will exit.
EXIT CODES
Lynis uses exit codes to signal any invoking script. Currently the fol-
lowing codes are used:
0 Program exited normally, nothing found
1 Fatal error
64 An unknown parameter is used, or incomplete
65 Incorrect data encountered
66 Can't open file or directory
78 Lynis found 1 or more warnings or configurations errors
0x04 查看日志
grep Warning /var/log/lynis.log
grep Suggestingon /var/log/lynis.log
0x05 扩展阅读
1. lynis官方帮助文档
https://cisofy.com/documentation/lynis/get-started/
2. lynis官方介绍资料
https://cisofy.com
3github地址
https://github.com/CISOfy/lynis
欢迎大家分享更好的思路,热切期待^^_^^ !!!
linux安全审计和加固工具-lynis相关推荐
- linux 安全审计以及加固工具 lynis 使用介绍
0x00 概述 Lynis是一款Unix系统的安全审计以及加固工具,能够进行深层次的安全扫描,其目的是检测潜在的时间并对未来的系统加固提供建议.这款软件会扫描一般系统信息,脆弱软件包以及潜在的错误配置 ...
- Linux安全漏洞审计工具Lynis
Linux安全漏洞审计工具Lynis Lynis是针对类Unix系统的审计工具,它支持Unix.Linux.FreeBSD.Mac OS多种操作系统.它能对系统实施大于400种测试,以发现39个方面的 ...
- JShielder:一款自动化Linux服务器安全增强工具
JShielder介绍 JSHielder是一款开源的Bash脚本,旨在帮助系统管理员和开发人员增强Linux服务器的安全性,以更好地开发任何Web应用程序或在线服务.该工具可以自动化安装托管Web应 ...
- 1 Linux SSH安全加固
Linux SSH 安全加固,这里使用CentOS7.5 做演示 一.配置SSH双因素登录 1.确定系统时钟是正确的 2.安装相关依赖 yum install -y git gcc aut ...
- Linux系统安全加固浅谈
对于企业来说,安全加固是一门必做的安全措施.主要分为:账号安全.认证授权.协议安全.审计安全.总的来说,就是4A(统一安全管理平台解决方案),账号管理.认证管理.授权管理.审计管理.用漏洞扫描工具扫描 ...
- Linux下C++开发工具介绍
概述 就C++开发工具而言,与Windows下微软(VC, VS2005等)一统天下相比,Linux/Unix下C++开发,可谓五花八门,各式各样.Emacs, vi, eclipse, an ...
- linux平台软件动态分析工具valgrind系列工具及其可视化
linux平台软件动态分析工具valgrind系列工具 Memcheck–内存检查工具 Callgrind–函数调用分析工具 Cachegrind–缓存命中分析工具 Helgrind–线程分析工具 M ...
- Linux性能分析命令工具汇总
转自:http://rdc.hundsun.com/portal/article/731.html?ref=myread 出于对Linux操作系统的兴趣,以及对底层知识的强烈欲望,因此整理了这篇文章. ...
- Linux 性能測试工具
Linux 性能測试工具 linux performance 查看系统配置 查看CPU信息 lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64- ...
- 解决Linux安装 VMware tools 工具的方法
解决Linux安装 VMware tools 工具的方法 参考文章: (1)解决Linux安装 VMware tools 工具的方法 (2)https://www.cnblogs.com/ios9/p ...
最新文章
- 激光雷达(LiDAR)点云数据知多少?
- Selenium自动化中DOM,XPATH,CSS定位Web页面对象的优劣性分析
- ASP.NET MVC 线程和并发
- linux 更改文件和目录权限
- oracle变量名,Oracle中的替换变量,变量名,变量名
- Jquery 插件集合
- js的正则表达,只允许数字和特殊
- Pandas 表连接(Merge,join,concatenate)
- 栈的典型应用 —— 逆序输出
- I/O多路复用技术详解之poll模型
- svn利用钩子post-commit自动更新到线上测试服务器
- html小任务,编写表单里的各项元素
- javascript的一些各浏览器不兼容的地方
- 模拟电话簿提取名字显示
- 计算机主机检测不到耳机,win10电脑检测不到耳机的原因及处理方法
- 内存卡Android怎么删除,安卓手机怎么清理内置存储卡垃圾文件
- PCIE原理-002:PCIE地址是如何映射的
- 股市中的马太效应带给我们什么股票道理?
- (银行案例)智能营销赋能大零售转型
- KubeSphere介绍和基于K8S的安装