sshcnfgr 0.1.0b1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sshcnfgr-0.1.0b1/.gitignore +40 -0
- sshcnfgr-0.1.0b1/CHANGELOG.md +30 -0
- sshcnfgr-0.1.0b1/LICENSE +21 -0
- sshcnfgr-0.1.0b1/PKG-INFO +205 -0
- sshcnfgr-0.1.0b1/README.md +163 -0
- sshcnfgr-0.1.0b1/SECURITY.md +28 -0
- sshcnfgr-0.1.0b1/pyproject.toml +77 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/__init__.py +5 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/cli.py +182 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/dedup.py +363 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/dedup_screen.py +466 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/generator.py +83 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/gui/__init__.py +29 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/gui/dedup_dialog.py +462 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/gui/main_window.py +1225 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/identities.py +95 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/importer.py +152 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/logging_conf.py +45 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/model.py +231 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/paths.py +37 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/settings.py +87 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/store.py +222 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/tui.py +471 -0
- sshcnfgr-0.1.0b1/src/sshcnfgr/tui.tcss +105 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Python bytecode and caches
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Virtual environments
|
|
7
|
+
.venv/
|
|
8
|
+
venv/
|
|
9
|
+
.env
|
|
10
|
+
.env.*
|
|
11
|
+
|
|
12
|
+
# Test and tooling caches
|
|
13
|
+
.pytest_cache/
|
|
14
|
+
.ruff_cache/
|
|
15
|
+
.mypy_cache/
|
|
16
|
+
.coverage
|
|
17
|
+
.coverage.*
|
|
18
|
+
htmlcov/
|
|
19
|
+
|
|
20
|
+
# Build artifacts
|
|
21
|
+
dist/
|
|
22
|
+
build/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.eggs/
|
|
25
|
+
|
|
26
|
+
# IDE/editor files
|
|
27
|
+
.vscode/
|
|
28
|
+
.idea/
|
|
29
|
+
*.swp
|
|
30
|
+
*.swo
|
|
31
|
+
|
|
32
|
+
# OS files
|
|
33
|
+
.DS_Store
|
|
34
|
+
Thumbs.db
|
|
35
|
+
|
|
36
|
+
# Local runtime and logs
|
|
37
|
+
*.log
|
|
38
|
+
|
|
39
|
+
# Optional local outputs (keep if you want them versioned)
|
|
40
|
+
# doc/*.generated
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (with PEP 440 pre-release tags).
|
|
7
|
+
|
|
8
|
+
## [0.1.0b1] - 2026-11-26
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Single-file TOML storage in `~/.ssh/sshcnfgr.toml`:** Works uniformly on Linux, macOS, and Windows right next to `~/.ssh/config`, with automatic `0600` permissions on POSIX and integrated `[ui]` theme settings. Seamless fallback/migration from legacy `~/.config/sshcnfgr/hosts.toml`.
|
|
12
|
+
- **Direct `uvx` launch:** Running `sshcnfgr` (or `uvx sshcnfgr`) without a subcommand launches the Textual TUI directly; added `--version` and optional `--log-file` CLI flags (no stray log files created by default).
|
|
13
|
+
- **Duplicate detection & interactive merge (`dedup.py`):** Groups active hosts sharing the same effective target `(HostName, Port, User)`, detects conflicting fields (including case-insensitive `extra_options`), merges non-conflicting fields/groups/tags, and lets users disable or delete discarded duplicates.
|
|
14
|
+
- **TUI duplicate review screen (`Ctrl+U`):** Interactive comparison table, conflict selectors, live preview, and transactional saving.
|
|
15
|
+
- **Optional Qt6 desktop GUI (`sshcnfgr gui`):** Installable via `sshcnfgr[qt]` (`PySide6-Essentials`), supporting Wayland, X11, macOS, and Windows with tabs for Hosts (search, filter, `extra_options` editor, file pickers), Groups, Identities, Config Preview, and an interactive Duplicate Review dialog.
|
|
16
|
+
- **Automatic timestamped backups:** Backups (`*.bak.YYYYMMDD-HHMMSS`) are created before overwriting `sshcnfgr.toml` or generated OpenSSH config files.
|
|
17
|
+
- **Automated test suite (`tests/`):** Unit tests for core logic, duplicate merging, Textual Pilot TUI flows, and headless Qt6 GUI tests.
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
- Upgraded Textual theme switching from legacy `App.dark` to Textual 6+/8.x `App.theme`.
|
|
21
|
+
- Importer now supports `Key=Value` syntax and terminates active host blocks at `Match` blocks instead of leaking directives.
|
|
22
|
+
- Generator now emits global `Include` directives before host blocks, keeps `Host *` defaults at the end, and writes generated files with `0600` permissions on POSIX.
|
|
23
|
+
- Case-insensitive resolution for `IdentityFile`, `IdentityAgent`, `User`, and `Port` in `global_options` / `extra_options`.
|
|
24
|
+
- TUI form now clears `port` properly when emptied, persists `Toggle Aktiv`, clears form fields on delete, and suppresses `stderr` logging during TUI execution.
|
|
25
|
+
- `identities scan` now preserves manually disabled (`enabled = false`) identity profiles.
|
|
26
|
+
|
|
27
|
+
## [0.1.0a1] - 2026-07-28
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- Initial Alpha MVP with Click CLI, Textual TUI, TOML persistence (`hosts.toml`), OpenSSH config import/generation, host groups, identity scanning from `~/.ssh`, and persistent theme toggle.
|
sshcnfgr-0.1.0b1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Thomas Baer
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sshcnfgr
|
|
3
|
+
Version: 0.1.0b1
|
|
4
|
+
Summary: TUI, optional Qt6 GUI, and CLI to manage OpenSSH host configs from a single TOML file
|
|
5
|
+
Project-URL: Homepage, https://github.com/thomsbe/SSHCnfgr
|
|
6
|
+
Project-URL: Repository, https://github.com/thomsbe/SSHCnfgr
|
|
7
|
+
Project-URL: Issues, https://github.com/thomsbe/SSHCnfgr/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/thomsbe/SSHCnfgr/blob/main/CHANGELOG.md
|
|
9
|
+
Author-email: Thomas Baer <thomas.baer@tbaer.de>
|
|
10
|
+
Maintainer-email: Thomas Baer <thomas.baer@tbaer.de>
|
|
11
|
+
License-Expression: MIT
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: cli,config,devops,openssh,pyside6,qt,ssh,textual,tui
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Environment :: X11 Applications :: Qt
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Intended Audience :: System Administrators
|
|
19
|
+
Classifier: Operating System :: MacOS
|
|
20
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
21
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
26
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
27
|
+
Classifier: Topic :: System :: Systems Administration
|
|
28
|
+
Classifier: Topic :: Utilities
|
|
29
|
+
Requires-Python: >=3.12
|
|
30
|
+
Requires-Dist: click>=8.1.7
|
|
31
|
+
Requires-Dist: loguru>=0.7.3
|
|
32
|
+
Requires-Dist: textual>=6.0.0
|
|
33
|
+
Requires-Dist: tomli-w>=1.0.0
|
|
34
|
+
Provides-Extra: dev
|
|
35
|
+
Requires-Dist: build>=1.2.2; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest>=8.3.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: ruff>=0.6.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: twine>=5.1.1; extra == 'dev'
|
|
39
|
+
Provides-Extra: qt
|
|
40
|
+
Requires-Dist: pyside6-essentials>=6.8.0; extra == 'qt'
|
|
41
|
+
Description-Content-Type: text/markdown
|
|
42
|
+
|
|
43
|
+
# SSHCnfgr
|
|
44
|
+
|
|
45
|
+
> **English speaker?** Jump to the [English Summary](#english-summary) at the bottom.
|
|
46
|
+
|
|
47
|
+
[](https://github.com/thomsbe/SSHCnfgr/blob/main/LICENSE)
|
|
48
|
+
[](https://www.python.org/)
|
|
49
|
+
[](https://pypi.org/project/sshcnfgr/)
|
|
50
|
+
|
|
51
|
+
**SSHCnfgr** verwaltet deine OpenSSH-Hosts, Gruppen und Identities über eine einzige, saubere TOML-Datei (`~/.ssh/sshcnfgr.toml`) — per **Textual-TUI**, optionaler **Qt6-Desktop-GUI** (Wayland/X11/macOS/Windows) oder **Click-CLI**.
|
|
52
|
+
|
|
53
|
+
## Highlights
|
|
54
|
+
|
|
55
|
+
- **Eine einzige Datei neben `~/.ssh/config`:** Alles liegt in `~/.ssh/sshcnfgr.toml` (auf Linux/macOS automatisch mit `0600`-Rechten, unter Windows in `%USERPROFILE%\.ssh\sshcnfgr.toml`) — ideal für den direkten Start per `uvx`.
|
|
56
|
+
- **TOML als Source of Truth:** Deaktivierte Hosts bleiben in der Datenbank erhalten, landen aber nicht in der generierten OpenSSH-Config (`~/.ssh/config.generated`, ebenfalls `0600`).
|
|
57
|
+
- **Dubletten finden & zusammenführen:** Erkennt Hosts mit gleichem Ziel (`HostName` + effektiver `Port` + effektiver `User`), zeigt Feld-Konflikte übersichtlich an und führt Einträge interaktiv zusammen (übrige Dubletten wahlweise deaktivieren oder löschen).
|
|
58
|
+
- **TUI, Qt6-GUI & CLI:** Im Terminal mit Textual, auf dem Desktop optional mit PySide6/Qt6 (Live-Suche, Gruppen-/Identity-Tabs, `extra_options`-Editor, Config-Vorschau) oder skriptbar über die CLI.
|
|
59
|
+
- **Sicherheitsnetz:** Keine Speicherung privater Schlüssel-Inhalte (nur Pfade & `.pub`-Metadaten), atomares Schreiben und automatische Zeitstempel-Backups (`*.bak.YYYYMMDD-HHMMSS`) vor jedem Überschreiben.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Schnellstart mit `uv` / `uvx`
|
|
64
|
+
|
|
65
|
+
> **Hinweis zur Beta-Version (`0.1.0b1`):** Da es sich um eine Vorabversion handelt, benötigt `uvx` / `uv tool install` aktuell das Flag `--prerelease=allow`. Ab dem regulären `0.1.0`-Release entfällt dieses Flag.
|
|
66
|
+
|
|
67
|
+
### Ohne Installation direkt ausführen (`uvx`)
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Textual-TUI direkt starten (legt ~/.ssh/sshcnfgr.toml bei Bedarf an)
|
|
71
|
+
uvx --prerelease=allow sshcnfgr
|
|
72
|
+
|
|
73
|
+
# Optionale Qt6 Desktop-GUI starten (Wayland / X11 / macOS / Windows)
|
|
74
|
+
uvx --prerelease=allow --from "sshcnfgr[qt]" sshcnfgr gui
|
|
75
|
+
|
|
76
|
+
# Bestehende ~/.ssh/config importieren
|
|
77
|
+
uvx --prerelease=allow sshcnfgr import --source ~/.ssh/config
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Dauerhaft als CLI-Tool installieren (`uv tool install`)
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Terminal-Version (TUI + CLI)
|
|
84
|
+
uv tool install --prerelease=allow sshcnfgr
|
|
85
|
+
|
|
86
|
+
# Inklusive Qt6 Desktop-GUI
|
|
87
|
+
uv tool install --prerelease=allow "sshcnfgr[qt]"
|
|
88
|
+
|
|
89
|
+
# Danach direkt nutzbar:
|
|
90
|
+
sshcnfgr # startet die TUI
|
|
91
|
+
sshcnfgr gui # startet die Qt6-GUI
|
|
92
|
+
sshcnfgr --help # zeigt alle Kommandos
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
*(Falls `uv` noch nicht installiert ist: `curl -LsSf https://astral.sh/uv/install.sh | sh` auf Linux/macOS bzw. `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"` unter Windows.)*
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Typischer Ablauf
|
|
100
|
+
|
|
101
|
+
1. **Vorhandene SSH-Config importieren** (deine `~/.ssh/config` wird nur gelesen):
|
|
102
|
+
```bash
|
|
103
|
+
sshcnfgr import --source ~/.ssh/config
|
|
104
|
+
```
|
|
105
|
+
2. **Lokale SSH-Keys erfassen** (nur Pfade & `.pub`-Vorschau, keine Private Keys):
|
|
106
|
+
```bash
|
|
107
|
+
sshcnfgr identities scan
|
|
108
|
+
```
|
|
109
|
+
3. **Hosts pflegen & Dubletten aufräumen:**
|
|
110
|
+
- In der TUI (`sshcnfgr`) mit **`Ctrl+U`** oder Button **„Dubletten“**
|
|
111
|
+
- Oder in der Qt6-GUI (`sshcnfgr gui`) über **„Dubletten…“** (`Ctrl+U`)
|
|
112
|
+
4. **OpenSSH-Config erzeugen:**
|
|
113
|
+
```bash
|
|
114
|
+
sshcnfgr generate
|
|
115
|
+
```
|
|
116
|
+
Standard-Ausgabe ist `~/.ssh/config.generated` (`0600`). Du kannst sie direkt per `Include` in deiner `~/.ssh/config` einbinden:
|
|
117
|
+
```sshconfig
|
|
118
|
+
Include config.generated
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## CLI-Übersicht
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
sshcnfgr # TUI direkt starten
|
|
127
|
+
sshcnfgr tui # TUI starten
|
|
128
|
+
sshcnfgr gui # Qt6 Desktop-GUI starten ([qt]-Extra)
|
|
129
|
+
sshcnfgr import --source ~/.ssh/config # OpenSSH-Config importieren
|
|
130
|
+
sshcnfgr generate --output ~/.ssh/config.generated # OpenSSH-Config generieren
|
|
131
|
+
sshcnfgr identities scan # Keys aus ~/.ssh erfassen
|
|
132
|
+
sshcnfgr identities list # Bekannte Identities anzeigen
|
|
133
|
+
sshcnfgr groups set-identity prod id_ed25519 # Gruppen-Default-Identity setzen
|
|
134
|
+
sshcnfgr --version # Version anzeigen
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Optionales File-Logging (Standard: keine Logdatei):
|
|
138
|
+
```bash
|
|
139
|
+
sshcnfgr --verbose --log-file /tmp/sshcnfgr.log generate
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## Dateien & Migration
|
|
145
|
+
|
|
146
|
+
| Datei | Zweck |
|
|
147
|
+
| --- | --- |
|
|
148
|
+
| `~/.ssh/sshcnfgr.toml` | Zentrale Source of Truth (Hosts, Gruppen, Identities, `global_options`, `[ui]`), `0600` auf POSIX |
|
|
149
|
+
| `~/.ssh/config.generated` | Generierte OpenSSH-Config (nur aktive Hosts, `Host *` am Ende), `0600` auf POSIX |
|
|
150
|
+
| `*.bak.YYYYMMDD-HHMMSS` | Automatisches Zeitstempel-Backup vor jedem Überschreiben |
|
|
151
|
+
|
|
152
|
+
> **Migration aus `0.1.0a1`:** Falls `~/.ssh/sshcnfgr.toml` noch nicht existiert, aber noch eine ältere `~/.config/sshcnfgr/hosts.toml` vorhanden ist, lädt SSHCnfgr diese automatisch und schreibt beim nächsten Speichern nach `~/.ssh/sshcnfgr.toml`.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Entwicklung & Release
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
git clone https://github.com/thomsbe/SSHCnfgr.git
|
|
160
|
+
cd SSHCnfgr
|
|
161
|
+
uv sync --extra dev --extra qt
|
|
162
|
+
|
|
163
|
+
# Linting & Tests (inkl. Textual Pilot & Qt6 Offscreen)
|
|
164
|
+
uv run ruff check .
|
|
165
|
+
QT_QPA_PLATFORM=offscreen uv run pytest -v
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Paket bauen & auf PyPI veröffentlichen
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
uv build
|
|
172
|
+
uv run twine check dist/*
|
|
173
|
+
uv publish
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Weitere Dokumente: [CHANGELOG.md](CHANGELOG.md), [SECURITY.md](SECURITY.md), [CONTRIBUTING.md](CONTRIBUTING.md), [LICENSE](LICENSE) (MIT).
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## English Summary
|
|
181
|
+
|
|
182
|
+
**SSHCnfgr** is a cross-platform (Linux, macOS, Windows) manager for OpenSSH host configurations backed by a **single TOML file** (`~/.ssh/sshcnfgr.toml`, `0600` permissions on POSIX) located right next to `~/.ssh/config`.
|
|
183
|
+
|
|
184
|
+
### Key Features
|
|
185
|
+
- **Single source of truth:** Manage hosts, groups, identity profiles, and global defaults in `~/.ssh/sshcnfgr.toml` and generate clean OpenSSH configs (`~/.ssh/config.generated`) containing only enabled hosts.
|
|
186
|
+
- **Duplicate detection & interactive merge:** Finds hosts pointing to the same effective `(HostName, Port, User)` target, highlights field conflicts, merges non-conflicting attributes, and lets you disable or delete duplicates safely.
|
|
187
|
+
- **Three interfaces:** Interactive **Textual TUI** (default), optional **Qt6 desktop GUI** (`PySide6-Essentials`, Wayland/X11/macOS/Windows), and **Click CLI**.
|
|
188
|
+
- **Safe by design:** Never reads or stores private SSH key contents; writes atomically with `0600` permissions and creates timestamped backups before overwriting.
|
|
189
|
+
|
|
190
|
+
### Quickstart
|
|
191
|
+
```bash
|
|
192
|
+
# Run directly with uvx (during 0.1.0b1 beta, pass --prerelease=allow)
|
|
193
|
+
uvx --prerelease=allow sshcnfgr
|
|
194
|
+
uvx --prerelease=allow --from "sshcnfgr[qt]" sshcnfgr gui
|
|
195
|
+
|
|
196
|
+
# Or install globally as a tool
|
|
197
|
+
uv tool install --prerelease=allow sshcnfgr
|
|
198
|
+
uv tool install --prerelease=allow "sshcnfgr[qt]"
|
|
199
|
+
|
|
200
|
+
# Import existing OpenSSH config & generate
|
|
201
|
+
sshcnfgr import --source ~/.ssh/config
|
|
202
|
+
sshcnfgr generate
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Licensed under the [MIT License](LICENSE). See [SECURITY.md](SECURITY.md) for security reporting and [CONTRIBUTING.md](CONTRIBUTING.md) for development details.
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# SSHCnfgr
|
|
2
|
+
|
|
3
|
+
> **English speaker?** Jump to the [English Summary](#english-summary) at the bottom.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/thomsbe/SSHCnfgr/blob/main/LICENSE)
|
|
6
|
+
[](https://www.python.org/)
|
|
7
|
+
[](https://pypi.org/project/sshcnfgr/)
|
|
8
|
+
|
|
9
|
+
**SSHCnfgr** verwaltet deine OpenSSH-Hosts, Gruppen und Identities über eine einzige, saubere TOML-Datei (`~/.ssh/sshcnfgr.toml`) — per **Textual-TUI**, optionaler **Qt6-Desktop-GUI** (Wayland/X11/macOS/Windows) oder **Click-CLI**.
|
|
10
|
+
|
|
11
|
+
## Highlights
|
|
12
|
+
|
|
13
|
+
- **Eine einzige Datei neben `~/.ssh/config`:** Alles liegt in `~/.ssh/sshcnfgr.toml` (auf Linux/macOS automatisch mit `0600`-Rechten, unter Windows in `%USERPROFILE%\.ssh\sshcnfgr.toml`) — ideal für den direkten Start per `uvx`.
|
|
14
|
+
- **TOML als Source of Truth:** Deaktivierte Hosts bleiben in der Datenbank erhalten, landen aber nicht in der generierten OpenSSH-Config (`~/.ssh/config.generated`, ebenfalls `0600`).
|
|
15
|
+
- **Dubletten finden & zusammenführen:** Erkennt Hosts mit gleichem Ziel (`HostName` + effektiver `Port` + effektiver `User`), zeigt Feld-Konflikte übersichtlich an und führt Einträge interaktiv zusammen (übrige Dubletten wahlweise deaktivieren oder löschen).
|
|
16
|
+
- **TUI, Qt6-GUI & CLI:** Im Terminal mit Textual, auf dem Desktop optional mit PySide6/Qt6 (Live-Suche, Gruppen-/Identity-Tabs, `extra_options`-Editor, Config-Vorschau) oder skriptbar über die CLI.
|
|
17
|
+
- **Sicherheitsnetz:** Keine Speicherung privater Schlüssel-Inhalte (nur Pfade & `.pub`-Metadaten), atomares Schreiben und automatische Zeitstempel-Backups (`*.bak.YYYYMMDD-HHMMSS`) vor jedem Überschreiben.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Schnellstart mit `uv` / `uvx`
|
|
22
|
+
|
|
23
|
+
> **Hinweis zur Beta-Version (`0.1.0b1`):** Da es sich um eine Vorabversion handelt, benötigt `uvx` / `uv tool install` aktuell das Flag `--prerelease=allow`. Ab dem regulären `0.1.0`-Release entfällt dieses Flag.
|
|
24
|
+
|
|
25
|
+
### Ohne Installation direkt ausführen (`uvx`)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Textual-TUI direkt starten (legt ~/.ssh/sshcnfgr.toml bei Bedarf an)
|
|
29
|
+
uvx --prerelease=allow sshcnfgr
|
|
30
|
+
|
|
31
|
+
# Optionale Qt6 Desktop-GUI starten (Wayland / X11 / macOS / Windows)
|
|
32
|
+
uvx --prerelease=allow --from "sshcnfgr[qt]" sshcnfgr gui
|
|
33
|
+
|
|
34
|
+
# Bestehende ~/.ssh/config importieren
|
|
35
|
+
uvx --prerelease=allow sshcnfgr import --source ~/.ssh/config
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Dauerhaft als CLI-Tool installieren (`uv tool install`)
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Terminal-Version (TUI + CLI)
|
|
42
|
+
uv tool install --prerelease=allow sshcnfgr
|
|
43
|
+
|
|
44
|
+
# Inklusive Qt6 Desktop-GUI
|
|
45
|
+
uv tool install --prerelease=allow "sshcnfgr[qt]"
|
|
46
|
+
|
|
47
|
+
# Danach direkt nutzbar:
|
|
48
|
+
sshcnfgr # startet die TUI
|
|
49
|
+
sshcnfgr gui # startet die Qt6-GUI
|
|
50
|
+
sshcnfgr --help # zeigt alle Kommandos
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
*(Falls `uv` noch nicht installiert ist: `curl -LsSf https://astral.sh/uv/install.sh | sh` auf Linux/macOS bzw. `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"` unter Windows.)*
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Typischer Ablauf
|
|
58
|
+
|
|
59
|
+
1. **Vorhandene SSH-Config importieren** (deine `~/.ssh/config` wird nur gelesen):
|
|
60
|
+
```bash
|
|
61
|
+
sshcnfgr import --source ~/.ssh/config
|
|
62
|
+
```
|
|
63
|
+
2. **Lokale SSH-Keys erfassen** (nur Pfade & `.pub`-Vorschau, keine Private Keys):
|
|
64
|
+
```bash
|
|
65
|
+
sshcnfgr identities scan
|
|
66
|
+
```
|
|
67
|
+
3. **Hosts pflegen & Dubletten aufräumen:**
|
|
68
|
+
- In der TUI (`sshcnfgr`) mit **`Ctrl+U`** oder Button **„Dubletten“**
|
|
69
|
+
- Oder in der Qt6-GUI (`sshcnfgr gui`) über **„Dubletten…“** (`Ctrl+U`)
|
|
70
|
+
4. **OpenSSH-Config erzeugen:**
|
|
71
|
+
```bash
|
|
72
|
+
sshcnfgr generate
|
|
73
|
+
```
|
|
74
|
+
Standard-Ausgabe ist `~/.ssh/config.generated` (`0600`). Du kannst sie direkt per `Include` in deiner `~/.ssh/config` einbinden:
|
|
75
|
+
```sshconfig
|
|
76
|
+
Include config.generated
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## CLI-Übersicht
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
sshcnfgr # TUI direkt starten
|
|
85
|
+
sshcnfgr tui # TUI starten
|
|
86
|
+
sshcnfgr gui # Qt6 Desktop-GUI starten ([qt]-Extra)
|
|
87
|
+
sshcnfgr import --source ~/.ssh/config # OpenSSH-Config importieren
|
|
88
|
+
sshcnfgr generate --output ~/.ssh/config.generated # OpenSSH-Config generieren
|
|
89
|
+
sshcnfgr identities scan # Keys aus ~/.ssh erfassen
|
|
90
|
+
sshcnfgr identities list # Bekannte Identities anzeigen
|
|
91
|
+
sshcnfgr groups set-identity prod id_ed25519 # Gruppen-Default-Identity setzen
|
|
92
|
+
sshcnfgr --version # Version anzeigen
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Optionales File-Logging (Standard: keine Logdatei):
|
|
96
|
+
```bash
|
|
97
|
+
sshcnfgr --verbose --log-file /tmp/sshcnfgr.log generate
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Dateien & Migration
|
|
103
|
+
|
|
104
|
+
| Datei | Zweck |
|
|
105
|
+
| --- | --- |
|
|
106
|
+
| `~/.ssh/sshcnfgr.toml` | Zentrale Source of Truth (Hosts, Gruppen, Identities, `global_options`, `[ui]`), `0600` auf POSIX |
|
|
107
|
+
| `~/.ssh/config.generated` | Generierte OpenSSH-Config (nur aktive Hosts, `Host *` am Ende), `0600` auf POSIX |
|
|
108
|
+
| `*.bak.YYYYMMDD-HHMMSS` | Automatisches Zeitstempel-Backup vor jedem Überschreiben |
|
|
109
|
+
|
|
110
|
+
> **Migration aus `0.1.0a1`:** Falls `~/.ssh/sshcnfgr.toml` noch nicht existiert, aber noch eine ältere `~/.config/sshcnfgr/hosts.toml` vorhanden ist, lädt SSHCnfgr diese automatisch und schreibt beim nächsten Speichern nach `~/.ssh/sshcnfgr.toml`.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Entwicklung & Release
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
git clone https://github.com/thomsbe/SSHCnfgr.git
|
|
118
|
+
cd SSHCnfgr
|
|
119
|
+
uv sync --extra dev --extra qt
|
|
120
|
+
|
|
121
|
+
# Linting & Tests (inkl. Textual Pilot & Qt6 Offscreen)
|
|
122
|
+
uv run ruff check .
|
|
123
|
+
QT_QPA_PLATFORM=offscreen uv run pytest -v
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Paket bauen & auf PyPI veröffentlichen
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
uv build
|
|
130
|
+
uv run twine check dist/*
|
|
131
|
+
uv publish
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Weitere Dokumente: [CHANGELOG.md](CHANGELOG.md), [SECURITY.md](SECURITY.md), [CONTRIBUTING.md](CONTRIBUTING.md), [LICENSE](LICENSE) (MIT).
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## English Summary
|
|
139
|
+
|
|
140
|
+
**SSHCnfgr** is a cross-platform (Linux, macOS, Windows) manager for OpenSSH host configurations backed by a **single TOML file** (`~/.ssh/sshcnfgr.toml`, `0600` permissions on POSIX) located right next to `~/.ssh/config`.
|
|
141
|
+
|
|
142
|
+
### Key Features
|
|
143
|
+
- **Single source of truth:** Manage hosts, groups, identity profiles, and global defaults in `~/.ssh/sshcnfgr.toml` and generate clean OpenSSH configs (`~/.ssh/config.generated`) containing only enabled hosts.
|
|
144
|
+
- **Duplicate detection & interactive merge:** Finds hosts pointing to the same effective `(HostName, Port, User)` target, highlights field conflicts, merges non-conflicting attributes, and lets you disable or delete duplicates safely.
|
|
145
|
+
- **Three interfaces:** Interactive **Textual TUI** (default), optional **Qt6 desktop GUI** (`PySide6-Essentials`, Wayland/X11/macOS/Windows), and **Click CLI**.
|
|
146
|
+
- **Safe by design:** Never reads or stores private SSH key contents; writes atomically with `0600` permissions and creates timestamped backups before overwriting.
|
|
147
|
+
|
|
148
|
+
### Quickstart
|
|
149
|
+
```bash
|
|
150
|
+
# Run directly with uvx (during 0.1.0b1 beta, pass --prerelease=allow)
|
|
151
|
+
uvx --prerelease=allow sshcnfgr
|
|
152
|
+
uvx --prerelease=allow --from "sshcnfgr[qt]" sshcnfgr gui
|
|
153
|
+
|
|
154
|
+
# Or install globally as a tool
|
|
155
|
+
uv tool install --prerelease=allow sshcnfgr
|
|
156
|
+
uv tool install --prerelease=allow "sshcnfgr[qt]"
|
|
157
|
+
|
|
158
|
+
# Import existing OpenSSH config & generate
|
|
159
|
+
sshcnfgr import --source ~/.ssh/config
|
|
160
|
+
sshcnfgr generate
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Licensed under the [MIT License](LICENSE). See [SECURITY.md](SECURITY.md) for security reporting and [CONTRIBUTING.md](CONTRIBUTING.md) for development details.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
| ------- | --------- |
|
|
7
|
+
| `0.1.x` (Beta / Current) | Yes |
|
|
8
|
+
|
|
9
|
+
## Security Design Principles
|
|
10
|
+
|
|
11
|
+
Because SSHCnfgr works alongside `~/.ssh/config`, security and least-privilege handling of files are core design principles:
|
|
12
|
+
|
|
13
|
+
- **No private key contents:** SSHCnfgr never reads, stores, or transmits private SSH key material. Only file paths and public key metadata (`.pub` key type and comment preview) are stored.
|
|
14
|
+
- **Restrictive permissions:** On POSIX systems (Linux/macOS), `~/.ssh/sshcnfgr.toml`, its timestamped backups, and generated OpenSSH config files are written atomically with `0600` permissions.
|
|
15
|
+
- **Safe defaults:** Generating an OpenSSH config writes to `~/.ssh/config.generated` by default and never overwrites `~/.ssh/config` unless explicitly requested. Existing target files are backed up before overwriting.
|
|
16
|
+
|
|
17
|
+
## Reporting a Vulnerability
|
|
18
|
+
|
|
19
|
+
Please do **not** open a public GitHub issue for security vulnerabilities.
|
|
20
|
+
|
|
21
|
+
Instead, report security issues privately via one of the following channels:
|
|
22
|
+
|
|
23
|
+
1. **GitHub Security Advisories (preferred):**
|
|
24
|
+
<https://github.com/thomsbe/SSHCnfgr/security/advisories/new>
|
|
25
|
+
2. **Email:**
|
|
26
|
+
`thomas.baer@tbaer.de`
|
|
27
|
+
|
|
28
|
+
Please include a clear description of the issue, steps to reproduce, and any affected versions or operating systems. You will receive an initial response as quickly as possible.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "sshcnfgr"
|
|
3
|
+
version = "0.1.0b1"
|
|
4
|
+
description = "TUI, optional Qt6 GUI, and CLI to manage OpenSSH host configs from a single TOML file"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
license-files = ["LICENSE"]
|
|
9
|
+
authors = [{ name = "Thomas Baer", email = "thomas.baer@tbaer.de" }]
|
|
10
|
+
maintainers = [{ name = "Thomas Baer", email = "thomas.baer@tbaer.de" }]
|
|
11
|
+
keywords = ["ssh", "openssh", "tui", "textual", "qt", "pyside6", "cli", "config", "devops"]
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Environment :: Console",
|
|
15
|
+
"Environment :: X11 Applications :: Qt",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Intended Audience :: System Administrators",
|
|
18
|
+
"Operating System :: MacOS",
|
|
19
|
+
"Operating System :: Microsoft :: Windows",
|
|
20
|
+
"Operating System :: POSIX :: Linux",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Programming Language :: Python :: 3.14",
|
|
25
|
+
"Topic :: Software Development :: User Interfaces",
|
|
26
|
+
"Topic :: System :: Systems Administration",
|
|
27
|
+
"Topic :: Utilities",
|
|
28
|
+
]
|
|
29
|
+
dependencies = [
|
|
30
|
+
"textual>=6.0.0",
|
|
31
|
+
"click>=8.1.7",
|
|
32
|
+
"loguru>=0.7.3",
|
|
33
|
+
"tomli-w>=1.0.0",
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/thomsbe/SSHCnfgr"
|
|
38
|
+
Repository = "https://github.com/thomsbe/SSHCnfgr"
|
|
39
|
+
Issues = "https://github.com/thomsbe/SSHCnfgr/issues"
|
|
40
|
+
Changelog = "https://github.com/thomsbe/SSHCnfgr/blob/main/CHANGELOG.md"
|
|
41
|
+
|
|
42
|
+
[project.optional-dependencies]
|
|
43
|
+
qt = [
|
|
44
|
+
"PySide6-Essentials>=6.8.0",
|
|
45
|
+
]
|
|
46
|
+
dev = [
|
|
47
|
+
"build>=1.2.2",
|
|
48
|
+
"pytest>=8.3.0",
|
|
49
|
+
"ruff>=0.6.0",
|
|
50
|
+
"twine>=5.1.1",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[project.scripts]
|
|
54
|
+
sshcnfgr = "sshcnfgr.cli:cli"
|
|
55
|
+
|
|
56
|
+
[build-system]
|
|
57
|
+
requires = ["hatchling>=1.25.0"]
|
|
58
|
+
build-backend = "hatchling.build"
|
|
59
|
+
|
|
60
|
+
[tool.hatch.build]
|
|
61
|
+
include = [
|
|
62
|
+
"/src",
|
|
63
|
+
"/README.md",
|
|
64
|
+
"/LICENSE",
|
|
65
|
+
"/SECURITY.md",
|
|
66
|
+
"/CHANGELOG.md",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[tool.hatch.build.targets.wheel]
|
|
70
|
+
packages = ["src/sshcnfgr"]
|
|
71
|
+
|
|
72
|
+
[tool.ruff]
|
|
73
|
+
line-length = 100
|
|
74
|
+
target-version = "py312"
|
|
75
|
+
|
|
76
|
+
[tool.ruff.lint]
|
|
77
|
+
select = ["E", "F", "I", "UP"]
|