<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>System Port Security (系统端口安全) &#8211; Eternal Center</title>
	<atom:link href="https://eternalcenter-may-1-2022.github.io/category/system/system-network-system-security-system-log/system-security/system-port-security/feed/" rel="self" type="application/rss+xml" />
	<link>https://eternalcenter-may-1-2022.github.io/</link>
	<description></description>
	<lastBuildDate>Fri, 29 Apr 2022 14:39:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>[步骤] Linux SSH 密钥的批量更新</title>
		<link>https://eternalcenter-may-1-2022.github.io/ssh-key-batch-renew/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 29 Apr 2022 14:36:55 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Login Security (系统登录安全)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Setting (系统设置)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=23423</guid>

					<description><![CDATA[步骤目录： 步骤一：生成新的 SSH 密钥1.1 进入 ~/.ssh 目录1.2 生成新的 SSH 密钥 步骤二：将新的 SSH 公钥拷贝到目标服务器 步骤三：更新 SSH 密钥3.1 更新 SSH 私钥3.1.1 备份旧有的 SSH 私钥3.1.2 更新 SSH 私钥3.2 更新 SSH 公钥3.2.1 备份旧有的 SSH 公钥3.2.2 更新 SSH 公钥 步骤四：删除目标服务器的旧有 SSH 公钥4.1 删除目标服务器的旧有 SSH 公钥4.2 确定目标服务器就有的 SSH 已经删除 具体的操作步骤： 步骤一：生成新的 SSH 密钥1.1 进入 ~/.ssh 目录 1.2 生成新的 SSH 密钥 步骤二：将新的 &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/ssh-key-batch-renew/" class="more-link">Continue reading<span class="screen-reader-text"> "[步骤] Linux SSH 密钥的批量更新"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2>步骤目录：</h2>



<h4>步骤一：生成新的 SSH 密钥<br>1.1 进入 ~/.ssh 目录<br>1.2 生成新的 SSH 密钥</h4>



<h4>步骤二：将新的 SSH 公钥拷贝到目标服务器</h4>



<h4>步骤三：更新 SSH 密钥<br>3.1 更新 SSH 私钥<br>3.1.1 备份旧有的 SSH 私钥<br>3.1.2 更新 SSH 私钥<br>3.2 更新 SSH 公钥<br>3.2.1 备份旧有的 SSH 公钥<br>3.2.2 更新 SSH 公钥</h4>



<h4>步骤四：删除目标服务器的旧有 SSH 公钥<br>4.1 删除目标服务器的旧有 SSH 公钥<br>4.2 确定目标服务器就有的 SSH 已经删除</h4>



<h2>具体的操作步骤：</h2>



<h4>步骤一：生成新的 SSH 密钥<br>1.1 进入 ~/.ssh 目录</h4>



<pre class="wp-block-code"><code># cd ~/.ssh</code></pre>



<h4>1.2 生成新的 SSH 密钥</h4>



<pre class="wp-block-code"><code># ssh-keygen -b 4096 -t rsa -C "&lt;content&gt;" -f "&lt;public private key name&gt;"</code></pre>



<h4>步骤二：将新的 SSH 公钥拷贝到目标服务器</h4>



<pre class="wp-block-code"><code># for i in `cat &lt;server list&gt;`;do echo $i;ssh-copy-id -i ~/.ssh/&lt;public private key name&gt;.pub $i;echo;done</code></pre>



<h4>步骤三：更新 SSH 密钥<br>3.1 更新 SSH 私钥<br>3.1.1 备份旧有的 SSH 私钥</h4>



<pre class="wp-block-code"><code># mv id_rsa id_rsa.backup</code></pre>



<h4>3.1.2 更新 SSH 私钥</h4>



<pre class="wp-block-code"><code># cp &lt;public private key name&gt; id_rsa</code></pre>



<h4>3.2 更新 SSH 公钥<br>3.2.1 备份旧有的 SSH 公钥</h4>



<pre class="wp-block-code"><code># mv id_rsa.pub id_rsa.pub.backup</code></pre>



<h4>3.2.2 更新 SSH 公钥</h4>



<pre class="wp-block-code"><code># cp &lt;public private key name&gt;.pub id_rsa.pub</code></pre>



<h4>步骤四：删除目标服务器的旧有 SSH 公钥<br>4.1 删除目标服务器的旧有 SSH 公钥</h4>



<pre class="wp-block-code"><code># for i in `cat &lt;server list&gt;`;do echo $i;ssh $i "sed -i /&lt;old SSH key content&gt;/d ~/.ssh/authorized_keys";echo;done</code></pre>



<h4>4.2 确定目标服务器就有的 SSH 已经删除</h4>



<pre class="wp-block-code"><code># for i in `cat &lt;server list&gt;`;do echo $i;ssh $i "cat ~/.ssh/authorized_keys | egrep -v '&lt;content&gt;'";echo;done</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[工具] Shell 显示系统常用信息</title>
		<link>https://eternalcenter-may-1-2022.github.io/shell-display-system-common-information/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 26 Apr 2022 16:14:48 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Languages (语言)]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell Monitor (监控)]]></category>
		<category><![CDATA[Shell Tool (工具)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Computer & System Hardware & System Installation & System Upgradation (系统电脑 & 系统硬件 & 系统安装 & 系统升级)]]></category>
		<category><![CDATA[System Directory (系统目录)]]></category>
		<category><![CDATA[System Hardware (系统硬件)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Operation (系统操作)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Performance (系统性能)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Process & System Performance (系统进程 & 系统性能)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Software (系统软件)]]></category>
		<category><![CDATA[System Storage (系统存储)]]></category>
		<category><![CDATA[System Storage & System Directory & System File (系统存储 & 系统目录 & 系统文件)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=23311</guid>

					<description><![CDATA[介绍： 作者：朱明宇名称：显示系统常用信息作用：显示系统常用信息 使用方法：1. 在此脚本的分割线内写入相应的内容2. 给此脚本添加执行权限3. 执行此脚本 脚本分割线里的变量：1) times=2 #显示系统常用信息的次数2) sleeptime=0.1 #大部分行与行之间显示的间隔时间 注意：部分功能需要安装了 sysstat 软件或搭建了 KVM 虚拟化平台后执行此脚本的用户能够使用 sudo virsh list 命令后才能实现 脚本：]]></description>
										<content:encoded><![CDATA[
<h2>介绍：</h2>



<p>作者：朱明宇<br>名称：显示系统常用信息<br>作用：显示系统常用信息</p>



<p>使用方法：<br>1. 在此脚本的分割线内写入相应的内容<br>2. 给此脚本添加执行权限<br>3. 执行此脚本</p>



<p>脚本分割线里的变量：<br>1) times=2 #显示系统常用信息的次数<br>2) sleeptime=0.1 #大部分行与行之间显示的间隔时间</p>



<p>注意：部分功能需要安装了 sysstat 软件或搭建了 KVM 虚拟化平台后执行此脚本的用户能够使用 sudo virsh list 命令后才能实现</p>



<h2>脚本：</h2>



<pre class="wp-block-code"><code>#!/bin/bash

####################### Separator ########################
times=2
sleeptime=0.1
####################### Separator ########################

nowtime=1

while (( nowtime &lt;= times))
do
        echo -e "Start Monitoring: \c"
	for i in {1..100}
	do
	        echo -e "#\c"
		sleep 0.01
        done
	echo

	sleep $sleeptime
        host=`hostname`
        echo -e "Name:\t\t\t\t\t\t \033&#91;1m$host\033&#91;0m"

        ip=`ip a s | awk '/&#91;1-2]?&#91;0-9]{0,2}\.&#91;1-2]?&#91;0-9]{0,2}/&amp;&amp;!/127.0.0.1/{print $2}' | awk -F/ '{print $1}'`
        for iip in `echo $ip`
        do
		sleep $sleeptime
                echo -e "IP Address:\t\t\t\t\t \033&#91;1m$iip\033&#91;0m"
        done

        sleep $sleeptime

        cpu=`top -bn 1 | awk -F',' '/^%Cpu/{print $4 }' | awk '{print $1}' | awk '{print 100-$1}'`
        echo -e "CPU Usage (Total):\t\t\t\t \033&#91;1m$cpu%\033&#91;0m"

        sleep $sleeptime

        mem=`free | grep Mem | awk '{print $3/$2 * 100.0}' | egrep -o "&#91;1]?&#91;0-9]{0,2}\.&#91;0-9]"`
        echo -e "Memory Usage (Total):\t\t\t\t \033&#91;1m$mem%\033&#91;0m"

	directory=`df -h | grep -v run | grep -v boot | awk '$1~/\/dev/{print $6}'`
        for idirectory in `echo $directory`
        do
                sleep $sleeptime
                directoryusage=`df -h | grep -v run | grep -v boot | awk '$1~/\/dev/{print}' | grep $idirectory$ | awk '{print $5}'`
		if &#91; $idirectory == / -o $idirectory == /ec  ];then
                        echo -e "Directory Usage ($idirectory):\t\t\t\t \033&#91;1m$directoryusage\033&#91;0m"
	        else
                        echo -e "Directory Usage ($idirectory):\t\t\t \033&#91;1m$directoryusage\033&#91;0m"
		fi
        done

	sudo -l | grep 'virsh list' &amp;&gt; /dev/null
        if &#91; $? -eq 0 ];then
	        sleep $sleeptime
	        virtual=`sudo virsh list | egrep &#91;0-9] | wc -l`
	        echo -e "Number of Virtual Machines (Total):\t\t \033&#91;1m$virtual\033&#91;0m"
        fi

        sleep $sleeptime

        user=`who | wc -l`
        echo -e "Number of User Logins (Total):\t\t\t \033&#91;1m$user\033&#91;0m"

        soft=`rpm -qa | wc -l`
        echo -e "Number of Softwares (Total):\t\t\t \033&#91;1m$soft\033&#91;0m"

        sleep $sleeptime

        port=`ss -ntulap | wc -l`
        echo -e "Number of Open Ports (Total):\t\t\t \033&#91;1m$port\033&#91;0m"

        which sar &amp;&gt; /dev/null
        if &#91; $? -eq 0 ];then
                networkcard=`ifconfig | awk -F: '/flags/&amp;&amp;!/lo/{print $1}'`
                for inetworkcard in `echo $networkcard`
                do
                        networkread="`sar -n DEV 1 1 | grep $inetworkcard | awk '/&#91;0-9]&#91;0-9]:&#91;0-9]&#91;0-9]/{print $3/1000}'` m/s"
                        networkwrite="`sar -n DEV 1 1 | grep $inetworkcard | awk '/&#91;0-9]&#91;0-9]:&#91;0-9]&#91;0-9]/{print $4/1000}'` m/s"
			echo $inetworkcard | grep eth &amp;&gt; /dev/null
			if &#91; $?  -ne 0 ];then
	                echo -e "Network Card IO ($inetworkcard):\t\t\t \033&#91;1m$networkread\033&#91;0m (Read)\t\033&#91;1m$networkwrite\033&#91;0m (Write)"
		        else
	                echo -e "Network Card IO ($inetworkcard):\t\t\t\t \033&#91;1m$networkread\033&#91;0m (Read)\t\033&#91;1m$networkwrite\033&#91;0m (Write)"
			fi
                done
        fi

        which iostat &amp;&gt; /dev/null
        if &#91; $? -eq 0 ];then
	        disk=`iostat -d -k 1 1 | awk '!/^$/&amp;&amp;!/Device/&amp;&amp;!/Linux/{print $1}'`
                for idisk in `echo $disk`
	        do
			sleep $sleeptime
		        diskread="`iostat -d -k 1 1 | grep $idisk |  awk '{print $3/1000}'` m/s"
		        diskwrite="`iostat -d -k 1 1 | grep $idisk |  awk '{print $4/1000}'` m/s"
			echo $idisk | grep 'nvme' &amp;&gt; /dev/null
			if &#91; $? -eq 0 ];then
		                echo -e "Disk IO (/dev/$idisk):\t\t\t\t \033&#91;1m$diskread\033&#91;0m (Read)\t\033&#91;1m$diskwrite\033&#91;0m (Write)"
		        else
		                echo -e "Disk IO (/dev/$idisk):\t\t\t\t \033&#91;1m$diskread\033&#91;0m (Read)\t\033&#91;1m$diskwrite\033&#91;0m (Write)"
			fi
	        done

        fi

        echo -e "Complete Monitoring: \c"
        for i in {1..97}
        do
                echo -e "#\c"
                sleep 0.01
        done
        echo
        sleep $sleeptime

        let nowtime++
done

        echo -e "Terminal Monitoring: \c"
        for i in {1..97}
        do
                echo -e "#\c"
                sleep 0.01
        done

exit</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] iptables 防火墙规则持久化 （让防火墙规则开机自启）</title>
		<link>https://eternalcenter-may-1-2022.github.io/iptables-rule-permanent/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 25 Apr 2022 07:28:11 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Firewall (系统防火墙)]]></category>
		<category><![CDATA[System Login Security (系统登录安全)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=23270</guid>

					<description><![CDATA[内容一：Rocky Linux &#38; RHEL iptables 防火墙规则持久化 内容二：Rocky Linux &#38; RHEL 和 openSUSE &#38; SUSE iptables 防火墙规则持久化2.1 导出现在 iptables 防火墙的规则 （补充：这里以将 iptables 防火墙规则导出到 /root/iptables_save 文件为例） 2.2 创建用于加载 iptables 防火墙规则的 systemctl 管理文件 创建以下内容： （补充：这里以创建 systemctl 管理文件 /etc/systemd/system/iptables_save.service 将 /root/iptables_save 文件里的内容导入到 iptables 防火墙为例） 2.3 加载刚刚创建的 systemctl 管理文件 2.4 给刚刚创建的 systemctl 管理文件添加执行权限 （补充：这里以给 systemctl 管理文件 /etc/systemd/system/iptables_save.service 添加执行权限为例） 2.5 让防火墙规则开机自启 &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/iptables-rule-permanent/" class="more-link">Continue reading<span class="screen-reader-text"> "[内容] iptables 防火墙规则持久化 （让防火墙规则开机自启）"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h4>内容一：Rocky Linux &amp; RHEL iptables 防火墙规则持久化</h4>



<pre class="wp-block-code"><code># service iptables save</code></pre>



<h4>内容二：Rocky Linux &amp; RHEL 和 openSUSE &amp; SUSE iptables 防火墙规则持久化<br>2.1 导出现在 iptables 防火墙的规则</h4>



<pre class="wp-block-code"><code># iptables-save &gt; /root/iptables_save</code></pre>



<p>（补充：这里以将 iptables 防火墙规则导出到 /root/iptables_save 文件为例）</p>



<h4>2.2 创建用于加载 iptables 防火墙规则的 systemctl 管理文件</h4>



<pre class="wp-block-code"><code># vim /etc/systemd/system/iptables_save.service</code></pre>



<p>创建以下内容：</p>



<pre class="wp-block-code"><code>&#91;Unit]
Description=iptables_save
After=default.target

&#91;Service]
Type=oneshot
ExecStart=/usr/sbin/iptables-restore &lt; /root/iptables_save

&#91;Install]
WantedBy=default.target</code></pre>



<p>（补充：这里以创建 systemctl 管理文件 /etc/systemd/system/iptables_save.service 将 /root/iptables_save 文件里的内容导入到 iptables 防火墙为例）</p>



<h4>2.3 加载刚刚创建的 systemctl 管理文件</h4>



<pre class="wp-block-code"><code># systemctl daemon-reload</code></pre>



<h4>2.4 给刚刚创建的 systemctl 管理文件添加执行权限</h4>



<pre class="wp-block-code"><code># chmod u+x /etc/systemd/system/iptables_save.service</code></pre>



<p>（补充：这里以给 systemctl 管理文件 /etc/systemd/system/iptables_save.service 添加执行权限为例）</p>



<h4>2.5 让防火墙规则开机自启</h4>



<pre class="wp-block-code"><code># systemctl enable iptables_save.service</code></pre>



<p>（补充：这里以开机自启 iptables_save.service 服务为例）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] iptables 防火墙规则的导出和导入</title>
		<link>https://eternalcenter-may-1-2022.github.io/iptables-rule-export-import/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 25 Apr 2022 07:20:19 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Firewall (系统防火墙)]]></category>
		<category><![CDATA[System Login Security (系统登录安全)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=23267</guid>

					<description><![CDATA[内容一：导出 iptables 防火墙规则 （补充：这里以将 iptables 防火墙规则导出到 /root/iptables_save 文件为例） 内容二：导入 iptables 防火墙规则 （补充：这里以将 /root/iptables_save 文件里的内容导入到 iptables 防火墙为例）]]></description>
										<content:encoded><![CDATA[
<h4>内容一：导出 iptables 防火墙规则</h4>



<pre class="wp-block-code"><code># iptables-save &gt; /root/iptables_save</code></pre>



<p>（补充：这里以将 iptables 防火墙规则导出到 /root/iptables_save 文件为例）</p>



<h4>内容二：导入 iptables 防火墙规则</h4>



<pre class="wp-block-code"><code># iptables-restore &lt; /root/iptables_save</code></pre>



<p>（补充：这里以将 /root/iptables_save 文件里的内容导入到 iptables 防火墙为例）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[命令] Linux 目标网站 SSL 证书的显示 （OpenSSL 版）</title>
		<link>https://eternalcenter-may-1-2022.github.io/ssl-display-openssl/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 15 Feb 2022 13:39:10 +0000</pubDate>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Basic Guidelines for Website building (网站建设基础指南)]]></category>
		<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Django Service (服务)]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Nginx Security (安全)]]></category>
		<category><![CDATA[Personal Website Building (个人网站建设)]]></category>
		<category><![CDATA[Project (项目)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Operation (系统操作)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Web Application Firewall (WAF)]]></category>
		<category><![CDATA[Website Services (网站服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=21971</guid>

					<description><![CDATA[内容一：查看完整信息 （补充：这里以显示 eternalcenter.com 的 443 端口的 SSL 证书为例） 内容二：查看主要信息 （补充：这里以显示 eternalcenter.com 的 443 端口的 SSL 证书为例）]]></description>
										<content:encoded><![CDATA[
<h4>内容一：查看完整信息</h4>



<pre class="wp-block-code"><code># openssl s_client -connect eternalcenter.com:443
CONNECTED(00000003)
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = eternalcenter.com
verify return:1
---
Certificate chain
 0 s:CN = eternalcenter.com
   i:C = US, O = Let's Encrypt, CN = R3
 1 s:C = US, O = Let's Encrypt, CN = R3
   i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
 2 s:C = US, O = Internet Security Research Group, CN = ISRG Root X1
   i:O = Digital Signature Trust Co., CN = DST Root CA X3
---
Server certificate
-----BEGIN CERTIFICATE-----
MIIFKjCCBBKgAwIBAgISAxDxly99eBiarmHggFEmDJoMMA0GCSqGSIb3DQEBCwUA
MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD
EwJSMzAeFw0yMTEyMTkxMzA4MzJaFw0yMjAzMTkxMzA4MzFaMBwxGjAYBgNVBAMT
EWV0ZXJuYWxjZW50ZXIuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC
AQEAtCcCuOqBrWP4eo//VBEXh668EjwrE1eXz2CS4GIN4ddn0rS8LHGFOrB92R8E
OnaYeTKpZjzNM3NA/AG/Gq5mTRZGTpyTasHEb/phwXdhrtJWdbMtQjGFSg8rXSB8
cap5NGP/NxAy8FV0MbXftg5t9VgBoCMGUzioSHZTEjefq+/OZwlP7RzxZN3bwj1D
61gWSw6q1X3bsi8ttwbkkiJfvjXo2KIeGOAnY10X+FPJmVa7jonhOuljrX4CYgnd
SCxmsfgwGMUzRu27VB1rEbKqvSr6tb9KfwFiqsZd5tTi7RW6WMqA0VbDV7BbDqLP
OzcturwRtXfzHjJxssy9zhnrQQIDAQABo4ICTjCCAkowDgYDVR0PAQH/BAQDAgWg
MB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAMBgNVHRMBAf8EAjAAMB0G
A1UdDgQWBBQMGBCfBuZxTAS8VcBI/13ugqc2RDAfBgNVHSMEGDAWgBQULrMXt1hW
y65QCUDmH6+dixTCxjBVBggrBgEFBQcBAQRJMEcwIQYIKwYBBQUHMAGGFWh0dHA6
Ly9yMy5vLmxlbmNyLm9yZzAiBggrBgEFBQcwAoYWaHR0cDovL3IzLmkubGVuY3Iu
b3JnLzAcBgNVHREEFTATghFldGVybmFsY2VudGVyLmNvbTBMBgNVHSAERTBDMAgG
BmeBDAECATA3BgsrBgEEAYLfEwEBATAoMCYGCCsGAQUFBwIBFhpodHRwOi8vY3Bz
LmxldHNlbmNyeXB0Lm9yZzCCAQYGCisGAQQB1nkCBAIEgfcEgfQA8gB3AN+lXqto
gk8fbK3uuF9OPlrqzaISpGpejjsSwCBEXCpzAAABfdMFzUsAAAQDAEgwRgIhAMFF
1orPZPnpCyhzwX2xZAZjJnOmDGmBjAl0tHnX4nEWAiEAqZTUwjrdwZAL+kDAgpzG
Me2RnGMseDBY8Oy2sefUgsAAdwBGpVXrdfqRIDC1oolp9PN9ESxBdL79SbiFq/L8
cP5tRwAAAX3TBc1zAAAEAwBIMEYCIQDLhR0nbVHEIL1uw9hRuv/ZbFjf91W/M4Jp
od7NTMQZbAIhAKEAAfmdu0nVHklyS2At1VValwQ6vNbqd0NQ85giG606MA0GCSqG
SIb3DQEBCwUAA4IBAQB/s+rZEaNrlUyBVnbxv5X9NTBd8buBOkR1qVswlS1R2i8B
pRjeJmgbiMzM2z5Mvx0yTIiCyXXUc3YaqoyxvddaQam9nlLGr0nKX9T5DkE7y0Fh
Qg0/ievRQF86XnDqQBxDR32jj5A1nKEiJrNCqugCWTAABndW3tvzK5DOsF2BfjJC
mcjwiKaSCjFVpf+KzLWS3UEW+DRTKOLBucXpenS7QEcQu4K6ShNSL7+K6UOZEbFu
uCRjOawCJFF7EH5vzRBy696Fu4EmzCV+c4rV8K8EcuCCQQeOTWJ/93Jv6U6kGrmE
P6wlcHFy1tZhTAmXf/qcpE3sGeH58OlNNiVmNJdH
-----END CERTIFICATE-----
subject=CN = eternalcenter.com

issuer=C = US, O = Let's Encrypt, CN = R3

---
No client certificate CA names sent
Peer signing digest: SHA256
Peer signature type: RSA-PSS
Server Temp Key: X25519, 253 bits
---
SSL handshake has read 4695 bytes and written 412 bytes
Verification: OK
---
New, TLSv1.2, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : ECDHE-RSA-AES256-GCM-SHA384
    Session-ID: D63BC88824810A4D43ACE901AD4FF2D82073BC6F0D8B2DE71F6310CA1C87707F
    Session-ID-ctx: 
    Master-Key: A6836430C394B96DDD5552867D49802F94AAC8BF5E882100F0D27185CF5CFD6A946B94D87652E44A6684FC9781D16D90
    PSK identity: None
    PSK identity hint: None
    SRP username: None
    TLS session ticket lifetime hint: 300 (seconds)
    TLS session ticket:
    0000 - bb be 55 e0 4b 6d c3 08-cd bc 45 6e 79 67 fc eb   ..U.Km....Enyg..
    0010 - 30 d5 4c 8a 5a c8 f7 13-42 4b 1d 02 ce 94 c0 b8   0.L.Z...BK......
    0020 - d7 cf f6 f0 ee 9d 49 5b-0a c8 a4 1a 8b dd 8a e0   ......I&#91;........
    0030 - 66 83 52 9b 31 4d da 9e-d5 05 1a 70 ca e9 86 5e   f.R.1M.....p...^
    0040 - f5 09 a1 1c 92 6b 64 90-b7 e1 0e ec 30 e2 26 68   .....kd.....0.&amp;h
    0050 - 49 13 10 9e 3e a5 e0 13-a2 f1 7a 7c c5 ad 99 6c   I...&gt;.....z|...l
    0060 - e9 f6 1d 46 5f cc f6 f9-c5 f6 05 49 53 78 7e ea   ...F_......ISx~.
    0070 - 8c 17 eb 8d 96 c3 3f 92-fe e0 f0 f6 86 59 05 c8   ......?......Y..
    0080 - d2 8c 27 6b 9d 65 38 20-84 d4 23 54 35 70 19 4d   ..'k.e8 ..#T5p.M
    0090 - db 35 6d f4 44 50 d7 6e-a5 87 2b 32 e5 f8 42 88   .5m.DP.n..+2..B.
    00a0 - 28 e2 ab 35 e1 2c 06 71-e5 b2 82 cb 3a 75 cc 72   (..5.,.q....:u.r
    00b0 - ed ae e1 12 ff 82 6c 3a-3a 38 7a 8c 3c 9c f1 10   ......l::8z.&lt;...
    00c0 - 78 b8 37 87 c3 a2 00 76-01 72 8c ef 3b 20 48 28   x.7....v.r..; H(

    Start Time: 1644931899
    Timeout   : 7200 (sec)
    Verify return code: 0 (ok)
    Extended master secret: yes
---
closed</code></pre>



<p>（补充：这里以显示 eternalcenter.com 的 443 端口的 SSL 证书为例）</p>



<h4>内容二：查看主要信息</h4>



<pre class="wp-block-code"><code># echo | openssl s_client -connect scc.suse.com:443 | head -n 16
CONNECTED(00000003)
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
verify return:1
depth=1 C = US, O = Let's Encrypt, CN = R3
verify return:1
depth=0 CN = eternalcenter.com
verify return:1
---
Certificate chain
 0 s:CN = eternalcenter.com
   i:C = US, O = Let's Encrypt, CN = R3
 1 s:C = US, O = Let's Encrypt, CN = R3
   i:C = US, O = Internet Security Research Group, CN = ISRG Root X1
 2 s:C = US, O = Internet Security Research Group, CN = ISRG Root X1
   i:O = Digital Signature Trust Co., CN = DST Root CA X3
---</code></pre>



<p>（补充：这里以显示 eternalcenter.com 的 443 端口的 SSL 证书为例）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[命令] Rocky Linux 8 &#038; RHEL 8 命令 update-crypto-policies</title>
		<link>https://eternalcenter-may-1-2022.github.io/update-crypto-policies/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 12 Feb 2022 09:12:59 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Setting (系统设置)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=21893</guid>

					<description><![CDATA[内容一：update-crypto-policies 参数的意义 1) DEFAULT 不严格的安全等级，可以让系统使用 TLSv1.22) FUTURE 严格的安全等级，只能让系统使用 TLSv1.2 不能使用 TLSv1.3 内容二：显示当前的 update-crypto-policies 参数 （补充：从这里可以看出目前的 update-crypto-policies 参数是 DEFAULT） 内容三：设置 update-crypto-policies 参数 （补充：这里以将 update-crypto-policies 参数设置为 FUTURE 为例）]]></description>
										<content:encoded><![CDATA[
<h4 id="内容一-update-crypto-policies-参数的意义">内容一：update-crypto-policies 参数的意义</h4>



<p>1) DEFAULT 不严格的安全等级，可以让系统使用 TLSv1.2<br>2) FUTURE 严格的安全等级，只能让系统使用 TLSv1.2 不能使用 TLSv1.3</p>



<h4 id="内容二-查看当前的-update-crypto-policies-参数">内容二：显示当前的 update-crypto-policies 参数</h4>



<pre class="wp-block-code"><code># update-crypto-policies --show
DEFAULT</code></pre>



<p>（补充：从这里可以看出目前的 update-crypto-policies 参数是 DEFAULT）</p>



<h4 id="内容三-设置-update-crypto-policies-参数">内容三：设置 update-crypto-policies 参数</h4>



<pre class="wp-block-code"><code># update-crypto-policies --set=FUTURE</code></pre>



<p>（补充：这里以将 update-crypto-policies 参数设置为 FUTURE 为例）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[排错] 解决 Linux 执行 curl 命令时报错 “curl: (35) error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure”</title>
		<link>https://eternalcenter-may-1-2022.github.io/debug-35-error14094410ssl-routinesssl3_read_bytessslv3-alert-handshake-failure/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 12 Feb 2022 09:03:09 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Setting (系统设置)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=21890</guid>

					<description><![CDATA[报错代码： 分析： Rocky Linux 8 &#38; RHEL 8 已经默认废弃 TLSv1.2可以使用 TLSv1.3 替代 TLSv1.2 或者将 update-crypto-policies 参数设置为 DEFAULT 以解决此报错 解决方法： 步骤一：显示当前的 update-crypto-policies 参数 （补充：从这里可以看出目前的 update-crypto-policies 参数是 FUTURE） 步骤二：将 update-crypto-policies 参数设置为 DEFAULT （补充：这里以将 update-crypto-policies 参数设置为 DEFAULT 为例）]]></description>
										<content:encoded><![CDATA[
<h2 id="报错代码">报错代码：</h2>



<pre class="wp-block-code"><code>curl: (35) error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure</code></pre>



<h2 id="分析">分析：</h2>



<p>Rocky Linux 8 &amp; RHEL 8 已经默认废弃 TLSv1.2<br>可以使用 TLSv1.3 替代 TLSv1.2 或者将 update-crypto-policies 参数设置为 DEFAULT 以解决此报错</p>



<h2 id="解决方法">解决方法：</h2>



<h4 id="步骤一-查看当前的-update-crypto-policies-参数">步骤一：显示当前的 update-crypto-policies 参数</h4>



<pre class="wp-block-code"><code># update-crypto-policies --show
FUTURE</code></pre>



<p>（补充：从这里可以看出目前的 update-crypto-policies 参数是 FUTURE）</p>



<h4 id="步骤二-将-update-crypto-policies-参数设置为-default">步骤二：将 update-crypto-policies 参数设置为 DEFAULT</h4>



<pre class="wp-block-code"><code># update-crypto-policies --set=DEFAULT</code></pre>



<p>（补充：这里以将 update-crypto-policies 参数设置为 DEFAULT 为例）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] Linux SSL 证书的生成 （Let&#8217;s Encrypt certbot 版）</title>
		<link>https://eternalcenter-may-1-2022.github.io/ssl-lets-encrypt-certbot/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sun, 19 Dec 2021 15:12:46 +0000</pubDate>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Basic Guidelines for Website building (网站建设基础指南)]]></category>
		<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Django Service (服务)]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Nginx Security (安全)]]></category>
		<category><![CDATA[Personal Website Building (个人网站建设)]]></category>
		<category><![CDATA[Project (项目)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[Website Services (网站服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=19886</guid>

					<description><![CDATA[步骤目录： 步骤一：将要申请 Let&#8217;s Encrypt SSL 的域名解析到要进行操作的服务器 IP 地址上 步骤二：安装 certbot 步骤三：使用 certbot 生成 Let&#8217;s Encrypt SSL 证书 步骤四：显示已经生成的 Let&#8217;s Encrypt SSL 证书 步骤五：延期 Let&#8217;s Encrypt SSL 证书5.1 显示 Let&#8217;s Encrypt SSL 证书的延期策略5.2 手动延期 Let&#8217;s Encrypt SSL 证书5.3 自动延期 Let&#8217;s Encrypt SSL 证书 步骤六：Let’s Encrypt SSL 证书的生成限制 具体的操作步骤： 步骤一：将要申请 Let&#8217;s Encrypt SSL 的域名解析到要进行操作的服务器 IP 地址上 （步骤略） &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/ssl-lets-encrypt-certbot/" class="more-link">Continue reading<span class="screen-reader-text"> "[步骤] Linux SSL 证书的生成 （Let&#8217;s Encrypt certbot 版）"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2 id="步骤目录">步骤目录：</h2>



<h4 id="步骤一-将要申请-let-s-encrypt-ssl-的域名解析到要进行操作的服务器-ip-地址上">步骤一：将要申请 Let&#8217;s Encrypt SSL 的域名解析到要进行操作的服务器 IP 地址上</h4>



<h4 id="步骤二-安装-certbot">步骤二：安装 certbot</h4>



<h4 id="步骤三-使用-certbot-生成-let-s-encrypt-ssl-证书">步骤三：使用 certbot 生成 Let&#8217;s Encrypt SSL 证书</h4>



<h4 id="步骤四-查看已经生成的-let-s-encrypt-ssl-证书">步骤四：显示已经生成的 Let&#8217;s Encrypt SSL 证书</h4>



<h4 id="步骤五-延期-let-s-encrypt-ssl-证书-5-1-显示-let-s-encrypt-ssl-证书的延期策略-5-2-手动延期-let-s-encrypt-ssl-证书-5-3-自动延期-let-s-encrypt-ssl-证书">步骤五：延期 Let&#8217;s Encrypt SSL 证书<br>5.1 显示 Let&#8217;s Encrypt SSL 证书的延期策略<br>5.2 手动延期 Let&#8217;s Encrypt SSL 证书<br>5.3 自动延期 Let&#8217;s Encrypt SSL 证书</h4>



<h4 id="步骤六-let-s-encrypt-ssl-证书的生成限制">步骤六：Let’s Encrypt SSL 证书的生成限制</h4>



<h2 id="具体的操作步骤">具体的操作步骤：</h2>



<h4 id="步骤一-将要申请-let-s-encrypt-ssl-的域名解析到要进行操作的服务器-ip-地址上">步骤一：将要申请 Let&#8217;s Encrypt SSL 的域名解析到要进行操作的服务器 IP 地址上</h4>



<p>（步骤略）</p>



<h4 id="步骤二-安装-certbot">步骤二：安装 certbot</h4>



<pre class="wp-block-code"><code># yum -y install certbot</code></pre>



<p>（补充：这里以在 Fedora 35 上安装 certbot 为例）</p>



<h4 id="步骤三-使用-certbot-生成-let-s-encrypt-ssl-证书">步骤三：使用 certbot 生成 Let&#8217;s Encrypt SSL 证书</h4>



<pre class="wp-block-code"><code># certbot certonly --email mingyu.zhu@eternalcenter.com -n --agree-tos --webroot -w /usr/share/nginx/html/ -d eternalcenter.com
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Requesting a certificate for eternalcenter.com
Performing the following challenges:
http-01 challenge for eternalcenter.com
Using the webroot path /usr/share/nginx/html for all unmatched domains.
Waiting for verification...
Cleaning up challenges

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/eternalcenter.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/eternalcenter.com/privkey.pem
   Your certificate will expire on 2022-03-20. To obtain a new or
   tweaked version of this certificate in the future, simply run
   certbot again. To non-interactively renew *all* of your
   certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le</code></pre>



<p>（<br>补充：这里以<br>1) 使用 mingyu.zhu@eternalcenter.com 邮箱<br>2) 以非交互式的方式<br>3) 通过给 /usr/share/nginx/html/ 网站目录里添加验证文件进行验证<br>4) 给 eternalcenter.com 域名<br>申请 Let&#8217;s Encrypt SSL 证书为例<br>）</p>



<h4 id="步骤四-查看已经生成的-let-s-encrypt-ssl-证书">步骤四：显示已经生成的 Let&#8217;s Encrypt SSL 证书</h4>



<pre class="wp-block-code"><code># certbot certificates
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Found the following certs:
  Certificate Name: eternalcenter.com
    Serial Number: 3e8cdb74a1abfbf3d535ec1c3f8cb3e4e4c
    Key Type: RSA
    Domains: eternalcenter.com
    Expiry Date: 2022-03-20 13:48:48+00:00 (VALID: 89 days)
    Certificate Path: /etc/letsencrypt/live/eternalcenter.com/fullchain.pem
    Private Key Path: /etc/letsencrypt/live/eternalcenter.com/privkey.pem
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
</code></pre>



<p>（<br>补充：<br>1) /etc/letsencrypt/live/eternalcenter.com/fullchain.pem 是公钥<br>2) /etc/letsencrypt/live/eternalcenter.com/privkey.pem 是私钥<br>）</p>



<h4 id="步骤五-延期-let-s-encrypt-ssl-证书-5-1-显示-let-s-encrypt-ssl-证书的延期策略">步骤五：延期 Let&#8217;s Encrypt SSL 证书<br>5.1 显示 Let&#8217;s Encrypt SSL 证书的延期策略</h4>



<pre class="wp-block-code"><code># cat /etc/letsencrypt/renewal/eternalcenter.com.conf 
# renew_before_expiry = 30 days
version = 1.20.0
archive_dir = /etc/letsencrypt/archive/eternalcenter.com
cert = /etc/letsencrypt/live/eternalcenter.com/cert.pem
privkey = /etc/letsencrypt/live/eternalcenter.com/privkey.pem
chain = /etc/letsencrypt/live/eternalcenter.com/chain.pem
fullchain = /etc/letsencrypt/live/eternalcenter.com/fullchain.pem</code></pre>



<p>（补充：可以看出 Let&#8217;s Encrypt SSL 证书是在过期前 30 天才能更新）</p>



<h4 id="5-2-手动延期-let-s-encrypt-ssl-证书">5.2 手动延期 Let&#8217;s Encrypt SSL 证书</h4>



<pre class="wp-block-code"><code># /usr/bin/certbot renew</code></pre>



<p>（补充：这里以延期 Let&#8217;s Encrypt SSL 证书为例）</p>



<h4 id="5-3-自动延期-let-s-encrypt-ssl-证书">5.3 自动延期 Let&#8217;s Encrypt SSL 证书</h4>



<pre class="wp-block-code"><code># crontab -e</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
0 0 */30 * * /usr/bin/certbot renew</code></pre>



<p>（补充：这里以每过 30 天的 0 时 0 分延期 Let&#8217;s Encrypt SSL 证书为例）</p>



<h4 id="步骤六-let-s-encrypt-ssl-证书的生成限制">步骤六：Let’s Encrypt SSL 证书的生成限制</h4>



<p>1) 一个域名申请次数不能超过 5 次/周<br>2) 允许申请失败次数不能超过 5 次/时<br>3) 属于同一个顶级域名的二级域名申请次数不能超过 20 次/周<br>4) 申请请求频率不能超过 20 次/秒<br>5) 一个 IP 地址创建用户个数不能超过 10 个/3 小时<br>6) 一个用户最多 pending 审核的数不能超过 300 个</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[步骤] SELinux  的启用 （openSUSE &#038; SLE  版） （不建议）</title>
		<link>https://eternalcenter-may-1-2022.github.io/selinux-opensuse-sle/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 01 Jun 2021 08:50:14 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[SELinux]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System File Security (系统文件安全)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Process Security (系统进程安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Security Log (系统安全日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=14516</guid>

					<description><![CDATA[软件准备： 在 SELinuxProject 的官网上下载 SELinux 策略 UseRefpolicy： https://github.com/SELinuxProject/refpolicy/wiki/UseRefpolicy 注意： 1) 如果使用此文的方法将 openSUSE &#38; SLE 的 SELinux 设置为 Enforcing 则系统将无法设置 IP 地址2) 如果使用此文的方法开启了 SELinux 并且将所有的布尔（boolean）值开启，则系统将无法关机，开启所有布尔值的方法：# for i in semanage boolean -l &#124; awk '{print $1}'; do echo $i;setsebool -P $i 1; done 正文： 步骤目录： 步骤一：安装 SELinux 组件 步骤二：安装 SELinux 策略2.1 解压包含 SELinux 策略的压缩包2.2 将 SELinux 策略移动到 &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/selinux-opensuse-sle/" class="more-link">Continue reading<span class="screen-reader-text"> "[步骤] SELinux  的启用 （openSUSE &#038; SLE  版） （不建议）"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2 id="软件准备">软件准备：</h2>



<p>在 SELinuxProject 的官网上下载 SELinux 策略 UseRefpolicy：</p>



<p class="has-text-align-center"><a href="https://github.com/SELinuxProject/refpolicy/wiki/UseRefpolicy" target="_blank" rel="noreferrer noopener">https://github.com/SELinuxProject/refpolicy/wiki/UseRefpolicy</a></p>



<h2 id="注意">注意：</h2>



<p>1) 如果使用此文的方法将 openSUSE &amp; SLE 的 SELinux 设置为 Enforcing 则系统将无法设置 IP 地址<br>2) 如果使用此文的方法开启了 SELinux 并且将所有的布尔（boolean）值开启，则系统将无法关机，开启所有布尔值的方法：# for i in <code>semanage boolean -l | awk '{print $1}'</code>; do echo $i;setsebool -P $i 1; done</p>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 id="正文">正文：</h2>



<h2 id="步骤目录">步骤目录：</h2>



<h4 id="步骤一-安装-selinux-组件">步骤一：安装 SELinux 组件</h4>



<h4 id="步骤二-安装-selinux-策略-2-1-解压包含-selinux-策略的压缩包-2-2-将-selinux-策略移动到-selinux-配置文件的位置-2-3-进入到和-selinux-策略相同目录下-2-4-显示-selinux-策略的安装手册-2-5-创建-selinux-策略的配置文件-2-6-创建-selinux-策略-2-7-编译-selinux-策略-2-8-安装-selinux-策略">步骤二：安装 SELinux 策略<br>2.1 解压包含 SELinux 策略的压缩包<br>2.2 将 SELinux 策略移动到 SELinux 配置文件的位置<br>2.3 进入到和 SELinux 策略相同目录下<br>2.4 显示 SELinux 策略的安装手册<br>2.5 创建 SELinux 策略的配置文件<br>2.6 创建 SELinux 策略<br>2.7 编译 SELinux 策略<br>2.8 安装 SELinux 策略</h4>



<h4 id="步骤三-配置-selinux-配置文件-3-1-在-selinux-配置文件中将-selinux-设置为-permissive-状态-3-2-在系统内核中禁止使用-apparmor-使用-selinux-并且将-selinux-状态设置为-permissive-3-2-1-设置-grub-文件-3-2-2-让刚刚设置的-grub-文件生效-3-3-刷新系统内所有文件的标签">步骤三：配置 SELinux 配置文件<br>3.1 在 SELinux 配置文件中将 SELinux 设置为 Permissive 状态<br>3.2 在系统内核中禁止使用 AppArmor 使用 SELinux 并且将 SELinux 状态设置为 Permissive<br>3.2.1 设置 grub 文件<br>3.2.2 让刚刚设置的 grub 文件生效<br>3.3 刷新系统内所有文件的标签</h4>



<h4 id="步骤四-重启系统让-selinux-生效">步骤四：重启系统让 SELinux 生效</h4>



<h2 id="具体的操作步骤">具体的操作步骤：</h2>



<h4 id="步骤一-安装-selinux-组件">步骤一：安装 SELinux 组件</h4>



<pre class="wp-block-code"><code># zypper in libselinux1 libsemanage1 libsepol-devel libsepol1 libselinux-devel mcstrans libselinux1-32bit policycoreutils checkpolicy libsemanage-devel setools-tcl setools-libs setools-java setools-devel setools-console selinux-tools python3-policycoreutils python3-selinux python3-semanage python3-setools restorecond</code></pre>



<h4 id="步骤二-安装-selinux-策略-2-1-解压包含-selinux-策略的压缩包">步骤二：安装 SELinux 策略<br>2.1 解压包含 SELinux 策略的压缩包</h4>



<pre class="wp-block-code"><code># tar -xvf refpolicy-2.20210203.tar.bz2</code></pre>



<p>（补充：这里以解压 refpolicy-2.20210203.tar.bz2 压缩包为例）</p>



<h4 id="2-2-将-selinux-策略移动到-selinux-配置文件的位置">2.2 将 SELinux 策略移动到 SELinux 配置文件的位置</h4>



<pre class="wp-block-code"><code># mv refpolicy /etc/selinux/</code></pre>



<h4 id="2-3-进入到和-selinux-策略相同目录下">2.3 进入到和 SELinux 策略相同目录下</h4>



<pre class="wp-block-code"><code># cd /etc/selinux/refpolicy/</code></pre>



<h4 id="2-4-显示-selinux-策略的安装手册">2.4 显示 SELinux 策略的安装手册</h4>



<pre class="wp-block-code"><code># cat INSTALL</code></pre>



<h4 id="2-5-创建-selinux-策略的配置文件">2.5 创建 SELinux 策略的配置文件</h4>



<pre class="wp-block-code"><code># make conf</code></pre>



<h4 id="2-6-创建-selinux-策略">2.6 创建 SELinux 策略</h4>



<pre class="wp-block-code"><code># make policy</code></pre>



<h4 id="2-7-编译-selinux-策略">2.7 编译 SELinux 策略</h4>



<pre class="wp-block-code"><code># make install</code></pre>



<h4 id="2-8-安装-selinux-策略">2.8 安装 SELinux 策略</h4>



<pre class="wp-block-code"><code># make load</code></pre>



<h4 id="步骤三-配置-selinux-配置文件-3-1-在-selinux-配置文件中将-selinux-设置为-permissive-状态">步骤三：配置 SELinux 配置文件<br>3.1 在 SELinux 配置文件中将 SELinux 设置为 Permissive 状态</h4>



<pre class="wp-block-code"><code># vim /etc/selinux/config</code></pre>



<p>创建以下内容：</p>



<pre class="wp-block-code"><code># 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=permissive
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=refpolicy</code></pre>



<h4 id="3-2-在系统内核中禁止使用-apparmor-使用-selinux-并且将-selinux-状态设置为-permissive-3-2-1-设置-grub-文件">3.2 在系统内核中禁止使用 AppArmor 使用 SELinux 并且将 SELinux 状态设置为 Permissive<br>3.2.1 设置 grub 文件</h4>



<pre class="wp-block-code"><code># vim /etc/default/grub</code></pre>



<p>在这一行里：</p>



<pre class="wp-block-code"><code>GRUB_CMDLINE_LINUX_DEFAULT="......"</code></pre>



<pre class="wp-block-code"><code>添加以下内容：</code></pre>



<pre class="wp-block-code"><code>GRUB_CMDLINE_LINUX_DEFAULT="...... security=selinux selinux=1 enforcing=0"</code></pre>



<h4 id="3-2-2-让刚刚设置的-grub-文件生效">3.2.2 让刚刚设置的 grub 文件生效</h4>



<pre class="wp-block-code"><code># grub2-mkconfig -o /boot/grub2/grub.cfg</code></pre>



<h4 id="3-3-刷新系统内所有文件的标签">3.3 刷新系统内所有文件的标签</h4>



<pre class="wp-block-code"><code># restorecon -Rp /</code></pre>



<h4 id="步骤四-重启系统让-selinux-生效">步骤四：重启系统让 SELinux 生效</h4>



<pre class="wp-block-code"><code># reboot</code></pre>



<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>



<h2 id="参考文献">参考文献：</h2>



<p class="has-text-align-center">https://documentation.suse.com/sles/15-SP2/html/SLES-all/cha-selinux.html</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] Linux SELinux 状态的设置</title>
		<link>https://eternalcenter-may-1-2022.github.io/selinux-state/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 31 May 2021 13:37:41 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[SELinux]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System File Security (系统文件安全)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Process Security (系统进程安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Security Log (系统安全日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=14456</guid>

					<description><![CDATA[内容目录： 内容一：SELinux 的状态 内容二：永久切换 SELinux 状态2.1 将 SELinux 永久切换至 Disabled 状态2.1.1 修改 SELinux 配置文件2.1.2 重启系统2.1.3 显示 SELinux 状态2.2 将 SELinux 永久切换至 Permissive 状态2.2.1 修改 SELinux 配置文件2.2.2 重启系统2.2.3 显示 SELinux 状态2.3 将 SELinux 永久切换至 Enforcing 状态2.3.1 修改 SELinux 配置文件2.3.2 重启系统2.3.3 显示 SELinux 状态 内容三：临时切换 SELinux 状态3.1 临时切换到 Permissive 状态3.1.1 临时切换到 Permissive 状态3.1.2 显示 SELinux 状态3.2 临时切换到 &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/selinux-state/" class="more-link">Continue reading<span class="screen-reader-text"> "[内容] Linux SELinux 状态的设置"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2 id="内容目录">内容目录：</h2>



<h4 id="内容一-selinux-的状态">内容一：SELinux 的状态</h4>



<h4 id="内容二-永久切换-selinux-状态-2-1-将-selinux-永久切换至-disabled-状态-2-1-1-修改-selinux-配置文件-2-1-2-重启系统-2-1-3-显示-selinux-状态-2-2-将-selinux-永久切换至-permissive-状态-2-2-1-修改-selinux-配置文件-2-2-2-重启系统-2-2-3-显示-selinux-状态-2-3-将-selinux-永久切换至-enforcing-状态-2-3-1-修改-selinux-配置文件-2-3-2-重启系统-2-3-3-显示-selinux-状态">内容二：永久切换 SELinux 状态<br>2.1 将 SELinux 永久切换至 Disabled 状态<br>2.1.1 修改 SELinux 配置文件<br>2.1.2 重启系统<br>2.1.3 显示 SELinux 状态<br>2.2 将 SELinux 永久切换至 Permissive 状态<br>2.2.1 修改 SELinux 配置文件<br>2.2.2 重启系统<br>2.2.3 显示 SELinux 状态<br>2.3 将 SELinux 永久切换至 Enforcing 状态<br>2.3.1 修改 SELinux 配置文件<br>2.3.2 重启系统<br>2.3.3 显示 SELinux 状态</h4>



<h4 id="内容三-临时切换-selinux-状态-3-1-临时切换到-permissive-状态-3-1-1-临时切换到-permissive-状态-3-1-2-显示-selinux-状态-3-2-临时切换到-enforcing-状态-3-2-1-临时切换到-enforcing-状态-3-2-2-显示-selinux-状态">内容三：临时切换 SELinux 状态<br>3.1 临时切换到 Permissive 状态<br>3.1.1 临时切换到 Permissive 状态<br>3.1.2 显示 SELinux 状态<br>3.2 临时切换到 Enforcing 状态<br>3.2.1 临时切换到 Enforcing 状态<br>3.2.2 显示 SELinux 状态</h4>



<h2 id="具体的内容">具体的内容：</h2>



<h4 id="内容一-selinux-的状态">内容一：SELinux 的状态</h4>



<p>1) Disabled：完全关闭 SELinux<br>2) Permissive：即使违反了策略也依旧可以执行，但是违反策略的记录会被记录在日志中<br>3) Enforcing：如果违反了策略就不能之行</p>



<h4 id="内容二-永久切换-selinux-状态-2-1-将-selinux-永久切换至-disabled-状态-2-1-1-修改-selinux-配置文件">内容二：永久切换 SELinux 状态<br>2.1 将 SELinux 永久切换至 Disabled 状态<br>2.1.1 修改 SELinux 配置文件</h4>



<pre class="wp-block-code"><code># vim /etc/selinux/config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
SELINUX=......
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
SELINUX=disabled
......</code></pre>



<h4 id="2-1-2-重启系统">2.1.2 重启系统</h4>



<pre class="wp-block-code"><code># reboot</code></pre>



<h4 id="2-1-3-显示-selinux-状态">2.1.3 显示 SELinux 状态</h4>



<pre class="wp-block-code"><code># getenforce 
Disabled</code></pre>



<h4 id="2-2-将-selinux-永久切换至-permissive-状态-2-2-1-修改-selinux-配置文件">2.2 将 SELinux 永久切换至 Permissive 状态<br>2.2.1 修改 SELinux 配置文件</h4>



<pre class="wp-block-code"><code># vim /etc/selinux/config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
SELINUX=......
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
SELINUX=permissive
......</code></pre>



<h4 id="2-2-2-重启系统">2.2.2 重启系统</h4>



<pre class="wp-block-code"><code># reboot</code></pre>



<h4 id="2-2-3-显示-selinux-状态">2.2.3 显示 SELinux 状态</h4>



<pre class="wp-block-code"><code># getenforce 
Permissive</code></pre>



<h4 id="2-3-将-selinux-永久切换至-enforcing-状态-2-3-1-修改-selinux-配置文件">2.3 将 SELinux 永久切换至 Enforcing 状态<br>2.3.1 修改 SELinux 配置文件</h4>



<pre class="wp-block-code"><code># vim /etc/selinux/config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
SELINUX=......
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
SELINUX=enforcing
......</code></pre>



<h4 id="2-3-2-重启系统">2.3.2 重启系统</h4>



<pre class="wp-block-code"><code># reboot</code></pre>



<h4 id="2-3-3-显示-selinux-状态">2.3.3 显示 SELinux 状态</h4>



<pre class="wp-block-code"><code># getenforce 
Enforcing</code></pre>



<h4 id="内容三-临时切换-selinux-状态-3-1-临时切换到-permissive-状态-3-1-1-临时切换到-permissive-状态">内容三：临时切换 SELinux 状态<br>3.1 临时切换到 Permissive 状态<br>3.1.1 临时切换到 Permissive 状态</h4>



<pre class="wp-block-code"><code># setenfoce 0</code></pre>



<p>（<br>注意：<br>1) 系统重启后失效<br>2) 只能从 Enforcing 状态切换到 Permissive 状态<br>）</p>



<h4 id="3-1-2-显示-selinux-状态">3.1.2 显示 SELinux 状态</h4>



<pre class="wp-block-code"><code># getenforce 
Permissive</code></pre>



<h4 id="3-2-临时切换到-enforcing-状态-3-2-1-临时切换到-enforcing-状态">3.2 临时切换到 Enforcing 状态<br>3.2.1 临时切换到 Enforcing 状态</h4>



<pre class="wp-block-code"><code># setenfoce 1</code></pre>



<p>（<br>注意：<br>1) 系统重启后失效<br>2) 只能从 Permissive 状态切换到 Enforcing 状态<br>）</p>



<h4 id="3-2-2-显示-selinux-状态">3.2.2 显示 SELinux 状态</h4>



<pre class="wp-block-code"><code># getenforce 
Enforcing</code></pre>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[工具] Shell 检测服务器某个端口有没有启动</title>
		<link>https://eternalcenter-may-1-2022.github.io/shell-port-check/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 18 May 2021 06:23:57 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Languages (语言)]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell Monitor (监控)]]></category>
		<category><![CDATA[Shell Tool (工具)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=14314</guid>

					<description><![CDATA[介绍： 作者：朱明宇名称：检测服务器某个端口有没有启动作用：检测服务器某个端口有没有启动 使用方法：1. 在此脚本的分割线内写入相应的内容2. 给此脚本添加执行权限3. 执行此脚本4. 如果被检测的端口被启动则会被记录在指定文件里 脚本分割线里的变量：1. checkport=&#8217;7111&#8242; #被检测的端口2. logfile=&#8217;checkportlog.txt&#8217; #记录文件 脚本：]]></description>
										<content:encoded><![CDATA[
<h2>介绍：</h2>



<p>作者：朱明宇<br>名称：检测服务器某个端口有没有启动<br>作用：检测服务器某个端口有没有启动</p>



<p>使用方法：<br>1. 在此脚本的分割线内写入相应的内容<br>2. 给此脚本添加执行权限<br>3. 执行此脚本<br>4. 如果被检测的端口被启动则会被记录在指定文件里</p>



<p>脚本分割线里的变量：<br>1. checkport=&#8217;7111&#8242; #被检测的端口<br>2. logfile=&#8217;checkportlog.txt&#8217; #记录文件</p>



<h2>脚本：</h2>



<pre class="wp-block-code"><code>#!/bin/bash

####################### Separator ########################
checkport='7111'
logfile='checkportlog.txt'
####################### Separator ########################

a=`/sbin/ss -ntulap | grep udp | grep $checkport | awk '{print $7}' | awk -F'"' '{print $2}'`

if &#91; -n "$a" ];then
       echo `date` >> $logfile
       echo $checkport >> $logfile
       echo `/sbin/ss -ntulap | grep udp | grep $checkport | awk '{print $7}' | awk -F'"' '{print $2}'` >> $logfile
       echo >> $logfile
fi</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[命令] Linux SSL 证书的生成 （OpenSSL 版）</title>
		<link>https://eternalcenter-may-1-2022.github.io/ssl-openssl/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Tue, 20 Apr 2021 07:50:42 +0000</pubDate>
				<category><![CDATA[Apache]]></category>
		<category><![CDATA[Basic Guidelines for Website building (网站建设基础指南)]]></category>
		<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Django Service (服务)]]></category>
		<category><![CDATA[Nginx]]></category>
		<category><![CDATA[Nginx Security (安全)]]></category>
		<category><![CDATA[Personal Website Building (个人网站建设)]]></category>
		<category><![CDATA[Project (项目)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Operation (系统操作)]]></category>
		<category><![CDATA[System Operation & System Setting & System Software (系统操作 & 系统设置 & 系统软件)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[Tomcat]]></category>
		<category><![CDATA[Web Application Firewall (WAF)]]></category>
		<category><![CDATA[Website Services (网站服务)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=14032</guid>

					<description><![CDATA[内容一：生成 SSL 证书1.1 交互式生成 SSL 证书 （补充：这里以同时生成长度 4096 位，加密格式为 512 的私钥 eternalcenter.com.key 和公钥 eternalcenter.com.csr 为例） 1.2 非交互式生成 SSL 证书 （补充：这里以同时生成1) 长度为 4096 位2) 加密格式为 5123) 国家为 CN4) 州或省为 Sichuan5) 城市为 Chengdu6) 组织为 Eternal Center7) 部门为 Mingyu Zhu8) 域名为 eternalcenter.com9) 邮箱地址为 contact@mingyuzhu.com的私钥 eternalcenter.com.key 和公钥 eternalcenter.com.csr 为例） 内容二：测试 SSL 证书]]></description>
										<content:encoded><![CDATA[
<h4 id="内容一-生成-ssl-证书-1-1-交互式生成-ssl-证书">内容一：生成 SSL 证书<br>1.1 交互式生成 SSL 证书</h4>



<pre class="wp-block-code"><code># openssl req -nodes -newkey rsa:4096 -sha512 -keyout eternalcenter.com.key -out eternalcenter.com.csr</code></pre>



<p>（补充：这里以同时生成长度 4096 位，加密格式为 512 的私钥 eternalcenter.com.key 和公钥 eternalcenter.com.csr 为例）</p>



<h4 id="1-2-非交互式生成-ssl-证书">1.2 非交互式生成 SSL 证书</h4>



<pre class="wp-block-code"><code># openssl req -nodes -newkey rsa:4096 -sha512 -out eternalcenter.com.csr -keyout eternalcenter.com.key -subj "/C=CN/ST=Sichuan/L=Chengdu/O=Eternal Center/OU=Mingyu Zhu/CN=eternalcenter.com/emailAddress=contact@mingyuzhu.com"</code></pre>



<p>（<br>补充：这里以同时生成<br>1) 长度为 4096 位<br>2) 加密格式为 512<br>3) 国家为 CN<br>4) 州或省为 Sichuan<br>5) 城市为 Chengdu<br>6) 组织为 Eternal Center<br>7) 部门为 Mingyu Zhu<br>8) 域名为 eternalcenter.com<br>9) 邮箱地址为 contact@mingyuzhu.com<br>的私钥 eternalcenter.com.key 和公钥 eternalcenter.com.csr 为例<br>）</p>



