chore(docs): GitHub URLs in README/docs, remove .cursor from repo
Replace git.kalinamall.ru links with github.com/PTah in public docs. Add Rewrite-GitHostUrls.ps1 and Push-Mirror.ps1 for kalinamall mirror pushes. Add .cursor/ to .gitignore. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
---
|
||||
description: Global token-saving, cost control, and context management rules
|
||||
globs: *
|
||||
---
|
||||
|
||||
# Global Optimization & Cost Control
|
||||
|
||||
## ?? Answers
|
||||
-Always answer briefly and only to the point, otherwise only if it is stated in the question or when it is not possible to answer briefly.
|
||||
|
||||
## ?? Context & Local Data
|
||||
- **Strict file targeting:** Work ONLY with files explicitly provided via `@` or open in the active editor tab. Do not use global codebase search unless requested.
|
||||
- **Local assets only:** Always work with local copies of repositories and dependencies. Never request external web resources or re-download packages without a explicit build error.
|
||||
- **Size Limit:** Do not load files larger than 500 lines into the context unless strictly necessary.
|
||||
|
||||
## ?? Git & Commits Management
|
||||
- **Automatic commits are strictly FORBIDDEN.** Never execute `git commit` or `git push` without an explicit user command.
|
||||
- Only suggest a commit after phrases like: "Ñäåëàé êîììèò", "Çàôèêñèðóé èçìåíåíèÿ", "Push".
|
||||
- Before committing: display `git diff --stat` and wait for explicit user confirmation.
|
||||
- Use Conventional Commits format (`feat:`, `fix:`, `refactor:`, `docs:`).
|
||||
|
||||
## ?? Output Format & Brevity
|
||||
- **Strictly no fluff:** Omit greetings, apologies, and closing pleasantries.
|
||||
- **Diff-style only:** Output only modified code fragments, never duplicate unchanged logic or whole files.
|
||||
- **Extreme brevity:** Explanations must be 1-3 sentences max. Use documentation links instead of long texts.
|
||||
- If a task doesn't require code, respond strictly with text. If in doubt, ask ONE precise clarifying question.
|
||||
|
||||
## ?? Model Routing Reminder
|
||||
- Simple questions, explanations, docs ? Use lightweight models (e.g., `gpt-4o-mini`, `claude-3-haiku`).
|
||||
- Complex code generation, refactoring, and debugging ? Use advanced models (e.g., `claude-3.5-sonnet`).
|
||||
- Do not switch models without an explicit reason.
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
---
|
||||
description: При правках агентских скриптов (RDP/SSH) всегда bump версии — иначе ПК не обновятся
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Версии агентов: обязательный bump
|
||||
|
||||
Workspace **security-monitors** (RDP + SSH + SAC). Любая **существенная правка агентских скриптов** без bump версии **не доедет до компьютеров**.
|
||||
|
||||
## RDP-login-monitor
|
||||
|
||||
| Файл | Поле |
|
||||
|------|------|
|
||||
| `Login_Monitor.ps1` | `$ScriptVersion` |
|
||||
| `version.txt` | та же строка |
|
||||
|
||||
Триггер деплоя на Windows: **`Deploy-LoginMonitor.ps1`** сравнивает `version.txt` на шаре с `C:\ProgramData\RDP-login-monitor\deployed_version.txt`.
|
||||
|
||||
## ssh-monitor
|
||||
|
||||
| Файл | Поле |
|
||||
|------|------|
|
||||
| `ssh-monitor` | `SSH_MONITOR_VERSION` |
|
||||
| `version.txt` | та же строка |
|
||||
|
||||
Обновление на Linux: **`update_ssh_monitor.sh`** (sha256 + перезапуск сервиса).
|
||||
|
||||
## Правило для агента
|
||||
|
||||
При изменении `Login_Monitor.ps1`, `Deploy-LoginMonitor.ps1`, `Sac-Client.ps1`, `ssh-monitor`, `sac-client.sh`, `update_ssh_monitor.sh`:
|
||||
|
||||
1. Поднять **patch** версии (`2.0.6-SAC` → `2.0.7-SAC`) в **обоих** местах репозитория
|
||||
2. Включить bump в **тот же коммит**, что и правку (или сразу следом `chore: bump release to …`)
|
||||
3. Напомнить: опубликовать RDP на NETLOGON / на SSH-хостах выполнить update
|
||||
|
||||
## SAC (backend)
|
||||
|
||||
Версия UI/API — **`backend/app/version.py`** и **`frontend/src/version.ts`** (`APP_VERSION`, должны совпадать). Bump при релизе SAC на сервер; на автообновление **агентов на ПК** не влияет.
|
||||
@@ -1,30 +0,0 @@
|
||||
---
|
||||
description: Запрет упоминаний Cursor IDE/Agent в git-репозиториях (файлы и коммиты)
|
||||
alwaysApply: true
|
||||
---
|
||||
|
||||
# Не оставлять следов Cursor в репозиториях
|
||||
|
||||
В **коммитах и файлах**, которые попадают в git (включая публичный GitHub), **запрещено** добавлять что-либо, связанное с Cursor как инструментом разработки.
|
||||
|
||||
## Запрещено
|
||||
|
||||
- Упоминания **Cursor**, **Cursor IDE**, **Cursor Agent**, **cursoragent**, **cursor.com**, **cursor.sh** в README, docs, комментариях, конфигах.
|
||||
- Trailers в сообщениях коммитов: `Co-authored-by: Cursor …`, `Made-with: Cursor`, email `cursoragent@cursor.com`.
|
||||
- Каталог **`.cursor/`**, файлы только для IDE (**`AGENTS.md`**, **`CURSOR.md`**) — **не коммитить** в публичные репозитории (должны быть в `.gitignore`, если репо public).
|
||||
- Ссылки на Cursor в runbook, deploy-доках, issue templates.
|
||||
|
||||
## Разрешено (не путать с IDE)
|
||||
|
||||
- CSS: **`cursor: pointer`** (и аналоги).
|
||||
- Предметный код: **poll cursor**, **CurrentCursor**, **Update-MonitorPollCursor**, **Console.CursorLeft**, **DB cursor** (sqlite/psycopg2), **MOEX `analytics.cursor`** и т.п.
|
||||
|
||||
## Git / GitHub
|
||||
|
||||
- **Author и committer** — только владелец проекта (**Andrey Lutsenko**, email, привязанный к GitHub), **без** co-author Cursor.
|
||||
- Перед push в public remote: нет `cursoragent`, `Co-authored-by: Cursor` в истории и дереве (`git log --format=fuller`, поиск по репо).
|
||||
|
||||
## При работе агента
|
||||
|
||||
- Не добавлять «Powered by Cursor», бейджи, секции про Cursor в документацию продукта.
|
||||
- Правила Cursor (`.cursor/rules/`) — локально или только в **приватном** remote; в публичный GitHub не попадают.
|
||||
@@ -1,18 +0,0 @@
|
||||
---
|
||||
description: High-density PowerShell script generation rules for minimal token usage
|
||||
globs: "*.ps1, *.psm1"
|
||||
---
|
||||
|
||||
# PowerShell Token Optimization
|
||||
|
||||
- **Use Short Aliases:** Use short aliases instead of full cmdlet names to drastically cut output tokens:
|
||||
- Use `gc` instead of `Get-Content`
|
||||
- Use `gci` instead of `Get-ChildItem`
|
||||
- Use `%` instead of `ForEach-Object`
|
||||
- Use `?` instead of `Where-Object`
|
||||
- Use `measure` instead of `Measure-Object`
|
||||
- **Pipeline Over Loops:** Prefer pipeline chains (`gci | % { ... }`) over multi-line `foreach ($item in $items) { ... }` blocks.
|
||||
- **No Help/Comments:** Do not generate `.SYNOPSIS`, `.DESCRIPTION`, or comment-based help at the top of scripts.
|
||||
- **Omit Parameter Names:** Drop explicit parameter names where positional arguments are clear (e.g., use `gc file.txt` instead of `Get-Content -Path file.txt`).
|
||||
- **Silent Execution:** Do not add verbose logging, `Write-Host`, or `Write-Output` unless explicitly asked to create UI/logs.
|
||||
- **Preserve CLI Arguments:** Do not duplicate full multi-line `yt-dlp` command-line arguments, format strings, or output templates if they are not the subject of the modifications. Use placeholders or variable references.
|
||||
@@ -1,14 +0,0 @@
|
||||
---
|
||||
description: Ultra-dense Python code generation rules to save output tokens
|
||||
globs: "*.py"
|
||||
---
|
||||
|
||||
# Python Token Optimization
|
||||
|
||||
- **Use Syntactic Sugar:** Prioritize list comprehensions, dict comprehensions, and ternary operators (`x if condition else y`) to keep code on a single line.
|
||||
- **Built-in Libraries First:** Use standard libraries (`pathlib`, `json`, `subprocess`, `asyncio`) instead of introducing heavy external dependencies unless already in `requirements.txt`.
|
||||
- **Type Hinting:** Do NOT add type hints (`def func(x: int) -> str:`) unless the existing file strictly uses them. Type hints consume significant tokens.
|
||||
- **No Format Duplication:** When modifying scripts (like video downloaders), provide only the modified function or class method. Never output the `if __name__ == "__main__":` block or argument parsing logic if they haven't changed.
|
||||
- **No Docstrings:** Strictly forbid writing `"""docstrings"""` or `# comments` explaining the logic.
|
||||
- **Preserve yt-dlp Options:** Never rewrite, duplicate, or expand the `ydl_opts` configuration dictionary or custom extraction options. If changes are unrelated to download options, use a placeholder comment like `# ... existing ydl_opts ...` instead of outputting the full dictionary block.
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
---
|
||||
description: При правке скриптов RDP-монитора обязательно поднимать version.txt и $ScriptVersion
|
||||
globs: Login_Monitor.ps1,Deploy-LoginMonitor.ps1,Sac-Client.ps1,Exchange-MailSecurity.ps1,Watchdog_RDP_Monitor.ps1,version.txt
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Bump версии RDP-login-monitor
|
||||
|
||||
Без новой версии **`Deploy-LoginMonitor.ps1` на ПК не подхватит обновление** (сравнение `version.txt` на шаре с `deployed_version.txt`).
|
||||
|
||||
## Что менять в одном коммите с правкой
|
||||
|
||||
1. **`Login_Monitor.ps1`** — `$ScriptVersion` (например `2.0.7-SAC`)
|
||||
2. **`version.txt`** — **та же строка**, одна строка без лишнего текста
|
||||
|
||||
Строки должны **совпадать** (включая суффикс `-SAC`).
|
||||
|
||||
## Как поднимать
|
||||
|
||||
- Обычная правка монитора / deploy / SAC-клиента → **patch**: `2.0.6-SAC` → `2.0.7-SAC`
|
||||
- Крупный релиз → по смыслу **minor** (`2.0.x` → `2.1.0-SAC`)
|
||||
|
||||
## Другие скрипты с собственной версией
|
||||
|
||||
- **`Exchange-MailSecurity.ps1`** — отдельный `$ScriptVersion`; bump только если меняли этот пакет
|
||||
- После bump опубликовать на шару NETLOGON (`update-rdp-monitor.ps1` / pull на сервере публикации)
|
||||
|
||||
## Чеклист перед push
|
||||
|
||||
- [ ] `$ScriptVersion` и `version.txt` совпадают
|
||||
- [ ] Версия на шаре будет **новее** локальной `deployed_version.txt` на клиентах
|
||||
@@ -1,28 +0,0 @@
|
||||
---
|
||||
description: При правке ssh-monitor обязательно поднимать version.txt и SSH_MONITOR_VERSION
|
||||
globs: ssh-monitor,sac-client.sh,update_ssh_monitor.sh,version.txt
|
||||
alwaysApply: false
|
||||
---
|
||||
|
||||
# Bump версии ssh-monitor
|
||||
|
||||
Без bump **`update_ssh_monitor.sh` не скопирует новый скрипт** на хост (сравнение sha256; версия нужна для отчётов, SAC и диагностики).
|
||||
|
||||
## Что менять в одном коммите с правкой
|
||||
|
||||
1. **`ssh-monitor`** — `SSH_MONITOR_VERSION="X.Y.Z-SAC"` (первая строка блока версии)
|
||||
2. **`version.txt`** — **та же строка**
|
||||
|
||||
Строки должны **совпадать**.
|
||||
|
||||
## Как поднимать
|
||||
|
||||
- Обычная правка → **patch**: `2.0.0-SAC` → `2.0.1-SAC`
|
||||
- Крупный релиз → **minor** по смыслу
|
||||
|
||||
`sac-client.sh` отдельный номер **не** задаёт — берёт `SSH_MONITOR_VERSION` из установленного `ssh-monitor`.
|
||||
|
||||
## Чеклист перед push
|
||||
|
||||
- [ ] `SSH_MONITOR_VERSION` и `version.txt` совпадают
|
||||
- [ ] На хостах: `git pull` и запуск `update_ssh_monitor.sh` (или `--deploy`)
|
||||
@@ -21,6 +21,7 @@ dist/
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
*.code-workspace
|
||||
.cursor/
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
|
||||
| Репозиторий | Назначение |
|
||||
|-------------|------------|
|
||||
| [ssh-monitor](https://git.kalinamall.ru/PapaTramp/ssh-monitor) | Linux: SSH, sudo, logind, брутфорс, баны IP |
|
||||
| [RDP-login-monitor](https://git.kalinamall.ru/PapaTramp/RDP-login-monitor) | Windows: RDP/RDS, RD Gateway, WinRM, admin share C$/ADMIN$ |
|
||||
| [ssh-monitor](https://github.com/PTah/ssh-monitor) | Linux: SSH, sudo, logind, брутфорс, баны IP |
|
||||
| [RDP-login-monitor](https://github.com/PTah/RDP-login-monitor) | Windows: RDP/RDS, RD Gateway, WinRM, admin share C$/ADMIN$ |
|
||||
| **security-alert-center** (этот репозиторий) | Ubuntu 24.04: API, БД, UI, оповещения |
|
||||
| [seaca](https://git.kalinamall.ru/PapaTramp/seaca) | Android: мобильный клиент SAC, push (FCM) |
|
||||
| [seaca](https://github.com/PTah/seaca) | Android: мобильный клиент SAC, push (FCM) |
|
||||
|
||||
## Статус
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
|
||||
События приходят от агентов по [контракту ingest](docs/agent-integration.md) (`type`, `severity`, `details`):
|
||||
|
||||
- **Linux — [ssh-monitor](https://git.kalinamall.ru/PapaTramp/ssh-monitor):** SSH (успех/неудача), **sudo**, **systemd-logind**, брутфорс и баны IP (ipset), пороги без бана, ежедневный отчёт, heartbeat.
|
||||
- **Windows — [RDP-login-monitor](https://git.kalinamall.ru/PapaTramp/RDP-login-monitor):**
|
||||
- **Linux — [ssh-monitor](https://github.com/PTah/ssh-monitor):** SSH (успех/неудача), **sudo**, **systemd-logind**, брутфорс и баны IP (ipset), пороги без бана, ежедневный отчёт, heartbeat.
|
||||
- **Windows — [RDP-login-monitor](https://github.com/PTah/RDP-login-monitor):**
|
||||
- **RDP/RDS** (4624/4625);
|
||||
- **RD Gateway** (302/303), **WinRM / PowerShell Remoting** (Enter-PSSession, ID 91);
|
||||
- **админ-шары `C$` / `ADMIN$`** (Security **5140**, `smb.admin_share.access`);
|
||||
@@ -65,7 +65,7 @@
|
||||
## Быстрый старт (native)
|
||||
|
||||
```bash
|
||||
git clone https://git.kalinamall.ru/PapaTramp/security-alert-center.git /opt/security-alert-center
|
||||
git clone https://github.com/PTah/security-alert-center.git /opt/security-alert-center
|
||||
# deploy/env.native.example -> config/sac-api.env
|
||||
cd /opt/security-alert-center/backend
|
||||
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ Self-hosted hub for collecting, storing, and displaying security events from Lin
|
||||
|
||||
## Status
|
||||
|
||||
**Version:** `0.8.3`
|
||||
**Version:** `0.9.0`
|
||||
**Stack:** FastAPI, PostgreSQL, Vue 3, JWT, SSE
|
||||
**Deploy:** `sudo /opt/sac-deploy.sh` (see `deploy/sac-deploy.sh`)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[Unit]
|
||||
Description=Security Alert Center API (FastAPI)
|
||||
Documentation=https://git.kalinamall.ru/PapaTramp/security-alert-center
|
||||
Documentation=https://github.com/PTah/security-alert-center
|
||||
After=network-online.target postgresql.service
|
||||
Wants=network-online.target
|
||||
Requires=postgresql.service
|
||||
|
||||
@@ -74,7 +74,7 @@ UI **Настройки** (`/settings`) — правило + параметры
|
||||
|
||||
### 1.4. Версии и доставка обновлений
|
||||
|
||||
При **любом** изменении агента, влияющем на SAC или поведение на хосте, поднимайте версию и пушьте в **git.kalinamall.ru**:
|
||||
При **любом** изменении агента, влияющем на SAC или поведение на хосте, поднимайте версию и пушьте в **GitHub** (`github.com/PTah`); для зеркала kalinamall — `.\scripts\Push-Mirror.ps1 kalinamall`:
|
||||
|
||||
| Агент | Маркер версии | Как хост узнаёт о новой версии |
|
||||
|-------|---------------|--------------------------------|
|
||||
|
||||
+1
-1
@@ -115,7 +115,7 @@ sudo /opt/sac-deploy.sh
|
||||
|
||||
Установка скрипта (один раз): `sudo cp /opt/security-alert-center/deploy/sac-deploy.sh /opt/sac-deploy.sh && sudo chmod 755 /opt/sac-deploy.sh`
|
||||
|
||||
После **force-push** на git.kalinamall.ru обычный `git pull` на сервере падает с «diverging branches». Скрипт `sac-deploy.sh` (актуальная версия) делает `fetch` и при необходимости `reset --hard` к upstream. **Один раз вручную**, если на сервере ещё старый скрипт:
|
||||
После **force-push** на upstream remote обычный `git pull` на сервере падает с «diverging branches». Скрипт `sac-deploy.sh` (актуальная версия) делает `fetch` и при необходимости `reset --hard` к upstream. **Один раз вручную**, если на сервере ещё старый скрипт:
|
||||
|
||||
```bash
|
||||
sudo -u sac git -C /opt/security-alert-center fetch --prune
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.kalinamall.ru/PapaTramp/security-alert-center/schemas/event-v1.json",
|
||||
"$id": "https://github.com/PTah/security-alert-center/schemas/event-v1.json",
|
||||
"title": "Security Alert Center Event v1",
|
||||
"description": "Каноническое событие от ssh-monitor или RDP-login-monitor",
|
||||
"type": "object",
|
||||
|
||||
@@ -24,7 +24,7 @@ Docker удобен для локальной отладки или изолир
|
||||
|
||||
```bash
|
||||
sudo apt install -y git
|
||||
sudo git clone https://git.kalinamall.ru/PapaTramp/security-alert-center.git /opt/security-alert-center
|
||||
sudo git clone https://github.com/PTah/security-alert-center.git /opt/security-alert-center
|
||||
sudo chown -R "$USER:$USER" /opt/security-alert-center
|
||||
```
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ nginx -v
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /opt
|
||||
sudo git clone https://git.kalinamall.ru/PapaTramp/security-alert-center.git /opt/security-alert-center
|
||||
sudo git clone https://github.com/PTah/security-alert-center.git /opt/security-alert-center
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
```bash
|
||||
# см. полный чеклист в native-руководстве
|
||||
sudo apt update && sudo apt install -y git postgresql nginx python3.12 python3.12-venv
|
||||
sudo git clone https://git.kalinamall.ru/PapaTramp/security-alert-center.git /opt/security-alert-center
|
||||
sudo git clone https://github.com/PTah/security-alert-center.git /opt/security-alert-center
|
||||
# … PostgreSQL, venv, config/sac-api.env, systemd, nginx
|
||||
```
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ sudo /opt/sac-deploy.sh
|
||||
| Параметр | Значение |
|
||||
|----------|----------|
|
||||
| Хост | `ubabuba` / `10.10.36.9` |
|
||||
| Репозиторий | `git.kalinamall.ru/PapaTramp/ssh-monitor` (`main`, есть `sac-client.sh`) |
|
||||
| Репозиторий | `github.com/PTah/ssh-monitor` (`main`, есть `sac-client.sh`) |
|
||||
| `UseSAC` | пилот **exclusive** — см. [pilot-2.1-exclusive.md](pilot-2.1-exclusive.md) |
|
||||
| Сервис | `ssh-monitor.service` — **active** |
|
||||
| `--check-sac` | OK (health + ingest `agent.test` 202) |
|
||||
|
||||
+3
-3
@@ -66,7 +66,7 @@
|
||||
|
||||
**Цель:** нативный Android-клиент и push по тем же правилам оповещений, что Telegram/email/webhook.
|
||||
|
||||
Репозиторий клиента: [seaca](https://git.kalinamall.ru/PapaTramp/seaca) (Kotlin, Jetpack Compose, FCM).
|
||||
Репозиторий клиента: [seaca](https://github.com/PTah/seaca) (Kotlin, Jetpack Compose, FCM).
|
||||
|
||||
**Сервер SAC:**
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
|
||||
**Не в мобильном клиенте:** пользователи SAC, каналы Telegram/SMTP/webhook, админ-настройки.
|
||||
|
||||
Подробный план клиента — [seaca/docs/ROADMAP.md](https://git.kalinamall.ru/PapaTramp/seaca/src/branch/main/docs/ROADMAP.md).
|
||||
Подробный план клиента — [seaca/docs/ROADMAP.md](https://github.com/PTah/seaca/blob/main/docs/ROADMAP.md).
|
||||
|
||||
---
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
| v0.1 | — (не требуется) | — |
|
||||
| v0.2 | TBD (тег с UseSAC) | TBD |
|
||||
| v0.3+ | совместимость schema 1.0 | совместимость schema 1.0 |
|
||||
| v0.6 | — | — (мобильный клиент [seaca](https://git.kalinamall.ru/PapaTramp/seaca), не агент) |
|
||||
| v0.6 | — | — (мобильный клиент [seaca](https://github.com/PTah/seaca), не агент) |
|
||||
|
||||
При breaking change схемы — `schema_version: 1.1` с поддержкой 1.0 на ingest.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Seaca — мобильный клиент SAC
|
||||
|
||||
Репозиторий приложения: [seaca](https://git.kalinamall.ru/PapaTramp/seaca).
|
||||
Репозиторий приложения: [seaca](https://github.com/PTah/seaca).
|
||||
Требуется SAC **≥ 0.9.0** с применённой миграцией `014`.
|
||||
|
||||
---
|
||||
@@ -84,7 +84,7 @@ SAC_FCM_SERVICE_ACCOUNT_JSON=/etc/security-alert-center/fcm-service-account.json
|
||||
| `sac.kalinamall.ru` | Web UI | yes (`git-sac-allowed`) |
|
||||
| `sac-api.kalinamall.ru` | Seaca, `/api/v1/mobile/*` | no (enroll + JWT) |
|
||||
|
||||
Both resolve to the same SAC server (**192.168.160.145**). nginx must accept both names in `server_name`. See [reverse-proxy/docs/sac-access.md](https://git.kalinamall.ru/PapaTramp/reverse-proxy/src/branch/main/docs/sac-access.md).
|
||||
Both resolve to the same SAC server (**192.168.160.145**). nginx must accept both names in `server_name`. See [reverse-proxy/docs/sac-access.md](https://github.com/PTah/reverse-proxy/blob/main/docs/sac-access.md).
|
||||
|
||||
---
|
||||
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
| # | Задача | Статус |
|
||||
|---|--------|--------|
|
||||
| 0.1–0.3 | ТЗ, архитектура, схема, deployment | ✅ |
|
||||
| 0.5 | Репозиторий git.kalinamall.ru | ✅ |
|
||||
| 0.5 | Репозиторий GitHub + зеркало kalinamall | ✅ |
|
||||
| 0.6 | Multi-root workspace | ✅ |
|
||||
|
||||
---
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
|
||||
## 1. Расположение репозиториев (пример)
|
||||
|
||||
| Имя в workspace | Путь (пример Windows) | Remote |
|
||||
|-----------------|----------------------|--------|
|
||||
| `ssh-monitor` | `D:\Soft\Git\ssh-monitor` | git.kalinamall.ru |
|
||||
| `rdp-monitor` | `D:\Soft\Git\RDP-login-monitor` | git.kalinamall.ru |
|
||||
| `security-alert-center` | `D:\Soft\Git\security-alert-center` | git.kalinamall.ru |
|
||||
| Имя в workspace | Путь (пример Windows) | Публичный remote |
|
||||
|-----------------|----------------------|------------------|
|
||||
| `ssh-monitor` | `D:\Soft\Git\ssh-monitor` | github.com/PTah/ssh-monitor |
|
||||
| `rdp-monitor` | `D:\Soft\Git\RDP-login-monitor` | github.com/PTah/RDP-login-monitor |
|
||||
| `security-alert-center` | `D:\Soft\Git\security-alert-center` | github.com/PTah/security-alert-center |
|
||||
|
||||
Пути подставьте свои.
|
||||
Пути подставьте свои. Закрытый инстанс **git.kalinamall.ru** — зеркало с теми же репозиториями; ссылки в документации на каждом хосте должны вести **на этот же хост** (см. ниже).
|
||||
|
||||
---
|
||||
|
||||
@@ -23,18 +23,9 @@
|
||||
```json
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "D:/Soft/Git/ssh-monitor",
|
||||
"name": "ssh-monitor"
|
||||
},
|
||||
{
|
||||
"path": "D:/Soft/Git/RDP-login-monitor",
|
||||
"name": "rdp-monitor"
|
||||
},
|
||||
{
|
||||
"path": "D:/Soft/Git/security-alert-center",
|
||||
"name": "security-alert-center"
|
||||
}
|
||||
{ "path": "D:/Soft/Git/ssh-monitor", "name": "ssh-monitor" },
|
||||
{ "path": "D:/Soft/Git/RDP-login-monitor", "name": "rdp-monitor" },
|
||||
{ "path": "D:/Soft/Git/security-alert-center", "name": "security-alert-center" }
|
||||
],
|
||||
"settings": {
|
||||
"files.eol": "\n"
|
||||
@@ -58,50 +49,42 @@
|
||||
|
||||
## 4. Соглашения
|
||||
|
||||
- Контракт событий: `security-alert-center/docs/event-schema-v1.json` — **единственный источник истины**.
|
||||
- Контракт событий: `security-alert-center/schemas/event-schema-v1.json` — **единственный источник истины**.
|
||||
- Изменение схемы → обновить ТЗ + версию `schema_version` + оба агента.
|
||||
- Коммиты в три репо **раздельные**; связь через теги/версии в README (см. [roadmap.md](roadmap.md)).
|
||||
|
||||
### 4.1. Git: только git.kalinamall.ru
|
||||
### 4.1. Git: зеркала и ссылки в документации
|
||||
|
||||
**Единственный рабочий remote для commit/push — `kalinamall` (git.kalinamall.ru).**
|
||||
GitHub (`origin`) в этом workspace **не используем**: не push, не pull, не PR.
|
||||
В **main** ссылки между репозиториями указывают на **GitHub** (`https://github.com/PTah/...`).
|
||||
|
||||
После каждой завершённой фичи (или логического блока работы):
|
||||
Перед push на другой хост (kalinamall, papatramp) используйте скрипт зеркалирования — он подменяет URL в docs, пушит и **не оставляет** чужие ссылки в локальной ветке:
|
||||
|
||||
```powershell
|
||||
# security-alert-center (аналогичные скрипты — в соседних репо при необходимости)
|
||||
.\scripts\Rewrite-GitHostUrls.ps1 kalinamall # только проверка diff
|
||||
.\scripts\Push-Mirror.ps1 kalinamall # commit → push kalinamall → reset main
|
||||
.\scripts\Push-Mirror.ps1 github # push на GitHub после обычного commit
|
||||
```
|
||||
|
||||
Обычный цикл разработки:
|
||||
|
||||
```bash
|
||||
git add …
|
||||
git commit -m "…"
|
||||
git fetch kalinamall
|
||||
git push kalinamall main
|
||||
git push github main
|
||||
# при необходимости синхронизировать kalinamall:
|
||||
# PowerShell: .\scripts\Push-Mirror.ps1 kalinamall
|
||||
```
|
||||
|
||||
Upstream ветки `main`:
|
||||
|
||||
```bash
|
||||
git config branch.main.remote kalinamall
|
||||
git config branch.main.merge refs/heads/main
|
||||
git config remote.pushDefault kalinamall
|
||||
```
|
||||
|
||||
Если `git push --force-with-lease` пишет `stale info` — сначала `git fetch kalinamall`, затем push снова.
|
||||
|
||||
---
|
||||
|
||||
## 5. Remote kalinamall (первичная настройка)
|
||||
|
||||
```bash
|
||||
git remote add kalinamall https://git.kalinamall.ru/PapaTramp/<repo>.git
|
||||
git push -u kalinamall main
|
||||
```
|
||||
|
||||
Репозитории:
|
||||
## 5. URL репозиториев (GitHub)
|
||||
|
||||
| Проект | URL |
|
||||
|--------|-----|
|
||||
| security-alert-center | `https://git.kalinamall.ru/PapaTramp/security-alert-center.git` |
|
||||
| ssh-monitor | `https://git.kalinamall.ru/PapaTramp/ssh-monitor.git` |
|
||||
| RDP-login-monitor | `https://git.kalinamall.ru/PapaTramp/RDP-login-monitor.git` |
|
||||
| security-alert-center | `https://github.com/PTah/security-alert-center.git` |
|
||||
| ssh-monitor | `https://github.com/PTah/ssh-monitor.git` |
|
||||
| RDP-login-monitor | `https://github.com/PTah/RDP-login-monitor.git` |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://git.kalinamall.ru/PapaTramp/security-alert-center/schemas/event-v1.json",
|
||||
"$id": "https://github.com/PTah/security-alert-center/schemas/event-v1.json",
|
||||
"title": "Security Alert Center Event v1",
|
||||
"description": "Каноническое событие от ssh-monitor или RDP-login-monitor",
|
||||
"type": "object",
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Push main to a mirror remote with host-specific doc URLs, without leaving URL churn on main.
|
||||
# Usage: .\scripts\Push-Mirror.ps1 github|kalinamall|papatramp
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateSet('github', 'kalinamall', 'papatramp')]
|
||||
[string]$Target
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$Root = Split-Path -Parent $PSScriptRoot
|
||||
Set-Location $Root
|
||||
|
||||
$remote = switch ($Target) {
|
||||
'github' { 'github' }
|
||||
'kalinamall' { 'kalinamall' }
|
||||
'papatramp' { 'papatramp' }
|
||||
}
|
||||
|
||||
git remote get-url $remote 2>$null | Out-Null
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "remote not configured: $remote"
|
||||
}
|
||||
|
||||
if ((git status --porcelain)) {
|
||||
throw 'working tree not clean; commit or stash first'
|
||||
}
|
||||
|
||||
$before = (git rev-parse HEAD).Trim()
|
||||
& "$PSScriptRoot\Rewrite-GitHostUrls.ps1" -Target $Target
|
||||
|
||||
if (-not (git status --porcelain)) {
|
||||
Write-Output "no URL changes for $Target; pushing as-is"
|
||||
git push $remote main
|
||||
exit 0
|
||||
}
|
||||
|
||||
git add -A
|
||||
git commit -m "chore(docs): sync repository URLs for ${Target} mirror"
|
||||
git push $remote main
|
||||
git reset --hard $before
|
||||
Write-Output "pushed $remote with ${Target} URLs; local main reset to $before"
|
||||
@@ -0,0 +1,57 @@
|
||||
# Rewrite cross-repo URLs in tracked docs/config for the target Git host.
|
||||
# Usage: .\scripts\Rewrite-GitHostUrls.ps1 github|kalinamall|papatramp
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[ValidateSet('github', 'kalinamall', 'papatramp')]
|
||||
[string]$Target
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$Root = Split-Path -Parent $PSScriptRoot
|
||||
Set-Location $Root
|
||||
|
||||
switch ($Target) {
|
||||
'github' {
|
||||
$Base = 'https://github.com/PTah'
|
||||
$BlobSuffix = '/blob/main'
|
||||
}
|
||||
'kalinamall' {
|
||||
$Base = 'https://git.kalinamall.ru/PapaTramp'
|
||||
$BlobSuffix = '/src/branch/main'
|
||||
}
|
||||
'papatramp' {
|
||||
$Base = 'https://git.papatramp.ru/PTah'
|
||||
$BlobSuffix = '/src/branch/main'
|
||||
}
|
||||
}
|
||||
|
||||
$BaseHost = $Base -replace '^https://', ''
|
||||
|
||||
$patterns = @(
|
||||
@{ From = 'https://github.com/PTah/([^)/''"\s]+)/blob/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 = 'git.kalinamall.ru/PapaTramp/'; To = "$BaseHost/" }
|
||||
@{ From = 'git.papatramp.ru/PTah/'; To = "$BaseHost/" }
|
||||
)
|
||||
|
||||
$extensions = @('*.md', '*.json', '*.service', '*.example', '*.sh', '*.ps1', '*.yml', '*.yaml')
|
||||
$files = git ls-files $extensions 2>$null | Where-Object { $_ -and (Test-Path $_) }
|
||||
|
||||
foreach ($file in $files) {
|
||||
$content = [System.IO.File]::ReadAllText((Join-Path $Root $file))
|
||||
$updated = $content
|
||||
foreach ($p in $patterns) {
|
||||
$updated = [regex]::Replace($updated, $p.From, $p.To)
|
||||
}
|
||||
if ($updated -ne $content) {
|
||||
[System.IO.File]::WriteAllText((Join-Path $Root $file), $updated, [System.Text.UTF8Encoding]::new($false))
|
||||
Write-Output "updated: $file"
|
||||
}
|
||||
}
|
||||
|
||||
Write-Output "Rewrite-GitHostUrls: target=$Target base=$Base"
|
||||
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
# Push main to a mirror remote with host-specific doc URLs, without leaving URL churn on main.
|
||||
# Usage: push-mirror.sh github|kalinamall|papatramp
|
||||
set -euo pipefail
|
||||
|
||||
TARGET="${1:?usage: push-mirror.sh github|kalinamall|papatramp}"
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
case "$TARGET" in
|
||||
github) REMOTE=github ;;
|
||||
kalinamall) REMOTE=kalinamall ;;
|
||||
papatramp) REMOTE=papatramp ;;
|
||||
*)
|
||||
echo "unknown target: $TARGET" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! git remote get-url "$REMOTE" >/dev/null 2>&1; then
|
||||
echo "remote not configured: $REMOTE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! git diff --quiet || ! git diff --cached --quiet; then
|
||||
echo "working tree not clean; commit or stash first" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BEFORE="$(git rev-parse HEAD)"
|
||||
bash "$ROOT/scripts/rewrite-git-host-urls.sh" "$TARGET"
|
||||
|
||||
if git diff --quiet; then
|
||||
echo "no URL changes for $TARGET; pushing as-is"
|
||||
git push "$REMOTE" main
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git add -A
|
||||
git commit -m "chore(docs): sync repository URLs for ${TARGET} mirror"
|
||||
git push "$REMOTE" main
|
||||
git reset --hard "$BEFORE"
|
||||
echo "pushed $REMOTE with ${TARGET} URLs; local main reset to $BEFORE"
|
||||
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
# Rewrite cross-repo URLs in tracked docs/config for the target Git host.
|
||||
# Usage: rewrite-git-host-urls.sh github|kalinamall|papatramp
|
||||
set -euo pipefail
|
||||
|
||||
TARGET="${1:?usage: rewrite-git-host-urls.sh github|kalinamall|papatramp}"
|
||||
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$ROOT"
|
||||
|
||||
case "$TARGET" in
|
||||
github)
|
||||
BASE='https://github.com/PTah'
|
||||
BLOB_SUFFIX='/blob/main'
|
||||
;;
|
||||
kalinamall)
|
||||
BASE='https://git.kalinamall.ru/PapaTramp'
|
||||
BLOB_SUFFIX='/src/branch/main'
|
||||
;;
|
||||
papatramp)
|
||||
BASE='https://git.papatramp.ru/PTah'
|
||||
BLOB_SUFFIX='/src/branch/main'
|
||||
;;
|
||||
*)
|
||||
echo "unknown target: $TARGET" >&2
|
||||
exit 1
|
||||
;;
|
||||
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/\([^)/"'"'"' ]*\)/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|git.kalinamall.ru/PapaTramp/|'"${BASE#https://}"'/|g'
|
||||
's|git.papatramp.ru/PTah/|'"${BASE#https://}"'/|g'
|
||||
)
|
||||
|
||||
FILES=()
|
||||
while IFS= read -r -d '' f; do
|
||||
FILES+=("$f")
|
||||
done < <(git ls-files '*.md' '*.json' '*.service' '*.example' '*.sh' '*.ps1' '*.yml' '*.yaml' 2>/dev/null | tr '\n' '\0')
|
||||
|
||||
if [ "${#FILES[@]}" -eq 0 ]; then
|
||||
echo "no files to rewrite" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
for f in "${FILES[@]}"; do
|
||||
[ -f "$f" ] || continue
|
||||
tmp="$(mktemp)"
|
||||
cp "$f" "$tmp"
|
||||
for pat in "${PATTERNS[@]}"; do
|
||||
sed -i "$pat" "$tmp" 2>/dev/null || sed -i '' "$pat" "$tmp"
|
||||
done
|
||||
if ! cmp -s "$f" "$tmp"; then
|
||||
mv "$tmp" "$f"
|
||||
echo "updated: $f"
|
||||
else
|
||||
rm -f "$tmp"
|
||||
fi
|
||||
done
|
||||
|
||||
echo "rewrite-git-host-urls: target=$TARGET base=$BASE"
|
||||
Reference in New Issue
Block a user