From eb52a69e5ee2ea3a4845b8ddc11d7aa07e0a7285 Mon Sep 17 00:00:00 2001 From: Darren <27513732@qq.com> Date: Tue, 10 Oct 2023 11:34:04 +0800 Subject: [PATCH] fix --- README.md | 7 +++---- install/install_cockpit.sh | 25 ++++++++++++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d343f7d1..0f341742 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,7 @@ -[![](https://lab.frogg.it/lydra/yunohost/ansible-yunohost/badges/main/pipeline.svg)](https://lab.frogg.it/lydra/yunohost/ansible-yunohost/-/pipelines) [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0) -[![GitHub last commit](https://img.shields.io/github/last-commit/LydraFr/ansible-yunohost)](https://github.com/LydraFr/ansible-yunohost) -[![GitHub Release Date](https://img.shields.io/github/release-date/LydraFr/ansible-yunohost)](https://github.com/LydraFr/ansible-yunohost) -[![GitHub Repo stars](https://img.shields.io/github/stars/LydraFr/ansible-yunohost?style=social)](https://github.com/LydraFr/ansible-yunohost) +[![GitHub last commit](https://img.shields.io/github/last-commit/websoft9/websoft9)](https://github.com/websoft9/websoft9) +[![GitHub Release Date](https://img.shields.io/github/release-date/websoft9/websoft9)](https://github.com/websoft9/websoft9) +[![GitHub Repo stars](https://img.shields.io/github/stars/websoft9/websoft9?style=social)](https://github.com/websoft9/websoft9) # What is Websoft9? diff --git a/install/install_cockpit.sh b/install/install_cockpit.sh index e733b8c9..faacb025 100644 --- a/install/install_cockpit.sh +++ b/install/install_cockpit.sh @@ -165,20 +165,27 @@ Restart_Cockpit(){ sudo systemctl restart cockpit } -Set_Firewall(){ - echo "$echo_prefix_cockpit Set firewall for cockpit access" +Add_Firewalld(){ + echo "Add cockpit service to Firewalld..." + # cockpit.xml is not always the same path at Linux distributions + sudo sed -i "s/port=\"[0-9]*\"/port=\"$cockpit_port\"/g" /etc/firewalld/services/cockpit.xml + sudo sed -i "s/port=\"[0-9]*\"/port=\"$cockpit_port\"/g" /usr/lib/firewalld/services/cockpit.xml + sudo firewall-cmd --zone=public --add-service=cockpit --permanent + sudo firewall-cmd --zone=public --add-port=443/tcp --permanent + sudo firewall-cmd --zone=public --add-port=80/tcp --permanent + sudo firewall-cmd --reload +} + +Set_Firewalld(){ + echo "$echo_prefix_cockpit Set firewalld for cockpit access" if command -v firewall-cmd &> /dev/null; then echo "Set firewall for Cockpit..." if ! systemctl is-active --quiet firewalld; then sudo systemctl start firewalld - sudo sed -i "s/port=\"[0-9]*\"/port=\"$cockpit_port\"/g" /etc/firewalld/services/cockpit.xml - sudo firewall-cmd --permanent --zone=public --add-service=cockpit - sudo firewall-cmd --reload + Add_Firewalld sudo systemctl stop firewalld else - sudo sed -i "s/port=\"[0-9]*\"/port=\"$cockpit_port\"/g" /etc/firewalld/services/cockpit.xml - sudo firewall-cmd --permanent --zone=public --add-service=cockpit - sudo firewall-cmd --reload + Add_Firewalld fi fi } @@ -318,7 +325,7 @@ Install_Cockpit(){ Restart_Cockpit fi - Set_Firewall + Set_Firewalld Set_Selinux Set_Cockpit Edit_Menu