From c657c2133913412f02442b2366c5580d0bc4beef Mon Sep 17 00:00:00 2001
From: Hans Nilsson To fully understand how to configure the algorithms, we must understand partly both how the ssh protocol
+ works and how the OTP SSH app handles the corresponding items The first subsection will give a short background about the ssh protocol while later sections describes
+ the implementation and provides many examples SSH uses different sets of algorithms in different phases of a session. Which
+ algorithms to use is negotiated by the client and the server at the beginning of a session.
+ See The negotiation is simple: both peers sends their list of supported alghorithms to the other part.
+ The first algorithm on the client's list that also in on the server's list is selected. So it is the
+ client's orderering of the list that gives the priority for the algorithms. There are five lists exchanged in the connection setup. Three of them are also divided in two
+ directions, to and from the server. The lists are (named as in the SSH application's options): Key exchange. An algorithm is selected for computing a secret encryption key. Among examples are:
+ the old nowadays week Server host key The asymetric encryption algorithm used in the server's private-public host key pair.
+ Examples include the well-known RSA Symetric cipher algorithm used for the message encryption. This algorithm will use the key calculated
+ in the kex phase (together with other info) to genereate the actual key used. Examples are
+ tripple-DES This list is actually two - one for each direction server-to-client and client-to-server. Therefore it
+ is possible but rare to have different algorithms in the two directions in one connection. Message authentication code "Check sum" of each message sent between the peers. Examples are SHA This list is also divided into two for the both directions If and how to compress the message. Examples are This list is also divided into two for the both directions The set of algorithms that the SSH app uses by default depends on the algoritms supported by the: The cryptolib OTP is linked with, usally the one the OS uses, probably OpenSSL, and finaly what the SSH app implements Due to this, it impossible to list in documentation what algorithms that are available in a certain installation. There is an important commands to list the actual algorithms and their ordering:
+ To change this listing, there are two options which can be used in
+ The options are See the Here follows a series of examples ranging from simple to more complex. The experimental function Replace the kex algorithms list with the single algorithm Note that the unmentioned lists ( In the lists that are divided in two for the two directions (c.f Note that both lists in In the lists that are divided in two for the two directions (c.f It is of course possible to change more than one list: Note that the ordering of the tuples in the lists didn't matter. The option To facilitate addition or removal of algorithms the option The option takes a list with instructions to append, prepend or remove algorithms: Each of the As an example let's add the Diffie-Hellman Group1 first in the kex list. It is supported according to
+ And the result shows that the Diffie-Hellman Group1 is added at the head of the kex list In next example, we also move the Note that the appended algorithm is removed from its original place and then appended. In next example, we also move the Note that the appended algorithm first is removed from its original place and then appended. In this example, we use both options ( It is of course questionable why anyone would like to use the both options together, but it is possible
+ if the needed.
+
+
+0> ssh:default_algorithms().
+[{kex,['ecdh-sha2-nistp384','ecdh-sha2-nistp521',
+ 'ecdh-sha2-nistp256','diffie-hellman-group-exchange-sha256',
+ 'diffie-hellman-group16-sha512',
+ 'diffie-hellman-group18-sha512',
+ 'diffie-hellman-group14-sha256',
+ 'diffie-hellman-group14-sha1',
+ 'diffie-hellman-group-exchange-sha1']},
+ {public_key,['ecdsa-sha2-nistp384','ecdsa-sha2-nistp521',
+ 'ecdsa-sha2-nistp256','ssh-rsa','rsa-sha2-256',
+ 'rsa-sha2-512','ssh-dss']},
+ {cipher,[{client2server,['aes256-gcm@openssh.com',
+ 'aes256-ctr','aes192-ctr','aes128-gcm@openssh.com',
+ 'aes128-ctr','aes128-cbc','3des-cbc']},
+ {server2client,['aes256-gcm@openssh.com','aes256-ctr',
+ 'aes192-ctr','aes128-gcm@openssh.com','aes128-ctr',
+ 'aes128-cbc','3des-cbc']}]},
+ {mac,[{client2server,['hmac-sha2-256','hmac-sha2-512',
+ 'hmac-sha1']},
+ {server2client,['hmac-sha2-256','hmac-sha2-512',
+ 'hmac-sha1']}]},
+ {compression,[{client2server,[none,'zlib@openssh.com',zlib]},
+ {server2client,[none,'zlib@openssh.com',zlib]}]}]
+
+
+
+1> ssh:chk_algos_opts(
+ [{preferred_algorithms,
+ [{kex, ['diffie-hellman-group14-sha256']}
+ ]
+ }
+ ]).
+[{kex,['diffie-hellman-group14-sha256']},
+ {public_key,['ecdsa-sha2-nistp384','ecdsa-sha2-nistp521',
+ 'ecdsa-sha2-nistp256','ssh-rsa','rsa-sha2-256',
+ 'rsa-sha2-512','ssh-dss']},
+ {cipher,[{client2server,['aes256-gcm@openssh.com',
+ 'aes256-ctr','aes192-ctr','aes128-gcm@openssh.com',
+ 'aes128-ctr','aes128-cbc','3des-cbc']},
+ {server2client,['aes256-gcm@openssh.com','aes256-ctr',
+ 'aes192-ctr','aes128-gcm@openssh.com','aes128-ctr',
+ 'aes128-cbc','3des-cbc']}]},
+ {mac,[{client2server,['hmac-sha2-256','hmac-sha2-512',
+ 'hmac-sha1']},
+ {server2client,['hmac-sha2-256','hmac-sha2-512',
+ 'hmac-sha1']}]},
+ {compression,[{client2server,[none,'zlib@openssh.com',zlib]},
+ {server2client,[none,'zlib@openssh.com',zlib]}]}]
+
+
+2> ssh:chk_algos_opts(
+ [{preferred_algorithms,
+ [{cipher,['aes128-ctr']}
+ ]
+ }
+ ]).
+[{kex,['ecdh-sha2-nistp384','ecdh-sha2-nistp521',
+ 'ecdh-sha2-nistp256','diffie-hellman-group-exchange-sha256',
+ 'diffie-hellman-group16-sha512',
+ 'diffie-hellman-group18-sha512',
+ 'diffie-hellman-group14-sha256',
+ 'diffie-hellman-group14-sha1',
+ 'diffie-hellman-group-exchange-sha1']},
+ {public_key,['ecdsa-sha2-nistp384','ecdsa-sha2-nistp521',
+ 'ecdsa-sha2-nistp256','ssh-rsa','rsa-sha2-256',
+ 'rsa-sha2-512','ssh-dss']},
+ {cipher,[{client2server,['aes128-ctr']},
+ {server2client,['aes128-ctr']}]},
+ {mac,[{client2server,['hmac-sha2-256','hmac-sha2-512',
+ 'hmac-sha1']},
+ {server2client,['hmac-sha2-256','hmac-sha2-512',
+ 'hmac-sha1']}]},
+ {compression,[{client2server,[none,'zlib@openssh.com',zlib]},
+ {server2client,[none,'zlib@openssh.com',zlib]}]}]
+
+
+3> ssh:chk_algos_opts(
+ [{preferred_algorithms,
+ [{cipher,[{client2server,['aes128-ctr']}]}
+ ]
+ }
+ ]).
+[{kex,['ecdh-sha2-nistp384','ecdh-sha2-nistp521',
+ 'ecdh-sha2-nistp256','diffie-hellman-group-exchange-sha256',
+ 'diffie-hellman-group16-sha512',
+ 'diffie-hellman-group18-sha512',
+ 'diffie-hellman-group14-sha256',
+ 'diffie-hellman-group14-sha1',
+ 'diffie-hellman-group-exchange-sha1']},
+ {public_key,['ecdsa-sha2-nistp384','ecdsa-sha2-nistp521',
+ 'ecdsa-sha2-nistp256','ssh-rsa','rsa-sha2-256',
+ 'rsa-sha2-512','ssh-dss']},
+ {cipher,[{client2server,['aes128-ctr']},
+ {server2client,['aes256-gcm@openssh.com','aes256-ctr',
+ 'aes192-ctr','aes128-gcm@openssh.com','aes128-ctr',
+ 'aes128-cbc','3des-cbc']}]},
+ {mac,[{client2server,['hmac-sha2-256','hmac-sha2-512',
+ 'hmac-sha1']},
+ {server2client,['hmac-sha2-256','hmac-sha2-512',
+ 'hmac-sha1']}]},
+ {compression,[{client2server,[none,'zlib@openssh.com',zlib]},
+ {server2client,[none,'zlib@openssh.com',zlib]}]}]
+
+
+4> ssh:chk_algos_opts(
+ [{preferred_algorithms,
+ [{cipher,['aes128-ctr']},
+ {mac,['hmac-sha2-256']},
+ {kex,['ecdh-sha2-nistp384']},
+ {public_key,['ssh-rsa']},
+ {compression,[{server2client,[none]},
+ {client2server,[zlib]}]}
+ ]
+ }
+ ]).
+[{kex,['ecdh-sha2-nistp384']},
+ {public_key,['ssh-rsa']},
+ {cipher,[{client2server,['aes128-ctr']},
+ {server2client,['aes128-ctr']}]},
+ {mac,[{client2server,['hmac-sha2-256']},
+ {server2client,['hmac-sha2-256']}]},
+ {compression,[{client2server,[zlib]},
+ {server2client,[none]}]}]
+
+
+
+{modify_algorithms, [{append, ...},
+ {prepend, ...},
+ {rm, ...}
+ ]}
+
+
+5> ssh:chk_algos_opts(
+ [{modify_algorithms,
+ [{prepend,
+ [{kex,['diffie-hellman-group1-sha1']}]
+ }
+ ]
+ }
+ ]).
+[{kex,['diffie-hellman-group1-sha1','ecdh-sha2-nistp384',
+ 'ecdh-sha2-nistp521','ecdh-sha2-nistp256',
+ 'diffie-hellman-group-exchange-sha256',
+ 'diffie-hellman-group16-sha512',
+ 'diffie-hellman-group18-sha512',
+ 'diffie-hellman-group14-sha256',
+ 'diffie-hellman-group14-sha1',
+ 'diffie-hellman-group-exchange-sha1']},
+ {public_key,['ecdsa-sha2-nistp384','ecdsa-sha2-nistp521',
+ 'ecdsa-sha2-nistp256','ssh-rsa','rsa-sha2-256',
+ 'rsa-sha2-512','ssh-dss']},
+ {cipher,[{client2server,['aes256-gcm@openssh.com',
+ 'aes256-ctr','aes192-ctr','aes128-gcm@openssh.com',
+ 'aes128-ctr','aes128-cbc','3des-cbc']},
+ {server2client,['aes256-gcm@openssh.com','aes256-ctr',
+ 'aes192-ctr','aes128-gcm@openssh.com','aes128-ctr',
+ 'aes128-cbc','3des-cbc']}]},
+ {mac,[{client2server,['hmac-sha2-256','hmac-sha2-512',
+ 'hmac-sha1']},
+ {server2client,['hmac-sha2-256','hmac-sha2-512',
+ 'hmac-sha1']}]},
+ {compression,[{client2server,[none,'zlib@openssh.com',zlib]},
+ {server2client,[none,'zlib@openssh.com',zlib]}]}]
+
+
+
+6> ssh:chk_algos_opts(
+ [{modify_algorithms,
+ [{prepend,
+ [{kex, ['diffie-hellman-group1-sha1']}
+ ]},
+ {append,
+ [{kex, ['ecdh-sha2-nistp521']}
+ ]}
+ ]
+ }
+ ]).
+[{kex,['diffie-hellman-group1-sha1','ecdh-sha2-nistp384',
+ 'ecdh-sha2-nistp256','diffie-hellman-group-exchange-sha256',
+ 'diffie-hellman-group16-sha512',
+ 'diffie-hellman-group18-sha512',
+ 'diffie-hellman-group14-sha256',
+ 'diffie-hellman-group14-sha1',
+ 'diffie-hellman-group-exchange-sha1','ecdh-sha2-nistp521']},
+ {public_key,['ecdsa-sha2-nistp384','ecdsa-sha2-nistp521',
+ .....
+]
+
+
+7> ssh:chk_algos_opts(
+ [{modify_algorithms,
+ [{prepend,
+ [{kex, ['diffie-hellman-group1-sha1']}
+ ]},
+ {append,
+ [{kex, ['ecdh-sha2-nistp521']}
+ ]}
+ ]
+ }
+ ]).
+[{kex,['diffie-hellman-group1-sha1','ecdh-sha2-nistp384',
+ 'ecdh-sha2-nistp256','diffie-hellman-group-exchange-sha256',
+ 'diffie-hellman-group16-sha512',
+ 'diffie-hellman-group18-sha512',
+ 'diffie-hellman-group14-sha256',
+ 'diffie-hellman-group14-sha1',
+ 'diffie-hellman-group-exchange-sha1','ecdh-sha2-nistp521']},
+ {public_key,['ecdsa-sha2-nistp384','ecdsa-sha2-nistp521',
+ .....
+]
+
+
+8> ssh:chk_algos_opts(
+ [{preferred_algorithms,
+ [{cipher,['aes128-ctr']},
+ {mac,['hmac-sha2-256']},
+ {kex,['ecdh-sha2-nistp384']},
+ {public_key,['ssh-rsa']},
+ {compression,[{server2client,[none]},
+ {client2server,[zlib]}]}
+ ]
+ },
+ {modify_algorithms,
+ [{prepend,
+ [{kex, ['some unsupported algorithm']}
+ ]},
+ {append,
+ [{kex, ['diffie-hellman-group1-sha1']}
+ ]}
+ ]
+ }
+ ]).
+[{kex,['ecdh-sha2-nistp384','diffie-hellman-group1-sha1']},
+ {public_key,['ssh-rsa']},
+ {cipher,[{client2server,['aes128-ctr']},
+ {server2client,['aes128-ctr']}]},
+ {mac,[{client2server,['hmac-sha2-256']},
+ {server2client,['hmac-sha2-256']}]},
+ {compression,[{client2server,[zlib]},
+ {server2client,[none]}]}]
+
+
+
List of algorithms to use in the algorithm negotiation. The default
For background and more examples see the
Changing the values can make a connection less secure. Do not change unless you know exactly what you are doing. If you do not understand the values then you @@ -282,6 +288,41 @@
Modifies the list of algorithms to use in the algorithm negotiation. The modifications are
+ applied after the option
The possible modifications are to:
+Append or prepend supported but not enabled algorithm(s) to the list of + algorithms.
If the wanted algorithms already are in the list of algorithms, they will first + be removed and then appended or prepended. +
+Remove (rm) one or more algorithms from the list of algorithms.
If an unsupported algorithm is in the list, it will be silently ignored
+ +Here is an example of this option:
+
+{modify_algorithms,
+ [{prepend, [{kex, ['diffie-hellman-group1-sha1']}],
+ {rm, [{compression, [none]}]}
+ ]
+}
+
+ The example specifies that:
+the old key exchange algorithm 'diffie-hellman-group1-sha1' should be + the main alternative. It will be the main alternative since it is prepened to the list
+The compression algorithm none (= no compression) is removed so compression is enforced
+For background and more examples see the
Sets the three diffie-hellman-group-exchange parameters that guides the connected server in choosing a group. @@ -555,6 +596,8 @@ for cipher but specifies the same algorithms for mac and compression in both directions. The kex (key exchange) is implicit but public_key is set explicitly.
+For background and more examples see the
Changing the values can make a connection less secure. Do not change unless you know exactly what you are doing. If you do not understand the values then you @@ -562,6 +605,41 @@
Modifies the list of algorithms to use in the algorithm negotiation. The modifications are
+ applied after the option
The possible modifications are to:
+Append or prepend supported but not enabled algorithm(s) to the list of + algorithms.
If the wanted algorithms already are in the list of algorithms, they will first + be removed and then appended or prepended. +
+Remove (rm) one or more algorithms from the list of algorithms.
If an unsupported algorithm is in the list, it will be silently ignored
+ +Here is an example of this option:
+
+{modify_algorithms,
+ [{prepend, [{kex, ['diffie-hellman-group1-sha1']}],
+ {rm, [{compression, [none]}]}
+ ]
+}
+
+ The example specifies that:
+the old key exchange algorithm 'diffie-hellman-group1-sha1' should be + the main alternative. It will be the main alternative since it is prepened to the list
+The compression algorithm none (= no compression) is removed so compression is enforced
+For background and more examples see the
Defines the groups the server may choose among when diffie-hellman-group-exchange is negotiated. diff --git a/lib/ssh/doc/src/ssh_app.xml b/lib/ssh/doc/src/ssh_app.xml index 33ec7aaee0..1cbbdfcf38 100644 --- a/lib/ssh/doc/src/ssh_app.xml +++ b/lib/ssh/doc/src/ssh_app.xml @@ -97,7 +97,7 @@
The
Supported algorithms are:
- +To fully understand how to configure the algorithms, we must understand partly both how the ssh protocol - works and how the OTP SSH app handles the corresponding items
+To fully understand how to configure the algorithms, it is essential to have a basic understanding of the SSH protocol + and how OTP SSH app handles the corresponding items
-The first subsection will give a short background about the ssh protocol while later sections describes - the implementation and provides many examples
+The first subsection will give a short background of the SSH protocol while later sections describes + the implementation and provides some examples
Symetric cipher algorithm used for the message encryption. This algorithm will use the key calculated +
Symetric cipher algorithm used for the payload encryption. This algorithm will use the key calculated
in the kex phase (together with other info) to genereate the actual key used. Examples are
tripple-DES
Due to this, it impossible to list in documentation what algorithms that are available in a certain installation.
-There is an important commands to list the actual algorithms and their ordering: +
There is an important command to list the actual algorithms and their ordering:
0> ssh:default_algorithms().
@@ -143,8 +143,8 @@
{server2client,[none,'zlib@openssh.com',zlib]}]}]
- To change this listing, there are two options which can be used in
-
To change the algorithm list, there are two options which can be used in
+
Here follows a series of examples ranging from simple to more complex.
-The experimental function
To forsee the effect of an option there is an experimental function
The option
A situation where it might be useful to add an algorithm is when one need to use a supported but disabled one.
+ An example is the
The option
To facilitate addition or removal of algorithms the option
In next example, we also move the
In this example, we in put the 'diffie-hellman-group1-sha1' first and also move the
+
6> ssh:chk_algos_opts(
[{modify_algorithms,
@@ -377,46 +379,15 @@
.....
]
- Note that the appended algorithm is removed from its original place and then appended.
+Note that the appended algorithm is removed from its original place and then appended to the same list.
In next example, we also move the
-7> ssh:chk_algos_opts(
- [{modify_algorithms,
- [{prepend,
- [{kex, ['diffie-hellman-group1-sha1']}
- ]},
- {append,
- [{kex, ['ecdh-sha2-nistp521']}
- ]}
- ]
- }
- ]).
-[{kex,['diffie-hellman-group1-sha1','ecdh-sha2-nistp384',
- 'ecdh-sha2-nistp256','diffie-hellman-group-exchange-sha256',
- 'diffie-hellman-group16-sha512',
- 'diffie-hellman-group18-sha512',
- 'diffie-hellman-group14-sha256',
- 'diffie-hellman-group14-sha1',
- 'diffie-hellman-group-exchange-sha1','ecdh-sha2-nistp521']},
- {public_key,['ecdsa-sha2-nistp384','ecdsa-sha2-nistp521',
- .....
-]
-
- Note that the appended algorithm first is removed from its original place and then appended.
-In this example, we use both options (
-8> ssh:chk_algos_opts(
+7> ssh:chk_algos_opts(
[{preferred_algorithms,
[{cipher,['aes128-ctr']},
{mac,['hmac-sha2-256']},
@@ -446,8 +417,8 @@
{server2client,[none]}]}]
- It is of course questionable why anyone would like to use the both options together, but it is possible - if the needed.
+It is of course questionable why anyone would like to use the both these options together, + but it is possible if an unforeseen need should arise.
Modifies the list of algorithms to use in the algorithm negotiation. The modifications are
- applied after the option
The possible modifications are to:
+ applied after the optionThe algoritm for modifications works like this:
Append or prepend supported but not enabled algorithm(s) to the list of - algorithms.
If the wanted algorithms already are in the list of algorithms, they will first - be removed and then appended or prepended. -
+Input is the
The head of the
The possible modifications are:
+Append or prepend supported but not enabled algorithm(s) to the list of
+ algorithms. If the wanted algorithms already are in
Remove (rm) one or more algorithms from
Repeat the modification step with the tail of
Remove (rm) one or more algorithms from the list of algorithms.
If an unsupported algorithm is in the list, it will be silently ignored
- +If an unsupported algorithm is in the
If there are more than one modify_algorithms options, the result is undefined.
Here is an example of this option:
{modify_algorithms,
--
cgit v1.2.3