1
0
Fork 0
mirror of https://github.com/proxysu/ProxySU.git synced 2025-04-02 21:36:17 +03:00

CentOS7 防火墙firewall运行状态判断

This commit is contained in:
ProxySU 2020-11-05 05:45:28 +08:00
parent 78d299f5c7
commit ebf9feb651
3 changed files with 15 additions and 5 deletions

View file

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d"
Title="ProxySU - v2.4.19-beta5" Height="675" Width="650">
Title="ProxySU - v2.4.19-beta6" Height="675" Width="650">
<!--以下样式参考自https://yq.aliyun.com/articles/331878
https://docs.microsoft.com/en-us/dotnet/desktop-wpf/fundamentals/styles-templates-overview-->
<Window.Resources>

View file

@ -7132,7 +7132,7 @@ namespace ProxySU
#endregion
#region
#region
private void ButtonWebBrowserHomePage_Click(object sender, RoutedEventArgs e)
{
@ -7169,7 +7169,7 @@ namespace ProxySU
}
}
#endregion
#region
private void ButtonWebBrowserHomePageFreeWallURL_Click(object sender, RoutedEventArgs e)
@ -7249,7 +7249,8 @@ namespace ProxySU
#endregion
#endregion
#region
private void Button_Click(object sender, RoutedEventArgs e)
{
@ -8025,8 +8026,17 @@ namespace ProxySU
if (String.IsNullOrEmpty(client.RunCommand("command -v firewall-cmd").Result) == false)
{
//有很奇怪的vps主机在firewalld未运行时端口是关闭的无法访问。所以要先启动firewalld
sshShellCommand = @"systemctl restart firewalld";
//用于保证acme.sh申请证书成功
sshShellCommand = @"firewall-cmd --state";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
if(String.Equals(currentShellCommandResult.Trim(), "running") == false)
{
sshShellCommand = @"systemctl restart firewalld";
currentShellCommandResult = MainWindowsShowCmd(client, sshShellCommand);
}
if (String.Equals(openFireWallPort, "443"))
{
sshShellCommand = @"firewall-cmd --zone=public --add-port=80/tcp --permanent";

Binary file not shown.