mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-11-17 03:18:24 +01:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c65116b723 | ||
|
|
29f0401109 | ||
|
|
9041c124c7 | ||
|
|
82488a2dfb | ||
|
|
b1abf0a68e | ||
|
|
d469b15f9b |
No files matched your search
@@ -586,10 +586,16 @@ Exercise vigilance regarding copycat or coat-tailing sites that seek to exploit
|
||||
|
||||
## 2026-11-16
|
||||
|
||||
### 🆕 New Scripts
|
||||
|
||||
- Gitea Runner ([#18782](https://github.com/community-scripts/ProxmoxVE/pull/18782))
|
||||
- NetAlertX ([#18781](https://github.com/community-scripts/ProxmoxVE/pull/18781))
|
||||
|
||||
### 🚀 Updated Scripts
|
||||
|
||||
- #### 🐞 Bug Fixes
|
||||
|
||||
- Dawarich: let Rails serve undigested asset paths [@ryanvo](https://github.com/ryanvo) ([#18779](https://github.com/community-scripts/ProxmoxVE/pull/18779))
|
||||
- ArchiveBox: install libatomic1 for the Playwright driver [@MickLesk](https://github.com/MickLesk) ([#18722](https://github.com/community-scripts/ProxmoxVE/pull/18722))
|
||||
- Ollama/OpenWebUI: download update before stopping the service [@jobben-2025](https://github.com/jobben-2025) ([#18755](https://github.com/community-scripts/ProxmoxVE/pull/18755))
|
||||
- opengym: bump Node.js from 22 to 26 [@github-actions[bot]](https://github.com/github-actions[bot]) ([#18756](https://github.com/community-scripts/ProxmoxVE/pull/18756))
|
||||
|
||||
@@ -40,6 +40,13 @@ function update_script() {
|
||||
msg_ok "Fixed MapLibre delivery in Nginx"
|
||||
fi
|
||||
|
||||
if [[ -f /etc/nginx/sites-available/dawarich.conf ]] && grep -q 'try_files \$uri =404;' /etc/nginx/sites-available/dawarich.conf; then
|
||||
msg_info "Fixing Dawarich asset fallback in Nginx"
|
||||
sed -i 's|try_files \$uri =404;|try_files $uri @rails;|' /etc/nginx/sites-available/dawarich.conf
|
||||
nginx_enable_site dawarich.conf
|
||||
msg_ok "Fixed Dawarich asset fallback in Nginx"
|
||||
fi
|
||||
|
||||
if check_for_gh_release "dawarich" "Freika/dawarich"; then
|
||||
msg_info "Stopping Services"
|
||||
systemctl stop dawarich-web dawarich-worker
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
#!/usr/bin/env bash
|
||||
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
||||
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: community-scripts
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://gitea.com/gitea/runner
|
||||
|
||||
APP="Gitea-Runner"
|
||||
var_tags="${var_tags:-ci;git}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_arm64="${var_arm64:-yes}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
# Needed for container-based workflow execution (Docker/Podman inside LXC)
|
||||
var_nesting="${var_nesting:-1}"
|
||||
var_keyctl="${var_keyctl:-1}"
|
||||
|
||||
if [[ -z "${var_os:-}" ]] && command -v pveversion >/dev/null 2>&1; then
|
||||
var_os=$(msg_menu "Choose the container OS" \
|
||||
"debian" "Debian 13" \
|
||||
"alpine" "Alpine 3.24 (smaller)")
|
||||
fi
|
||||
|
||||
var_os="${var_os:-debian}"
|
||||
if [[ "${var_os:-}" == "alpine" ]]; then
|
||||
var_ram="${var_ram:-1024}"
|
||||
var_disk="${var_disk:-4}"
|
||||
var_version="${var_version:-3.24}"
|
||||
else
|
||||
var_ram="${var_ram:-2048}"
|
||||
var_disk="${var_disk:-8}"
|
||||
var_version="${var_version:-13}"
|
||||
fi
|
||||
|
||||
export var_gitea_url="${var_gitea_url:-}"
|
||||
export var_gitea_token="${var_gitea_token:-}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
update_deb_based() {
|
||||
if [[ ! -f /usr/local/bin/gitea-runner ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ensure_dependencies git
|
||||
|
||||
RELEASE=$(curl -fsSL https://gitea.com/api/v1/repos/gitea/runner/releases/latest | jq -r .tag_name | sed 's/^v//')
|
||||
if [[ "${RELEASE}" == "$(cat ~/.gitea-runner 2>/dev/null)" ]]; then
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||
exit
|
||||
fi
|
||||
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop gitea-runner
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
msg_info "Updating ${APP} to v${RELEASE}"
|
||||
$STD curl -fsSL -o /usr/local/bin/gitea-runner "https://gitea.com/gitea/runner/releases/download/v${RELEASE}/gitea-runner-${RELEASE}-linux-$(arch_resolve)"
|
||||
chmod +x /usr/local/bin/gitea-runner
|
||||
ln -sf /usr/local/bin/gitea-runner /usr/local/bin/act_runner
|
||||
echo "${RELEASE}" >~/.gitea-runner
|
||||
msg_ok "Updated ${APP} to v${RELEASE}"
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start gitea-runner
|
||||
msg_ok "Started Service"
|
||||
msg_ok "Updated successfully!"
|
||||
}
|
||||
|
||||
update_alpine() {
|
||||
if [[ ! -f /usr/local/bin/gitea-runner ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
msg_info "Updating Alpine Packages"
|
||||
$STD apk -U upgrade
|
||||
$STD apk add --no-cache git
|
||||
msg_ok "Updated Alpine Packages"
|
||||
|
||||
RELEASE=$(curl -fsSL https://gitea.com/api/v1/repos/gitea/runner/releases/latest | jq -r .tag_name | sed 's/^v//')
|
||||
if [[ "${RELEASE}" == "$(cat ~/.gitea-runner 2>/dev/null)" ]]; then
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||
exit
|
||||
fi
|
||||
|
||||
msg_info "Stopping Service"
|
||||
$STD rc-service gitea-runner stop
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
msg_info "Updating ${APP} to v${RELEASE}"
|
||||
$STD curl -fsSL -o /usr/local/bin/gitea-runner "https://gitea.com/gitea/runner/releases/download/v${RELEASE}/gitea-runner-${RELEASE}-linux-$(arch_resolve)"
|
||||
chmod +x /usr/local/bin/gitea-runner
|
||||
ln -sf /usr/local/bin/gitea-runner /usr/local/bin/act_runner
|
||||
echo "${RELEASE}" >~/.gitea-runner
|
||||
msg_ok "Updated ${APP} to v${RELEASE}"
|
||||
|
||||
msg_info "Starting Service"
|
||||
$STD rc-service gitea-runner start
|
||||
msg_ok "Started Service"
|
||||
msg_ok "Updated successfully!"
|
||||
}
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
run_os_update
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW}To register the runner, execute the following command in the container console:${CL}"
|
||||
if [[ -n "${var_gitea_url:-}" ]]; then
|
||||
echo -e "${TAB}${BGN}gitea-runner -c /etc/gitea-runner/config.yaml register --instance ${var_gitea_url} --token <REGISTRATION_TOKEN>${CL}"
|
||||
else
|
||||
echo -e "${TAB}${BGN}gitea-runner -c /etc/gitea-runner/config.yaml register --instance <GITEA_INSTANCE_URL> --token <REGISTRATION_TOKEN>${CL}"
|
||||
fi
|
||||
echo -e "${INFO}${YW}After registering, start the runner daemon:${CL}"
|
||||
if [[ "${var_os:-}" == "alpine" ]]; then
|
||||
echo -e "${TAB}${BGN}rc-service gitea-runner start${CL}"
|
||||
else
|
||||
echo -e "${TAB}${BGN}systemctl start gitea-runner${CL}"
|
||||
fi
|
||||
echo -e "${INFO}${YW}Official registration documentation:${CL}"
|
||||
echo -e "${GATEWAY}${BGN}https://docs.gitea.com/runner/registration/${CL}"
|
||||
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env bash
|
||||
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
||||
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/netalertx/NetAlertX
|
||||
|
||||
APP="NetAlertX"
|
||||
var_tags="${var_tags:-network;monitoring}"
|
||||
var_cpu="${var_cpu:-1}"
|
||||
var_ram="${var_ram:-1024}"
|
||||
var_disk="${var_disk:-4}"
|
||||
var_os="${var_os:-debian}"
|
||||
var_version="${var_version:-13}"
|
||||
var_arm64="${var_arm64:-yes}"
|
||||
var_unprivileged="${var_unprivileged:-1}"
|
||||
|
||||
header_info "$APP"
|
||||
variables
|
||||
color
|
||||
catch_errors
|
||||
|
||||
function update_script() {
|
||||
header_info
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -d /opt/netalertx ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if check_for_gh_release "netalertx" "netalertx/NetAlertX"; then
|
||||
msg_info "Stopping NetAlertX"
|
||||
systemctl stop netalertx
|
||||
msg_ok "Stopped NetAlertX"
|
||||
|
||||
CLEAN_INSTALL=1 CLEAN_INSTALL_KEEP=".venv" fetch_and_deploy_gh_release "netalertx" "netalertx/NetAlertX" "tarball"
|
||||
|
||||
msg_info "Updating NetAlertX"
|
||||
cd /opt/netalertx
|
||||
$STD uv pip install --python .venv/bin/python -r requirements.txt
|
||||
ln -sfn /opt/netalertx/install/production-filesystem/services /opt/netalertx/services
|
||||
echo "v$(cat ~/.netalertx)" >/opt/netalertx/.VERSION
|
||||
date +%s >/opt/netalertx/front/buildtimestamp.txt
|
||||
msg_ok "Updated NetAlertX"
|
||||
|
||||
msg_info "Starting NetAlertX"
|
||||
systemctl start netalertx
|
||||
msg_ok "Started NetAlertX"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
start
|
||||
build_container
|
||||
description
|
||||
|
||||
msg_ok "Completed Successfully!\n"
|
||||
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
|
||||
echo -e "${GATEWAY}${BGN}http://${IP}:20211${CL}"
|
||||
echo -e "${INFO}${YW}The login password is in /opt/netalertx_data/.env${CL}"
|
||||
@@ -159,7 +159,7 @@ server {
|
||||
location ~ ^/(assets|packs)/ {
|
||||
expires max;
|
||||
add_header Cache-Control "public, immutable";
|
||||
try_files \$uri =404;
|
||||
try_files \$uri @rails;
|
||||
}
|
||||
|
||||
location / {
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: community-scripts
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://gitea.com/gitea/runner
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
setup_deb_based() {
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y git
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
setup_docker
|
||||
|
||||
msg_info "Installing Gitea Runner"
|
||||
RELEASE=$(curl -fsSL https://gitea.com/api/v1/repos/gitea/runner/releases/latest | jq -r .tag_name | sed 's/^v//')
|
||||
$STD curl -fsSL -o /usr/local/bin/gitea-runner "https://gitea.com/gitea/runner/releases/download/v${RELEASE}/gitea-runner-${RELEASE}-linux-$(arch_resolve)"
|
||||
chmod +x /usr/local/bin/gitea-runner
|
||||
ln -sf /usr/local/bin/gitea-runner /usr/local/bin/act_runner
|
||||
echo "${RELEASE}" >~/.gitea-runner
|
||||
msg_ok "Installed Gitea Runner v${RELEASE}"
|
||||
|
||||
msg_info "Configuring Gitea Runner"
|
||||
mkdir -p /etc/gitea-runner /var/lib/gitea-runner
|
||||
/usr/local/bin/gitea-runner config generate >/etc/gitea-runner/config.yaml
|
||||
sed -i 's|.*file:.*\.runner.*| file: /var/lib/gitea-runner/.runner|' /etc/gitea-runner/config.yaml
|
||||
msg_ok "Configured Gitea Runner"
|
||||
|
||||
if [[ -n "${var_gitea_url:-}" ]] && [[ -n "${var_gitea_token:-}" ]]; then
|
||||
msg_info "Registering Gitea Runner"
|
||||
$STD /usr/local/bin/gitea-runner register --no-interactive --config /etc/gitea-runner/config.yaml --instance "${var_gitea_url}" --token "${var_gitea_token}" --name "$(hostname)"
|
||||
msg_ok "Registered Gitea Runner"
|
||||
fi
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/gitea-runner.service
|
||||
[Unit]
|
||||
Description=Gitea Actions Runner
|
||||
Documentation=https://docs.gitea.com/runner/
|
||||
After=network-online.target docker.service
|
||||
Wants=network-online.target docker.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/gitea-runner daemon --config /etc/gitea-runner/config.yaml
|
||||
WorkingDirectory=/var/lib/gitea-runner
|
||||
Environment=HOME=/var/lib/gitea-runner
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
TimeoutStopSec=3h
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q gitea-runner
|
||||
if [[ -s /var/lib/gitea-runner/.runner ]]; then
|
||||
systemctl start gitea-runner
|
||||
fi
|
||||
msg_ok "Created Service"
|
||||
}
|
||||
|
||||
setup_alpine() {
|
||||
msg_info "Installing Docker"
|
||||
$STD apk add --no-cache docker docker-cli-compose git
|
||||
$STD rc-update add docker default
|
||||
$STD rc-service docker start
|
||||
msg_ok "Installed Docker"
|
||||
|
||||
msg_info "Installing Gitea Runner"
|
||||
RELEASE=$(curl -fsSL https://gitea.com/api/v1/repos/gitea/runner/releases/latest | jq -r .tag_name | sed 's/^v//')
|
||||
$STD curl -fsSL -o /usr/local/bin/gitea-runner "https://gitea.com/gitea/runner/releases/download/v${RELEASE}/gitea-runner-${RELEASE}-linux-$(arch_resolve)"
|
||||
chmod +x /usr/local/bin/gitea-runner
|
||||
ln -sf /usr/local/bin/gitea-runner /usr/local/bin/act_runner
|
||||
echo "${RELEASE}" >~/.gitea-runner
|
||||
msg_ok "Installed Gitea Runner v${RELEASE}"
|
||||
|
||||
msg_info "Configuring Gitea Runner"
|
||||
mkdir -p /etc/gitea-runner /var/lib/gitea-runner
|
||||
/usr/local/bin/gitea-runner config generate >/etc/gitea-runner/config.yaml
|
||||
sed -i 's|.*file:.*\.runner.*| file: /var/lib/gitea-runner/.runner|' /etc/gitea-runner/config.yaml
|
||||
msg_ok "Configured Gitea Runner"
|
||||
|
||||
if [[ -n "${var_gitea_url:-}" ]] && [[ -n "${var_gitea_token:-}" ]]; then
|
||||
msg_info "Registering Gitea Runner"
|
||||
$STD /usr/local/bin/gitea-runner register --no-interactive --config /etc/gitea-runner/config.yaml --instance "${var_gitea_url}" --token "${var_gitea_token}" --name "$(hostname)"
|
||||
msg_ok "Registered Gitea Runner"
|
||||
fi
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<'EOF' >/etc/init.d/gitea-runner
|
||||
#!/sbin/openrc-run
|
||||
name="gitea-runner"
|
||||
description="Gitea Actions Runner"
|
||||
|
||||
export HOME="/var/lib/gitea-runner"
|
||||
command="/usr/local/bin/gitea-runner"
|
||||
command_args="daemon --config /etc/gitea-runner/config.yaml"
|
||||
directory="/var/lib/gitea-runner"
|
||||
command_background="yes"
|
||||
pidfile="/run/gitea-runner.pid"
|
||||
output_log="/var/log/gitea-runner.log"
|
||||
error_log="/var/log/gitea-runner.log"
|
||||
|
||||
depend() {
|
||||
need net docker
|
||||
after firewall
|
||||
}
|
||||
EOF
|
||||
chmod +x /etc/init.d/gitea-runner
|
||||
$STD rc-update add gitea-runner default
|
||||
if [[ -s /var/lib/gitea-runner/.runner ]]; then
|
||||
$STD rc-service gitea-runner start
|
||||
fi
|
||||
msg_ok "Created Service"
|
||||
}
|
||||
|
||||
run_os_setup
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
@@ -0,0 +1,183 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright (c) 2021-2026 community-scripts ORG
|
||||
# Author: MickLesk (CanbiZ)
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||
# Source: https://github.com/netalertx/NetAlertX
|
||||
|
||||
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||
color
|
||||
verb_ip6
|
||||
catch_errors
|
||||
setting_up_container
|
||||
network_check
|
||||
update_os
|
||||
|
||||
msg_info "Installing Dependencies"
|
||||
$STD apt install -y \
|
||||
nginx \
|
||||
sqlite3 \
|
||||
arp-scan \
|
||||
nmap \
|
||||
fping \
|
||||
nbtscan \
|
||||
traceroute \
|
||||
mtr-tiny \
|
||||
iw \
|
||||
snmp \
|
||||
dnsutils \
|
||||
net-tools \
|
||||
avahi-utils \
|
||||
libwww-perl \
|
||||
usbutils \
|
||||
psmisc \
|
||||
wget \
|
||||
zip \
|
||||
cron
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
PHP_VERSION="8.4" PHP_FPM="YES" PHP_MODULE="curl,sqlite3" setup_php
|
||||
export UV_PYTHON_INSTALL_DIR="/opt/uv-python"
|
||||
PYTHON_VERSION="3.13" setup_uv
|
||||
fetch_and_deploy_gh_release "netalertx" "netalertx/NetAlertX" "tarball"
|
||||
|
||||
msg_info "Setting up NetAlertX"
|
||||
cd /opt/netalertx
|
||||
$STD uv venv --python 3.13 .venv
|
||||
$STD uv pip install --python .venv/bin/python -r requirements.txt
|
||||
ln -sfn /opt/netalertx/install/production-filesystem/services /opt/netalertx/services
|
||||
ln -sfn /opt/netalertx /app
|
||||
echo "v$(cat ~/.netalertx)" >/opt/netalertx/.VERSION
|
||||
date +%s >/opt/netalertx/front/buildtimestamp.txt
|
||||
mkdir -p /opt/netalertx_data/{config,db,log/plugins,api,tmp}
|
||||
touch /opt/netalertx_data/log/{app.log,execution_queue.log,app_front.log,app.php_errors.log,stderr.log,db_is_locked.log}
|
||||
install -m 600 /opt/netalertx/back/app.conf /opt/netalertx_data/config/app.conf
|
||||
cp /opt/netalertx/back/app.db /opt/netalertx_data/db/app.db
|
||||
NETALERTX_PASSWORD=$(random_password)
|
||||
sed -i "s|^TIMEZONE=.*|TIMEZONE='$(timedatectl show -p Timezone --value 2>/dev/null || echo Etc/UTC)'|" /opt/netalertx_data/config/app.conf
|
||||
cat <<EOF >>/opt/netalertx_data/config/app.conf
|
||||
ARPSCAN_ARGS='arp-scan --ignoredups --retry=6'
|
||||
NMAPDEV_ARGS='nmap --privileged -sn -PR -oX - '
|
||||
SETPWD_enable_password=True
|
||||
SETPWD_password='$(echo -n "$NETALERTX_PASSWORD" | sha256sum | awk '{print $1}')'
|
||||
EOF
|
||||
cat <<EOF >/opt/netalertx_data/.env
|
||||
NETALERTX_PASSWORD=${NETALERTX_PASSWORD}
|
||||
NETALERTX_APP=/opt/netalertx
|
||||
NETALERTX_DATA=/opt/netalertx_data
|
||||
NETALERTX_CONFIG=/opt/netalertx_data/config
|
||||
NETALERTX_DB=/opt/netalertx_data/db
|
||||
NETALERTX_API=/opt/netalertx_data/api
|
||||
NETALERTX_LOG=/opt/netalertx_data/log
|
||||
NETALERTX_TMP=/opt/netalertx_data/tmp
|
||||
SYSTEM_SERVICES_RUN_TMP=/opt/netalertx_data/tmp
|
||||
VENDORSPATH_NEWEST=/opt/netalertx_data/tmp/ieee-oui.txt
|
||||
LOG_EXECUTION_QUEUE=/opt/netalertx_data/log/execution_queue.log
|
||||
PYTHONPATH=/opt/netalertx:/opt/netalertx/server:/opt/netalertx/server/plugins
|
||||
PATH=/opt/netalertx/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
PYTHONUNBUFFERED=1
|
||||
NMAP_PRIVILEGED=1
|
||||
EOF
|
||||
chmod 600 /opt/netalertx_data/.env
|
||||
chown -R www-data:www-data /opt/netalertx_data
|
||||
msg_ok "Set up NetAlertX"
|
||||
|
||||
msg_info "Configuring PHP-FPM and Nginx"
|
||||
cat <<EOF >/etc/php/8.4/fpm/pool.d/netalertx.conf
|
||||
[netalertx]
|
||||
user = www-data
|
||||
group = www-data
|
||||
listen = /run/php/netalertx.sock
|
||||
listen.owner = www-data
|
||||
listen.group = www-data
|
||||
pm = dynamic
|
||||
pm.max_children = 10
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 3
|
||||
env[NETALERTX_CONFIG] = /opt/netalertx_data/config
|
||||
env[NETALERTX_DB] = /opt/netalertx_data/db
|
||||
env[NETALERTX_API] = /opt/netalertx_data/api
|
||||
env[NETALERTX_LOG] = /opt/netalertx_data/log
|
||||
php_admin_value[memory_limit] = 256M
|
||||
EOF
|
||||
systemctl restart php8.4-fpm
|
||||
cat <<'EOF' >/etc/nginx/sites-available/netalertx
|
||||
map "$http_referer|$http_host" $sec_legacy {
|
||||
"~^https?://(?<ref_host>[^/:]+)(?::\d+)?/.*\|\k<ref_host>(?::\d+)?$" "TRUSTED";
|
||||
default "UNTRUSTED";
|
||||
}
|
||||
map $http_sec_fetch_site $is_trusted {
|
||||
"same-origin" "TRUSTED";
|
||||
"" $sec_legacy;
|
||||
default "UNTRUSTED";
|
||||
}
|
||||
server {
|
||||
listen 20211 default_server;
|
||||
large_client_header_buffers 4 16k;
|
||||
root /opt/netalertx/front;
|
||||
index index.php;
|
||||
add_header X-Forwarded-Prefix "/app" always;
|
||||
|
||||
location /server/ {
|
||||
error_page 403 /403_internal.html;
|
||||
if ($is_trusted != "TRUSTED") {
|
||||
return 403;
|
||||
}
|
||||
rewrite ^/server/(.*)$ /$1 break;
|
||||
proxy_pass http://127.0.0.1:20212;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
client_max_body_size 50m;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location ~* \.php$ {
|
||||
add_header Cache-Control "no-store";
|
||||
fastcgi_pass unix:/run/php/netalertx.sock;
|
||||
include fastcgi_params;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||
fastcgi_read_timeout 600;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
nginx_enable_site "netalertx"
|
||||
msg_ok "Configured PHP-FPM and Nginx"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/netalertx.service
|
||||
[Unit]
|
||||
Description=NetAlertX Backend
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=www-data
|
||||
Group=www-data
|
||||
WorkingDirectory=/opt/netalertx
|
||||
EnvironmentFile=/opt/netalertx_data/.env
|
||||
AmbientCapabilities=CAP_NET_RAW CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
||||
ExecStart=/opt/netalertx/.venv/bin/python3 -m server
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
cat <<EOF >/etc/cron.d/netalertx
|
||||
* * * * * www-data LOG_EXECUTION_QUEUE=/opt/netalertx_data/log/execution_queue.log /opt/netalertx/services/scripts/cron_script.sh >/dev/null 2>&1
|
||||
EOF
|
||||
systemctl enable -q --now netalertx
|
||||
msg_ok "Created Service"
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
cleanup_lxc
|
||||
Reference in new issue
Block a user