
Rule-based linter for OpenSSH client config files जो डुप्लिकेट होस्ट, गुम पहचान फ़ाइलें, कमजोर एल्गोरिदम, वाइल्डकार्ड ऑर्डरिंग समस्याएं, और खतरनाक सेटिंग्स का पता लगाता है, JSON आउटपुट और CI-अनुकूल एग्जिट कोड के साथ।
# sshconfig-lint
[](https://github.com/Noah4ever/sshconfig-lint/actions/workflows/tests.yml)
[](https://crates.io/crates/sshconfig-lint)
[](LICENSE)
**हर उस जगह के लिए एक इंजन जहाँ आपका SSH कॉन्फ़िग बदलता है।**
sshconfig-lint OpenSSH क्लाइंट कॉन्फ़िग्स में सिमेंटिक गलतियाँ ढूँढता है: डुप्लिकेट होस्ट, टूटे हुए identity पाथ, असुरक्षित ऑप्शन, कमज़ोर एल्गोरिदम, वाइल्डकार्ड ऑर्डरिंग, और उलझी हुई `Include` चेन। एक ही रूल कोड को लोकली, Git hooks, GitHub Actions, और एडिटर्स में इस्तेमाल करें।
[प्राइवेट ब्राउज़र प्लेग्राउंड आज़माएँ](https://sshconfig-lint.apps.thiering.org/en) · [इंटरैक्टिव उदाहरणों के साथ सीखें](https://sshconfig-lint.apps.thiering.org/en/learn) · [हर रूल पढ़ें](https://sshconfig-lint.apps.thiering.org/en/rules)
ब्राउज़र चेकर आपके डिवाइस पर चलता है। कॉन्फ़िग की सामग्री अपलोड नहीं की जाती और कोई टेलीमेट्री एकत्र नहीं की जाती।
## त्वरित शुरुआत
```bash
# check ~/.ssh/config
sshconfig-lint
# check one or more repository configs
sshconfig-lint .ssh/config infrastructure/ssh_config
# fail on warnings and errors
sshconfig-lint .ssh/config --strict
```
## इंस्टॉल करें
### Homebrew
```bash
brew tap Noah4ever/tap
brew install sshconfig-lint
```
### Cargo
```bash
cargo install sshconfig-lint
```
### Arch Linux
```bash
yay -S sshconfig-lint-bin
```
[रिलीज़ पेज](https://github.com/Noah4ever/sshconfig-lint/releases) Linux, macOS, और Windows के लिए सत्यापित बाइनरीज़ प्रदान करता है। सुविधा इंस्टॉलर इंस्टॉल करने से पहले रिलीज़ चेकसम सत्यापित करता है:
```bash
curl -fsSL https://raw.githubusercontent.com/Noah4ever/sshconfig-lint/main/install.sh | bash
```
डिफ़ॉल्ट को ओवरराइड करने के लिए `VERSION=v0.5.0` या `INSTALL_DIR=~/.local/bin` सेट करें।
## GitHub Actions
आधिकारिक Action
[GitHub Marketplace](https://github.com/marketplace/actions/sshconfig-lint) में उपलब्ध है।
```yaml
name: SSH config
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Noah4ever/[email protected]
with:
paths: |
.ssh/config
infrastructure/ssh_config
strict: true
```
निष्कर्ष सटीक फ़ाइल और लाइन पर एनोटेशन के रूप में दिखाई देते हैं। Action अपने टैग से मेल खाने वाली रिलीज़ डाउनलोड करता है और निष्पादन से पहले `SHA256SUMS` सत्यापित करता है।
GitHub Code Scanning सक्षम वाले रिपॉज़िटरीज़ के लिए, SARIF को अलग से अपलोड किया जा सकता है:
```yaml
- run: sshconfig-lint .ssh/config --format sarif > sshconfig-lint.sarif
- uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: sshconfig-lint.sarif
```
## Pre-Commit
```yaml
repos:
- repo: https://github.com/Noah4ever/sshconfig-lint
rev: v1.0.0
hooks:
- id: sshconfig-lint-strict
```
जब चेतावनियाँ कमिट को ब्लॉक नहीं करनी चाहिए तो `id: sshconfig-lint` इस्तेमाल करें। जब कॉन्फ़िग्स किसी अन्य नामकरण परंपरा का उपयोग करते हैं तो अपने प्रोजेक्ट में `files:` को ओवरराइड करें।
## एडिटर्स
### VS Code
Marketplace से [VS Code एक्सटेंशन](https://marketplace.visualstudio.com/items?itemName=NoahThiering.sshconfig-lint) इंस्टॉल करें या चलाएँ:
```bash
code --install-extension NoahThiering.sshconfig-lint
```
एक्सटेंशन `sshconfig-lint lsp` शुरू करता है, एक बार मेल खाती सत्यापित बाइनरी डाउनलोड करता है, और फिर ऑफ़लाइन काम करता है। यह `.ssh/config`, `ssh_config`, और chezmoi के `dot_ssh/config` को पहचानता है। कोई टेलीमेट्री एकत्र नहीं की जाती। इसका सोर्स [`editors/vscode`](https://github.com/noah4ever/sshconfig-lint/blob/main/editors/vscode) में उपलब्ध है।
### Neovim
परीक्षित [`editors/neovim`](https://github.com/noah4ever/sshconfig-lint/blob/main/editors/neovim) उदाहरण Neovim के अंतर्निहित
LSP क्लाइंट का उपयोग करता है। इसके छोटे Lua मॉड्यूल को अपने कॉन्फ़िगरेशन में कॉपी करें और इसे इस तरह शुरू करें:
```lua
require("sshconfig_lint").setup()
```
यह VS Code के समान `sshconfig-lint lsp` सर्वर का उपयोग करता है और कस्टम
बाइनरी पाथ का समर्थन करता है।
LSP समर्थन वाला कोई भी एडिटर इसे शुरू कर सकता है:
```bash
sshconfig-lint lsp
```
v0.5 लैंग्वेज सर्वर खोलने, बदलने, और सहेजने पर पूरी-लाइन डायग्नोस्टिक्स प्रकाशित करता है। बिना शीर्षक वाले बफ़र्स केवल-सामग्री नियम चलाते हैं; सहेजी गई फ़ाइलें अतिरिक्त रूप से `Include` और फ़ाइलसिस्टम पाथ को हल करती हैं। नेस्टेड Includes से मिले निष्कर्ष शामिल की गई फ़ाइल से जोड़े जाते हैं और रूट दस्तावेज़ के साथ साफ़ हो जाते हैं।
## आउटपुट फ़ॉर्मैट
```bash
sshconfig-lint --format text
sshconfig-lint --format json
sshconfig-lint --format github
sshconfig-lint --format sarif
```
JSON निष्कर्षों में `severity`, `code`, `rule`, `line`, `file`, `message`, `hint`, और `documentation` शामिल होते हैं। रूल कोड और एग्ज़िट कोड स्थिर ऑटोमेशन इंटरफ़ेस हैं।
| Exit | Meaning |
|---:|---|
| `0` | कोई error-स्तरीय निष्कर्ष नहीं, और `--strict` के साथ कोई चेतावनी नहीं |
| `1` | कम से कम एक ब्लॉकिंग निष्कर्ष |
| `2` | कम से कम एक अनुरोधित कॉन्फ़िग पढ़ा नहीं जा सका |
## नियम
| Code | Rule | Severity |
|---|---|---|
| `INVALID_VALUE` | [अमान्य डायरेक्टिव मान](https://sshconfig-lint.apps.thiering.org/en/rules/invalid-directive-value) | error |
| `DUP_HOST` | [डुप्लिकेट Host ब्लॉक](https://sshconfig-lint.apps.thiering.org/en/rules/duplicate-host) | warning |
| `MISSING_IDENTITY` | [IdentityFile नहीं मिला](https://sshconfig-lint.apps.thiering.org/en/rules/identity-file-exists) | error |
| `WILDCARD_ORDER` | [Host वाइल्डकार्ड क्रम](https://sshconfig-lint.apps.thiering.org/en/rules/wildcard-host-order) | warning |
| `WEAK_ALGO` | [कमज़ोर एल्गोरिदम](https://sshconfig-lint.apps.thiering.org/en/rules/deprecated-weak-algorithms) | warning |
| `DUP_DIRECTIVE` | [डुप्लिकेट डायरेक्टिव](https://sshconfig-lint.apps.thiering.org/en/rules/duplicate-directives) | warning |
| `INSECURE_OPT` | [असुरक्षित ऑप्शन](https://sshconfig-lint.apps.thiering.org/en/rules/insecure-option) | warning |
| `UNSAFE_CTRL_PATH` | [असुरक्षित ControlPath](https://sshconfig-lint.apps.thiering.org/en/rules/unsafe-control-path) | warning |
| `INCLUDE_CYCLE` | [Include चक्र](https://sshconfig-lint.apps.thiering.org/en/rules/include-cycle) | error |
| `INCLUDE_DEPTH` | [Include नेस्टिंग बहुत गहरी](https://sshconfig-lint.apps.thiering.org/en/rules/include-depth) | error |
| `INCLUDE_READ` | [Include पढ़ा नहीं जा सकता](https://sshconfig-lint.apps.thiering.org/en/rules/include-read) | error |
| `INCLUDE_GLOB` | [अमान्य Include पैटर्न](https://sshconfig-lint.apps.thiering.org/en/rules/include-glob) | error |
| `INCLUDE_NO_MATCH` | [Include किसी फ़ाइल से मेल नहीं खाता](https://sshconfig-lint.apps.thiering.org/en/rules/include-no-match) | info |
| `NEGATED_HOST` | [Host में केवल नेगेटेड पैटर्न हैं](https://sshconfig-lint.apps.thiering.org/en/rules/negated-only-host) | warning |
| `PROXY_CONFLICT` | [ProxyCommand और ProxyJump में टकराव](https://sshconfig-lint.apps.thiering.org/en/rules/proxy-command-jump-conflict) | warning |
| `REVOKED_HOST_KEYS_UNREADABLE` | [RevokedHostKeys फ़ाइल अपठनीय है](https://sshconfig-lint.apps.thiering.org/en/rules/revoked-host-keys-readable) | error |
| `MISSING_CERTIFICATE` | [CertificateFile नहीं मिला](https://sshconfig-lint.apps.thiering.org/en/rules/certificate-file-exists) | error |
| `LOCAL_COMMAND_DISABLED` | [LocalCommand सक्षम नहीं है](https://sshconfig-lint.apps.thiering.org/en/rules/local-command-enabled) | warning |
| `INVALID_TOKEN` | [अमान्य प्रतिशत टोकन](https://sshconfig-lint.apps.thiering.org/en/rules/invalid-percent-token) | error |
| `INVALID_SYNTAX` | [अमान्य सिंटैक्स](https://sshconfig-lint.apps.thiering.org/en/rules/invalid-syntax) | error |
| `UNKNOWN_DIRECTIVE` | [अज्ञात डायरेक्टिव](https://sshconfig-lint.apps.thiering.org/en/rules/unknown-directive) | error |
| `DEPRECATED_OPTION` | [अप्रचलित ऑप्शन](https://sshconfig-lint.apps.thiering.org/en/rules/deprecated-option) | warning |
| `INVALID_MATCH` | [अमान्य Match शर्त](https://sshconfig-lint.apps.thiering.org/en/rules/invalid-match-condition) | error |
| `CONTROL_PERSIST_UNUSED` | [ControlMaster के बिना ControlPersist](https://sshconfig-lint.apps.thiering.org/en/rules/control-persist-requires-master) | warning |
| `UPDATE_HOSTKEYS_ASK_PERSIST` | [ControlPersist के साथ UpdateHostKeys ask](https://sshconfig-lint.apps.thiering.org/en/rules/update-hostkeys-control-persist) | warning |
रूल गाइड सटीक टूटा हुआ अंश, एक सुधारा हुआ कॉन्फ़िग, यह क्यों मायने रखता है, और OpenSSH के साथ परिणाम को कैसे सत्यापित करें दिखाते हैं।
`INVALID_VALUE` पोर्ट, रिट्राई और प्रॉम्प्ट काउंटर, alive सेटिंग्स, `ForwardX11Timeout`, `RequiredRSASize`, `ControlPersist`, बूलियन स्विच, `ObscureKeystrokeTiming`, OpenSSH समय मान, `StreamLocalBindMask`, `IPQoS`, और प्रलेखित मान सेट जैसे `AddressFamily`, `ControlMaster`, `StrictHostKeyChecking`, `LogLevel`, और `PubkeyAuthentication` की जाँच करता है। OpenSSH द्वारा स्वीकार किए गए कोटेड और केस-असंवेदनशील मान वैध रहते हैं। लिंटर आधुनिक सिंटैक्स स्वीकार करता है बिना उस SSH क्लाइंट के संस्करण का अनुमान लगाने की कोशिश किए जो कॉन्फ़िग का उपभोग करेगा।
फ़ाइलसिस्टम जाँचें प्रतिशत टोकन या एनवायरनमेंट वेरिएबल वाले पाथ को छोड़ देती हैं क्योंकि उनका अंतिम मान कनेक्शन संदर्भ पर निर्भर करता है। `LOCAL_COMMAND_DISABLED` इसी तरह रूढ़िवादी है: यह तब दबा दिया जाता है जब कोई अनसुलझा `Include` या कोई संभावित `PermitLocalCommand yes` कमांड को प्रभावी बना सकता है। सबसे सटीक परिणाम के लिए सामान्य CLI या सहेजे गए एडिटर दस्तावेज़ के माध्यम से Includes को हल करें।
## विकास
Rust 1.85 या नए की आवश्यकता है।
```bash
cargo test --all
cargo clippy --all-targets --all-features -- -D warnings
cargo fmt -- --check
```
[CONTRIBUTING.md](https://github.com/noah4ever/sshconfig-lint/blob/main/CONTRIBUTING.md), सार्वजनिक [रोडमैप](https://github.com/noah4ever/sshconfig-lint/blob/main/ROADMAP.md),
[v1 स्थिरता अनुबंध](https://github.com/noah4ever/sshconfig-lint/blob/main/STABILITY.md), और [सुरक्षा नीति](https://github.com/noah4ever/sshconfig-lint/blob/main/SECURITY.md) देखें।
## लाइसेंस
MIT