Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung Nächste ÜberarbeitungBeide Seiten der Revision | ||
centos:ssh-install [12.11.2016 19:39. ] – [Dokumentation] django | centos:ssh-install [13.11.2016 16:46. ] – [Zielverzeichnis anlegen und öffentlichen Schlüssel kopieren] django | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Secure Shell - ssh ====== | ====== Secure Shell - ssh ====== | ||
- | {{: | + | {{: |
+ | |||
+ | ===== openSSH - Programmsuite ===== | ||
+ | Die für die **// | ||
+ | * openssh : Die OpenSSH-Implementierung der SSH Protokoll-Versionen 2 (und 1) | ||
+ | * openssh-clients : Die OpenSSH-Client-Anwendungen | ||
+ | * openssh-server : Der OpenSSH-Server Daemon | ||
+ | * openssh-askpass : Passphrase-Dialog für OpenSSH und X | ||
+ | ==== openssh ==== | ||
+ | Mittels '' | ||
+ | |||
+ | # rpm -qil openssh | ||
+ | < | ||
+ | Version | ||
+ | Release | ||
+ | Architecture: | ||
+ | Install Date: Wed 23 Mar 2016 07:14:52 PM CET | ||
+ | Group : Applications/ | ||
+ | Size : 1450050 | ||
+ | License | ||
+ | Signature | ||
+ | Source RPM : openssh-6.6.1p1-25.el7_2.src.rpm | ||
+ | Build Date : Mon 21 Mar 2016 11:18:48 PM CET | ||
+ | Build Host : worker1.bsys.centos.org | ||
+ | Relocations : (not relocatable) | ||
+ | Packager | ||
+ | Vendor | ||
+ | URL : http:// | ||
+ | Summary | ||
+ | Description : | ||
+ | SSH (Secure SHell) is a program for logging into and executing | ||
+ | commands on a remote machine. SSH is intended to replace rlogin and | ||
+ | rsh, and to provide secure encrypted communications between two | ||
+ | untrusted hosts over an insecure network. X11 connections and | ||
+ | arbitrary TCP/IP ports can also be forwarded over the secure channel. | ||
+ | |||
+ | OpenSSH is OpenBSD' | ||
+ | it up to date in terms of security and features. | ||
+ | |||
+ | This package includes the core files necessary for both the OpenSSH | ||
+ | client and server. To make this package useful, you should also | ||
+ | install openssh-clients, | ||
+ | /etc/ssh | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | |||
+ | |||
+ | ==== openssh-clients ==== | ||
+ | Beim Paket **openssh-clients** wird mitgeliefert: | ||
+ | |||
+ | # rpm -qil openssh-clients | ||
+ | < | ||
+ | Version | ||
+ | Release | ||
+ | Architecture: | ||
+ | Install Date: Wed 23 Mar 2016 07:14:59 PM CET | ||
+ | Group : Applications/ | ||
+ | Size : 2298871 | ||
+ | License | ||
+ | Signature | ||
+ | Source RPM : openssh-6.6.1p1-25.el7_2.src.rpm | ||
+ | Build Date : Mon 21 Mar 2016 11:18:48 PM CET | ||
+ | Build Host : worker1.bsys.centos.org | ||
+ | Relocations : (not relocatable) | ||
+ | Packager | ||
+ | Vendor | ||
+ | URL : http:// | ||
+ | Summary | ||
+ | Description : | ||
+ | OpenSSH is a free version of SSH (Secure SHell), a program for logging | ||
+ | into and executing commands on a remote machine. This package includes | ||
+ | the clients necessary to make encrypted connections to SSH servers. | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ==== openssh-server ==== | ||
+ | Hingegen liefert uns **openssh-server** folgende Dateien: | ||
+ | |||
+ | # rpm -qil openssh-server | ||
+ | < | ||
+ | Release | ||
+ | Architecture: | ||
+ | Install Date: Wed 23 Mar 2016 07:14:58 PM CET | ||
+ | Group : System Environment/ | ||
+ | Size : 943088 | ||
+ | License | ||
+ | Signature | ||
+ | Source RPM : openssh-6.6.1p1-25.el7_2.src.rpm | ||
+ | Build Date : Mon 21 Mar 2016 11:18:48 PM CET | ||
+ | Build Host : worker1.bsys.centos.org | ||
+ | Relocations : (not relocatable) | ||
+ | Packager | ||
+ | Vendor | ||
+ | URL : http:// | ||
+ | Summary | ||
+ | Description : | ||
+ | OpenSSH is a free version of SSH (Secure SHell), a program for logging | ||
+ | into and executing commands on a remote machine. This package contains | ||
+ | the secure shell daemon (sshd). The sshd daemon allows SSH clients to | ||
+ | securely connect to your SSH server. | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | ==== openssh-askpass ==== | ||
+ | Zu guter Letzt sehen wir uns noch das Paket **openssh-askpass** genauer an: | ||
+ | |||
+ | # rpm -qil openssh-askpass | ||
+ | < | ||
+ | Version | ||
+ | Release | ||
+ | Architecture: | ||
+ | Install Date: Sat 12 Nov 2016 08:22:40 PM CET | ||
+ | Group : Applications/ | ||
+ | Size : 15944 | ||
+ | License | ||
+ | Signature | ||
+ | Source RPM : openssh-6.6.1p1-25.el7_2.src.rpm | ||
+ | Build Date : Mon 21 Mar 2016 11:18:48 PM CET | ||
+ | Build Host : worker1.bsys.centos.org | ||
+ | Relocations : (not relocatable) | ||
+ | Packager | ||
+ | Vendor | ||
+ | URL : http:// | ||
+ | Summary | ||
+ | Description : | ||
+ | OpenSSH is a free version of SSH (Secure SHell), a program for logging | ||
+ | into and executing commands on a remote machine. This package contains | ||
+ | an X11 passphrase dialog for OpenSSH. | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
===== Dokumentation ===== | ===== Dokumentation ===== | ||
Zeile 818: | Zeile 1005: | ||
BSD | BSD | ||
- | ===== openSSH - Programmsuite ===== | ||
- | Die für die **// | ||
- | * openssh : Die OpenSSH-Implementierung der SSH Protokoll-Versionen 2 (und 1) | ||
- | * openssh-clients : Die OpenSSH-Client-Anwendungen | ||
- | * openssh-server : Der OpenSSH-Server Daemon | ||
- | * openssh-askpass : Passphrase-Dialog für OpenSSH und X | ||
- | ==== openssh ==== | ||
- | Mittels '' | ||
- | # rpm -qil openssh | ||
- | < | ||
- | Version | ||
- | Release | ||
- | Architecture: | ||
- | Install Date: Wed 23 Mar 2016 07:14:52 PM CET | ||
- | Group : Applications/ | ||
- | Size : 1450050 | ||
- | License | ||
- | Signature | ||
- | Source RPM : openssh-6.6.1p1-25.el7_2.src.rpm | ||
- | Build Date : Mon 21 Mar 2016 11:18:48 PM CET | ||
- | Build Host : worker1.bsys.centos.org | ||
- | Relocations : (not relocatable) | ||
- | Packager | ||
- | Vendor | ||
- | URL : http:// | ||
- | Summary | ||
- | Description : | ||
- | SSH (Secure SHell) is a program for logging into and executing | ||
- | commands on a remote machine. SSH is intended to replace rlogin and | ||
- | rsh, and to provide secure encrypted communications between two | ||
- | untrusted hosts over an insecure network. X11 connections and | ||
- | arbitrary TCP/IP ports can also be forwarded over the secure channel. | ||
- | OpenSSH is OpenBSD' | ||
- | it up to date in terms of security and features. | ||
- | This package includes the core files necessary for both the OpenSSH | ||
- | client and server. To make this package useful, you should also | ||
- | install openssh-clients, | ||
- | /etc/ssh | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | ==== openssh-clients | + | ===== ssh in der Praxis ===== |
- | Beim Paket **openssh-clients** wird mitgeliefert: | + | Auch wenn Passworte bei **ssh** verschlüsselt übertragen werden, wollen wir **__zwei wesentliche Aspekte__** bei Verwendung der **ssh** berücksichtigen: |
+ | | ||
+ | - Wir werden Key-basierte Anmeldungen verwenden und **__keine__** Anmeldungen mit Passwort zulassen. Somit laufen wir nicht in Gefahr, Zugänge durch Trivialpassworte angreifbar zu machen. Stattdessen werden wir uns für unsere Administratoren und berechtigten Nutzern, ein Schlüsselpaar bestehend aus privaten und öffentlichen Schlüssel erzeugen. Bei der Erzeugung dieses Schlüsselpaares werden wir eine Schlüsselpasswort (passphrase) angeben, welches Zur Nutzung des Schlüssel abgefragt | ||
- | # rpm -qil openssh-clients | ||
- | < | ||
- | Version | ||
- | Release | ||
- | Architecture: | ||
- | Install Date: Wed 23 Mar 2016 07:14:59 PM CET | ||
- | Group : Applications/ | ||
- | Size : 2298871 | ||
- | License | ||
- | Signature | ||
- | Source RPM : openssh-6.6.1p1-25.el7_2.src.rpm | ||
- | Build Date : Mon 21 Mar 2016 11:18:48 PM CET | ||
- | Build Host : worker1.bsys.centos.org | ||
- | Relocations : (not relocatable) | ||
- | Packager | ||
- | Vendor | ||
- | URL : http:// | ||
- | Summary | ||
- | Description : | ||
- | OpenSSH is a free version of SSH (Secure SHell), a program for logging | ||
- | into and executing commands on a remote machine. This package includes | ||
- | the clients necessary to make encrypted connections to SSH servers. | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | ==== openssh-server ==== | ||
- | Hingegen liefert uns **openssh-server** folgende Dateien: | ||
- | # rpm -qil openssh-server | ||
- | < | ||
- | Release | ||
- | Architecture: | ||
- | Install Date: Wed 23 Mar 2016 07:14:58 PM CET | ||
- | Group : System Environment/ | ||
- | Size : 943088 | ||
- | License | ||
- | Signature | ||
- | Source RPM : openssh-6.6.1p1-25.el7_2.src.rpm | ||
- | Build Date : Mon 21 Mar 2016 11:18:48 PM CET | ||
- | Build Host : worker1.bsys.centos.org | ||
- | Relocations : (not relocatable) | ||
- | Packager | ||
- | Vendor | ||
- | URL : http:// | ||
- | Summary | ||
- | Description : | ||
- | OpenSSH is a free version of SSH (Secure SHell), a program for logging | ||
- | into and executing commands on a remote machine. This package contains | ||
- | the secure shell daemon (sshd). The sshd daemon allows SSH clients to | ||
- | securely connect to your SSH server. | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | / | ||
- | ==== openssh-askpass ==== | ||
- | Zu guter Letzt sehen wir uns noch das Paket **openssh-askpass** genauer an: | ||
- | # rpm -qil openssh-askpass | + | Zum Erstellen eines Schlüsselpaares nutzen wir das Programm **ssh-keygen**. Einen Überberlick über die möglichen Optionen erhalten wir beim Abruf der zugehörigen **manpage**. |
- | < | + | # man ssh-keygen |
- | Version | + | |
- | Release | + | < |
- | Architecture: | + | |
- | Install Date: Sat 12 Nov 2016 08:22:40 PM CET | + | NAME |
- | Group : Applications/Internet | + | ssh-keygen — authentication key generation, management and conversion |
- | Size : 15944 | + | |
- | License | + | SYNOPSIS |
- | Signature | + | |
- | Source RPM : | + | |
- | Build Date : | + | |
- | Build Host : | + | |
- | Relocations | + | |
- | Packager | + | |
- | Vendor | + | |
- | URL : http://www.openssh.com/portable.html | + | |
- | Summary | + | |
- | Description : | + | |
- | OpenSSH | + | |
- | into and executing commands | + | |
- | an X11 passphrase | + | |
- | /etc/profile.d/gnome-ssh-askpass.csh | + | |
- | /etc/profile.d/gnome-ssh-askpass.sh | + | |
- | /usr/libexec/openssh/gnome-ssh-askpass | + | [-K checkpt] [-W generator] |
- | /usr/libexec/openssh/ssh-askpass</ | + | |
- | ===== Konfiguration ===== | + | [-V validity_interval] [-z serial_number] file ... |
- | ==== ssh Daemon ==== | + | ssh-keygen -L [-f input_keyfile] |
- | ===== ssh in der Praxis ===== | + | |
- | Auch wenn das Passwort bei **ssh** verschlüsselt übertragen wird, lohnt ein Blick auf die Alternative | + | |
- | Einfacher geht dies über asymetrische Schlüssel. | + | ssh-keygen -Q -f krl_file file ... |
- | ==== Erzeugung eines Schlüssel | + | |
- | Als erstes | + | DESCRIPTION |
- | < | + | |
- | Generating public/ | + | RSA keys for use by SSH protocol version 1 and DSA, ECDSA, ED25519 or RSA keys for use by SSH pro‐ |
- | Enter file in which to save the key (/ | + | tocol version 2. The type of key to be generated is specified with the -t option. |
+ | | ||
+ | |||
+ | | ||
+ | the MODULI GENERATION section for details. | ||
+ | |||
+ | | ||
+ | given keys have been revoked by one. See the KEY REVOCATION LISTS section for details. | ||
+ | |||
+ | | ||
+ | | ||
+ | ~/ | ||
+ | in /etc/rc. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | of characters you want. Good passphrases are 10-30 characters long, are not simple sentences or | ||
+ | | ||
+ | very bad passphrases), | ||
+ | meric characters. | ||
+ | |||
+ | There is no way to recover a lost passphrase. | ||
+ | must be generated and the corresponding public key copied to other machines. | ||
+ | |||
+ | For RSA1 keys, there is also a comment field in the key file that is only for convenience to the | ||
+ | user to help identify the key. The comment can tell what the key is for, or whatever is useful. | ||
+ | The comment is initialized to “user@host” when the key is created, but can be changed using the -c | ||
+ | | ||
+ | |||
+ | After a key is generated, instructions below detail where the keys should be placed to be acti‐ | ||
+ | | ||
+ | |||
+ | The options are as follows: | ||
+ | |||
+ | | ||
+ | | ||
+ | bits for the key type, and default comment. | ||
+ | | ||
+ | |||
+ | -a rounds | ||
+ | When saving a new-format private key (i.e. an ed25519 key or any SSH protocol 2 key when | ||
+ | the -o flag is set), this option specifies the number of KDF (key derivation function) | ||
+ | | ||
+ | tance to brute-force password cracking (should the keys be stolen). | ||
+ | |||
+ | When screening DH-GEX candidates ( using the -T command). | ||
+ | of primality tests to perform. | ||
+ | |||
+ | | ||
+ | |||
+ | -b bits | ||
+ | | ||
+ | bits and the default is 2048 bits. Generally, 2048 bits is considered sufficient. | ||
+ | keys must be exactly 1024 bits as specified by FIPS 186-2. | ||
+ | | ||
+ | 521 bits. Attempting to use bit lengths other than these three values for ECDSA keys will | ||
+ | | ||
+ | |||
+ | -C comment | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | for the passphrase if the key has one, and for the new comment. | ||
+ | |||
+ | -D pkcs11 | ||
+ | | ||
+ | | ||
+ | the CERTIFICATES section for details). | ||
+ | |||
+ | | ||
+ | one of the formats specified by the -m option. | ||
+ | This option allows exporting OpenSSH keys for use by other programs, including several com‐ | ||
+ | | ||
+ | |||
+ | -F hostname | ||
+ | | ||
+ | This option is useful to find hashed host names or addresses and may also be used in con‐ | ||
+ | | ||
+ | |||
+ | -f filename | ||
+ | | ||
+ | |||
+ | -G output_file | ||
+ | | ||
+ | -T option) before use. | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | tions within the specified file; the original content is moved to a file with a .old suf‐ | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | the CERTIFICATES section for details. | ||
+ | |||
+ | -I certificate_identity | ||
+ | | ||
+ | for details. | ||
+ | |||
+ | | ||
+ | by the -m option and print an OpenSSH compatible private (or public) key to stdout. | ||
+ | |||
+ | -J num_lines | ||
+ | Exit after screening the specified number of lines while performing DH candidate screening | ||
+ | using the -T option. | ||
+ | |||
+ | -j start_line | ||
+ | Start screening at the specified line number while performing DH candidate screening using | ||
+ | the -T option. | ||
+ | |||
+ | -K checkpt | ||
+ | Write the last line processed to the file checkpt while performing DH candidate screening | ||
+ | using the -T option. | ||
+ | been processed if the job is restarted. | ||
+ | ware, including several commercial SSH implementations. | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | RSA and DSA keys ssh-keygen tries to find the matching public key file and prints its fin‐ | ||
+ | | ||
+ | | ||
+ | |||
+ | -M memory | ||
+ | | ||
+ | | ||
+ | |||
+ | -m key_format | ||
+ | | ||
+ | key formats are: “RFC4716” (RFC 4716/SSH2 public or private key), “PKCS8” (PEM PKCS8 public | ||
+ | key) or “PEM” (PEM public key). The default conversion format is “RFC4716”. | ||
+ | |||
+ | -N new_passphrase | ||
+ | | ||
+ | |||
+ | -n principals | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | -O option | ||
+ | | ||
+ | | ||
+ | user certificates are: | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | force-command=command | ||
+ | | ||
+ | user when the certificate is used for authentication. | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | At present, no options are valid for host keys. | ||
+ | |||
+ | | ||
+ | than the more compatible PEM format. | ||
+ | force password cracking but is not supported by versions of OpenSSH prior to 6.5. Ed25519 | ||
+ | keys always use the new private key format. | ||
+ | |||
+ | -P passphrase | ||
+ | | ||
+ | |||
+ | | ||
+ | key. The program will prompt for the file containing the private key, for the old | ||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | | ||
+ | |||
+ | -R hostname | ||
+ | | ||
+ | | ||
+ | |||
+ | -r hostname | ||
+ | Print the SSHFP fingerprint resource record named hostname for the specified public key | ||
+ | | ||
+ | |||
+ | -S start | ||
+ | | ||
+ | |||
+ | -s ca_key | ||
+ | | ||
+ | tion for details. | ||
+ | |||
+ | When generating a KRL, -s specifies a path to a CA public key file used to revoke certifi‐ | ||
+ | cates directly by key ID or serial number. | ||
+ | | ||
+ | |||
+ | -T output_file | ||
+ | Test DH group exchange candidate primes (generated using the -G option) for safety. | ||
+ | |||
+ | -t type | ||
+ | | ||
+ | and “dsa”, “ecdsa”, | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | -V validity_interval | ||
+ | | ||
+ | a single time, indicating that the certificate is valid beginning now and expiring at that | ||
+ | time, or may consist of two times separated by a colon to indicate an explicit time inter‐ | ||
+ | | ||
+ | MMSS format or a relative time (to the current time) consisting of a minus sign followed by | ||
+ | a relative time in the format described in the TIME FORMATS section of sshd_config(5). | ||
+ | end time may be specified as a YYYYMMDD date, a YYYYMMDDHHMMSS time or a relative time | ||
+ | | ||
+ | |||
+ | For example: “+52w1d” (valid from now to 52 weeks and one day from now), “-4w:+4w” (valid | ||
+ | from four weeks ago to four weeks from now), “20100101123000:20110101123000” (valid from | ||
+ | | ||
+ | yesterday to midnight, January 1st, 2011). | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | -W generator | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | -z serial_number | ||
+ | | ||
+ | from others from the same CA. The default serial number is zero. | ||
+ | |||
+ | When generating a KRL, the -z flag is used to specify a KRL version number. | ||
+ | |||
+ | MODULI GENERATION | ||
+ | | ||
+ | | ||
+ | but memory intensive process. These candidate primes are then tested for suitability (a CPU-inten‐ | ||
+ | sive process). | ||
+ | |||
+ | | ||
+ | specified by the -b option. | ||
+ | |||
+ | # ssh-keygen -G moduli-2048.candidates -b 2048 | ||
+ | |||
+ | By default, the search for primes begins at a random point in the desired length range. | ||
+ | be overridden using the -S option, which specifies a different start point (in hex). | ||
+ | |||
+ | Once a set of candidates have been generated, they must be screened for suitability. | ||
+ | | ||
+ | (or a file specified using the -f option). | ||
+ | |||
+ | # ssh-keygen -T moduli-2048 -f moduli-2048.candidates | ||
+ | |||
+ | By default, each candidate will be subjected to 100 primality tests. | ||
+ | the -a option. | ||
+ | | ||
+ | tor values are 2, 3, and 5. | ||
+ | |||
+ | | ||
+ | | ||
+ | |||
+ | CERTIFICATES | ||
+ | | ||
+ | | ||
+ | | ||
+ | (CA) key. Clients or servers may then trust only the CA key and verify its signature on a certifi‐ | ||
+ | cate rather than trusting many user/host keys. Note that OpenSSH certificates are a different, and | ||
+ | much simpler, format to the X.509 certificates used in ssl(8). | ||
+ | |||
+ | | ||
+ | to servers, whereas host certificates authenticate server hosts to users. | ||
+ | | ||
+ | |||
+ | $ ssh-keygen -s / | ||
+ | |||
+ | The resultant certificate will be placed in / | ||
+ | | ||
+ | |||
+ | $ ssh-keygen -s /path/ | ||
+ | |||
+ | The host certificate will be output to / | ||
+ | |||
+ | It is possible to sign using a CA key stored in a PKCS#11 token by providing the token library | ||
+ | using -D and identifying the CA key by providing its public half as an argument to -s: | ||
+ | |||
+ | $ ssh-keygen -s ca_key.pub -D libpkcs11.so -I key_id host_key.pub | ||
+ | |||
+ | In all cases, key_id is a "key identifier" | ||
+ | used for authentication. | ||
+ | |||
+ | | ||
+ | erated certificates are valid for all users or hosts. | ||
+ | set of principals: | ||
+ | |||
+ | $ ssh-keygen -s ca_key -I key_id -n user1,user2 user_key.pub | ||
+ | $ ssh-keygen -s ca_key -I key_id -h -n host.domain user_key.pub | ||
+ | |||
+ | | ||
+ | | ||
+ | when presented from particular source addresses or may force the use of a specific command. | ||
+ | list of valid certificate options, see the documentation | ||
+ | |||
+ | | ||
+ | of certificate start and end times. | ||
+ | will not be considered valid. | ||
+ | future. | ||
+ | |||
+ | For certificates to be used for user or host authentication, | ||
+ | | ||
+ | |||
+ | KEY REVOCATION LISTS | ||
+ | | ||
+ | ify keys or certificates to be revoked using a compact format, taking as little as one bit per cer‐ | ||
+ | | ||
+ | |||
+ | KRLs may be generated using the -k flag. This option reads one or more files from the command line | ||
+ | and generates a new KRL. The files may either contain a KRL specification | ||
+ | keys, listed one per line. Plain public keys are revoked by listing their hash or contents in the | ||
+ | KRL and certificates revoked by serial number or key ID (if the serial is zero or not available). | ||
+ | |||
+ | | ||
+ | revoke keys and may be used to directly revoke certificates by serial number or key ID without hav‐ | ||
+ | ing the complete original certificate | ||
+ | one of the following directives followed by a colon and some directive-specific information. | ||
+ | |||
+ | | ||
+ | | ||
+ | not including zero and may be expressed in decimal, hex or octal. | ||
+ | are specified separated by a hyphen, then the range of serial numbers including and between | ||
+ | each is revoked. | ||
+ | the -s option. | ||
+ | |||
+ | id: key_id | ||
+ | | ||
+ | fied on the ssh-keygen command line using the -s option. | ||
+ | |||
+ | key: public_key | ||
+ | | ||
+ | lic key. | ||
+ | |||
+ | sha1: public_key | ||
+ | | ||
+ | |||
+ | KRLs may be updated using the -u flag in addition to -k. When this option is specified, keys | ||
+ | | ||
+ | |||
+ | It is also possible, given a KRL, to test whether it revokes a particular key (or keys). | ||
+ | flag will query an existing KRL, testing each key specified on the commandline. | ||
+ | on the command line has been revoked (or an error encountered) then ssh-keygen will exit with a | ||
+ | | ||
+ | |||
+ | FILES | ||
+ | | ||
+ | | ||
+ | not be readable by anyone but the user. It is possible to specify a passphrase | ||
+ | ating the key; that passphrase will be used to encrypt the private part of this file using | ||
+ | | ||
+ | | ||
+ | |||
+ | ~/.ssh/identity.pub | ||
+ | | ||
+ | file should be added to ~/.ssh/ | ||
+ | in using RSA authentication. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | a passphrase when generating the key; that passphrase will be used to encrypt the private | ||
+ | part of this file using 128-bit AES. This file is not automatically accessed by ssh-keygen | ||
+ | but it is offered as the default file for the private key. | ||
+ | a login attempt is made. | ||
+ | |||
+ | ~/.ssh/id_dsa.pub | ||
+ | ~/.ssh/ | ||
+ | | ||
+ | | ||
+ | | ||
+ | The contents of this file should be added to ~/ | ||
+ | the user wishes to log in using public key authentication. | ||
+ | | ||
+ | | ||
+ | |||
+ | | ||
+ | | ||
+ | file should be added to ~/ | ||
+ | in using RSA authentication. | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | a passphrase when generating the key; that passphrase will be used to encrypt the private | ||
+ | part of this file using 128-bit AES. This file is not automatically accessed by ssh-keygen | ||
+ | but it is offered as the default file for the private key. | ||
+ | a login attempt is made. | ||
+ | |||
+ | ~/.ssh/id_dsa.pub | ||
+ | ~/.ssh/id_ecdsa.pub | ||
+ | ~/.ssh/ | ||
+ | | ||
+ | | ||
+ | The contents of this file should be added to ~/ | ||
+ | the user wishes to log in using public key authentication. | ||
+ | | ||
+ | |||
+ | / | ||
+ | | ||
+ | |||
+ | ENVIRONMENT | ||
+ | | ||
+ | The reseeding of the OpenSSL random generator is usually done from /dev/urandom. | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | SEE ALSO | ||
+ | | ||
+ | |||
+ | The Secure Shell (SSH) Public Key File Format, RFC 4716, 2006. | ||
+ | |||
+ | AUTHORS | ||
+ | | ||
+ | bell, Bob Beck, Markus Friedl, Niels Provos, Theo de Raadt and Dug Song removed many bugs, re-added | ||
+ | newer features and created OpenSSH. | ||
+ | sions 1.5 and 2.0. | ||
+ | |||
+ | BSD | ||
+ | </ | ||
+ | |||
+ | Bevor wir uns die Entscheidung treffen können, welchen Schlüssel-Typ wir erzeugen wollen, müssen wir überlegen, von welchem System wir aus auf unseren Linux/ | ||
+ | |||
+ | Hier empfiehlt es sich auf den beteiligten System zu überprüfen, | ||
+ | |||
+ | === Liste der unterstützten Cipher | ||
+ | # ssh -Q cipher | ||
+ | < | ||
+ | blowfish-cbc | ||
+ | cast128-cbc | ||
+ | arcfour | ||
+ | arcfour128 | ||
+ | arcfour256 | ||
+ | aes128-cbc | ||
+ | aes192-cbc | ||
+ | aes256-cbc | ||
+ | rijndael-cbc@lysator.liu.se | ||
+ | aes128-ctr | ||
+ | aes192-ctr | ||
+ | aes256-ctr | ||
+ | aes128-gcm@openssh.com | ||
+ | aes256-gcm@openssh.com | ||
+ | chacha20-poly1305@openssh.com</ | ||
+ | |||
+ | === Liste der unterstützten MACs === | ||
+ | # ssh -Q mac | ||
+ | < | ||
+ | hmac-sha1-96 | ||
+ | hmac-sha2-256 | ||
+ | hmac-sha2-512 | ||
+ | hmac-md5 | ||
+ | hmac-md5-96 | ||
+ | hmac-ripemd160 | ||
+ | hmac-ripemd160@openssh.com | ||
+ | umac-64@openssh.com | ||
+ | umac-128@openssh.com | ||
+ | hmac-sha1-etm@openssh.com | ||
+ | hmac-sha1-96-etm@openssh.com | ||
+ | hmac-sha2-256-etm@openssh.com | ||
+ | hmac-sha2-512-etm@openssh.com | ||
+ | hmac-md5-etm@openssh.com | ||
+ | hmac-md5-96-etm@openssh.com | ||
+ | hmac-ripemd160-etm@openssh.com | ||
+ | umac-64-etm@openssh.com | ||
+ | umac-128-etm@openssh.com</ | ||
+ | |||
+ | === Liste der unterstützten Schlüssel Typen ==== | ||
+ | # ssh -Q key | ||
+ | < | ||
+ | ssh-dss | ||
+ | ssh-ed25519 | ||
+ | ecdsa-sha2-nistp256 | ||
+ | ecdsa-sha2-nistp384 | ||
+ | ecdsa-sha2-nistp521 | ||
+ | ssh-rsa-cert-v01@openssh.com | ||
+ | ssh-dss-cert-v01@openssh.com | ||
+ | ecdsa-sha2-nistp256-cert-v01@openssh.com | ||
+ | ecdsa-sha2-nistp384-cert-v01@openssh.com | ||
+ | ecdsa-sha2-nistp521-cert-v01@openssh.com | ||
+ | ssh-rsa-cert-v00@openssh.com | ||
+ | ssh-dss-cert-v00@openssh.com | ||
+ | ssh-ed25519-cert-v01@openssh.com | ||
+ | null</ | ||
+ | |||
+ | === Liste alller unterstützten Key Exchange Algorithmen === | ||
+ | # ssh -Q kex | ||
+ | < | ||
+ | diffie-hellman-group14-sha1 | ||
+ | diffie-hellman-group-exchange-sha1 | ||
+ | diffie-hellman-group-exchange-sha256 | ||
+ | ecdh-sha2-nistp256 | ||
+ | ecdh-sha2-nistp384 | ||
+ | ecdh-sha2-nistp521 | ||
+ | diffie-hellman-group1-sha1 | ||
+ | curve25519-sha256@libssh.org | ||
+ | gss-gex-sha1- | ||
+ | gss-group1-sha1- | ||
+ | gss-group14-sha1-</ | ||
+ | |||
+ | |||
+ | ==== Erzeugung eines Schlüsselpäärchens | ||
+ | === RSA Key === | ||
+ | Im ersten Beispiel | ||
+ | $ ssh-keygen -b 4096 -t rsa -C django@nausch.org -f ~/ | ||
+ | |||
+ | < | ||
Enter passphrase (empty for no passphrase): | Enter passphrase (empty for no passphrase): | ||
Enter same passphrase again: | Enter same passphrase again: | ||
- | Your identification has been saved in / | + | Your identification has been saved in / |
- | Your public key has been saved in / | + | Your public key has been saved in / |
The key fingerprint is: | The key fingerprint is: | ||
- | 2b:83:69:f2:76:e8:c9:8b:cf:34:c8:c2:ae:2b:e1:ee django@host.nausch.org</ | + | 44:8b:1a:4b:87:95:3a:23:af:65:b7:e6:1a:bf:98:3d django@nausch.org |
+ | The key's randomart image is: | ||
+ | +--[ RSA 4096]----+ | ||
+ | | ... | | ||
+ | | o.o . | | ||
+ | | +.o o | | ||
+ | | ..+= . | | ||
+ | | | ||
+ | | + . | | ||
+ | | +.. . | | ||
+ | | . *E | | ||
+ | | ++=o | | ||
+ | +-----------------+</ | ||
- | $ ssh-keygen -t ed25519 -o -a 100 -C django@nausch.org -f ~/ | ||
+ | Die // | ||
+ | Nun liegen in dem Verzeichnis **/ | ||
+ | # ll ~/ | ||
+ | < | ||
+ | -rw-r--r--. 1 django django | ||
+ | |||
+ | **id_rsa4096_dmz** enthält den privaten Schlüssel und sollte auf keinen Fall weitergegeben werden und darf auch __nur__ für den Nutzer selbst lesbar sein! **id_rsa4096_dmz.pub**, | ||
+ | |||
+ | === ED25519 Key === | ||
+ | Ob man in Zeiten von Überwachungsphantasten bei einer NSA oder BND, noch solhcen Schlüssel einsetzen kann und mag, muss natürlich jeder Admin für sich sekbst entscheiden. Auf solche Schlüssel muss man aber nicht mehr zwingend zurückgreifen, | ||
+ | $ ssh-keygen -t ed25519 -o -a 100 -C django@nausch.org -f ~/ | ||
+ | |||
+ | < | ||
+ | Enter passphrase (empty for no passphrase): | ||
+ | Enter same passphrase again: | ||
+ | Your identification has been saved in / | ||
+ | Your public key has been saved in / | ||
+ | The key fingerprint is: | ||
+ | a3: | ||
+ | The key's randomart image is: | ||
+ | +--[ED25519 | ||
+ | | *o | | ||
+ | | o + +. | | ||
+ | | + = o | | ||
+ | | * o | | ||
+ | | + . S | | ||
+ | | + = o | | ||
+ | | = + | | ||
+ | | Eo o | | ||
+ | | ...o . | | ||
+ | +-----------------+</ | ||
Die // | Die // | ||
- | Nun liegen in dem Verzeichnis **/ | + | Nun liegen in dem Verzeichnis **/ |
- | < | + | # ll ~/.ssh/*ed25519* |
- | insgesamt 24 | + | < |
- | -rw------- 1 django django | + | -rw-r--r--. 1 django django |
- | -rw-r--r-- 1 django django | + | |
- | **id_rsa** enthält den privaten Schlüssel und sollte auf keinen Fall weitergegeben werden und darf auch __nur__ für den Nutzer selbst lesbar sein! **id_rsa.pub**, der öffentliche Schlüssel, dagegen muss auf den Zielrechner kopiert werden. | + | **id_ed25519_dmz** enthält den privaten Schlüssel und sollte auf keinen Fall weitergegeben werden und darf auch __nur__ für den Nutzer selbst lesbar sein! **id_ed25519_dmz.pub**, der öffentliche Schlüssel, dagegen muss auf den Zielrechner kopiert werden. |
==== Zielverzeichnis anlegen und öffentlichen Schlüssel kopieren | ==== Zielverzeichnis anlegen und öffentlichen Schlüssel kopieren | ||
Auf dem Zielrechner legen wir nun das Verzeichnis **.ssh** an und schützen es entsprechend. | Auf dem Zielrechner legen wir nun das Verzeichnis **.ssh** an und schützen es entsprechend. | ||
Zeile 1040: | Zeile 1684: | ||
[django@zielhost django]$ chmod 700 .ssh | [django@zielhost django]$ chmod 700 .ssh | ||
- | Den öffentlichen Schlüssel kopieren wir dann wie folgt auf das Zielsystem: | + | Den öffentlichen Schlüssel kopieren wir dann wie folgt auf das Zielsystem; hatten wir uns einen RSA-key erstellt verwenden wir folgenden Aufruf: |
- | | + | $ scp /home/django/.ssh/ |
+ | bzw. bei einem ed25519 Schlüssel: | ||
+ | $ scp / | ||
- | Anschließend | + | Anschliessend |
- | | + | |
Zu guter Letzt passen wir noch die Berechtigungen an und löschen die nicht mehr benötigte **id_rsa.pub** | Zu guter Letzt passen wir noch die Berechtigungen an und löschen die nicht mehr benötigte **id_rsa.pub** | ||
- | [django@zielhost .ssh]$ chmod 600 authorized_keys | + | $ chmod 600 authorized_keys |
- | | + | |
<WRAP round info>Das Kopieren des Public-Keys auf unseren Zielhost mit Anpassen der Dateiberechtigungen kann man natürlich auch einfacher vornehmen. Man benutzt hierzu einfach den Befehl **ssh-copy-id** aus dem Paket // | <WRAP round info>Das Kopieren des Public-Keys auf unseren Zielhost mit Anpassen der Dateiberechtigungen kann man natürlich auch einfacher vornehmen. Man benutzt hierzu einfach den Befehl **ssh-copy-id** aus dem Paket // | ||
- | $ ssh-copy-id -i ~/ | + | * RSA-Key < |
+ | * ed25519-Key < | ||
- | Die Angabe '' | + | Mit der Angabe '' |
- | '' | + | |
</ | </ | ||
==== authorized_keys vs. authorized_keys2 ==== | ==== authorized_keys vs. authorized_keys2 ==== | ||
<WRAP round tip>Bei der Einführung von SSH Version 2 kam die Datei '' | <WRAP round tip>Bei der Einführung von SSH Version 2 kam die Datei '' | ||
+ | |||
===== ssh-Daemon ===== | ===== ssh-Daemon ===== |