复习之selinux的管理
一、什么是selinux?
SELinux,Security Enhanced Linux 的缩写,也就是安全强化的 Linux,是由美国国家安全局(NSA)联合其他安全机构(比如 SCC 公司)共同开发的,旨在增强传统 Linux 操作系统的安全性,解决传统 Linux 系统中自主访问控制(DAC)系统中的各种权限问题(如 root 权限过高等)。
下面举例了解下selinux:
1. selinux关闭时
- 移动/mnt/里面的文件到ftp的默认发布目录中可以被访问
- ls -Z 访问文件属性时显示?
- 匿名用户可以上传文件(前提是配置文件设定权限)
首先查看selinux的状态
[root@ftp ~]# getenforce
Disabled
在/mnt/建立新文件,并且移动他到ftp的默认发布目录/var/ftp,当匿名用户登录时可以访问该文件!
[root@ftp ~]# touch /mnt/westodfile1
[root@ftp ~]# mv /mnt/westodfile1 /var/ftp/
[root@ftp ~]# lftp 172.25.254.100
lftp 172.25.254.100:~> ls
drwxrwxr-x 3 0 50 49 Aug 02 05:51 pub
-rw-r--r-- 1 0 0 0 Aug 02 13:05 westodfile1
lftp 172.25.254.100:/>
ls -Z 访问文件属性时显示?
[root@ftp ~]# ls -Z /var/ftp
? pub ? westodfile1
[root@ftp ~]#
在配置文件中设定匿名用户可以上传文件!
重启服务后,匿名用户上传文件成功!
[root@ftp ~]# vim /etc/vsftpd/vsftpd.conf
[root@ftp ~]# systemctl restart vsftpd.service
[root@ftp ~]# lftp 172.25.254.100
lftp 172.25.254.100:~> ls
drwxrwxr-x 3 0 50 49 Aug 02 05:51 pub
-rw-r--r-- 1 0 0 0 Aug 02 13:05 westodfile1
lftp 172.25.254.100:/> cd pub/
lftp 172.25.254.100:/pub> ls
-rw-r--r-- 1 1000 50 16043547 Aug 02 05:53 bigfile
-rw-r--r-- 1 1000 50 2761 Aug 02 05:02 passwd
drwx------ 2 14 50 6 Aug 01 11:30 westos
lftp 172.25.254.100:/pub> put /etc/inittab
490 bytes transferred
lftp 172.25.254.100:/pub> ls
-rw-r--r-- 1 1000 50 16043547 Aug 02 05:53 bigfile
-rw-r--r-- 1 1000 50 490 Aug 02 13:12 inittab
-rw-r--r-- 1 1000 50 2761 Aug 02 05:02 passwd
drwx------ 2 14 50 6 Aug 01 11:30 westos
lftp 172.25.254.100:/pub> quit
2. selinu开启时
- vim /etc/sysconfig/selinux : 修改selinux状态
- 重复以上实验,比较结果!
首先修改selinux状态!修改完成一定要重启系统,否则不识别!重启比较慢,等待一下。。。
[root@ftp ~]# vim /etc/sysconfig/selinux
[root@ftp ~]# cat /etc/sysconfig/selinux # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted[root@ftp ~]# reboot
重启成功后,再次重复上面的实验!首先查看selinux的状态!此时时开启的!
[root@ftp ~]# getenforce
Enforcing
再次新建文件移动到ftp的默认发布目录,看看可以访问玛?发现不能访问了!
[root@ftp ~]# touch /mnt/westosfile2
[root@ftp ~]# mv /mnt/westosfile2 /var/ftp/
[root@ftp ~]# lftp 172.25.254.100
lftp 172.25.254.100:~> ls
drwxrwxr-x 3 0 50 64 Aug 02 13:12 pub
-rw-r--r-- 1 0 0 0 Aug 02 13:05 westodfile1
lftp 172.25.254.100:/> quit
利用ls -Z 访问文件属性显示。。。
[root@ftp ~]# ls -Z /var/ftp
system_u:object_r:public_content_t:s0 pub
system_u:object_r:public_content_t:s0 westodfile1unconfined_u:object_r:mnt_t:s0 westosfile2
[root@ftp ~]#
此时配置文件允许匿名用户上传文件
但是匿名用户却无法上传文件!
[root@ftp ~]# lftp 172.25.254.100
lftp 172.25.254.100:~> ls
drwxrwxr-x 3 0 50 64 Aug 02 13:12 pub
-rw-r--r-- 1 0 0 0 Aug 02 13:05 westodfile1
lftp 172.25.254.100:/> cd pub/
lftp 172.25.254.100:/pub> ls
-rw-r--r-- 1 1000 50 16043547 Aug 02 05:53 bigfile
-rw-r--r-- 1 1000 50 490 Aug 02 13:12 inittab
-rw-r--r-- 1 1000 50 2761 Aug 02 05:02 passwd
drwx------ 2 14 50 6 Aug 01 11:30 westos
lftp 172.25.254.100:/pub> put /etc/group
put: /etc/group: Access failed: 553 Could not create file. (group)
lftp 172.25.254.100:/pub> quit
[root@ftp ~]#
以上对比可知,selinux可以提高系统的安全性!
二、selinux的状态及管理
1.selinux的状态
- enforcing :selinux开机设定为强制状态此状态为selinux开启
- permissive :selinux开机设定为警告状态此状态为selinux开启
- disabled:selinux关闭
enforcing 和 permissive状态都是开启状态,有什么不同呢?
enforcing: 不符合条件一定不能被允许,并会收到警告信息
permissive: 不符合条件被允许,并会收到警告信息
2. selinux状态的查看
- getenforce
- cat /etc/sysconfig/delinux
- cat /etc/selinux/config
[root@ftp ~]# geten
getenforce getent
[root@ftp ~]# getenforce
Enforcing
[root@ftp ~]# cat /etc/sysconfig/selinux # This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
3.selinux状态的转换
(1)开启和关闭状态之间的转换
selinux从开启状态变为关闭状态或者从关闭状态转换为开启状态,必须要重启!
(2)开启状态之间的转换
enforceing 和 permissive状态之间的转换可以用
- setenforce 0/1 进行转换
- setenforce 0 : 转换到permissive状态
- setenforce 1 :转换到enforcing状态
[root@ftp ~]# getenforce
Enforcing
[root@ftp ~]# setenforce 0
[root@ftp ~]# getenforce
Permissive
[root@ftp ~]# setenforce 1
[root@ftp ~]# getenforce
Enforcing
[root@ftp ~]#
(3)开机时想转换状态
当正在开机时,想转换状态
- “e" 编辑输入 selinux=0/1
- selinux=0 : disabled状态
- selinux=1:enforcing状态
初始时enforcing状态
重启后
想改变状态
[root@ftp ~]# getenforce
Enforcing
[root@ftp ~]# reboot
Connection to 172.25.254.100 closed by remote host.
Connection to 172.25.254.100 closed.
[root@node73 Desktop]# ssh -l root 172.25.254.100
root@172.25.254.100's password:
Activate the web console with: systemctl enable --now cockpit.socketThis system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --registerLast login: Sat Aug 5 10:30:45 2023 from 172.25.254.73
[root@ftp ~]# getenforce
Disabled
在开机界面编辑 selinux=0 可以改成enforcing状态
开启,selinux状态转换成了disabled状态!
三、selinux的安全上下文
SELinux 管理过程中,进程是否可以正确地访问文件资源,取决于它们的安全上下文。进程和文件都有自己的安全上下文,SELinux 会为进程和文件添加安全信息标签,比如 SELinux 用户、角色、类型、类别等,当运行 SELinux 后,所有这些信息都将作为访问控制的依据。
1. selinux安全上下文的查看方法
ps:首先要开启selinux!!!
- ls -Z :查看文件的安全上下文
- ls -Zd :查看目录的安全上下文
- ps auxZ :查看进程的安全上下文
[root@ftp ~]# ls -Zsystem_u:object_r:admin_home_t:s0 anaconda-ks.cfg system_u:object_r:admin_home_t:s0 passwd
unconfined_u:object_r:admin_home_t:s0 Desktop unconfined_u:object_r:admin_home_t:s0 Pictures
unconfined_u:object_r:admin_home_t:s0 Documents unconfined_u:object_r:admin_home_t:s0 Public
unconfined_u:object_r:admin_home_t:s0 Downloads unconfined_u:object_r:admin_home_t:s0 Templates
unconfined_u:object_r:admin_home_t:s0 fstab unconfined_u:object_r:admin_home_t:s0 Videossystem_u:object_r:admin_home_t:s0 initial-setup-ks.cfg unconfined_u:object_r:admin_home_t:s0 westos.cfg
unconfined_u:object_r:admin_home_t:s0 Music
[root@ftp ~]# ls -Zd /var/www/html/
system_u:object_r:httpd_sys_content_t:s0 /var/www/html/
[root@ftp ~]# ps aux -Z
LABEL USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
system_u:system_r:init_t:s0 root 1 0.4 0.7 181872 13996 ? Ss 18:06 0:01 /usr/lib/systemd/systemd --switched-root --syst
system_u:system_r:kernel_t:s0 root 2 0.0 0.0 0 0 ? S 18:06 0:00 [kthreadd]
system_u:system_r:kernel_t:s0 root 3 0.0 0.0 0 0 ? I< 18:06 0:00 [rcu_gp]
system_u:system_r:kernel_t:s0 root 4 0.0 0.0 0 0 ? I< 18:06 0:00 [rcu_par_gp]
system_u:system_r:kernel_t:s0 root 5 0.0 0.0 0 0 ? I 18:06 0:00 [kworker/0:0-events_power_efficient]
system_u:system_r:kernel_t:s0 root 6 0.0 0.0 0 0 ? I< 18:06 0:00 [kworker/0:0H-kblockd]
system_u:system_r:kernel_t:s0 root 7 0.0 0.0 0 0 ? I 18:06 0:00 [kworker/u4:0-events_unbound]
2. 安全上下文的组成
只要进程和文件的安全上下文匹配,该进程就可以访问该文件资源。
安全上下文看起来比较复杂,它使用“:”分隔为 4 个字段,其实共有 5 个字段,只是最后一个“类别”字段是可选的
- system_u : object_r : httpd_sys_content_t : s0 /var/www/html/
- 身份字段 : 角色 : 类型 :灵敏度 [类别]
(1)身份字段--user
用于标识该数据被哪个身份所拥有,相当于权限中的用户身份。常见的身份类型有以下 3 种:
- 1.- root:表示安全上下文的身份是 root。
- 2.- system_u:表示系统用户身份,其中“_u”代表 user。
- 3.- user_u:表示与一般用户账号相关的身份,其中“_u”代表 user。
(2)角色--role
主要用来表示此数据是进程还是文件或目录。常见的角色有以下两种:
- 1.- object_r:代表该数据是文件或目录,这里的“_r”代表 role。
- 2.- system_r:代表该数据是进程,这里的“_r”代表 role。
(3)类型--type
类型字段是安全上下文中最重要的字段,进程是否可以访问文件,主要就是看进程的安全上下文类型字段是否和文件的安全上下文类型字段相匹配,如果匹配则可以访问
ps:类型字段在文件或目录的安全上下文中被称作类型(type),但是在进程的安全上下文中被称作域(domain)。也就是说,在主体(Subject)的安全上下文中,这个字段被称为域;在目标(Object)的安全上下文中,这个字段被称为类型。域和类型需要匹配(进程的类型要和文件的类型相匹配),才能正确访问。
apache 进程的域是 httpd_t,/var/www/html/ 目录的类型是 httpd_sys_content_t,这个主体的安全上下文类型经过策略规则的比对,是和目标的安全上下文类型匹配的,所以 apache 进程可以访问 /var/www/html/ 目录。
(4) 灵敏度
灵敏度一般是用 s0、s1、s2 来命名的,数字代表灵敏度的分级。数值越大,代表灵敏度越高。
(5)类别
类别字段不是必须有的
3. selinux安全上下文的修改
- chcon:临时修改
- semanage :永久修改
(1)临时修改--chcon
- chcon [选项] 文件或目录
-
-R: 递归,当前目录和目录下的所有子文件同时设置; -t: 修改安全上下文的类型字段,最常用; -u: 修改安全上下文的身份字段; -r: 修改安全上下文的角色字段;
-------------------------------------------------------实验----------------------------------------------------------------------
在apache的默认发布目录中 写入test page
[root@ftp html]# echo "test page" >> /var/www/html/index.html
上下文匹配的情况下,打开浏览器,可以看见以下界面!
此时,修改默认目录的安全上下文,与httpd进程的上下文不再匹配
[root@ftp html]# ps auxZ | grep httpd
system_u:system_r:httpd_t:s0 root 1078 0.0 0.6 281404 11464 ? Ss 18:06 0:00 /usr/sbin/httpd -DFOREGROUND
system_u:system_r:httpd_t:s0 apache 1200 0.0 0.4 294140 8524 ? S 18:06 0:00 /usr/sbin/httpd -DFOREGROUND
system_u:system_r:httpd_t:s0 apache 1201 0.0 1.0 1941840 20412 ? Sl 18:06 0:00 /usr/sbin/httpd -DFOREGROUND
system_u:system_r:httpd_t:s0 apache 1205 0.0 0.6 1810712 12244 ? Sl 18:06 0:00 /usr/sbin/httpd -DFOREGROUND
system_u:system_r:httpd_t:s0 apache 1206 0.0 0.8 1810712 16332 ? Sl 18:06 0:00 /usr/sbin/httpd -DFOREGROUND
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 root 2550 0.0 0.0 12108 1100 pts/0 S+ 18:36 0:00 grep --color=auto httpd
[root@ftp html]# chcon -t var_t /var/www/html/index.html
[root@ftp html]# ls -Z /var/www/html/index.html
unconfined_u:object_r:var_t:s0 /var/www/html/index.html
[root@ftp html]#
再次打浏览器,进入默认发布目录,发现无法访问!
这是因为 安全上下文不匹配!当然,我们可以通过 chcon 命令修改回来就可以修复。不过,我们还有一个命令 restorecon,这个命令的作用就是把文件的安全上下文恢复成默认的安全上下文。SELinux 的安全上下文设定非常完善,所以使用 restorecon 命令就可以修复安全上下文不匹配所引起的问题。
(2)恢复默认上下文--restorecon
-
restorecon [选项】 文件或目录
-
-R:递归.当前目录和目录下所有的子文件同时恢复; -V:把恢复过程显示到屏幕上;
恢复目录的默认上下文!!
[root@ftp html]# restorecon -Rv /var/www/html/index.html
Relabeled /var/www/html/index.html from unconfined_u:object_r:var_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
[root@ftp html]# ls -Z /var/www/html/index.html
unconfined_u:object_r:httpd_sys_content_t:s0 /var/www/html/index.html
再次通过浏览器访问!!再次访问成功,因为此时安全上下文已经匹配!
(3) 修改默认安全上下文--semanage
- semanage fcontent -l : 查看内核的安全上下文
- semanage fcontext -a -t public_content_t '/westosdir(/.*)?' : 修改目录的安全上下文
- restorecon -RvvF /westosdir/ :刷新,修改目录当前的安全上下文
- semanage fcontext -d -t public_content_t '/westosdir(/.*)?' : 删除目录的安全上下文
----------------------------------------------------------------实验--------------------------------------------------------
[root@ftp ~]# semanage fcontext -l
查看内核的安全上下文,建立目录westosdir
修改默认上下文
修改后,还没有改变,因为只是修改了默认上下文,没有修改目前的安全上下文!
因此要刷新,修改目前的安全上下文
修改完成后,默认上下文已经改变,再次查看内核的安全上下文,/wesosdir存在!
如果不想要这个上下文,可以删除!删除后依旧要刷新!
root@ftp ~]# semanage fcontext -d -t public_content_t '/westosdir(/.*)?'
[root@ftp ~]# ls -Zd /westosdir/
system_u:object_r:public_content_t:s0 /westosdir/
[root@ftp ~]# restorecon -RvvF /westosdir/
Relabeled /westosdir from system_u:object_r:public_content_t:s0 to system_u:object_r:default_t:s0
[root@ftp ~]# ls -Zd /westosdir/
system_u:object_r:default_t:s0 /westosdir/
查看内核的安全上下文,已经不存在!
四、SEBOOL
sebool 是selinux能对服务功能能够添加的开关
- getsebool -a | grep ftp :查看ftp的bool值
- setsebool -P ftpd_anon_write on:更改bool值
---------------------------------------实验-------------------------------------------------------
ftp默认配置目录中允许匿名用户上传文件
但实际不允许匿名用户上传文件
[root@ftp ~]# lftp 172.25.254.100
lftp 172.25.254.100:~> ls
drwxrwxr-x 3 0 50 64 Aug 02 13:12 pub
-rw-r--r-- 1 0 0 0 Aug 02 13:05 westodfile1
-rw-r--r-- 1 0 0 0 Aug 02 13:23 westosfile2
lftp 172.25.254.100:/> cd pub/
lftp 172.25.254.100:/pub> ls
-rw-r--r-- 1 1000 50 16043547 Aug 02 05:53 bigfile
-rw-r--r-- 1 1000 50 490 Aug 02 13:12 inittab
-rw-r--r-- 1 1000 50 2761 Aug 02 05:02 passwd
drwx------ 2 14 50 6 Aug 01 11:30 westos
lftp 172.25.254.100:/pub> put /etc/group
put: /etc/group: Access failed: 553 Could not create file. (group)
lftp 172.25.254.100:/pub> quit
这是因为selinux开启!!此时查看ftp的sebool值,发现匿名用户上传功能关闭!
[root@ftp ~]# getenforce
Enforcing
[root@ftp ~]# getsebool -a | grep ftp
ftpd_anon_write --> off
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> off
ftpd_full_access --> off
ftpd_use_cifs --> off
ftpd_use_fusefs --> off
ftpd_use_nfs --> off
ftpd_use_passive_mode --> off
httpd_can_connect_ftp --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
tftp_home_dir --> off
更改sebool值
[root@ftp ~]# setsebool -P ftpd_anon_write on
[root@ftp ~]# getsebool -a | grep ftp
ftpd_anon_write --> on
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> off
ftpd_full_access --> off
ftpd_use_cifs --> off
ftpd_use_fusefs --> off
ftpd_use_nfs --> off
ftpd_use_passive_mode --> off
httpd_can_connect_ftp --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
tftp_home_dir --> off
再次匿名上传文件,成功!!
<pre>[root@ftp ~]# lftp 172.25.254.100
lftp 172.25.254.100:~> ls
drwxrwxr-x 3 0 50 64 Aug 02 13:12 <font color="#0087FF">pub</font>
-rw-r--r-- 1 0 0 0 Aug 02 13:05 westodfile1
-rw-r--r-- 1 0 0 0 Aug 02 13:23 westosfile2
lftp 172.25.254.100:/> cd pub/
lftp 172.25.254.100:/pub> ls
-rw-r--r-- 1 1000 50 16043547 Aug 02 05:53 bigfile
-rw-r--r-- 1 1000 50 490 Aug 02 13:12 inittab
-rw-r--r-- 1 1000 50 2761 Aug 02 05:02 passwd
drwx------ 2 14 50 6 Aug 01 11:30 <font color="#0087FF">westos</font>
lftp 172.25.254.100:/pub> put /etc/group
1032 bytes transferred
lftp 172.25.254.100:/pub> quit
</pre>
五、SEPORT
SEPORT是selinux对于服务端口的管理
- semanage port -l | grep ssh:查看服务可用端口
- semanage port -a -t ssh_port_t -p tcp 2222:添加服务端口
- semanage port -d -t ssh_port_t -p tcp 2222:删除服务端口
---------------------------------------------------------实验------------------------------------------------------
首先设定selinux状态为permissive,然后修改ssh服务的默认端口号,重启服务,成功!
[root@ftp ~]# getenforce
Enforcing
[root@ftp ~]# setenforce 0
[root@ftp ~]# getenforce
Permissive
[root@ftp ~]# vim /etc/ssh/sshd_config
[root@ftp ~]# systemctl restart sshd
[root@ftp ~]# netstat -antlupe | grep sshd
tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN 0 37626 2320/sshd
tcp 0 0 172.25.254.100:22 172.25.254.73:59242 ESTABLISHED 0 34599 2152/sshd: root [pr
tcp6 0 0 :::2222 :::* LISTEN 0 37628 2320/sshd
查看端口号,也可以使用!此时修改selinux的状态为enforcing,重启服务失败!
[root@ftp ~]# setenforce 1
[root@ftp ~]# getenforce
Enforcing
[root@ftp ~]# systemctl restart sshd
Job for sshd.service failed because the control process exited with error code.
See "systemctl status sshd.service" and "journalctl -xe" for details.
[root@ftp ~]# netstat -antlupe | grep sshd
tcp 0 0 172.25.254.100:22 172.25.254.73:59242 ESTABLISHED 0 34599 2152/sshd: root [pr
如果在enforcing状态下,想使用指定的端口号怎么办?可以使用semanage命添加指定端口!
[root@ftp ~]# netstat -antlupe | grep sshd
tcp 0 0 172.25.254.100:22 172.25.254.73:59242 ESTABLISHED 0 34599 2152/sshd: root [pr
[root@ftp ~]# semanage port -a -t ssh_port_t -p tcp 2222
[root@ftp ~]# semanage -l | grep ssh
semanage: error: the following arguments are required: subcommand
[root@ftp ~]# semanage port -l | grep ssh
ssh_port_t tcp 2222, 22
[root@ftp ~]# netstat -antlupe | grep sshd
tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN 0 40835 2436/sshd
tcp 0 0 172.25.254.100:22 172.25.254.73:59242 ESTABLISHED 0 34599 2152/sshd: root [pr
tcp6 0 0 :::2222 :::* LISTEN 0 40837 2436/sshd
[root@ftp ~]# systemctl restart sshd
添加成功,重启服务成功!当然也可删除该端口,删除后,2222端口不存在!!
[root@ftp ~]# semanage port -d -t ssh_port_t -p tcp 2222
[root@ftp ~]# semanage port -l | grep ssh
ssh_port_t tcp 22
六、selinux的排错解决方案
- /var/log/audit/audit.log :selinux警告信息
- /var/log/messages:selinux问题解决方案
- setroubleshoot-server :此软件功能是采集警告信息并分析得到解决方案存放到message中
--------------------------------------------------------实验------------------------------------------------------------------
首先建立新文件,移动该文件到ftp的发布目录
[root@ftp ~]# touch /mnt/westostest
[root@ftp ~]# mv /mnt/westostest /var/ftp
mv: overwrite '/var/ftp/westostest'? y
接着进入发布目录,发现没有看见该文件!
[root@ftp ~]# lftp 172.25.254.100
lftp 172.25.254.100:~> ls
drwxrwxr-x 3 0 50 77 Aug 05 12:04 pub
-rw-r--r-- 1 0 0 0 Aug 02 13:05 westodfile1
-rw-r--r-- 1 0 0 0 Aug 02 13:23 westosfile2
lftp 172.25.254.100:/> quit
进入/var/log/audit/audit.log ,查看警告信息
但是没有解决方案,进入/var/log/messages查看解决方案
运行该命令发现,有两个命令可以解决
选择一个运行:
ps:/westostest 前面加上/var/ftp
[root@ftp ~]# /sbin/restorecon -v /var/ftp/westostest
Relabeled /var/ftp/westostest from unconfined_u:object_r:mnt_t:s0 to unconfined_u:object_r:public_content_t:s0
此时再次查看ftp默认目录,发现wesetostest文件已经出现!
宗上,selinux有排错功能是因为有软件:
如果没有解决方案可能是没有安装这个软件!
相关文章:

复习之selinux的管理
一、什么是selinux? SELinux,Security Enhanced Linux 的缩写,也就是安全强化的 Linux,是由美国国家安全局(NSA)联合其他安全机构(比如 SCC 公司)共同开发的,旨在增强传统 Linux 操…...

无涯教程-Lua - 文件I/O
I/O库用于在Lua中读取和处理文件。 Lua中有两种文件操作,即隐式(Implicit)和显式(Explicit)操作。 对于以下示例,无涯教程将使用例文件test.lua,如下所示。 -- sample test.lua -- sample2 test.lua 一个简单的文件打开操作使用以下语句。…...

java+ssm民宿酒店客房推荐预订系统_2k78b--论文
摘 要 互联网日益成熟,走进千家万户,改变多个行业传统的工作方式。民宿推荐管理以用户需求为基础,借由发展迅猛的互联网平台实现民宿推荐管理的信息化,简化旧时民宿推荐管理所需的纸质记录这一繁杂过程,从而大幅提高民…...

Docker实战-关于Docker镜像的相关操作(一)
导语 镜像,Docker中三大核心概念之一,并且在运行Docker容器之前需要本地存储对应的镜像。那么下面我们就来介绍一下在Docker中如何使用镜像。 如何获取镜像? 镜像作为容器运行的前提条件,在Docker Hub上提供了各种各样的开放的…...

Jenkins Gerrit Trigger实践
1.创建Gerrit Trigger 2.jenkins master节点生成gerrit用户的密钥 这里的用户名得写登录gerrit后个人信息中的 Username 3.gerrit 配置刚刚jenkins生成密钥的公钥 4.gerrit 用户加入群组 不加这个群组,下一步测试就会报错“User aeshare has no capability conn…...

Xcode protobuf2.5添加arm64编译器补丁生成静态库
项目需求,protobuf源码编成静态库使用 但是,github上的protobuf源码没有对应arm64的编译器定义,编译出来的静态库使用时报错。 下面的连接是arm64编译器代码补丁包,把编译器代码放到src/google/protobuf/stubs/atomicops_intern…...

计算机毕设 深度学习疫情社交安全距离检测算法 - python opencv cnn
文章目录 0 前言1 课题背景2 实现效果3 相关技术3.1 YOLOV43.2 基于 DeepSort 算法的行人跟踪 4 最后 0 前言 🔥 这两年开始毕业设计和毕业答辩的要求和难度不断提升,传统的毕设题目缺少创新和亮点,往往达不到毕业答辩的要求,这两…...

四数之和——力扣18
文章目录 题目描述双指针法题目描述 双指针法 class Solution {public:vector<vector<int>>...
Serializable 和 Externalizable区别?
Serializable接口 java.io.Serializable 接口没有方法或字段,仅用于标识可序列化的语义。 public interface Serializable { }可序列化类的所有子类型本身都是可序列化的。在进行序列化操作时,会判断要被序列化的类是否是Enum、Array和 Serializable类…...

2023 电赛 E 题 K210 方案--K210实现矩形识别
相关库介绍 sensor(摄像头) sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(10) reset():重置并初始化单目摄像头 set_pixformat():设置摄像头输出格式,…...

【雕爷学编程】MicroPython动手做(29)——物联网之SIoT 2
知识点:什么是掌控板? 掌控板是一块普及STEAM创客教育、人工智能教育、机器人编程教育的开源智能硬件。它集成ESP-32高性能双核芯片,支持WiFi和蓝牙双模通信,可作为物联网节点,实现物联网应用。同时掌控板上集成了OLED…...

chapter13:springboot与任务
Spring Boot与任务视频 1. 异步任务 使用注解 Async 开启一个异步线程任务, 需要在主启动类上添加注解EnableAsync开启异步配置; Service public class AsyncService {Asyncpublic void hello() {try {Thread.sleep(3000);} catch (InterruptedExcept…...

(十一)大数据实战——hadoop高可用之HDFS手动模式高可用
前言 本节内容我们介绍一下hadoop在手动模式下如何实现HDFS的高可用,HDFS的高可用功能是通过配置多个 NameNodes(Active/Standby)实现在集群中对 NameNode 的热备来解决上述问题。如果出现故障,如机器崩溃或机器需要升级维护,这时可通过此种…...

problem(3):python IDE和python解释器
为什么写这篇文章呢?遇到了下面的问题,相同的解释器,如果运行angr库的代码,会出现 这样的情况,但是用spyder IDE 会显示正常,很奇怪 应该就是IDE的原因 IDE的循环导入问题 检查IDE配置: 如果可…...

【C语言进阶篇】模拟实现通讯录 (内附源码)
🎬 鸽芷咕:个人主页 🔥 个人专栏:《C语言初阶篇》 《C语言进阶篇》 ⛺️生活的理想,就是为了理想的生活! 文章目录 📋 前言一 、 通讯录的简介1.1 联系人的类型定义1.2 通讯录的定义1.3 通讯录要实现的功能 二 、 如何…...

Python web实战之 Django 的模板语言详解
关键词: Python、web开发、Django、模板语言 概要 作为 Python Web 开发的框架之一,Django 提供了一套完整的 MVC 模式,其中的模板语言为开发者提供了强大的渲染和控制前端的能力。本文介绍 Django 的模板语言。 1. Django 模板语言入门 Dj…...

使用ChatGPT编写技术文档
技术文档对于任何项目都是至关重要的,因为它确保所有利益相关者都在同一层面上,并允许有效的沟通和协作。创建详细而准确的技术文档可能既耗时又具有挑战性,特别是对于那些不熟悉主题或缺乏强大写作技巧的人来说。ChatGPT 是一个强大的人工智…...
Java超级玛丽小游戏制作过程讲解 第四天 创建并完成常量类03
今天继续来完成常量类。 package com.sxt;import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.List;public class StaticValue {//背景public static Buff…...

webpack基础知识八:说说如何借助webpack来优化前端性能?
一、背景 随着前端的项目逐渐扩大,必然会带来的一个问题就是性能 尤其在大型复杂的项目中,前端业务可能因为一个小小的数据依赖,导致整个页面卡顿甚至奔溃 一般项目在完成后,会通过webpack进行打包,利用webpack对前…...

JAVA SE -- 第十五天
(全部来自“韩顺平教育”) 多线程 一、线程相关概念 1、程序:是为完成特定任务、用某种语言编写的一组指令的集合。 2、进程:是指运行中的程序,如QQ,就启动了一个进程,操作系统就会为该进程…...

label-studio的使用教程(导入本地路径)
文章目录 1. 准备环境2. 脚本启动2.1 Windows2.2 Linux 3. 安装label-studio机器学习后端3.1 pip安装(推荐)3.2 GitHub仓库安装 4. 后端配置4.1 yolo环境4.2 引入后端模型4.3 修改脚本4.4 启动后端 5. 标注工程5.1 创建工程5.2 配置图片路径5.3 配置工程类型标签5.4 配置模型5.…...

P3 QT项目----记事本(3.8)
3.8 记事本项目总结 项目源码 1.main.cpp #include "widget.h" #include <QApplication> int main(int argc, char *argv[]) {QApplication a(argc, argv);Widget w;w.show();return a.exec(); } 2.widget.cpp #include "widget.h" #include &q…...

Maven 概述、安装、配置、仓库、私服详解
目录 1、Maven 概述 1.1 Maven 的定义 1.2 Maven 解决的问题 1.3 Maven 的核心特性与优势 2、Maven 安装 2.1 下载 Maven 2.2 安装配置 Maven 2.3 测试安装 2.4 修改 Maven 本地仓库的默认路径 3、Maven 配置 3.1 配置本地仓库 3.2 配置 JDK 3.3 IDEA 配置本地 Ma…...

算法岗面试经验分享-大模型篇
文章目录 A 基础语言模型A.1 TransformerA.2 Bert B 大语言模型结构B.1 GPTB.2 LLamaB.3 ChatGLMB.4 Qwen C 大语言模型微调C.1 Fine-tuningC.2 Adapter-tuningC.3 Prefix-tuningC.4 P-tuningC.5 LoRA A 基础语言模型 A.1 Transformer (1)资源 论文&a…...

视频行为标注工具BehaviLabel(源码+使用介绍+Windows.Exe版本)
前言: 最近在做行为检测相关的模型,用的是时空图卷积网络(STGCN),但原有kinetic-400数据集数据质量较低,需要进行细粒度的标注,同时粗略搜了下已有开源工具基本都集中于图像分割这块,…...

MFC 抛体运动模拟:常见问题解决与界面美化
在 MFC 中开发抛体运动模拟程序时,我们常遇到 轨迹残留、无效刷新、视觉单调、物理逻辑瑕疵 等问题。本文将针对这些痛点,详细解析原因并提供解决方案,同时兼顾界面美化,让模拟效果更专业、更高效。 问题一:历史轨迹与小球残影残留 现象 小球运动后,历史位置的 “残影”…...

接口自动化测试:HttpRunner基础
相关文档 HttpRunner V3.x中文文档 HttpRunner 用户指南 使用HttpRunner 3.x实现接口自动化测试 HttpRunner介绍 HttpRunner 是一个开源的 API 测试工具,支持 HTTP(S)/HTTP2/WebSocket/RPC 等网络协议,涵盖接口测试、性能测试、数字体验监测等测试类型…...
MySQL 主从同步异常处理
阅读原文:https://www.xiaozaoshu.top/articles/mysql-m-s-update-pk MySQL 做双主,遇到的这个错误: Could not execute Update_rows event on table ... Error_code: 1032是 MySQL 主从复制时的经典错误之一,通常表示ÿ…...

高分辨率图像合成归一化流扩展
大家读完觉得有帮助记得关注和点赞!!! 1 摘要 我们提出了STARFlow,一种基于归一化流的可扩展生成模型,它在高分辨率图像合成方面取得了强大的性能。STARFlow的主要构建块是Transformer自回归流(TARFlow&am…...
前端工具库lodash与lodash-es区别详解
lodash 和 lodash-es 是同一工具库的两个不同版本,核心功能完全一致,主要区别在于模块化格式和优化方式,适合不同的开发环境。以下是详细对比: 1. 模块化格式 lodash 使用 CommonJS 模块格式(require/module.exports&a…...