当前位置: 首页 > news >正文

个人网页设计html与css代码杭州seo技术培训

个人网页设计html与css代码,杭州seo技术培训,做毕业设计资料网站好,哪个网站可以做中文云文字目录 一.SElinux工作原理简介 1.system_u 2.object_r 3.httpd_sys_content_t 4.s0 二.SElinux策略的具体使用详情 1.restorecon 2.semanage 3.chcon 一.SElinux工作原理简介 通过mac方式管理进程,管理的目标是进程是否具有读取权限的文件(文件…

目录

一.SElinux工作原理简介

1.system_u

2.object_r

3.httpd_sys_content_t

4.s0

二.SElinux策略的具体使用详情

1.restorecon

2.semanage

3.chcon


 

一.SElinux工作原理简介

通过mac方式管理进程,管理的目标是进程是否具有读取权限的文件(文件、目录、端口等),要使得进程和目标的安全上下文一致才能够顺利访问到资源(还要受文件资源的RWX等权限影响)。MAC可以针对特定的进程与特定的文件资源来进行权限的控制,即使你是root,在使用不同的进程时,你所能取得的权限并不一定是root,而得要看当时该进程的设置而定。这样一来就可以针对进程而不是用户对文件来进行访问控制。此外,这个进程也不能任意使用系统文件资源,因为每个文件资源也有针对进程设置可取用的权限。由于,整个系统进程那么多,文件那么多,所以SELinux也提供一些默认的策略(policy),并在该策略内提供多个规则,让你可以选择是否启用该控制规则。

#如下是我160主机的httpd的html目录的安全上下文内容,以ls -Z来查看,其中有4个字段,稍后作解释
[root@R9 www]# ls -Zl
total 0
drwxr-xr-x. 2 root root system_u:object_r:httpd_sys_content_t:s0 24 Dec 23 21:38 ip
drwxr-xr-x. 2 root root system_u:object_r:httpd_sys_content_t:s0 24 Dec 27 13:29 ip1

1.system_u

身份标识,root表示root、system_u表示进程程序、unconfined_u表示一般用户相关身份

2.object_r

角色字段,可以判断是属于程序、文件、用户中的哪一种,object_r表示文件或目录资源,system_r表示是进程

3.httpd_sys_content_t

类型字段,作用域哪一个域

4.s0

灵敏度,一般会有s0、s1、s2,数值越大灵敏度越高,与MLS和MCS相关

二.SElinux策略的具体使用详情

SElinux的开启和关闭在之前的文章已经介绍到,现在我们在关闭firewalld并且SElinux为Enforcing(Enforcing为强制限制,permissive为运行selinux但不强制,disabled为关闭selinux)的情况下进行演示,这里所有代码段均以httpd服务为例。

[root@R9 www]# systemctl status firewalld.service | grep ActiveActive: inactive (dead)
[root@R9 www]# getenforce 
Enforcing

1.restorecon

(1)这个命令可以将安全上下文修改为原始默认的状态,如下所示

[root@R9 www]# ls -Zl   #修改后安全上下文
total 0
drwxr-xr-x. 2 root root system_u:object_r:httpd_sys_content_t:s0 24 Dec 23 21:38 ip
drwxr-xr-x. 2 root root system_u:object_r:httpd_sys_content_t:s0 24 Dec 27 13:29 ip1
[root@R9 www]# restorecon -R /www/   #进行重置
[root@R9 www]# ls -ZL
system_u:object_r:default_t:s0 ip
system_u:object_r:default_t:s0 ip1

(2)可用参数

-R:将目录及其子目录一起修改

-v:将过程输出到屏幕上(详情)

2.semanage

(1)这个命令可以来进行查询和修改安全上下文设置,如下所示,我要修改我本机的html目录时就可以去查看httpd默认的安全上下文是怎样的,在后面就可以按照这个策略进行更改

[root@R9 www]# semanage fcontext -l | grep /var/www/html
/var/www/html(/.*)?/sites/default/files(/.*)?      all files          system_u:object_r:httpd_sys_rw_content_t:s0 
/var/www/html(/.*)?/sites/default/settings\.php    regular file       system_u:object_r:httpd_sys_rw_content_t:s0 
/var/www/html(/.*)?/uploads(/.*)?                  all files          system_u:object_r:httpd_sys_rw_content_t:s0 
/var/www/html(/.*)?/wp-content(/.*)?               all files          system_u:object_r:httpd_sys_rw_content_t:s0 
/var/www/html(/.*)?/wp_backups(/.*)?               all files          system_u:object_r:httpd_sys_rw_content_t:s0 
/var/www/html/[^/]*/cgi-bin(/.*)?                  all files          system_u:object_r:httpd_sys_script_exec_t:s0 
/var/www/html/cgi/munin.*                          all files          system_u:object_r:munin_script_exec_t:s0 
/var/www/html/configuration\.php                   all files          system_u:object_r:httpd_sys_rw_content_t:s0 
/var/www/html/munin(/.*)?                          all files          system_u:object_r:munin_content_t:s0 
/var/www/html/munin/cgi(/.*)?                      all files          system_u:object_r:munin_script_exec_t:s0 
/var/www/html/nextcloud/data(/.*)?                 all files          system_u:object_r:httpd_sys_rw_content_t:s0 
/var/www/html/owncloud/data(/.*)?                  all files          system_u:object_r:httpd_sys_rw_content_t:s0 

(2)可用参数

-l:查询

-a:增加安全上下文设置

-m:修改设置

-d:删除设置

(3)这里以一个例子介绍一部分semanage对于端口的管理

如下所示,我配置了80和8090端口的http服务,80端口chcon了安全上下文,8090端口为chcon安全上下文并且没有配置其的端口放行,在重启服务时就会报错了

[root@R9 www]# semanage port -l | grep http_port
http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t            tcp      5988
[root@R9 www]# ls -Zl
total 0
drwxr-xr-x. 2 root root system_u:object_r:httpd_sys_content_t:s0 24 Dec 23 21:38 ip
drwxr-xr-x. 2 root root system_u:object_r:default_t:s0           24 Dec 27 14:19 ip1
​
[root@R9 www]# cat /etc/httpd/conf.d/myweb.conf 
<VirtualHost 192.168.2.160>servername www.ssll.comDocumentRoot /www/ip<Directory "/www">AllowOverride NoneRequire all granted</Directory>
</VirtualHost>
<VirtualHost 192.168.2.160:8090>DocumentRoot /www/ip1<Directory "/www">AllowOverride NoneRequire all granted</Directory>
</VirtualHost>
​
[root@R9 www]# systemctl restart httpd
Job for httpd.service failed because the control process exited with error code.
See "systemctl status httpd.service" and "journalctl -xeu httpd.service" for details.
[root@R9 www]# systemctl status httpd
× httpd.service - The Apache HTTP ServerLoaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)Active: failed (Result: exit-code) since Wed 2023-12-27 14:21:25 CST; 7s agoDuration: 46min 40.807sDocs: man:httpd.service(8)Process: 4553 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)Main PID: 4553 (code=exited, status=1/FAILURE)Status: "Reading configuration..."CPU: 25ms
​
Dec 27 14:21:15 R9 systemd[1]: Starting The Apache HTTP Server...
Dec 27 14:21:25 R9 httpd[4553]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:>
Dec 27 14:21:25 R9 httpd[4553]: (13)Permission denied: AH00072: make_sock: could not bind to address [::]:8090
Dec 27 14:21:25 R9 httpd[4553]: (13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:8090
Dec 27 14:21:25 R9 httpd[4553]: no listening sockets available, shutting down
Dec 27 14:21:25 R9 httpd[4553]: AH00015: Unable to open logs
Dec 27 14:21:25 R9 systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE
Dec 27 14:21:25 R9 systemd[1]: httpd.service: Failed with result 'exit-code'.
Dec 27 14:21:25 R9 systemd[1]: Failed to start The Apache HTTP Server.

接下来添加8090服务端口,可以看到重启服务成功并且8090端口已被添加成功,也可以成功访问

[root@R9 www]# semanage port -a -t http_port_t -p tcp 8090
[root@R9 www]# systemctl restart httpd
🔐 Enter TLS private key passphrase for fe80::20c:29ff:fe49:e52%ens160:443 (RSA) : *******                 
[root@R9 www]# ls -Zl
total 0
drwxr-xr-x. 2 root root system_u:object_r:httpd_sys_content_t:s0 24 Dec 23 21:38 ip
drwxr-xr-x. 2 root root system_u:object_r:default_t:s0           24 Dec 27 14:19 ip1
[root@R9 www]# semanage port -l | grep http_port_t
http_port_t                    tcp      8090, 80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t            tcp      5988
​
[root@SLB ~]# curl 192.168.2.160:8090
hello

删除端口时可以这样做

[root@R9 www]# semanage port -d -t http_port_t -p tcp 8090

3.chcon

(1)这个命令用于修改安全上下文,如下所示我按照上面我查询到的策略进行修改后,能够顺利访问到目录内容

[root@R9 www]# ls -Zl
total 0
drwxr-xr-x. 2 root root system_u:object_r:default_t:s0 24 Dec 23 21:38 ip
drwxr-xr-x. 2 root root system_u:object_r:default_t:s0 24 Dec 27 13:29 ip1
[root@R9 www]# chcon -t httpd_sys_rw_content_t /www/ -R
[root@R9 www]# ls -Zl
total 0
drwxr-xr-x. 2 root root system_u:object_r:httpd_sys_rw_content_t:s0 24 Dec 23 21:38 ip
drwxr-xr-x. 2 root root system_u:object_r:httpd_sys_rw_content_t:s0 24 Dec 27 13:29 ip1
​
[root@SLB ~]# curl 192.168.2.160
192.168.2.160 

(2)可用参数

-R:将目录及其子目录一起修改

-t:跟安全上下文所要修改的字段内容

-u:跟身份标识

-r:跟角色字段

--reference=:这个表示按照哪个目录文件进行修改安全上下文

[root@R9 www]# restorecon -R /www   #按照httpd默认的html目录进行修改
[root@R9 www]# chcon --reference=/var/www/html -R /www
[root@R9 www]# ls -Zl
total 0
drwxr-xr-x. 2 root root system_u:object_r:httpd_sys_content_t:s0 24 Dec 23 21:38 ip
drwxr-xr-x. 2 root root system_u:object_r:httpd_sys_content_t:s0 24 Dec 27 13:29 ip1
​
[root@SLB ~]# curl 192.168.2.160
192.168.2.160 

 

http://www.tj-hxxt.cn/news/22566.html

相关文章:

  • 企业网站建设方案范本网站怎么提升关键词排名
  • 公司网站链接怎么弄搜索引擎分哪三类
  • 网站视频提取获客引流100种方法
  • 做网站编程需要学什么软件百度seo系统
  • 企业网站建设cms站seo推广培训资料
  • 网站开发的甘特图seo收费低
  • 浙江工程造价信息网电脑优化
  • 动态网站开发实训报告总结网站改进建议有哪些
  • 网站建设服务采购方案模板下载百度推广一般要多少钱
  • 直播软件apk郑州网站seo外包公司
  • 十堰市网络运营中心seo培训班 有用吗
  • 中企动力 做网站 怎么样网站推广优化技巧
  • 北京论坛建站模板青岛网站seo推广
  • 网站接口需求太原做网络推广的公司
  • 装修公司加盟模式重庆seo整站优化
  • 做静态网站的软件在线企业管理培训课程
  • 做3ds磁铁卡网站广告营销推广
  • 口碑好的网站定制公司百度广告商
  • 资阳网站seoapp制作费用一览表
  • 阿里国际站网站建设十大管理培训课程
  • 网站制作banner 素材做推广的公司
  • 企业网站直销有哪些郑州高端网站建设
  • 沈总网站建设seo算法优化
  • 营销网站类型有什么功能
  • 南宁网站建设哪做网站公司哪家好
  • 成都区块链网站开发百度seo权重
  • 一个网站可以做多少个小程序搭建网站的软件
  • 宁波网站建设公司哪家比较好宁德市人民医院
  • 工程建设资质单位网站seo还能赚钱吗
  • 金华城乡建设部网站首页外贸网络推广