mirror of
https://github.com/nezhahq/nezha.git
synced 2025-02-12 22:18:13 -05:00
Merge pull request #202 from Erope/master [no ci]
Add SELinux Check Co-authored-by: Erope <44471469+Erope@users.noreply.github.com>
This commit is contained in:
commit
2e295f48ac
@ -4,7 +4,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
|
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
|
||||||
<br><br>
|
<br><br>
|
||||||
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.13.13&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github"> <img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge"> <img src="https://img.shields.io/badge/Installer-v0.10.0-brightgreen?style=for-the-badge&logo=linux">
|
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.13.13&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github"> <img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge"> <img src="https://img.shields.io/badge/Installer-v0.10.1-brightgreen?style=for-the-badge&logo=linux">
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<br>
|
||||||
<p>:trollface: <b>Nezha Monitoring</b> self-hosted lightweight monitoring and operation and maintenance system. Supports system status, HTTP (SSL certificate change, upcoming expiration, expiration), TCP, Ping <b>monitoring</b> and <b>alerting</b>, execute scheduled tasks and <b>web terminal</b>.</p>
|
<p>:trollface: <b>Nezha Monitoring</b> self-hosted lightweight monitoring and operation and maintenance system. Supports system status, HTTP (SSL certificate change, upcoming expiration, expiration), TCP, Ping <b>monitoring</b> and <b>alerting</b>, execute scheduled tasks and <b>web terminal</b>.</p>
|
||||||
|
@ -11,7 +11,7 @@ NZ_BASE_PATH="/opt/nezha"
|
|||||||
NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
|
NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
|
||||||
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
|
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
|
||||||
NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service"
|
NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service"
|
||||||
NZ_VERSION="v0.10.0"
|
NZ_VERSION="v0.10.1"
|
||||||
|
|
||||||
red='\033[0;31m'
|
red='\033[0;31m'
|
||||||
green='\033[0;32m'
|
green='\033[0;32m'
|
||||||
@ -124,15 +124,16 @@ before_show_menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_base() {
|
install_base() {
|
||||||
(command -v git >/dev/null 2>&1 && command -v curl >/dev/null 2>&1 && command -v wget >/dev/null 2>&1 && command -v unzip >/dev/null 2>&1) ||
|
(command -v git >/dev/null 2>&1 && command -v curl >/dev/null 2>&1 && command -v wget >/dev/null 2>&1 && command -v unzip >/dev/null 2>&1 && command -v getenforce >/dev/null 2>&1) ||
|
||||||
(install_soft curl wget git unzip)
|
(install_soft curl wget git unzip)
|
||||||
}
|
}
|
||||||
|
|
||||||
install_soft() {
|
install_soft() {
|
||||||
(command -v yum >/dev/null 2>&1 && yum install $* -y) ||
|
# Arch官方库不包含selinux等组件
|
||||||
(command -v apt >/dev/null 2>&1 && apt install $* -y) ||
|
(command -v yum >/dev/null 2>&1 && yum install $* selinux-policy -y) ||
|
||||||
|
(command -v apt >/dev/null 2>&1 && apt install $* selinux-utils -y) ||
|
||||||
(command -v pacman >/dev/null 2>&1 && pacman -Syu $*) ||
|
(command -v pacman >/dev/null 2>&1 && pacman -Syu $*) ||
|
||||||
(command -v apt-get >/dev/null 2>&1 && apt-get install $* -y)
|
(command -v apt-get >/dev/null 2>&1 && apt-get install $* selinux-utils -y)
|
||||||
}
|
}
|
||||||
|
|
||||||
install_dashboard() {
|
install_dashboard() {
|
||||||
@ -195,8 +196,20 @@ install_dashboard() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selinux(){
|
||||||
|
#判断当前的状态
|
||||||
|
getenforce | grep enfor
|
||||||
|
if [ $? -eq 0 ];then
|
||||||
|
echo -e "SELinux是开启状态,正在关闭!"
|
||||||
|
setenforce 0 &>/dev/null
|
||||||
|
find_key="SELINUX="
|
||||||
|
sed -ri "/^$find_key/c${find_key}disabled" /etc/selinux/config
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
install_agent() {
|
install_agent() {
|
||||||
install_base
|
install_base
|
||||||
|
selinux
|
||||||
|
|
||||||
echo -e "> 安装监控Agent"
|
echo -e "> 安装监控Agent"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ NZ_BASE_PATH="/opt/nezha"
|
|||||||
NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
|
NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
|
||||||
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
|
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
|
||||||
NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service"
|
NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service"
|
||||||
NZ_VERSION="v0.10.0"
|
NZ_VERSION="v0.10.1"
|
||||||
|
|
||||||
red='\033[0;31m'
|
red='\033[0;31m'
|
||||||
green='\033[0;32m'
|
green='\033[0;32m'
|
||||||
@ -94,15 +94,16 @@ before_show_menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
install_base() {
|
install_base() {
|
||||||
(command -v git >/dev/null 2>&1 && command -v curl >/dev/null 2>&1 && command -v wget >/dev/null 2>&1 && command -v unzip >/dev/null 2>&1) ||
|
(command -v git >/dev/null 2>&1 && command -v curl >/dev/null 2>&1 && command -v wget >/dev/null 2>&1 && command -v unzip >/dev/null 2>&1 && command -v getenforce >/dev/null 2>&1) ||
|
||||||
(install_soft curl wget git unzip)
|
(install_soft curl wget git unzip)
|
||||||
}
|
}
|
||||||
|
|
||||||
install_soft() {
|
install_soft() {
|
||||||
(command -v yum >/dev/null 2>&1 && yum install $* -y) ||
|
# The official Arch library does not contain selinux components
|
||||||
(command -v apt >/dev/null 2>&1 && apt install $* -y) ||
|
(command -v yum >/dev/null 2>&1 && yum install $* selinux-policy -y) ||
|
||||||
|
(command -v apt >/dev/null 2>&1 && apt install $* selinux-utils -y) ||
|
||||||
(command -v pacman >/dev/null 2>&1 && pacman -Syu $*) ||
|
(command -v pacman >/dev/null 2>&1 && pacman -Syu $*) ||
|
||||||
(command -v apt-get >/dev/null 2>&1 && apt-get install $* -y)
|
(command -v apt-get >/dev/null 2>&1 && apt-get install $* selinux-utils -y)
|
||||||
}
|
}
|
||||||
|
|
||||||
install_dashboard() {
|
install_dashboard() {
|
||||||
@ -164,8 +165,20 @@ install_dashboard() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selinux(){
|
||||||
|
#Check SELinux
|
||||||
|
getenforce | grep enfor
|
||||||
|
if [ $? -eq 0 ];then
|
||||||
|
echo -e "SELinux running,closing now!"
|
||||||
|
setenforce 0 &>/dev/null
|
||||||
|
find_key="SELINUX="
|
||||||
|
sed -ri "/^$find_key/c${find_key}disabled" /etc/selinux/config
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
install_agent() {
|
install_agent() {
|
||||||
install_base
|
install_base
|
||||||
|
selinux
|
||||||
|
|
||||||
echo -e "> Install Nezha Agent"
|
echo -e "> Install Nezha Agent"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user