当前位置:网站首页>Getting started with kubernetes apparmor
Getting started with kubernetes apparmor
2022-08-09 05:54:00 【ghostwritten】
apparmor 入门
tags: apparmor,安全
1. 介绍
AppArmor is name-based access control Linux 安全模块实现.AppArmor Limit a single program to a set of listed files and posix 1003.1e Draft function.
有关 AppArmor 的更多信息可以在 AppArmor 项目的wiki上找到.
2. 安装
自 Ubuntu 8.04
LTS It is installed and loaded by default AppArmor
.Some packages will install their own mandatory profiles.可以在 Universe Repository packagesapparmor-profiles
Additional configuration files are found in .针对已安装的 apparmor When the configuration file is submitted incorrectly,请参阅:https /wiki.ubuntu.com/DebuggingApparmor
安装额外的 AppArmor 配置文件
- 启用 Universe 存储库.
- 安装apparmor-profiles.Click the link to install,或查看安装软件Learn more about installation options.
3. 用法
All the following commands should be executed from the terminal.
3.1 列出 apparmor 的当前状态
sudo aa-status
3.2 Put personal data in complaint mode
sudo aa-complain /path/to/bin
例子:
sudo aa-complain /bin/ping
3.3 Put the configuration file in enforcing mode
sudo aa-enforce /path/to/bin
例子:
sudo aa-enforce /bin/ping
3.4 禁用 AppArmor 框架
The system usually does not need to be completely disabled AppArmor.It is strongly recommended that users enable it AppArmor and put the problematic profile in complain mode(见上文),然后使用https://wiki.ubuntu.com/DebuggingApparmorThe program submits an error in .Disable if necessary AppArmor(例如使用 SELinux),用户可以:
sudo systemctl stop apparmor
sudo systemctl disable apparmor
在 Ubuntu 16.04 LTS 之前的 Ubuntu 系统上:
sudo invoke-rc.d apparmor stop
sudo update-rc.d -f apparmor remove
To be disabled in the kernel AppArmor,请执行以下任一操作:
- Adjust your kernel boot command line(见/etc/default/grub)
- ‘apparmor=0’
- ‘security=XXX’ 其中 XXX 可以是 “” 以禁用 AppArmor 或替代 LSM 名称,例如.‘安全=“selinux”’
Remove the garment package using your package manager.If you think you might want to re-enable it later AppArmor,请不要“清除”apparmor
3.5 启用 AppArmor 框架
AppArmor 默认启用.If you use the above process,要禁用它,You can re-enable it in the following ways:
- 确保 AppArmor 未
在/etc/default/grub
如果使用 Ubuntu 内核,或者使用非 Ubuntu
内核,那么/etc/default/grub
有apparmor=1
security=apparmor
- Make sure the garment is installed with the package
- 启用 systemd 单元:
sudo systemctl enable apparmor && sudo systemctl start apparmor
- 对于 Ubuntu 16.04 LTS 之前的系统:
sudo invoke-rc.d apparmor start
sudo update-rc.d apparmor start 37 S .
3.6 重新加载所有配置文件
sudo service apparmor reload
3.7 Reload a configuration file
sudo apparmor_parser -r /etc/apparmor.d/profile.name
例子:
sudo apparmor_parser -r /etc/apparmor.d/bin.ping
3.8 Disable a profile
sudo ln -s /etc/apparmor.d/profile.name /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/profile.name
例子:
sudo ln -s /etc/apparmor.d/bin.ping /etc/apparmor.d/disable/
sudo apparmor_parser -R /etc/apparmor.d/bin.ping
3.9 Enable a profile
默认情况下,Profile is enabled(i.e. loaded into the kernel and applied to the process).
sudo rm /etc/apparmor.d/disable/profile.name
sudo apparmor_parser -r /etc/apparmor.d/profile.name
例子:
sudo rm /etc/apparmor.d/disable/bin.ping
sudo apparmor_parser -r /etc/apparmor.d/bin.ping
这 aa-enforce
Commands can also be used to enable profiles:
sudo aa-enforce /etc/apparmor.d/bin.ping
配置文件定制
配置文件可以在/etc/apparmor.d
中找到.These are simple text files,You can use a text editor or use aa-logprof
进行编辑.
可以在/etc/apparmor.d/tunables/
中进行一些自定义.更新配置文件时,It is important to use these configuration files when appropriate.例如,Instead of using the following rules:
/home/*/ r,
利用:
@{
HOME}/ r,
更新配置文件后,Be sure to reload(见上文).
4. 常问问题
4.1 aa-status Reports processes that are unrestricted but have defined profiles
Restart the listed processes.A restart will also fix the problem.
AppArmor Only processes started after the kernel module is loaded can be tracked and secured.安装 apparmor 软件包后,apparmor 将启动.But running processes are not affected AppArmor 的保护.Restarting the process or rebooting will fix the problem.
4.2 如何为 Firefox 启用 AppArmor?
从 Ubuntu 9.10 (Karmic) 开始,AppArmor Comes with one disabled by default Firefox 配置文件.
You can enable it with the following command:
sudo aa-enforce /etc/apparmor.d/usr.bin.firefox
4.3 如何使 AppArmor and non-standard HOME directories work together?
可以在/etc/apparmor.d/tunables/home
Adjust the location of the home directory in .
使用 Ubuntu 10.04 LTS
及更高版本,您可以使用sudo dpkg-reconfigure apparmor
Set the home directory location.
5. 创建新配置文件
设计测试计划
Try to think about how the application should be executed.The test plan should be divided into small test cases.Each test case should have a short description and list the steps to follow.
Some standard test cases are:
- 启动程序
- 停止程序
- 重新加载程序
- 测试初始化All commands supported by the script
for graphics programs,Your test cases should also include anything you normally do.Download and open files、保存文件、上传文件、使用插件、It is possible to save configuration changes and start other programs.
6. 生成新的配置文件
使用aa-genprof
生成新的配置文件.
从终端,使用命令aa-genprof:
sudo aa-genprof executable
例子:
sudo aa-genprof slapd
The man page has more information:man aa-genprof
.
参考:
边栏推荐
猜你喜欢
手把手教你用C语言制作七夕流星雨---优雅永不过时(详细教程)
Chapter 3 Search and Graph Theory (1)
RNN-T
明明加了唯一索引,为什么还是产生重复数据?
Harbor Enterprise Mirror Warehouse Construction
半胱氨酸/半乳糖/苝二酰亚胺功能化Fe3O4四氧化三铁纳米材料|科研试剂
shell函数、数组
Fe3O4/SiO2 Composite Magnetic Nanoparticles Aminated on SiO2-NH2/Fe3O4 Surface (Qiyue Reagent)
华为鲲鹏生态培训试题
[Deep Learning] Let's talk about what is convolutional neural network and what does convolution mean?
随机推荐
bean的生命周期
JMeter test - JMeter 】 【 upload multiple images/batch CSV file upload pictures interface parametric method
IDEA05:线程管理
kubernetes 安全
金仓数据库能否设置事务自动提交
直播源码开发,点击扫描跳转到扫码页面
地理空间分析库turf.js的学习
pytorch实现GAN入门案例
王爽 汇编语言个人疑问汇总第九篇
cglib获取不到接口注解
2022牛客多校联赛第七场 题解
mysql查看表的创建时间
四氧化三铁/硫化铋纳米复合材料([email protected]@BSABiS纳米颗粒)|树状大分子稳定的硫化铋纳米颗粒|科研试剂
三剑客进阶
Chapter 7. Image-based lighting
el与data的
想要精准营销,从学习搭建一套对的标签体系开始丨DTVision分析洞察篇
找两个单身狗
qt发送邮件程序
软件测试工程师简历要怎么写,才能让HR看到