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

按照wordpress西安百度快照优化

按照wordpress,西安百度快照优化,wordpress伪静态404 nginx,门户网站网站制作防火墙 firewalld iptables:防火墙的工具,用于修改防火墙防御策略。 netfilter :真正实施策略的防火墙主题。 iptables 安装 [rootserver ~]# dnf install iptables-nft-services -y 开启iptables服务前要关闭防火墙 两个只能存在一个…

防火墙

firewalld iptables:防火墙的工具,用于修改防火墙防御策略。

netfilter :真正实施策略的防火墙主题。

iptables

安装

[root@server ~]# dnf install iptables-nft-services -y

开启iptables服务前要关闭防火墙  两个只能存在一个(iptables 与 firewalld都不是真正的防火墙,它们都只是用来定义防火墙策略的防火墙管理工具而已,即只是一种服务,而真正使用规则干活的是内核的netfilter,当前Linux 系统中存在多个防火墙管理工具,旨在方便运维人员管理 Linux 系统中的防火墙策略,我们只需要配置妥当其中的一个就足够了。)(Euler中默认使用的是firewalld,且与iptables之间有冲突,如果需要使用 iptables 需要先停止firewalld再进行安装: )

# 查看过滤表详情 (完整的写法 iptables -t filter -nxvL --line-numbers)n显示源 x取消单位 v详细信息 L写在最后列出所有规则

[root@server ~]# iptables -nL
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
....# -n 显示源   -v 详细信息  -x  自动转换为KB\MB等单位 -L写在最后列出所有规则  --line 增加行号# num:规则的编号(行号)
# pkts:数据包的数量
# bytes:数据包的字节数
# target:动作(放行、拒绝)
# port:端口
# in:入站的网卡
# out:出站网卡

 # 添加插入 -A -I

# 如果要在列表中末尾添加新规则使用 -A
[root@server ~]# iptables -A INPUT -p tcp --dport 80 -j ACCEPT
[root@server ~]# iptables -nL --line
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
....
5    REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited
6    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80Chain FORWARD (policy ACCEPT)
....# 插入一条规则 允许任意ip 访问80端口
[root@Server ~]# iptables (-t filter)-I INPUT 5 -p tcp --dport 80 -j ACCEPT# 实现以上命令后 无需关闭防火墙即可访问 nginx 默认发布目录

# 删除一条策略 -D  表名  -行号

# 删除一条策略
[root@Server ~]# iptables -D INPUT 6
[root@Server ~]# iptables -nL --line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0
3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
5    REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

# 修改一条规则   -R

# 修改一条规则
[root@Server ~]# iptables -R INPUT 6 -p all -j ACCEPT
[root@Server ~]# iptables -nL --line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0
3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
5    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80
6    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0

# -F 清空表中所有规则(内存中)(F:flush是“冲洗、冲掉”的意思)

# -F 清空表中所有规则(内存中)
[root@Server ~]# iptables -F
[root@Server ~]# iptables -nL --line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destinationChain FORWARD (policy ACCEPT)
num  target     prot opt source               destinationChain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination

 # 保存设置(将自定义的规则保存到配置文件中),否则重启系统后恢复默认设置

[root@server ~]# service  iptables save  
iptables: Saving firewall rules to /etc/sysconfig/iptables: [  OK  ]
# 保存设置,否则重启系统后恢复默认设置
# 注意:不能使用systemctl  save  iptables 命令# 查看
[root@server ~]# vim   /etc/sysconfig/iptables
# iptables的规则配置文件保存在 /etc/sysconfig/iptables
# 如果要将自定义的规则保存到配置文件中 调用一下命令
[root@Server ~]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables: [  OK  ]

练习

# 不允许ssh远程登录
[root@Server ~]# iptables -R INPUT 4 -p tcp --dport 22 -j REJECT
[root@Server ~]# iptables -nL --line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0
3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0
4    REJECT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:22 reject-with icmp-port-unreachable
5    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:80
6    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0# 允许172.25.254.200使用ssh远程登录
[root@Server ~]# iptables -A INPUT -s 172.25.254.200 -p tcp --dport 22 -j ACCEPT
[root@Server ~]# iptables -nL --line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination
1    ACCEPT     tcp  --  172.25.254.200       0.0.0.0/0            tcp dpt:22Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destinationChain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination
# 拒绝所有其他ip登录
[root@Server ~]# iptables -A INPUT  -p tcp --dport 22 -j REJECT
[root@Server ~]# Read from remote host 172.25.254.100: Operation timed out
Connection to 172.25.254.100 closed.
client_loop: send disconnect: Broken pipe# 允许非172.25.254.200的ip登录
[root@Server ~]# iptables -A INPUT -s 172.25.254.200 -p tcp --dport 22 -j REJECT
[root@Server ~]# iptables -A INPUT ! -s 172.25.254.200 -p tcp --dport 22 -j ACCEPT
[root@Server ~]# iptables -nL
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  -- !172.25.254.200       0.0.0.0/0            tcp dpt:22

firewalld

firewalld 配置文件

/etc/firewalld:配置文件主区(用户配置文件,可以自行修改)

/lib/firewalld:预先定义好服务文件(系统配置文件,尽量不要修改)

