-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update site at 20240319-211827, machine LiaoSirui-MacMini
- Loading branch information
Showing
4 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,38 @@ | ||
<http://c.biancheng.net/view/1147.html> | ||
## SELinux 简介 | ||
|
||
SELinux的策略与规则管理相关命令:seinfo 命令、sesearch 命令、getsebool 命令、setsebool 命令、semanage 命令 | ||
|
||
|
||
|
||
|
||
|
||
## 实例 | ||
|
||
- nginx 端口 | ||
|
||
```bash | ||
# 放行监听端口 | ||
semanage port -l | grep http_port_t | ||
semanage port -a -t http_port_t -p tcp 8088 | ||
|
||
# 放行上游 | ||
setsebool -P httpd_can_network_connect 1 | ||
setsebool -P httpd_can_network_relay 1 | ||
|
||
# 放行阻止的调用 | ||
cat /var/log/audit/audit.log | grep nginx | grep denied | audit2allow -M nginx | ||
semodule -i nginx.pp | ||
``` | ||
|
||
- node_exporter | ||
|
||
```bash | ||
semanage fcontext -a -t bin_t "/usr/sbin/node_exporter" | ||
restorecon -r -v /usr/sbin/node_exporter | ||
``` | ||
|
||
## 参考资料 | ||
|
||
- <https://wangchujiang.com/linux-command/c/semanage.html> | ||
|
||
- <http://c.biancheng.net/view/1147.html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
## crash 简介 | ||
|
||
crash 是一款可用来离线分析 linux 内核转存文件的工具,它整合了部分 gdb 的功能,可以查看堆栈、dmesg 日志、内核数据结构、反汇编等等,功能非常强大。crash 可支持多种工具生成的转存文件格式,例如 kdump、netdump、diskdump 等,而且还可以分析虚拟机 Xen 和 Kvm 上生成的内核转存文件 | ||
|
||
crash 与 linux 内核紧密耦合,需要与 linux 内核匹配。如果你的内核版本较新,crash 很可能无法解析,可以尝试安装最新的 crash 工具 | ||
|
||
使用 crash 来调试 vmcore,至少需要两个参数: | ||
|
||
- 未压缩的内核映像文件 vmlinux。认位于 `/usr/lib/debug/lib/modules/$(uname -r)/vmlinux`,由内核调试信息包提供 | ||
- 内存转储文件 vmcore,由 kdump 或 sysdump 转存的内核奔溃现场快照 | ||
|
||
(1)安装 kernel-debug | ||
|
||
```bash | ||
# 提供调试头文件 | ||
dnf install -y --enablerepo="base-debuginfo" install kernel-debuginfo | ||
``` | ||
|
||
(2)进入 core 文件所在路径, 执行如下命令: | ||
|
||
```bash | ||
crash vmcore /usr/lib/debug/lib/modules/<对应内核调试文件>/vmlinux | ||
``` | ||
|
||
## 常用命令 | ||
|
||
| 命令 | 功能 | 示例 | | ||
| ------------ | -------------------- | ------------------------------------------------------------ | | ||
| `bt` | 打印函数调用栈 | displays a task's kernel-stack backtrace,可以指定进程号 `bt <pid>` | | ||
| `log` | 打印系统消息缓冲区 | displays the kernel log_buf contents,如 `log \| tail -n 30` | | ||
| `ps` | 显示进程的状态 | `>` 表示活跃的进程,如 `ps | grep RU` | | ||
| `sys` | 显示系统概况 | | | ||
| `kmem -i` | 显示内存使用信息 | | | ||
| `dis <addr>` | 对给定地址进行反汇编 | | | ||
|
||
## 常见问题 | ||
|
||
- vmcore 和 vmlinux 出现不匹配问题的解决方法 | ||
|
||
PAE 物理地址扩展,软件包 `kernel-PAE-debuginfo` | ||
|
||
## 参考文档 | ||
|
||
- <https://www.ctyun.cn/developer/article/421358102605893> | ||
- <https://access.redhat.com/documentation/zh-cn/red_hat_enterprise_linux/8/html/managing_monitoring_and_updating_the_kernel/running-and-exiting-the-crash-utility_analyzing-a-core-dump> | ||
|
||
- <https://blog.csdn.net/WANGYONGZIXUE/article/details/128431816> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## Kdump 简介 | ||
|
||
Kdump 是一个用于收集系统崩溃、死锁或死机时内核参数的一个服务。举例来说,如果有一天系统崩溃了,在这时 Kdump 服务就会开始工作,将系统的运行状态和内核数据收集到一个“dump core”的文件中,便于后续让运维人员分析找出问题所在 | ||
|
||
Kdump 配置文件存放在 `/etc/kdump.conf` 配置文件中配置了一些相关信息,包括系统崩溃时,dump 的路径,默认情况下是放在 `/var/crash` 目录下面 | ||
|
||
## 参考文档 | ||
|
||
- <https://blog.csdn.net/heshuangzong/article/details/126906923> |