<h4 id="内容二-测试-ssl-证书">内容二：测试 SSL 证书</h4>



<pre class="wp-block-code"><code># openssl req -in eternalcenter.com.csr -noout -text</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[工具] Shell 批量检测服务器 TCP 端口的联通状态 （nc 版）</title>
		<link>https://eternalcenter-may-1-2022.github.io/shell-tcp-check-nc/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 25 Jan 2021 10:34:16 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Languages (语言)]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell Monitor (监控)]]></category>
		<category><![CDATA[Shell Tool (工具)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=13243</guid>

					<description><![CDATA[介绍： 作者：朱明宇名称：批量检测服务器 TCP 端口的联通状态作用：批量检测服务器 TCP 端口的联通状态 使用方法：1. 端口清单 $portlist 每一个端口占用一行，格式为：&#60;要联通端口号对应的 IP 地址&#62;:&#60;要联通的端口号&#62;:&#60;端口功能&#62;2. 在此脚本的分割线内写入相应的内容，并和此脚本放在同一目录下3. 给此脚本添加执行权限4. 执行此脚本，并将要测试的服务器 IP 地址跟在脚本的后面，例：. &#60;脚本名&#62; &#60;服务器 IP 地址 1&#62; &#60;服务器 IP 地址 2&#62; &#8230;&#8230; 脚本分割线里的变量：portlist=tcp_ports.txt #存放要测试的 TCP 端口的文件 注意：1. 此脚本执行前必须要先保证执行本脚本的用户能无密码 ssh 远程这些远程服务器2. 执行此脚本前确保 nc 命令已经安装 脚本：]]></description>
										<content:encoded><![CDATA[
<h2>介绍：</h2>



<p>作者：朱明宇<br>名称：批量检测服务器 TCP 端口的联通状态<br>作用：批量检测服务器 TCP 端口的联通状态</p>



<p>使用方法：<br>1. 端口清单 $portlist 每一个端口占用一行，格式为：&lt;要联通端口号对应的 IP 地址&gt;:&lt;要联通的端口号&gt;:&lt;端口功能&gt;<br>2. 在此脚本的分割线内写入相应的内容，并和此脚本放在同一目录下<br>3. 给此脚本添加执行权限<br>4. 执行此脚本，并将要测试的服务器 IP 地址跟在脚本的后面，例：. &lt;脚本名&gt; &lt;服务器 IP 地址 1&gt; &lt;服务器 IP 地址 2&gt; &#8230;&#8230;</p>



<p>脚本分割线里的变量：<br>portlist=tcp_ports.txt #存放要测试的 TCP 端口的文件</p>



<p>注意：<br>1. 此脚本执行前必须要先保证执行本脚本的用户能无密码 ssh 远程这些远程服务器<br>2. 执行此脚本前确保 nc 命令已经安装</p>



<h2>脚本：</h2>



<pre class="wp-block-code"><code>#!/bin/bash

####################### Separator ########################

portlist=tcp_ports.txt

####################### Separator ########################

for hosts in $*
do

        echo $hosts
        ssh $hosts "which nc" &amp;> /dev/null

        if &#91; $? -ne 0 ];then
                echo -e "\033&#91;31m$hosts can not use nc !!!!!!!!!!\033&#91;0m"
                continue
        fi

        for line in `cat $portlist`
        do
                ips=`echo $line | awk -F':' '{print $1}'`
                ports=`echo $line | awk -F':' '{print $2}'`
                remarks=`echo $line | awk -F':' '{print $3}'`

                ssh $hosts "nc -z -w 3 $ips $ports"

                if &#91; $? -ne 0 ];then
                        echo -e "\033&#91;31m$ips $ports $remarks can not be connected !!!!!!!!!!\033&#91;0m"
                else
                        echo -e "\033&#91;32m$ips $ports $remarks can be connected\033&#91;0m"
                fi

        done

done</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] VNC 数据的加密 （通过 SSH 实现）</title>
		<link>https://eternalcenter-may-1-2022.github.io/vnc-ssh/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Mon, 21 Sep 2020 14:56:43 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Login Security (系统登录安全)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[VNC]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=10572</guid>

					<description><![CDATA[内容目录： 内容一：直接通过 SSH 对 VNC 进行加密1.1 直接通过 SSH 对 VNC 进行加密的格式1.2 直接通过 SSH 对 VNC 进行加密的案例 内容二：通过非标准端口的 SSH 对 VNC 进行加密2.1 通过 SSH 对 VNC 进行加密，同时使用 SSH 隧道的格式2.2 通过 SSH 对 VNC 进行加密，同时使用 SSH 隧道的案例 具体的内容： 内容一：直接通过 SSH 对 VNC 进行加密1.1 直接通过 SSH 对 VNC 进行加密的格式 1.2 直接通过 SSH 对 VNC 进行加密的案例 （补充：这里以使用 eternalcenter.com 服务器上的 &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/vnc-ssh/" class="more-link">Continue reading<span class="screen-reader-text"> "[内容] VNC 数据的加密 （通过 SSH 实现）"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2>内容目录：</h2>



<h4>内容一：直接通过 SSH 对 VNC 进行加密<br>1.1 直接通过 SSH 对 VNC 进行加密的格式<br>1.2 直接通过 SSH 对 VNC 进行加密的案例</h4>



<h4>内容二：通过非标准端口的 SSH 对 VNC 进行加密<br>2.1 通过 SSH 对 VNC 进行加密，同时使用 SSH 隧道的格式<br>2.2 通过 SSH 对 VNC 进行加密，同时使用 SSH 隧道的案例</h4>



<h2>具体的内容：</h2>



<h4>内容一：直接通过 SSH 对 VNC 进行加密<br>1.1 直接通过 SSH 对 VNC 进行加密的格式</h4>



<pre class="wp-block-code"><code># vncviewer -via &lt;SSH user of VNC server>@&lt;IP address of VNC server> localhost :&lt;VNC service number></code></pre>



<h4>1.2 直接通过 SSH 对 VNC 进行加密的案例</h4>



<pre class="wp-block-code"><code># vncviewer -via zhumingyu@eternalcenter.com localhost :1</code></pre>



<p>（补充：这里以使用 eternalcenter.com 服务器上的 zhumingyu 用户访问编号为 1 的 VNC 服务为例）</p>



<h4>内容二：通过非标准端口的 SSH 对 VNC 进行加密<br>2.1 通过 SSH 对 VNC 进行加密，同时使用 SSH 隧道的格式</h4>



<pre class="wp-block-code"><code># ssh -p &lt;SSH non standard port number> -L &lt;Port number of VNC service>:localhost:&lt;Port number of VNC service> -l  &lt;SSH user of VNC server> &lt;IP address of VNC server></code></pre>



<p>另开启一个命令行终端：</p>



<pre class="wp-block-code"><code># vncviewer localhost :&lt;VNC service number></code></pre>



<h4>2.2 通过 SSH 对 VNC 进行加密，同时使用 SSH 隧道的案例</h4>



<pre class="wp-block-code"><code># ssh -p 1000 -L 5901:localhost:5901 -l zhumingyu eternalcenter.com</code></pre>



<p>另开启一个命令行终端：</p>



<pre class="wp-block-code"><code># vncviewer localhost :1</code></pre>



<p>（补充：这里以使用 eternalcenter.com 服务器上的 zhumingyu 用户通过 1000 端口号 的 SSH 访问编号为 1 的 VNC 服务为例）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] Linux SELinux 标签的设置</title>
		<link>https://eternalcenter-may-1-2022.github.io/selinux-label/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Sat, 25 Jul 2020 07:11:03 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[SELinux]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System File Security (系统文件安全)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Process Security (系统进程安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Security Log (系统安全日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=10257</guid>

					<description><![CDATA[内容目录： 内容一：开启 SELinux 标签1.1 修改 SELinux 配置文件1.2 重启系统 内容二：SELinux 的常见特性2.1 SELinux 特性一：创建的文件或目录会自动继承其父目录的 SELinux 标签2.1.1 在 /var/www/html/ 目录下新创建 index.html 文件2.1.2 显示 /var/www/html/ 目录的 SELinux 标签2.1.3 显示新生成的 /var/www/html/index.html 标签2.2 SELinux 特性二：移动文件或目录和保留属性复制文件或目录不会改变其 SELinux 标签，普通复制会改变 SELinux 标签2.2.1 在 /tmp/ 目录下新创建 file1，file2，file3 文件2.2.2 显示 ls -Zd /tmp/ 目录的 SELinux 标签2.2.3 显示新创建文件的标签2.2.4 将 /tmp/file1 复制到 /var/www/html/2.2.5 将 /tmp/file2 移动到 /var/www/html/2.2.6 将 &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/selinux-label/" class="more-link">Continue reading<span class="screen-reader-text"> "[内容] Linux SELinux 标签的设置"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2 id="内容目录">内容目录：</h2>



<h4 id="内容一-开启-selinux-标签1-1-修改-selinux-配置文件1-2-重启系统">内容一：开启 SELinux 标签<br>1.1 修改 SELinux 配置文件<br>1.2 重启系统</h4>



<h4 id="内容二-selinux-的常见特性2-1-selinux-特性一-创建的文件或目录会自动继承其父目录的-selinux-标签2-1-1-在-var-www-html-目录下新创建-index-html-文件2-1-2-显示-var-www-html-目录的-selinux-标签2-1-3-显示新生成的-var-www-html-index-html-标签2-2-selinux-特性二-移动文件或目录和保留属性复制文件或目录不会改变其-selinux-标签-普通复制会改变-selinux-标签2-2-1-在-tmp-目录下新创建-file1-file2-file3-文件2-2-2-显示-ls-zd-tmp-目录的-selinux-标签2-2-3-显示新创建文件的标签2-2-4-将-tmp-file1-复制到-var-www-html-2-2-5-将-tmp-file2-移动到-var-www-html-2-2-6-将-tmp-file2-复制到-var-www-html-并使用-a-选项保留文件属性2-2-7-显示这些文件的-selinux-标签">内容二：SELinux 的常见特性<br>2.1 SELinux 特性一：创建的文件或目录会自动继承其父目录的 SELinux 标签<br>2.1.1 在 /var/www/html/ 目录下新创建 index.html 文件<br>2.1.2 显示 /var/www/html/ 目录的 SELinux 标签<br>2.1.3 显示新生成的 /var/www/html/index.html 标签<br>2.2 SELinux 特性二：移动文件或目录和保留属性复制文件或目录不会改变其 SELinux 标签，普通复制会改变 SELinux 标签<br>2.2.1 在 /tmp/ 目录下新创建 file1，file2，file3 文件<br>2.2.2 显示 ls -Zd /tmp/ 目录的 SELinux 标签<br>2.2.3 显示新创建文件的标签<br>2.2.4 将 /tmp/file1 复制到 /var/www/html/<br>2.2.5 将 /tmp/file2 移动到 /var/www/html/<br>2.2.6 将 /tmp/file2 复制到 /var/www/html/，并使用 -a 选项保留文件属性<br>2.2.7 显示这些文件的 SELinux 标签</h4>



<h4 id="内容三-显示某个文件或目录-selinux-标签3-1-显示某个文件-selinux-标签3-2-显示某个目录-selinux-标签3-3-显示某个进程-selinux-标签">内容三：显示某个文件或目录 SELinux 标签<br>3.1 显示某个文件 SELinux 标签<br>3.2 显示某个目录 SELinux 标签<br>3.3 显示某个进程 SELinux 标签</h4>



<h4 id="内容四-显示所有-selinux-标签4-1-显示所有文件和目录的-selinux-标签4-2-显示所有端口的-selinux-标签4-3-显示所有进程的-selinux-标签">内容四：显示所有 SELinux 标签<br>4.1 显示所有文件和目录的 SELinux 标签<br>4.2 显示所有端口的 SELinux 标签<br>4.3 显示所有进程的 SELinux 标签</h4>



<h4 id="内容五-设置-selinux-标签5-1-设置文件和目录-selinux-标签5-1-1-使用-semanage-fcontext-命令和-restorecon-命令设置文件和目录的-selinux-标签5-1-1-1-semanage-fcontext-命令的常用选项5-1-1-2-使用-semanage-fcontext-命令和-restorecon-命令设置文件和目录的-selinux-标签5-1-1-2-1-使用-smanage-fcontext-命令设置-selinux-标签5-1-1-2-2-使用-restorecon-命令修改默认上下文5-1-2-使用-chcon-命令设置-selinux-标签5-2-设置端口-selinux">内容五：设置 SELinux 标签<br>5.1 设置文件和目录 SELinux 标签<br>5.1.1 使用 semanage fcontext 命令和 restorecon 命令设置文件和目录的 SELinux 标签<br>5.1.1.1 semanage fcontext 命令的常用选项<br>5.1.1.2 使用 semanage fcontext 命令和 restorecon 命令设置文件和目录的 SELinux 标签<br>5.1.1.2.1 使用 smanage fcontext 命令设置 SELinux 标签<br>5.1.1.2.2 使用 restorecon 命令修改默认上下文<br>5.1.2 使用 chcon 命令设置 SELinux 标签<br>5.2 设置端口 SELinux</h4>



<h2 id="具体的内容">具体的内容：</h2>



<h4 id="内容一-开启-selinux-标签1-1-修改-selinux-配置文件">内容一：开启 SELinux 标签<br>1.1 修改 SELinux 配置文件</h4>



<pre class="wp-block-code"><code># vim /etc/selinux/config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
SELINUX=disabled
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
SELINUX=enforcing
......</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code>......
SELINUX=perssive
......</code></pre>



<h4 id="1-2-重启系统">1.2 重启系统</h4>



<pre class="wp-block-code"><code># reboot</code></pre>



<h4 id="内容二-selinux-的常见特性2-1-selinux-特性一-创建的文件或目录会自动继承其父目录的-selinux-标签2-1-1-在-var-www-html-目录下新创建-index-html-文件">内容二：SELinux 的常见特性<br>2.1 SELinux 特性一：创建的文件或目录会自动继承其父目录的 SELinux 标签<br>2.1.1 在 /var/www/html/ 目录下新创建 index.html 文件</h4>



<pre class="wp-block-code"><code># echo website &gt; /var/www/html/index.html</code></pre>



<p>（补充：这里以在 /var/www/html/ 目录下生成 index.html 文件为例）</p>



<h4 id="2-1-2-显示-var-www-html-目录的-selinux-标签">2.1.2 显示 /var/www/html/ 目录的 SELinux 标签</h4>



<pre class="wp-block-code"><code># ls -dZ /var/www/html/
unconfined_u:object_r:httpd_sys_content_t:s0 index.html</code></pre>



<h4 id="2-1-3-显示新生成的-var-www-html-index-html-标签">2.1.3 显示新生成的 /var/www/html/index.html 标签</h4>



<pre class="wp-block-code"><code># ls -Z /var/www/html/index.html/index.html 
unconfined_u:object_r:httpd_sys_content_t:s0 index.html</code></pre>



<p>（补充：从内容 1.1.2 和内容 1.1.3 命令的结果可以看出新生成的文件或其父目录的 SELinux 标签一致）</p>



<h4 id="2-2-selinux-特性二-移动文件或目录和保留属性复制文件或目录不会改变其-selinux-标签-普通复制会改变-selinux-标签2-2-1-在-tmp-目录下新创建-file1-file2-file3-文件">2.2 SELinux 特性二：移动文件或目录和保留属性复制文件或目录不会改变其 SELinux 标签，普通复制会改变 SELinux 标签<br>2.2.1 在 /tmp/ 目录下新创建 file1，file2，file3 文件</h4>



<pre class="wp-block-code"><code># touch /tmp/file{1,2,3}</code></pre>



<h4 id="2-2-2-显示-ls-zd-tmp-目录的-selinux-标签">2.2.2 显示 ls -Zd /tmp/ 目录的 selinux 标签</h4>



<pre class="wp-block-code"><code># ls -Zd /tmp/
unconfined_u:object_r:user_tmp_t:s0 /tmp/</code></pre>



<h4 id="2-2-3-显示新创建文件的标签">2.2.3 显示新创建文件的标签</h4>



<pre class="wp-block-code"><code># ls -Z /tmp/file*
unconfined_u:object_r:user_tmp_t:s0 /tmp/file1  unconfined_u:object_r:user_tmp_t:s0 /tmp/file2
unconfined_u:object_r:user_tmp_t:s0 /tmp/file3</code></pre>



<h4 id="2-2-4-将-tmp-file1-复制到-var-www-html">2.2.4 将 /tmp/file1 复制到 /var/www/html/</h4>



<pre class="wp-block-code"><code># cp /tmp/file1 /var/www/html/</code></pre>



<h4 id="2-2-5-将-tmp-file2-移动到-var-www-html">2.2.5 将 /tmp/file2 移动到 /var/www/html/</h4>



<pre class="wp-block-code"><code># mv /tmp/file2 /var/www/html/</code></pre>



<h4 id="2-2-6-将-tmp-file2-复制到-var-www-html-并使用-a-选项保留文件属性">2.2.6 将 /tmp/file2 复制到 /var/www/html/，并使用 -a 选项保留文件属性</h4>



<pre class="wp-block-code"><code># cp -a /tmp/file3 /var/www/html/</code></pre>



<h4 id="2-2-7-显示这些文件的-selinux-标签">2.2.7 显示这些文件的 SELinux 标签</h4>



<pre class="wp-block-code"><code># ls -Z /var/www/html/file*
unconfined_u:object_r:httpd_sys_content_t:s0 file1           unconfined_u:object_r:user_tmp_t:s0 file3
unconfined_u:object_r:user_tmp_t:s0 file2</code></pre>



<p>（补充：从内容 2.2.3 和内容 2.2.7 命令的结果可以看出只有普通复制会改变 SELinux 标签 ）</p>



<h4 id="内容三-显示某个文件-目录或进程-selinux-标签3-1-显示某个文件-selinux-标签">内容三：显示某个文件、目录或进程 SELinux 标签<br>3.1 显示某个文件 SELinux 标签</h4>



<pre class="wp-block-code"><code># ls -Z &lt;file&gt;</code></pre>



<h4 id="3-2-显示某个目录-selinux-标签">3.2 显示某个目录 SELinux 标签</h4>



<pre class="wp-block-code"><code># ls -Zd &lt;directory&gt;</code></pre>



<h4 id="3-3-显示某个进程-selinux-标签">3.3 显示某个进程 SELinux 标签</h4>



<pre class="wp-block-code"><code># ps -auxZ | grep &lt;process&gt;</code></pre>



<h4 id="内容四-显示所有-selinux-标签4-1-显示所有文件和目录的-selinux-标签">内容四：显示所有 SELinux 标签<br>4.1 显示所有文件和目录的 SELinux 标签</h4>



<pre class="wp-block-code"><code># semanage fcontext -l</code></pre>



<p>（注意：需要单独安装 policycoreutils-python-utils 后才能使用 semanage 命令）</p>



<h4 id="4-2-显示所有端口的-selinux-标签">4.2 显示所有端口的 SELinux 标签</h4>



<pre class="wp-block-code"><code># semanage port -l</code></pre>



<p>（注意：需要单独安装 policycoreutils-python-utils 后才能使用 semanage 命令）</p>



<h4 id="4-3-显示所有进程的-selinux-标签">4.3 显示所有进程的 SELinux 标签</h4>



<pre class="wp-block-code"><code># ps -auxZ</code></pre>



<h4 id="内容五-设置-selinux-标签5-1-设置文件和目录-selinux-标签5-1-1-使用-semanage-fcontext-命令和-restorecon-命令设置文件和目录的-selinux-标签5-1-1-1-semanage-fcontext-命令的常用选项">内容五：设置 SELinux 标签<br>5.1 设置文件和目录 SELinux 标签<br>5.1.1 使用 semanage fcontext 命令和 restorecon 命令设置文件和目录的 SELinux 标签<br>5.1.1.1 semanage fcontext 命令的常用选项</h4>



<p>1) -a 添加或变更 SELinux 标签<br>2) -d 删除 SELinux 标签<br>3) -l 显示所有的 SELinux 标签<br>4) -t 指定上下文 SELinux 标签<br>5) -v 显示修改 SELinux 标签的内容<br>6) -R 递归设置 SELinux 标签<br>7) -m 变更 SELinux 标签</p>



<h4 id="5-1-1-2-使用-semanage-fcontext-命令和-restorecon-命令设置文件和目录的-selinux-标签5-1-1-2-1-使用-smanage-fcontext-命令设置-selinux-标签">5.1.1.2 使用 semanage fcontext 命令和 restorecon 命令设置文件和目录的 SELinux 标签<br>5.1.1.2.1 使用 smanage fcontext 命令设置 SELinux 标签</h4>



<pre class="wp-block-code"><code># semanage fcontext -a -t httpd_sys_content_t "/tmp(/.*)?"</code></pre>



<p>（补充：这里以将 /tmp(/.*) 的 SELinux 标签设置为 httpd_sys_content_t 为例）</p>



<p>（注意：需要单独安装 policycoreutils-python-utils 后才能使用 semanage 命令）</p>



<h4 id="5-1-1-2-2-使用-restorecon-命令修改默认上下文">5.1.1.2.2 使用 restorecon 命令修改默认上下文</h4>



<pre class="wp-block-code"><code># restorecon -Rv /tmp
Relabeled /tmp from unconfined_u:object_r:default_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0</code></pre>



<h4 id="5-1-2-使用-chcon-命令设置-selinux-标签">5.1.2 使用 chcon 命令设置 SELinux 标签</h4>



<pre class="wp-block-code"><code># chcon -t httpd_sys_content_t /tmp/*</code></pre>



<p>（补充：这里以将 /tmp/* 的 SELinux 标签设置为 httpd_sys_content_t 为例）</p>



<h4 id="5-2-设置端口-selinux">5.2 设置端口 SELinux</h4>



<pre class="wp-block-code"><code># semanage port -a -t http_port_t -p tcp 82</code></pre>



<p>（补充：这里以将 TCP 82 端口的 SELinux 标签设置为 http_port_t 为例）</p>



<p>（注意：需要单独安装 policycoreutils-python-utils 后才能使用 semanage 命令）</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] Postfix 数据的加密 （通过 TLS 实现）</title>
		<link>https://eternalcenter-may-1-2022.github.io/postfix-tls/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Wed, 22 Jul 2020 02:56:38 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[Other Services (其他服务)]]></category>
		<category><![CDATA[Services (服务)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=10215</guid>

					<description><![CDATA[内容一：Postfix 不使用 TLS 加密数据传输的后果 1) 收发的邮件数据会被他人截取2) 给 Gmail 等电子邮箱发送邮件时，会提示类似 “ *** 未对此邮件进行加密” 的信息 内容二：给 Postfix 设置 TLS 加密数据传输的方法2.1 给 Postfix 的配置文件设置 TLS 机密数据传输的参数 添加以下内容： （补充：smtpd_tls_security_level 代表接收邮件的 TLS 安全等级smtp_tls_security_level 代表发送邮件的 TLS 安全等级TLS 的常用安全等级有 none、may 和 encrypt ：1) none 表示禁止使用 TLS 加密2) may 表示可以接收不使用 TLS 加密的邮件，但是会提出支持 TLS 加密的通告。发送邮件时优先发送支持 TLS 加密的邮件3) encrypt 表示强制使用 TLS 加密） 2.2 重启 Postfix &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/postfix-tls/" class="more-link">Continue reading<span class="screen-reader-text"> "[内容] Postfix 数据的加密 （通过 TLS 实现）"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h4>内容一：Postfix 不使用 TLS 加密数据传输的后果</h4>



<p>1) 收发的邮件数据会被他人截取<br>2) 给 Gmail 等电子邮箱发送邮件时，会提示类似 “ *** 未对此邮件进行加密” 的信息</p>



<h4>内容二：给 Postfix 设置 TLS 加密数据传输的方法<br>2.1 给 Postfix 的配置文件设置 TLS 机密数据传输的参数</h4>



<pre class="wp-block-code"><code># vim /etc/postfix/main.cf</code></pre>



<p>添加以下内容：</p>



<pre class="wp-block-code"><code>......
smtpd_tls_security_level = may
smtp_tls_security_level = may
......</code></pre>



<p>（<br>补充：<br>smtpd_tls_security_level 代表接收邮件的 TLS 安全等级<br>smtp_tls_security_level 代表发送邮件的 TLS 安全等级<br>TLS 的常用安全等级有 none、may 和 encrypt ：<br>1) none 表示禁止使用 TLS 加密<br>2) may 表示可以接收不使用 TLS 加密的邮件，但是会提出支持 TLS 加密的通告。发送邮件时优先发送支持 TLS 加密的邮件<br>3) encrypt 表示强制使用 TLS 加密<br>）</p>



<h4>2.2 重启 Postfix 服务</h4>



<pre class="wp-block-code"><code># systemctl restart postfix</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[内容] Linux SELinux 布尔 （boolean） 值的设置</title>
		<link>https://eternalcenter-may-1-2022.github.io/selinux-boolean/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Thu, 16 Jul 2020 11:56:09 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[SELinux]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System File Security (系统文件安全)]]></category>
		<category><![CDATA[System Log (系统日志)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Process Security (系统进程安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<category><![CDATA[System Security Log (系统安全日志)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=10063</guid>

					<description><![CDATA[内容目录： 内容一：开启 SELinux 布尔（boolean）值1.1 显示当前 SELinux 状态1.2 将 SELinux 的状态设置为 Enforcing 以开启布尔（boolean）值1.2.1 当当前 SELinux 的状态为 Disabled 时开启布尔（boolean）值的方法1.2.1.1 修改 SELinux 配置文件1.2.1.2 重启系统1.2.2 当当前 SELinux 的状态为 Perssive 时开启布尔（boolean）值的方法 内容二：显示所有 SELinux 布尔（boolean）值 内容三：布尔（boolean）值的管理3.1 允许某一个 SELinux 布尔（boolean）值开启3.1.1 临时允许某一个 SELinux 布尔（boolean）值开启3.1.1.1 临时允许某一个 SELinux 布尔（boolean）值开启的格式3.1.1.2 临时允许某一个 SELinux 布尔（boolean）值开启的案例3.1.2 永久允许某一个 SELinux 布尔（boolean）值开启3.1.2.1 永久允许某一个 SELinux 布尔（boolean）值开启的格式3.1.2.2 永久允许某一个 SELinux 布尔（boolean）值开启的案例3.2 取消某一个 SELinux 布尔（boolean）值开启3.2.1 临时取消某一个 &#8230; <p class="link-more"><a href="https://eternalcenter-may-1-2022.github.io/selinux-boolean/" class="more-link">Continue reading<span class="screen-reader-text"> "[内容] Linux SELinux 布尔 （boolean） 值的设置"</span></a></p>]]></description>
										<content:encoded><![CDATA[
<h2 id="内容目录">内容目录：</h2>



<h4 id="内容一-开启-selinux-布尔-boolean-值1-1-显示当前-selinux-状态1-2-将-selinux-的状态设置为-enforcing-以开启布尔-boolean-值1-2-1-当当前-selinux-的状态为-disabled-时开启布尔-boolean-值的方法1-2-1-1-修改-selinux-配置文件1-2-1-2-重启系统1-2-2-当当前-selinux-的状态为-perssive-时开启布尔-boolean-值的方法">内容一：开启 SELinux 布尔（boolean）值<br>1.1 显示当前 SELinux 状态<br>1.2 将 SELinux 的状态设置为 Enforcing 以开启布尔（boolean）值<br>1.2.1 当当前 SELinux 的状态为 Disabled 时开启布尔（boolean）值的方法<br>1.2.1.1 修改 SELinux 配置文件<br>1.2.1.2 重启系统<br>1.2.2 当当前 SELinux 的状态为 Perssive 时开启布尔（boolean）值的方法</h4>



<h4 id="内容二-查看所有-selinux-布尔-boolean-值">内容二：显示所有 SELinux 布尔（boolean）值</h4>



<h4 id="内容三-布尔-boolean-值的管理3-1-允许某一个-selinux-布尔-boolean-值开启3-1-1-临时允许某一个-selinux-布尔-boolean-值开启3-1-1-1-临时允许某一个-selinux-布尔-boolean-值开启的格式3-1-1-2-临时允许某一个-selinux-布尔-boolean-值开启的案例3-1-2-永久允许某一个-selinux-布尔-boolean-值开启3-1-2-1-永久允许某一个-selinux-布尔-boolean-值开启的格式3-1-2-2-永久允许某一个-selinux-布尔-boolean-值开启的案例3-2-取消某一个-selinux-布尔-boolean-值开启3-2-1-临时取消某一个-selinux-布尔-boolean-值开启3-2-1-1-临时取消某一个-selinux-布尔-boolean-值开启的格式3-2-1-2-临时取消某一个-selinux-布尔-boolean-值开启的案例3-2-2-永久取消某一个-selinux-布尔-boolean-值关闭3-2-2-1-永久取消某一个-selinux-布尔-boolean-值开启的格式3-2-2-2-永久取消某一个-selinux-布尔-boolean-值开启的案例">内容三：布尔（boolean）值的管理<br>3.1 允许某一个 SELinux 布尔（boolean）值开启<br>3.1.1 临时允许某一个 SELinux 布尔（boolean）值开启<br>3.1.1.1 临时允许某一个 SELinux 布尔（boolean）值开启的格式<br>3.1.1.2 临时允许某一个 SELinux 布尔（boolean）值开启的案例<br>3.1.2 永久允许某一个 SELinux 布尔（boolean）值开启<br>3.1.2.1 永久允许某一个 SELinux 布尔（boolean）值开启的格式<br>3.1.2.2 永久允许某一个 SELinux 布尔（boolean）值开启的案例<br>3.2 取消某一个 SELinux 布尔（boolean）值开启<br>3.2.1 临时取消某一个 SELinux 布尔（boolean）值开启<br>3.2.1.1 临时取消某一个 SELinux 布尔（boolean）值开启的格式<br>3.2.1.2 临时取消某一个 SELinux 布尔（boolean）值开启的案例<br>3.2.2 永久取消某一个 SELinux 布尔（boolean）值关闭<br>3.2.2.1 永久取消某一个 SELinux 布尔（boolean）值开启的格式<br>3.2.2.2 永久取消某一个 SELinux 布尔（boolean）值开启的案例</h4>



<h2 id="具体的操作步骤">具体的操作步骤：</h2>



<h4 id="内容一-开启-selinux-布尔-boolean-值1-1-显示当前-selinux-状态">内容一：开启 SELinux 布尔（boolean）值<br>1.1 显示当前 SELinux 状态</h4>



<pre class="wp-block-code"><code># getenforce</code></pre>



<h4 id="1-2-将-selinux-的状态设置为-enforcing-以开启布尔-boolean-值1-2-1-当当前-selinux-的状态为-disabled-时开启布尔-boolean-值的方法1-2-1-1-修改-selinux-配置文件">1.2 将 SELinux 的状态设置为 Enforcing 以开启布尔（boolean）值<br>1.2.1 当当前 SELinux 的状态为 Disabled 时开启布尔（boolean）值的方法<br>1.2.1.1 修改 SELinux 配置文件</h4>



<pre class="wp-block-code"><code># vim /etc/selinux/config</code></pre>



<p>将以下内容：</p>



<pre class="wp-block-code"><code>......
SELINUX=disabled
......</code></pre>



<p>修改为：</p>



<pre class="wp-block-code"><code>......
SELINUX=enforcing
......</code></pre>



<h4 id="1-2-1-2-重启系统">1.2.1.2 重启系统</h4>



<pre class="wp-block-code"><code># reboot</code></pre>



<h4 id="1-2-2-当当前-selinux-的状态为-perssive-时开启布尔-boolean-值的方法">1.2.2 当当前 SELinux 的状态为 Perssive 时开启布尔（boolean）值的方法</h4>



<pre class="wp-block-code"><code># setenfoce 1</code></pre>



<p>（补充：系统重启后失效）</p>



<h4 id="内容二-查看所有-selinux-布尔-boolean-值">内容二：显示所有 SELinux 布尔（boolean）值</h4>



<pre class="wp-block-code"><code># semanage boolean -l</code></pre>



<h4 id="内容三-布尔-boolean-值的管理3-1-允许某一个-selinux-布尔-boolean-值开启3-1-1-临时允许某一个-selinux-布尔-boolean-值开启3-1-1-1-临时允许某一个-selinux-布尔-boolean-值开启的格式">内容三：布尔（boolean）值的管理<br>3.1 允许某一个 SELinux 布尔（boolean）值开启<br>3.1.1 临时允许某一个 SELinux 布尔（boolean）值开启<br>3.1.1.1 临时允许某一个 SELinux 布尔（boolean）值开启的格式</h4>



<pre class="wp-block-code"><code># setsebool &lt;boolean value&gt; 1</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool &lt;boolean value&gt; on</code></pre>



<h4 id="3-1-1-2-临时允许某一个-selinux-布尔-boolean-值开启的案例">3.1.1.2 临时允许某一个 SELinux 布尔（boolean）值开启的案例</h4>



<pre class="wp-block-code"><code># setsebool httpd_can_network_connect 1</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool httpd_can_network_connect on</code></pre>



<h4 id="3-1-2-永久允许某一个-selinux-布尔-boolean-值开启3-1-2-1-永久允许某一个-selinux-布尔-boolean-值开启的格式">3.1.2 永久允许某一个 SELinux 布尔（boolean）值开启<br>3.1.2.1 永久允许某一个 SELinux 布尔（boolean）值开启的格式</h4>



<pre class="wp-block-code"><code># setsebool -P &lt;boolean value&gt; 1</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool -P &lt;boolean value&gt; on</code></pre>



<h4 id="3-1-2-2-永久允许某一个-selinux-布尔-boolean-值开启的案例">3.1.2.2 永久允许某一个 SELinux 布尔（boolean）值开启的案例</h4>



<pre class="wp-block-code"><code># setsebool -P httpd_can_network_connect 1</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool -P httpd_can_network_connect on</code></pre>



<h4 id="3-2-取消某一个-selinux-布尔-boolean-值开启3-2-1-临时取消某一个-selinux-布尔-boolean-值开启3-2-1-1-临时取消某一个-selinux-布尔-boolean-值开启的格式">3.2 取消某一个 SELinux 布尔（boolean）值开启<br>3.2.1 临时取消某一个 SELinux 布尔（boolean）值开启<br>3.2.1.1 临时取消某一个 SELinux 布尔（boolean）值开启的格式</h4>



<pre class="wp-block-code"><code># setsebool &lt;boolean value&gt; 0</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool &lt;boolean value&gt; off</code></pre>



<h4 id="3-2-1-2-临时取消某一个-selinux-布尔-boolean-值开启的案例">3.2.1.2 临时取消某一个 SELinux 布尔（boolean）值开启的案例</h4>



<pre class="wp-block-code"><code># setsebool httpd_can_network_connect 0</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool httpd_can_network_connect off</code></pre>



<h4 id="3-2-2-永久取消某一个-selinux-布尔-boolean-值关闭3-2-2-1-永久取消某一个-selinux-布尔-boolean-值开启的格式">3.2.2 永久取消某一个 SELinux 布尔（boolean）值关闭<br>3.2.2.1 永久取消某一个 SELinux 布尔（boolean）值开启的格式</h4>



<pre class="wp-block-code"><code># setsebool -P &lt;boolean value&gt; 0</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool -P &lt;boolean value&gt; off</code></pre>



<h4 id="3-2-2-2-永久取消某一个-selinux-布尔-boolean-值开启的案例">3.2.2.2 永久取消某一个 SELinux 布尔（boolean）值开启的案例</h4>



<pre class="wp-block-code"><code># setsebool -P httpd_can_network_connect 0</code></pre>



<p>或者：</p>



<pre class="wp-block-code"><code># setsebool -P httpd_can_network_connect off</code></pre>



<p></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[工具] Shell 只对某一个 IP 地址开放 TCP 22 端口 （iptables 版）</title>
		<link>https://eternalcenter-may-1-2022.github.io/shell-iptables-22-port-add/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Wed, 15 Jul 2020 02:29:00 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Languages (语言)]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell Deployment (部署)]]></category>
		<category><![CDATA[Shell Network (网络)]]></category>
		<category><![CDATA[Shell Tool (工具)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Firewall (系统防火墙)]]></category>
		<category><![CDATA[System Login Security (系统登录安全)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=9996</guid>

					<description><![CDATA[介绍： 名称：只对某一个 IP 地址开放 TCP 22 端口作用：只对某一个 IP 地址开放 TCP 22 端口 使用方法：1. 给此脚本添加执行权限2. 执行此脚本 脚本分割线里的变量：ipaddress=192.168.1.1 #要开放 TCP 22 端口的 IP 地址 脚本：]]></description>
										<content:encoded><![CDATA[
<h2>介绍：</h2>



<p>名称：只对某一个 IP 地址开放 TCP 22 端口<br>作用：只对某一个 IP 地址开放 TCP 22 端口</p>



<p>使用方法：<br>1. 给此脚本添加执行权限<br>2. 执行此脚本</p>



<p>脚本分割线里的变量：<br>ipaddress=192.168.1.1 #要开放 TCP 22 端口的 IP 地址</p>



<h2>脚本：</h2>



<pre class="wp-block-code"><code>#!/bin/bash

####################### Separator ########################
ipaddress=192.168.1.1
####################### Separator ########################

systemctl stop firewalld
systemctl disable firewalld

yum -y install iptables-services
zypper -n install iptables

systemctl enable iptables
systemctl start iptables

sysctl -w net.ipv4.ip_forward=1
iptables -t filter -F
iptables -t nat -F

iptables -P OUTPUT ACCEPT
#iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT

iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT

iptables -t filter -A INPUT -j ACCEPT -s $ipaddress -p tcp --destination-port 22
iptables -t filter -A INPUT -j DROP -p tcp --destination-port 22

service iptables save
systemctl restart iptables</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[工具] Shell 取消所有已开放的端口策略 （firewalld 版）</title>
		<link>https://eternalcenter-may-1-2022.github.io/shell-firewalld-all-number-ports-remove/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 26 Jun 2020 08:49:55 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Languages (语言)]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell Deployment (部署)]]></category>
		<category><![CDATA[Shell Network (网络)]]></category>
		<category><![CDATA[Shell Tool (工具)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=9954</guid>

					<description><![CDATA[介绍： 作者：朱明宇名称：取消所有已开放的端口策略作用：取消所有已开放的端口策略 使用方法：1. 给此脚本添加执行权限2. 执行此脚本 脚本：]]></description>
										<content:encoded><![CDATA[
<h2>介绍：</h2>



<p>作者：朱明宇<br>名称：取消所有已开放的端口策略<br>作用：取消所有已开放的端口策略</p>



<p>使用方法：<br>1. 给此脚本添加执行权限<br>2. 执行此脚本</p>



<h2>脚本：</h2>



<pre class="wp-block-code"><code>#!/bin/bash

systemctl start firewalld
systemctl enable firewalld

for i in `firewall-cmd --list-all | grep ports | egrep &#91;0-9] | awk -F':' '{print $2}'`
do
        pports=`echo $i | awk -F'/' '{print $1}'`
        ptus=`echo $i | awk -F'/' '{print $2}'`

        firewall-cmd --remove-port=$pports/$ptus --permanent

done

firewall-cmd --add-service=ssh --permanent
firewall-cmd --reload</code></pre>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>[工具] Shell 取消所有已设置的复杂端口策略 （firewalld 版）</title>
		<link>https://eternalcenter-may-1-2022.github.io/shell-firewalld-all-number-ports-rich-rules-remove/</link>
		
		<dc:creator><![CDATA[Mingyu Zhu]]></dc:creator>
		<pubDate>Fri, 26 Jun 2020 08:30:51 +0000</pubDate>
				<category><![CDATA[Chinese (中文)]]></category>
		<category><![CDATA[Languages (语言)]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Shell Deployment (部署)]]></category>
		<category><![CDATA[Shell Tool (工具)]]></category>
		<category><![CDATA[Shell Website (网站)]]></category>
		<category><![CDATA[System (系统)]]></category>
		<category><![CDATA[System Network (系统网络)]]></category>
		<category><![CDATA[System Network & System Security & System Log (系统网络 & 系统安全 & 系统日志)]]></category>
		<category><![CDATA[System Port Security (系统端口安全)]]></category>
		<category><![CDATA[System Security (系统安全)]]></category>
		<guid isPermaLink="false">https://eternalcenter-may-1-2022.github.io/?p=9941</guid>

					<description><![CDATA[介绍： 作者：朱明宇名称：取消所有已设置的复杂端口策略作用：取消所有已设置的复杂端口策略 使用方法：1. 给此脚本添加执行权限2. 执行此脚本 脚本：]]></description>
										<content:encoded><![CDATA[
<h2>介绍：</h2>



<p>作者：朱明宇<br>名称：取消所有已设置的复杂端口策略<br>作用：取消所有已设置的复杂端口策略</p>



<p>使用方法：<br>1. 给此脚本添加执行权限<br>2. 执行此脚本</p>



<h2>脚本：</h2>



<pre class="wp-block-code"><code>#!/bin/bash

systemctl start firewalld
systemctl enable firewalld

max=`firewall-cmd --list-all | grep "rule family" | wc -l`

for i in `seq 1 $max`
do
        echo $i
        lines=`firewall-cmd --list-all | grep "rule family" | sed -n $&#91;i]p`
        ipvs=`echo $lines | awk -F'"' '{print $2}'`
        ips=`echo $lines | awk -F'"' '{print $4}'`
        ports=`echo $lines | awk -F'"' '{print $6}'`
        tus=`echo $lines | awk -F'"' '{print $8}'`
        acts=`echo $lines | awk -F'"' '{print $9}'`

        echo $ipvs $ips $ports $tus $acts
        firewall-cmd --remove-rich-rule="rule family="$ipvs" source address="$ips" port protocol="$tus" port="$ports" $acts" --permanent
done

firewall-cmd --add-service=ssh --permanent
firewall-cmd --reload</code></pre>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