firewalld的zone

根据信任级别分成9个默认zone

区域默认策略规则
trusted(信任区域)允许所有的传入流量
home (家庭区域)允许与SSH、MDNS(多播DNS)、IPP客户端、samba-客户端、DHCPv6客户端、cockpit(服务器管理工具)服务匹配的流量传入,其余拒绝
internal (内部区域)默认值时与homel区域相同
work(工作区域)允许 与SSH、DHCPv6客户端、cockpit服务匹配的流量传入,其余拒绝、
public (公共区域)允许与SSH或DHCPv6客户端、cockpit服务匹配的流量传入,其余拒绝 (是默认区域)
external(外部区域)允许与SSH服务匹配的流量传入,其余拒绝
dmz (隔离区域)也称为非军事区域,内外网络之间增加的一层网络,起到缓冲作用,允许与SSH服务匹配的流量传入,其余拒绝
block (阻塞区域)拒绝所有传入流量,返回icmp-host-prohibited消息
drop (丢去区域)丢弃所有传入流量,且没有任何回复,类似DROP

# 查看防火墙状态

[root@Server ~]# firewall-cmd --list-all
public (active)target: defaulticmp-block-inversion: nointerfaces: enp0s5sources:services: cockpit dhcpv6-client sshports:protocols:forward: yesmasquerade: noforward-ports:source-ports:icmp-blocks:rich rules:

# 获取防火墙的区域信息

[root@Server ~]# firewall-cmd --get-default-zone
public

# 查看系统中有哪些防御区域

[root@Server ~]# firewall-cmd --get-zones
block dmz drop external home internal nm-shared public trusted work

# 设置防火墙的区域

[root@Server ~]# firewall-cmd --set-default-zone=dmz
success
[root@Server ~]# firewall-cmd --list-all
dmz (active)target: defaulticmp-block-inversion: nointerfaces: enp0s5sources:services: sshports:protocols:forward: yesmasquerade: noforward-ports:source-ports:icmp-blocks:rich rules:

服务文件保存的目录

# /lib/firewalld/zones

# 制作自定义的服务 # 需重启火墙获取新增服务文件

[root@Server services]# cp http.xml nginx.xml
[root@Server services]# vim nginx.xml
....
<?xml version="1.0" encoding="utf-8"?>
<service><short>Nginx</short><description>this is a russian httpd</description><port protocol="tcp" port="80"/><port protocol="tcp" port="443"/><port protocol="tcp" port="7777"/>
</service>
....

# 添加自定义的服务

[root@Server services]# firewall-cmd --add-service=nginx
success

练习

# 添加ip规则
[root@Server services]# firewall-cmd --add-source=172.25.254.200 --zone=dmz
success
# 移除ip规则
[root@Server services]# firewall-cmd --remove-source=172.25.254.200
success
[root@Server services]# firewall-cmd --get-active-zones
publicinterfaces: enp0s5
# 移除网卡
[root@Server services]# firewall-cmd --remove-interface=enp0s5
success
# 添加网卡到指定区域
[root@Server services]# firewall-cmd --add-interface=enp0s5 --zone=dmz
success
# 修改网卡到指定区域
[root@Server services]# firewall-cmd --change-interface=enp0s5 --zone=public
success# 添加允许端口
[root@Server services]# firewall-cmd --add-port=7777/tcp
success# 移除允许端口
[root@Server services]# firewall-cmd --remove-port=7777/tcp
success
http://www.dtcms.com/wzjs/469204.html

相关文章:

  • 网站建设上传视频教程百度网盘网页版登录
  • 网站导航页设计百度最新秒收录方法2022
  • 网站建设贵阳昆明seo网站管理
  • 做相亲网站的安全责任信息流广告怎么投放
  • wordpress首页缩略图插件东莞seo网站优化排名
  • 高端网站建设webbj海南网站建设
  • 手机免费制作网站模板微信营销的方法
  • html5手机网页模板seo公司品牌哪家好
  • 网站界面设计毕业论文网站关键词优化排名外包
  • b2b商城网站方案搜索引擎优化工作
  • 坪山建设网站百度关键词热度排名
  • 中小型企业网站模板网站优化网
  • 网站建设需要用到那些语言单页网站制作教程
  • 企业网站定制公司免费的网站推广方法
  • 商业图片素材网站网络营销策划的概念
  • wordpress打开错误seo是什么级别
  • 宝应做网站2022近期重大新闻事件10条
  • 阿克苏网站建设国内做seo最好的公司
  • 项目网站建设方案模板seo推广技巧
  • 网站建设制作设计推广优化网站模板下载
  • 合肥建站公司哪seo搜索引擎优化薪酬
  • 株洲网站建设优化企业网页在线代理翻墙
  • 网站建设 网站设计最新的疫情最新消息
  • 视频网站怎么做动图关键词优化上海
  • 一般做网站空间大概多少钱今天最新的新闻
  • 烟台装修公司网站建设推广的渠道和方法有哪些
  • 网站规划与网站建设软文营销经典案例
  • java做网站用什么做百度seo效果怎么样
  • 网站服务器失去响应怎么解决有什么平台可以发布推广信息
  • php网站超市源码下载全国人大常委会委员长