内容一:zgrep 命令的用法
和 grep 命令相同
内容二:zgrep 命令的选项
和 grep 命令相同,除了以下选项
1) –dereference-recursive 或者 -R
2) –directories 或者 -d
3) –exclude
4) –exclude-from
5) –exclude-dir
6) –include
7) –null 或者 -Z
8) –null-data 或者 -z
9) –recursive 或者 -r
和 grep 命令相同
和 grep 命令相同,除了以下选项
1) –dereference-recursive 或者 -R
2) –directories 或者 -d
3) –exclude
4) –exclude-from
5) –exclude-dir
6) –include
7) –null 或者 -Z
8) –null-data 或者 -z
9) –recursive 或者 -r
# sudo dnf update
# sudo dnf install dnf-plugin-system-upgrade
# sudo dnf upgrade --refresh
# sudo dnf system-upgrade download --releasever=42
# sudo dnf system-upgrade reboot
(注意:系统会重启,并在后台升级系统,这个步骤可能会持续很长一段时间,根据虚拟机的硬件性能而定)
# umount /dev/mysqldatavg/mysqldatalv
# cryptsetup luksOpen /dev/mapper/mysqldatavg-mysqldatalv mysqldata
之后输入 /dev/mapper/mysqldatavg-mysqldatalv 的解密密码
(补充:这里的 mysqldata 是解锁后的硬件名称)
# cryptsetup luksAddKey UUID="2eg8c60ac-103k-4771-k31r-14t93b06226a" --key-file /root/keyfile
(
补充:
1) 这里的 2eg8c60ac-103k-4771-k31r-14t93b06226a 是新添加的解密密码
2) 这里的 /root/keyfile 是原来的用来解密加密硬盘的密钥
)
# cryptsetup luksOpen UUID="2eg8c60ac-103k-4771-k31r-14t93b06226a" mysqldatalv
(
补充:
1) 这里的 2eg8c60ac-103k-4771-k31r-14t93b06226a 是刚刚添加的解密密码
2) 这里的 mysqldata 是解密后的硬件名称
)
# vi /etc/ld.so.conf
或者:
# vi /etc/ld.so.conf.d/*.conf
添加以下内容:
......
/root/lib
(补充:这里以添加位于目录 /root/lib 的库为例)
(注意:这里的 /etc/ld.so.conf.d/*.conf 是指 /etc/ld.so.conf.d/ 目录下任意以 .conf 结尾的文件,例如 /etc/ld.so.conf.d/one.conf)
# cp /boot/initramfs-4.18.0-553.89.1.el8_10.x86_64.img /boot/initramfs-4.18.0-553.89.1.el8_10.x86_64.img.backup
(
补充:
1) 这里以将:/boot/initramfs-4.18.0-553.89.1.el8_10.x86_64.img 备份为:/boot/initramfs-4.18.0-553.89.1.el8_10.x86_64.img.backup 为例
2) initramfs 是压缩的 cpis 文件,是临时的根文件系统包含一些脚本、程序和配置文件,在 Linux 启动过程中被加载在内存里,负责 Linux 操作系统在挂载根目录前加载内核模块、检查硬件、加载驱动以及挂载真正的根文件系统等)
# dracut -f /boot/initramfs-(uname -r).img $(uname -r)
(补充:这里以将正在运行的内核版本生成一个新的 initramfs 为例)
(注意:此时原来启动系统时使用的那个 initramfs 文件会被覆盖)
# reboot
# ldconfig -p -M -X | grep out
(
补充:
1) 这里的 -N 和 -X 必须一起使用,作用是不更新相关链接和不重建相关缓存
2) 这里的 -p 作用是打印现在在缓存中的相关目录和相关候选库
3) 这条命令会显示目前在缓存中的第三方库
)
# for l in $(ldconfig -p -N -X | awk '{ print $1 }') ; do matches=$(ldconfig -p -N -X | awk "\$1 == \"$l\" { print }"); if [ $(echo "$matches" | wc -l) -ge 2 ]; then echo "$matches"; echo; fi; done |wc -l
(补充:如果加载的库中没有重复的则这里不会有任何输出结果)
# vim /etc/ssh/sshd_config
确保部分内容如下:
......
Include /etc/ssh/sshd_config.d/*.conf
......
Include /usr/etc/ssh/sshd_config.d/*.conf
......
# vim /etc/ssh/sshd_config.d/*.conf
或者:
# vim /usr/etc/ssh/sshd_config.d/*.conf
确保部分内容如下:
......
Include /etc/crypto-policies/back-ends/opensshserver.config
......
# cp /etc/crypto-policies/back-ends/opensshserver.config /etc/crypto-policies/back-ends/opensshserver.config.backup
# vim /etc/crypto-policies/back-ends/opensshserver.config
添加需要使用的 SSH 算法 (algorithms) 和加密方式 (ciphers):
(内容略)
(注意:如果需要使用的 SSH 加密方式 (cipher) 、信息验证代码 (message authentication code) 和算法 (algorithm) ,已包含在其中了则可以不用添加)
# cat /etc/crypto-policies/back-ends/opensshserver.config
Ciphers aes256-gcm@openssh.com,aes256-ctr,aes128-gcm@openssh.com,aes128-ctr
MACs hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha2-256,hmac-sha1,hmac-sha2-512
GSSAPIKexAlgorithms gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-
KexAlgorithms ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512
HostKeyAlgorithms ecdsa-sha2-nistp256,ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-512-cert-v01@openssh.com
PubkeyAcceptedAlgorithms ecdsa-sha2-nistp256,ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-512-cert-v01@openssh.com
HostbasedAcceptedAlgorithms ecdsa-sha2-nistp256,ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519,ssh-ed25519-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,rsa-sha2-256,rsa-sha2-256-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-512-cert-v01@openssh.com
CASignatureAlgorithms ecdsa-sha2-nistp256,sk-ecdsa-sha2-nistp256@openssh.com,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519,sk-ssh-ed25519@openssh.com,rsa-sha2-256,rsa-sha2-512
RequiredRSASize 2048
(补充:这里以显示 openSUSE & SLES 默认使用的 SSH 加密方式 (cipher)、信息验证代码 (message authentication code) 和算法 (algorithm) 为例)
# systemctl restart sshd
# ssh -vv -oCiphers=3des-cbc -oPort=22 192.168.0.1
(补充:这里以测试 IP 地址是 192.168.0.1,端口号是 22,有没有启用 3des-cbc SSH 加密方式 (cipher) 为例)
# ssh -vv -oCiphers=3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc -oPort=22 192.168.0.1
(补充:这里以测试 IP 地址是 192.168.0.1,端口号是 22,有没有启用 3des-cbc、aes128-cbc、aes192-cbc 和 aes256-cbc SSH 加密方式 (cipher) 为例)
# ssh -vv -oMACs=hmac-md5 -oPort=22 192.168.0.1
(补充:这里以测试 IP 地址是 192.168.0.1,端口号是 22,有没有启用 hmac-md5 SSH 信息验证代码 (message authentication code) 为例)
# ssh -vv -oMACs=hmac-md5,hmac-md5-96,hmac-sha1,hmac-sha1-96,hmac-md5-etm@openssh.com,hmac-md5-96-etm@openssh.com -oPort=22 192.168.0.1
(补充:这里以测试 IP 地址是 192.168.0.1,端口号是 22,有没有启用 hmac-md5、hmac-md5-96、hmac-sha1、hmac-sha1-96、hmac-md5-etm@openssh.com 和 hmac-md5-96-etm@openssh.com SSH 信息验证代码 (message authentication code) 为例)
# sshd -T | egrep -i "ciphers|macs|kexalgorithms"
# nmap --script ssh2-enum-algos -sV -p 22 127.0.0.1
(补充:这里以测试本地的 22 端口为例)
# ssh -vvv 127.0.0.1
(补充:这里以测试本地的 22 端口为例)