SSH-protokollen ("Secure Shell") er en metode til sikker fjernadgang fra et system til et andet. Sysadmins og brugere bruger en sikker kanal over et usikret netværk i et klient-server-arkitekturformat til at forbinde en SSH-klient med en SSH-server. Sikkerhed ssh server er en vigtig opgave. Der er et værktøj kaldet ssh_scan fra Mozilla, der fungerer som en prototype SSH-konfiguration og politik scanner til din SSHD.
Fordele ved ssh_scan
Fra projektets hjemmeside:
- Minimale afhængigheder - bruger native Ruby og BinData til at gøre sit arbejde, ingen tunge afhængigheder.
- Ikke blot et script - Implementering er bærbar til brug i et andet projekt eller til automatisering af opgaver.
- Enkelt - Bare peg ssh_scan på en SSH-service og få en JSON-rapport om, hvad den understøtter, og dens politikstatus.
- Konfigurerbar - Lav dine egne tilpassede politikker, der passer til dine unikke politiske krav.
Installer afhængigheder
Indtast følgende apt-get kommando/apt kommando at installere rubin og perle på Debian / Ubuntu Linux:
$ sudo apt-get install ruby gem
Prøveudgange:
Installer ssh_scan
Skriv følgende kommando for at installere ssh_scan som en perle:
$ sudo gem install ssh_scan
Prøveudgange:
Hvordan bruger jeg ssh_scan?
Syntaxen er:
$ ssh_scan -t ip
$ ssh_scan -t server
$ ssh_scan -t server1.cyberciti.biz
For eksempel scan en ssh-server installeret på 192.168.2.15, indtast:
$ ssh_scan -t 192.168.2.15
Prøveudgange:
I, [2017-04-25T16:12:11.019160 #32317] INFO -- : You're using the latest version of ssh_scan 0.0.19 [ { "ssh_scan_version": "0.0.19", "ip": "192.168.2.15", "port": 22, "server_banner": "SSH-2.0-OpenSSH_7.4p1 Ubuntu-10", "ssh_version": 2.0, "os": "ubuntu", "os_cpe": "o:canonical:ubuntu", "ssh_lib": "openssh", "ssh_lib_cpe": "a:openssh:openssh:7.4p1", "cookie": "82d7cc908765f03154b10d5cdf14195a", "key_algorithms": [ "curve25519-sha256", "[email protected]", "ecdh-sha2-nistp256", "ecdh-sha2-nistp384", "ecdh-sha2-nistp521", "diffie-hellman-group-exchange-sha256", "diffie-hellman-group16-sha512", "diffie-hellman-group18-sha512", "diffie-hellman-group14-sha256", "diffie-hellman-group14-sha1" ], "server_host_key_algorithms": [ "ssh-rsa", "rsa-sha2-512", "rsa-sha2-256", "ecdsa-sha2-nistp256", "ssh-ed25519" ], "encryption_algorithms_client_to_server": [ "[email protected]", "aes128-ctr", "aes192-ctr", "aes256-ctr", "[email protected]", "[email protected]" ], "encryption_algorithms_server_to_client": [ "[email protected]", "aes128-ctr", "aes192-ctr", "aes256-ctr", "[email protected]", "[email protected]" ], "mac_algorithms_client_to_server": [ "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "hmac-sha2-256", "hmac-sha2-512", "hmac-sha1" ], "mac_algorithms_server_to_client": [ "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]", "hmac-sha2-256", "hmac-sha2-512", "hmac-sha1" ], "compression_algorithms_client_to_server": [ "none", "[email protected]" ], "compression_algorithms_server_to_client": [ "none", "[email protected]" ], "languages_client_to_server": [ ], "languages_server_to_client": [ ], "hostname": "m6700", "auth_methods": [ "publickey", "password" ], "fingerprints": { "rsa": { "known_bad": "false", "md5": "1d:14:84:f0:c7:21:10:0e:30:d9:f9:59:6b:c3:95:97", "sha1": "70:ac:7c:2c:94:54:aa:09:f2:58:f3:48:f0:9e:f2:a0:a2:37:f1:0a", "sha256": "6d:d8:20:c6:8e:e7:db:0d:94:9d:34:66:ba:b7:9c:68:8a:ea:79:19:a6:0d:76:cc:ec:fe:82:21:68:a5:64:74" } }, "start_time": "2017-04-25 16:12:11 +0000", "end_time": "2017-04-25 16:12:11 +0000", "scan_duration_seconds": 0.118730486, "duplicate_host_key_ips": [ ], "compliance": { "policy": "Mozilla Modern", "compliant": false, "recommendations": [ "Remove these Key Exchange Algos: curve25519-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256, diffie-hellman-group14-sha1", "Remove these MAC Algos: [email protected], [email protected], [email protected], hmac-sha1", "Remove these Authentication Methods: password" ], "references": [ "https://wiki.mozilla.org/Security/Guidelines/OpenSSH" ] } } ]
For at se alle andre muligheder skal du indtaste:
$ ssh_scan -h
Prøveudgange:
ssh_scan v0.0.19 (https://github.com/mozilla/ssh_scan) Brug: ssh_scan [optioner] -t, - target [IP / Range / Hostname] IP / Range / Hostname to scan -f, - file [FilePath] Filsti til filen, der indeholder IP / Range / Hostnames til scanning -T, - timeout [sekunder] Timeout pr. Forbindelse, hvorefter ssh_scan opgiver værten -L, - logger [Log File Path] Aktivér logger -O, - -fra_json [FilePath] Fil til at læse JSON-output fra -o, --output [FilePath] Fil til at skrive JSON-output til -p, --port [PORT] Port (standard: 22) -P, --policy [FIL] Brugerdefineret politikfil (standard: Mozilla Modern) - tråde [NUMBER] Antal arbejdertråde (standard: 5) - fingeraftryk-db [FIL] Filplacering af fingeraftryksdatabase (standard: ./fingerprints.db) --suppress- opdateringsstatus Kontroller ikke for opdateringer -u, - enheds-test [FIL] Kast passende exit-koder baseret på overholdelsesstatus -V [STD_LOGGING_LEVEL], --verbosity -v, --version Vis bare versioninformation -h, - -hjælp Vis denne meddelelse Eksempler: ssh_scan -t 192.168.1.1 ssh_scan -t server.e xample.com ssh_scan -t :: 1 ssh_scan -t :: 1 -T 5 ssh_scan -f hosts.txt ssh_scan -o output.json ssh_scan -O output.json -o rescan_output.json ssh_scan -t 192.168.1.1 -p 22222 ssh_scan - t 192.168.1.1 -p 22222 -L output.log -V INFO ssh_scan -t 192.168.1.1 -P custom_policy.yml ssh_scan -t 192.168.1.1 - unit-test -P custom_policy.yml
Hvordan sikrer og optimerer jeg min OpenSSH-server?
- OpenSSH Security Best Practices
- For at give en sane baseline-politikanbefaling til SSH-konfigurationsparametre, se denne side