前段时间,经常在群里看到有同学在讨论服务器被挖矿木马入侵的问题。研究了一下,发现许多木马利用了 Redis 的安全漏洞实现入侵,以下整理了一些 Redis 安全加固的配置,予以防范。 继续阅读“Redis的安全配置”
编译bash通过Rsyslog记录执行命令日志,并将日志发送到Elastic Stack,实现history审计
此前考虑通过PROMPT_COMMAND
环境变量实现history审计,后来发现存在各种问题,就如使用su切换用户时,前后执行的命令不能被准确记录。
看了许多文章,最终找到一种相对完善的处理方法,就是通过编译bash,由Rsyslog记录执行命令日志。之后配置实时将日志数据输出到Elastic Stack,在Kibana上可以监控终端上执行的每一条命令,或对日志数据作分析和审计。
继续阅读“编译bash通过Rsyslog记录执行命令日志,并将日志发送到Elastic Stack,实现history审计”
使用pip查找指定python程序包的所有可安装版本
系统版本:
[root@centos76d77 14:56 ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@centos76d77 14:56 ~]# uname -r
3.10.0-957.el7.x86_64
[root@centos76d77 14:56 ~]# python3.4
Python 3.4.10 (default, Apr 8 2019, 02:17:36)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@centos76d77 17:59 ~]# pip3.4 search ipython
....
ipython (7.5.0) - IPython: Productive Interactive Computing
本机使用的python版本较老(3.4),最高仅能支持ipython 6.x
,而pip中默认提供的ipython版本为7.5.0
Vim的全局命令g
全局命令:g
在Vim中有着意想不到强大的功能。当想要在整个文件中对于匹配的行或者非匹配行进行一些操作时,应该第一时间想到这个:g
命令
:[range]global[!]/{pattern}/{command}
可以简写为
:[range]g/pattern/command
- [range]指定文本范围,默认为整个文档
- pattern在范围range内的行如果匹配pattern,则执行command
- !表示取反,也就是不匹配的行,也可以使用
vglobal
- command默认是打印文本
Minimal安装CentOS 6.7之后要做的基本配置
系统版本:
[root@centos67n1 ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[root@centos67n1 ~]# uname -r
2.6.32-573.el6.x86_64
1、配置网络连接
更换yum源、创建本地yum源
系统版本:
[root@centos67d1 ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[root@centos67d1 ~]# uname -r
2.6.32-573.el6.x86_64
[root@centos71d1 ~]# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
[root@centos71d1 ~]# uname -r
3.10.0-229.el7.x86_64
应用yum源的3种方式:
yum命令详解
系统版本:
[root@centos71d1 ~]# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
[root@centos71d1 ~]# uname -r
3.10.0-229.el7.x86_64
yum repository:
存储了众多rpm包,以及包相关的元数据文件(放置于特定目录下:repodata)
rpm命令详解
系统版本:
[root@centos71d1 ~]# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
[root@centos71d1 ~]# uname -r
3.10.0-229.el7.x86_64
rpm命令用于在Linux系统中查询、安装、升级、卸载、校验程序包,以及维护rpm数据库。
继续阅读“rpm命令详解”
LVM的基本操作
系统版本:
[root@centos71d1 ~]# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
[root@centos71d1 ~]# uname -r
3.10.0-229.el7.x86_64
以下演示LVM的基本操作:
1. PV的创建、查看、移除
2. VG的创建、查看、扩展、缩减
3. LV的创建、查看、扩展、缩减、快照、移除
继续阅读“LVM的基本操作”
Linux基础练习题(二)
系统版本:
[root@centos67d1 ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[root@centos67d1 ~]# uname -r
2.6.32-573.el6.x86_64
[root@centos71d1 ~]# cat /etc/redhat-release
CentOS Linux release 7.1.1503 (Core)
[root@centos71d1 ~]# uname -r
3.10.0-229.el7.x86_64