From 577db1da473bc02e9fad58a0abd3d652356706b4 Mon Sep 17 00:00:00 2001 From: PTah Date: Tue, 16 Jun 2026 11:37:52 +1000 Subject: [PATCH 1/4] chore(docs): sync repository URLs for kalinamall mirror --- README.md | 6 +++--- docs/auto-update.ru.md | 4 ++-- readme_eng.md | 4 ++-- scripts/Rewrite-GitHostUrls.ps1 | 12 ++++++------ scripts/rewrite-git-host-urls.sh | 12 ++++++------ update_ssh_monitor.sh | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index c641186..ce52b6c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ssh-monitor +# ssh-monitor Bash-скрипт мониторинга **SSH**, **SUDO** и событий **`systemd-logind`** (локальные/графические сессии и др.) с уведомлениями в **Telegram** и по **электронной почте (SMTP)**, опциональным резервным webhook, авто-блокировкой IP (**ipset** + **iptables** / **ip6tables**: наборы `hash:ip` с таймаутом, одно правило `-m set`; нюансы — **`IPSET-NOTES.txt`**) и ежедневным отчётом. @@ -14,7 +14,7 @@ Bash-скрипт мониторинга **SSH**, **SUDO** и событий **` ## Конфигурация -> **Закрытый инстанс Gitea:** в доверенном закрытом репозитории допустимо хранить **`ssh-monitor.conf`** с боевыми токенами (файл не в `.gitignore`). В публичном [GitHub](https://github.com/PTah/ssh-monitor) такой файл игнорируется — используйте только `ssh-monitor.conf.example`. +> **Закрытый инстанс Gitea:** в доверенном закрытом репозитории допустимо хранить **`ssh-monitor.conf`** с боевыми токенами (файл не в `.gitignore`). В публичном [GitHub](https://git.kalinamall.ru/PapaTramp/ssh-monitor) такой файл игнорируется — используйте только `ssh-monitor.conf.example`. Скрипт читает параметры из `/etc/ssh-monitor.conf` в формате `KEY="value"`. @@ -163,7 +163,7 @@ bash -n ./ssh-monitor make dist ``` -Появится файл `ssh-monitor-<версия>.tar.gz` (через `git archive`). Готовые архивы для установки без клона репозитория прикладываются к [релизам на GitHub](https://github.com/PTah/ssh-monitor/releases). +Появится файл `ssh-monitor-<версия>.tar.gz` (через `git archive`). Готовые архивы для установки без клона репозитория прикладываются к [релизам на GitHub](https://git.kalinamall.ru/PapaTramp/ssh-monitor/releases). ## Установка скрипта, конфигурации и systemd diff --git a/docs/auto-update.ru.md b/docs/auto-update.ru.md index 28c852f..79376e2 100644 --- a/docs/auto-update.ru.md +++ b/docs/auto-update.ru.md @@ -41,7 +41,7 @@ flowchart LR | Переменная | По умолчанию | Назначение | |------------|--------------|------------| | `UPDATE_DIR` | `/opt/scripts/update` | Каталог для git-клона | -| `REPO_URL` | `https://github.com/PTah/ssh-monitor.git` | URL репозитория (на закрытом зеркале — URL своего Gitea) | +| `REPO_URL` | `https://git.kalinamall.ru/PapaTramp/ssh-monitor.git` | URL репозитория (на закрытом зеркале — URL своего Gitea) | | `LOCAL_SCRIPT_PATH` | `/usr/local/bin/ssh-monitor` | Куда копировать бинарник | | `LOG_FILE` | `/var/log/update_script.log` | Лог обновлений | | `DEBUG` | `0` | `1` — подробный DEBUG в лог | @@ -169,4 +169,4 @@ sudo /opt/scripts/update_ssh_monitor.sh - Обновляется **только** файл **`ssh-monitor`**, не конфиг и не watchdog. - При недоступном git **`git pull`** пишет предупреждение и продолжает с локальной копией. -- На **закрытом зеркале** в `update_ssh_monitor.sh` задайте **`REPO_URL`** своего Gitea; в публичном GitHub по умолчанию — `github.com/PTah/ssh-monitor`. +- На **закрытом зеркале** в `update_ssh_monitor.sh` задайте **`REPO_URL`** своего Gitea; в публичном GitHub по умолчанию — `git.kalinamall.ru/PapaTramp/ssh-monitor`. diff --git a/readme_eng.md b/readme_eng.md index 219ea6e..b1968c5 100644 --- a/readme_eng.md +++ b/readme_eng.md @@ -1,4 +1,4 @@ -# ssh-monitor +# ssh-monitor Bash script that monitors **SSH**, **SUDO**, and **`systemd-logind`** events (local/graphical sessions, etc.), sends alerts via **Telegram** and **SMTP email**, optional backup webhook, automatic IP blocking (**ipset** + **iptables** / **ip6tables**: `hash:ip` sets with timeout, single `-m set` rule; details in **`IPSET-NOTES.txt`**), and a daily report. @@ -160,7 +160,7 @@ Version is set as **`SSH_MONITOR_VERSION`** in **`ssh-monitor`** and **`version. make dist ``` -Produces `ssh-monitor-.tar.gz` (via `git archive`). Prebuilt archives are attached to [GitHub releases](https://github.com/PTah/ssh-monitor/releases). +Produces `ssh-monitor-.tar.gz` (via `git archive`). Prebuilt archives are attached to [GitHub releases](https://git.kalinamall.ru/PapaTramp/ssh-monitor/releases). ## Installing the script, config, and systemd diff --git a/scripts/Rewrite-GitHostUrls.ps1 b/scripts/Rewrite-GitHostUrls.ps1 index 87a40f5..bbd8952 100644 --- a/scripts/Rewrite-GitHostUrls.ps1 +++ b/scripts/Rewrite-GitHostUrls.ps1 @@ -28,15 +28,15 @@ switch ($Target) { $BaseHost = $Base -replace '^https://', '' $patterns = @( - @{ From = 'https://github.com/PTah/([^)/''"\s]+)/blob/main/'; To = "$Base/`$1$BlobSuffix/" } + @{ From = 'https://git.kalinamall.ru/PapaTramp/([^)/''"\s]+)/blob/main/'; To = "$Base/`$1$BlobSuffix/" } + @{ From = 'https://git.kalinamall.ru/PapaTramp/([^)/''"\s]+)/src/branch/main/'; To = "$Base/`$1$BlobSuffix/" } @{ From = 'https://git.kalinamall.ru/PapaTramp/([^)/''"\s]+)/src/branch/main/'; To = "$Base/`$1$BlobSuffix/" } - @{ From = 'https://git.papatramp.ru/PTah/([^)/''"\s]+)/src/branch/main/'; To = "$Base/`$1$BlobSuffix/" } - @{ From = 'https://github.com/PTah/'; To = "$Base/" } @{ From = 'https://git.kalinamall.ru/PapaTramp/'; To = "$Base/" } - @{ From = 'https://git.papatramp.ru/PTah/'; To = "$Base/" } - @{ From = 'github.com/PTah/'; To = "$BaseHost/" } + @{ From = 'https://git.kalinamall.ru/PapaTramp/'; To = "$Base/" } + @{ From = 'https://git.kalinamall.ru/PapaTramp/'; To = "$Base/" } + @{ From = 'git.kalinamall.ru/PapaTramp/'; To = "$BaseHost/" } + @{ From = 'git.kalinamall.ru/PapaTramp/'; To = "$BaseHost/" } @{ From = 'git.kalinamall.ru/PapaTramp/'; To = "$BaseHost/" } - @{ From = 'git.papatramp.ru/PTah/'; To = "$BaseHost/" } ) $extensions = @('*.md', '*.json', '*.service', '*.example', '*.sh', '*.ps1', '*.yml', '*.yaml') diff --git a/scripts/rewrite-git-host-urls.sh b/scripts/rewrite-git-host-urls.sh index 38c4dfe..a0b76a0 100644 --- a/scripts/rewrite-git-host-urls.sh +++ b/scripts/rewrite-git-host-urls.sh @@ -28,15 +28,15 @@ esac # Order matters: longer patterns first. PATTERNS=( - 's|https://github.com/PTah/\([^)/"'"'"' ]*\)/blob/main/|'"${BASE}"'/\1'"${BLOB_SUFFIX}"'/|g' + 's|https://git.kalinamall.ru/PapaTramp/\([^)/"'"'"' ]*\)/blob/main/|'"${BASE}"'/\1'"${BLOB_SUFFIX}"'/|g' + 's|https://git.kalinamall.ru/PapaTramp/\([^)/"'"'"' ]*\)/src/branch/main/|'"${BASE}"'/\1'"${BLOB_SUFFIX}"'/|g' 's|https://git.kalinamall.ru/PapaTramp/\([^)/"'"'"' ]*\)/src/branch/main/|'"${BASE}"'/\1'"${BLOB_SUFFIX}"'/|g' - 's|https://git.papatramp.ru/PTah/\([^)/"'"'"' ]*\)/src/branch/main/|'"${BASE}"'/\1'"${BLOB_SUFFIX}"'/|g' - 's|https://github.com/PTah/|'"${BASE}"'/|g' 's|https://git.kalinamall.ru/PapaTramp/|'"${BASE}"'/|g' - 's|https://git.papatramp.ru/PTah/|'"${BASE}"'/|g' - 's|github.com/PTah/|'"${BASE#https://}"'/|g' + 's|https://git.kalinamall.ru/PapaTramp/|'"${BASE}"'/|g' + 's|https://git.kalinamall.ru/PapaTramp/|'"${BASE}"'/|g' + 's|git.kalinamall.ru/PapaTramp/|'"${BASE#https://}"'/|g' + 's|git.kalinamall.ru/PapaTramp/|'"${BASE#https://}"'/|g' 's|git.kalinamall.ru/PapaTramp/|'"${BASE#https://}"'/|g' - 's|git.papatramp.ru/PTah/|'"${BASE#https://}"'/|g' ) FILES=() diff --git a/update_ssh_monitor.sh b/update_ssh_monitor.sh index 4b4faee..d82ef8a 100755 --- a/update_ssh_monitor.sh +++ b/update_ssh_monitor.sh @@ -3,7 +3,7 @@ # === Конфигурация скрипта === UPDATE_DIR="/opt/scripts/update" SCRIPT_NAME="ssh-monitor" -REPO_URL="https://github.com/PTah/ssh-monitor.git" +REPO_URL="https://git.kalinamall.ru/PapaTramp/ssh-monitor.git" LOCAL_SCRIPT_PATH="/usr/local/bin/ssh-monitor" LOG_FILE="/var/log/update_script.log" From 9b454c32707df88b14ef010f65d41c7acd94b803 Mon Sep 17 00:00:00 2001 From: PTah Date: Fri, 19 Jun 2026 23:42:12 +1000 Subject: [PATCH 2/4] chore: bump version to 2.1.0-SAC --- README.md | 2 +- readme_eng.md | 2 +- ssh-monitor | 2 +- version.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ce52b6c..8a3444d 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ bash -n ./ssh-monitor ## Релизный архив -Версия задаётся в **`SSH_MONITOR_VERSION`** в файле **`ssh-monitor`** и дублируется в **`version.txt`** (сейчас **2.0.0-SAC**). Модуль **`sac-client.sh`** использует ту же версию для SAC `product_version`. Сборка tarball из текущего git-дерева: +Версия задаётся в **`SSH_MONITOR_VERSION`** в файле **`ssh-monitor`** и дублируется в **`version.txt`** (сейчас **2.1.0-SAC**). Модуль **`sac-client.sh`** использует ту же версию для SAC `product_version`. Сборка tarball из текущего git-дерева: ```bash make dist diff --git a/readme_eng.md b/readme_eng.md index b1968c5..b65832a 100644 --- a/readme_eng.md +++ b/readme_eng.md @@ -154,7 +154,7 @@ bash -n ./ssh-monitor ## Release tarball -Version is set as **`SSH_MONITOR_VERSION`** in **`ssh-monitor`** and **`version.txt`** (currently **2.0.0-SAC**). **`sac-client.sh`** reports the same version to SAC. Build from the git tree: +Version is set as **`SSH_MONITOR_VERSION`** in **`ssh-monitor`** and **`version.txt`** (currently **2.1.0-SAC**). **`sac-client.sh`** reports the same version to SAC. Build from the git tree: ```bash make dist diff --git a/ssh-monitor b/ssh-monitor index 6f35814..07d229c 100644 --- a/ssh-monitor +++ b/ssh-monitor @@ -7,7 +7,7 @@ IFS=$'\n\t' # ============================================ CONFIG_FILE="/etc/ssh-monitor.conf" -SSH_MONITOR_VERSION="2.0.6-SAC" +SSH_MONITOR_VERSION="2.1.0-SAC" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" if [ -f "$SCRIPT_DIR/sac-client.sh" ]; then diff --git a/version.txt b/version.txt index 7f313be..68bb1b9 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.0.6-SAC +2.1.0-SAC From bffc7f32456182d0447e38989c340368b4d7a45b Mon Sep 17 00:00:00 2001 From: PTah Date: Sat, 20 Jun 2026 19:02:59 +1000 Subject: [PATCH 3/4] docs: concise README with SAC integration and version 2.1.0-SAC --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8a3444d..61403c6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # ssh-monitor -Bash-скрипт мониторинга **SSH**, **SUDO** и событий **`systemd-logind`** (локальные/графические сессии и др.) с уведомлениями в **Telegram** и по **электронной почте (SMTP)**, опциональным резервным webhook, авто-блокировкой IP (**ipset** + **iptables** / **ip6tables**: наборы `hash:ip` с таймаутом, одно правило `-m set`; нюансы — **`IPSET-NOTES.txt`**) и ежедневным отчётом. +**Версия:** `2.1.0-SAC` + +Bash-мониторинг **SSH**, **sudo**, **systemd-logind**: Telegram/email, бан IP (ipset), ежедневный отчёт, heartbeat. + +**Security Alert Center:** модуль **`sac-client.sh`**, режим `UseSAC` (`off` | `exclusive` | `dual` | `fallback`) — [контракт SAC](https://git.kalinamall.ru/PapaTramp/security-alert-center/src/branch/main/docs/agent-integration.md). Обновление с хоста: `update_ssh_monitor.sh` или кнопка в SAC (SSH bootstrap). ## Состав репозитория From 76fc865d225cc1b2fadc6809fb3c59e8fc4b3b9a Mon Sep 17 00:00:00 2001 From: PTah Date: Sat, 20 Jun 2026 19:07:52 +1000 Subject: [PATCH 4/4] chore: add .cursorignore to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f70c3a2..8f3231a 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ ssh-monitor-*.tar.gz # Локальный загрузчик Rutube / yt-dlp — живёт в другом репозитории rutube-download.py .ytdl-archive.txt +.cursorignore