author | Jan Parcel <jan.parcel@oracle.com> |
Mon, 01 Feb 2016 06:53:50 -0800 | |
changeset 5376 | 4615bc2f4a50 |
parent 5310 | a06a01eef195 |
child 5819 | c5f05bd2a9bc |
permissions | -rw-r--r-- |
5310
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
1 |
# |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
2 |
# Dynamically set FIPS mode, when underlying libcrypto is FIPS capable. |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
3 |
# Limit ciphers and MACs in algorithm negotiation proposal. |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
4 |
# |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
5 |
# This patch is unlikely to be accepted upstream. |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
6 |
# |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
7 |
diff -pur old/cipher.c new/cipher.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
8 |
--- old/cipher.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
9 |
+++ new/cipher.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
10 |
@@ -77,7 +77,34 @@ struct sshcipher { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
11 |
#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
12 |
}; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
13 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
14 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
15 |
+/* in FIPS mode limit ciphers to FIPS compliant only */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
16 |
+#define ciphers (ssh_FIPS_mode() ? ciphers_fips : ciphers_dflt) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
17 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
18 |
+static const struct sshcipher ciphers_fips[] = { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
19 |
+ { "none", SSH_CIPHER_NONE, 8, 0, 0, 0, 0, 0, EVP_enc_null }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
20 |
+ { "3des-cbc", SSH_CIPHER_SSH2, 8, 24, 0, 0, 0, 1, EVP_des_ede3_cbc }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
21 |
+ { "aes128-cbc", SSH_CIPHER_SSH2, 16, 16, 0, 0, 0, 1, EVP_aes_128_cbc }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
22 |
+ { "aes192-cbc", SSH_CIPHER_SSH2, 16, 24, 0, 0, 0, 1, EVP_aes_192_cbc }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
23 |
+ { "aes256-cbc", SSH_CIPHER_SSH2, 16, 32, 0, 0, 0, 1, EVP_aes_256_cbc }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
24 |
+ { "[email protected]", |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
25 |
+ SSH_CIPHER_SSH2, 16, 32, 0, 0, 0, 1, EVP_aes_256_cbc }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
26 |
+ { "aes128-ctr", SSH_CIPHER_SSH2, 16, 16, 0, 0, 0, 0, EVP_aes_128_ctr }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
27 |
+ { "aes192-ctr", SSH_CIPHER_SSH2, 16, 24, 0, 0, 0, 0, EVP_aes_192_ctr }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
28 |
+ { "aes256-ctr", SSH_CIPHER_SSH2, 16, 32, 0, 0, 0, 0, EVP_aes_256_ctr }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
29 |
+# ifdef OPENSSL_HAVE_EVPGCM |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
30 |
+ { "[email protected]", |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
31 |
+ SSH_CIPHER_SSH2, 16, 16, 12, 16, 0, 0, EVP_aes_128_gcm }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
32 |
+ { "[email protected]", |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
33 |
+ SSH_CIPHER_SSH2, 16, 32, 12, 16, 0, 0, EVP_aes_256_gcm }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
34 |
+# endif /* OPENSSL_HAVE_EVPGCM */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
35 |
+ { NULL, SSH_CIPHER_INVALID, 0, 0, 0, 0, 0, 0, NULL } |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
36 |
+}; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
37 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
38 |
+static const struct sshcipher ciphers_dflt[] = { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
39 |
+#else /* ENABLE_OPENSSL_FIPS */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
40 |
static const struct sshcipher ciphers[] = { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
41 |
+#endif /* ENABLE_OPENSSL_FIPS */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
42 |
#ifdef WITH_SSH1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
43 |
{ "des", SSH_CIPHER_DES, 8, 8, 0, 0, 0, 1, EVP_des_cbc }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
44 |
{ "3des", SSH_CIPHER_3DES, 8, 16, 0, 0, 0, 1, evp_ssh1_3des }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
45 |
diff -pur old/digest-openssl.c new/digest-openssl.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
46 |
--- old/digest-openssl.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
47 |
+++ new/digest-openssl.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
48 |
@@ -53,8 +53,22 @@ struct ssh_digest { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
49 |
const EVP_MD *(*mdfunc)(void); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
50 |
}; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
51 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
52 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
53 |
/* NB. Indexed directly by algorithm number */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
54 |
+const struct ssh_digest digests_fips[] = { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
55 |
+ { SSH_DIGEST_MD5, "", 16, NULL }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
56 |
+ { SSH_DIGEST_RIPEMD160, "", 20, NULL }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
57 |
+ { SSH_DIGEST_SHA1, "SHA1", 20, EVP_sha1 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
58 |
+ { SSH_DIGEST_SHA256, "SHA256", 32, EVP_sha256 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
59 |
+ { SSH_DIGEST_SHA384, "SHA384", 48, EVP_sha384 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
60 |
+ { SSH_DIGEST_SHA512, "SHA512", 64, EVP_sha512 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
61 |
+ { -1, NULL, 0, NULL }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
62 |
+}; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
63 |
+/* NB. Indexed directly by algorithm number */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
64 |
+const struct ssh_digest digests_dflt[] = { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
65 |
+#else /* ENABLE_OPENSSL_FIPS */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
66 |
const struct ssh_digest digests[] = { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
67 |
+#endif /* ENABLE_OPENSSL_FIPS */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
68 |
{ SSH_DIGEST_MD5, "MD5", 16, EVP_md5 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
69 |
{ SSH_DIGEST_RIPEMD160, "RIPEMD160", 20, EVP_ripemd160 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
70 |
{ SSH_DIGEST_SHA1, "SHA1", 20, EVP_sha1 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
71 |
@@ -67,6 +81,9 @@ const struct ssh_digest digests[] = { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
72 |
static const struct ssh_digest * |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
73 |
ssh_digest_by_alg(int alg) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
74 |
{ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
75 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
76 |
+ struct ssh_digest *digests = ssh_FIPS_mode() ? digests_fips : digests_dflt; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
77 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
78 |
if (alg < 0 || alg >= SSH_DIGEST_MAX) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
79 |
return NULL; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
80 |
if (digests[alg].id != alg) /* sanity */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
81 |
@@ -79,6 +96,9 @@ ssh_digest_by_alg(int alg) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
82 |
int |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
83 |
ssh_digest_alg_by_name(const char *name) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
84 |
{ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
85 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
86 |
+ struct ssh_digest *digests = ssh_FIPS_mode() ? digests_fips : digests_dflt; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
87 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
88 |
int alg; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
89 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
90 |
for (alg = 0; digests[alg].id != -1; alg++) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
91 |
diff -pur old/gss-genr.c new/gss-genr.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
92 |
--- old/gss-genr.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
93 |
+++ new/gss-genr.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
94 |
@@ -100,6 +100,7 @@ ssh_gssapi_kex_mechs(gss_OID_set gss_sup |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
95 |
char deroid[2]; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
96 |
const EVP_MD *evp_md = EVP_md5(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
97 |
EVP_MD_CTX md; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
98 |
+ int fips_mode; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
99 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
100 |
if (gss_enc2oid != NULL) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
101 |
for (i = 0; gss_enc2oid[i].encoded != NULL; i++) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
102 |
@@ -112,6 +113,14 @@ ssh_gssapi_kex_mechs(gss_OID_set gss_sup |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
103 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
104 |
buffer_init(&buf); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
105 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
106 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
107 |
+ fips_mode = ssh_FIPS_mode(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
108 |
+ if (fips_mode) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
109 |
+ debug3("Temporarily unsetting FIPS mode to compute MD5 for " |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
110 |
+ "GSS-API key exchange method names"); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
111 |
+ FIPS_mode_set(0); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
112 |
+ } |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
113 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
114 |
oidpos = 0; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
115 |
for (i = 0; i < gss_supported->count; i++) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
116 |
if (gss_supported->elements[i].length < 128 && |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
117 |
@@ -119,7 +128,6 @@ ssh_gssapi_kex_mechs(gss_OID_set gss_sup |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
118 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
119 |
deroid[0] = SSH_GSS_OIDTYPE; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
120 |
deroid[1] = gss_supported->elements[i].length; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
121 |
- |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
122 |
EVP_DigestInit(&md, evp_md); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
123 |
EVP_DigestUpdate(&md, deroid, 2); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
124 |
EVP_DigestUpdate(&md, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
125 |
@@ -151,6 +159,12 @@ ssh_gssapi_kex_mechs(gss_OID_set gss_sup |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
126 |
oidpos++; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
127 |
} |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
128 |
} |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
129 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
130 |
+ if (fips_mode) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
131 |
+ ssh_FIPS_mode_set_if_capable(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
132 |
+ ssh_FIPS_check_status(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
133 |
+ } |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
134 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
135 |
gss_enc2oid[oidpos].oid = NULL; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
136 |
gss_enc2oid[oidpos].encoded = NULL; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
137 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
138 |
diff -pur old/mac.c new/mac.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
139 |
--- old/mac.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
140 |
+++ new/mac.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
141 |
@@ -53,8 +53,33 @@ struct macalg { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
142 |
int len; /* just for UMAC */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
143 |
int etm; /* Encrypt-then-MAC */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
144 |
}; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
145 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
146 |
+/* in FIPS mode limit macs to FIPS compliant only */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
147 |
+#define macs (ssh_FIPS_mode() ? macs_fips : macs_dflt) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
148 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
149 |
+static const struct macalg macs_fips[] = { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
150 |
+ /* Encrypt-and-MAC (encrypt-and-authenticate) variants */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
151 |
+ { "hmac-sha1", SSH_DIGEST, SSH_DIGEST_SHA1, 0, 0, 0, 0 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
152 |
+ { "hmac-sha1-96", SSH_DIGEST, SSH_DIGEST_SHA1, 96, 0, 0, 0 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
153 |
+#ifdef HAVE_EVP_SHA256 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
154 |
+ { "hmac-sha2-256", SSH_DIGEST, SSH_DIGEST_SHA256, 0, 0, 0, 0 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
155 |
+ { "hmac-sha2-512", SSH_DIGEST, SSH_DIGEST_SHA512, 0, 0, 0, 0 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
156 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
157 |
+ /* Encrypt-then-MAC variants */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
158 |
+ { "[email protected]", SSH_DIGEST, SSH_DIGEST_SHA1, 0, 0, 0, 1 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
159 |
+ { "[email protected]", SSH_DIGEST, SSH_DIGEST_SHA1, 96, 0, 0, 1 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
160 |
+#ifdef HAVE_EVP_SHA256 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
161 |
+ { "[email protected]", SSH_DIGEST, SSH_DIGEST_SHA256, 0, 0, 0, 1 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
162 |
+ { "[email protected]", SSH_DIGEST, SSH_DIGEST_SHA512, 0, 0, 0, 1 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
163 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
164 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
165 |
+ { NULL, 0, 0, 0, 0, 0, 0 } |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
166 |
+}; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
167 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
168 |
+static const struct macalg macs_dflt[] = { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
169 |
+#else /* ENABLE_OPENSSL_FIPS */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
170 |
static const struct macalg macs[] = { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
171 |
+#endif /* ENABLE_OPENSSL_FIPS */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
172 |
/* Encrypt-and-MAC (encrypt-and-authenticate) variants */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
173 |
{ "hmac-sha1", SSH_DIGEST, SSH_DIGEST_SHA1, 0, 0, 0, 0 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
174 |
{ "hmac-sha1-96", SSH_DIGEST, SSH_DIGEST_SHA1, 96, 0, 0, 0 }, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
175 |
diff -pur old/misc.c new/misc.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
176 |
--- old/misc.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
177 |
+++ new/misc.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
178 |
@@ -38,12 +38,15 @@ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
179 |
#include <string.h> |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
180 |
#include <time.h> |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
181 |
#include <unistd.h> |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
182 |
+#include <dlfcn.h> |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
183 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
184 |
#include <netinet/in.h> |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
185 |
#include <netinet/in_systm.h> |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
186 |
#include <netinet/ip.h> |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
187 |
#include <netinet/tcp.h> |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
188 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
189 |
+#include <openssl/crypto.h> |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
190 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
191 |
#include <ctype.h> |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
192 |
#include <errno.h> |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
193 |
#include <fcntl.h> |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
194 |
@@ -77,6 +80,60 @@ chop(char *s) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
195 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
196 |
} |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
197 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
198 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
199 |
+/* is OpenSSL FIPS mode set? */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
200 |
+int |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
201 |
+ssh_FIPS_mode() |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
202 |
+{ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
203 |
+ return FIPS_mode(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
204 |
+} |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
205 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
206 |
+/* store FIPS_mode_set() err code */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
207 |
+static unsigned long ssh_FIPS_err_code = 0; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
208 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
209 |
+#define MSGBUFSIZ 1024 /* equals log.c:MSGBUFSIZ */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
210 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
211 |
+/* |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
212 |
+ * Check and display FIPS mode status. |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
213 |
+ * Called after ssh_FIPS_mode_set_if_capable() and when logging facility is |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
214 |
+ * available. |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
215 |
+ * If FIPS_mode_failed for FIPS capable libcrypto, exits with 255 code. |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
216 |
+ */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
217 |
+void |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
218 |
+ssh_FIPS_check_status() |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
219 |
+{ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
220 |
+ char ebuf[MSGBUFSIZ]; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
221 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
222 |
+ if (dlsym(RTLD_DEFAULT, "FIPS_module_mode_set") != NULL) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
223 |
+ if (ssh_FIPS_mode()) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
224 |
+ debug("Running in FIPS mode."); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
225 |
+ } else { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
226 |
+ ERR_error_string_n(ssh_FIPS_err_code, ebuf, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
227 |
+ sizeof (ebuf)); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
228 |
+ fatal("Setting FIPS mode failed! %s", ebuf); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
229 |
+ } |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
230 |
+ } else { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
231 |
+ debug3("Loaded libcrypto is not FIPS capable."); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
232 |
+ } |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
233 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
234 |
+} |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
235 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
236 |
+/* if underlying libcrypto is FIPS capable, set FIPS_mode to 1 */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
237 |
+int |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
238 |
+ssh_FIPS_mode_set_if_capable() |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
239 |
+{ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
240 |
+ /* presence of FIPS_module_mode_set indicates FIPS capable OpenSSL */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
241 |
+ if (dlsym(RTLD_DEFAULT, "FIPS_module_mode_set") != NULL) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
242 |
+ /* call the API function FIPS_mode_set*/ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
243 |
+ if (!FIPS_mode_set(1)) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
244 |
+ ssh_FIPS_err_code = ERR_get_error(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
245 |
+ return 1; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
246 |
+ } |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
247 |
+ } |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
248 |
+ return 0; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
249 |
+} |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
250 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
251 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
252 |
/* set/unset filedescriptor to non-blocking */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
253 |
int |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
254 |
set_nonblock(int fd) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
255 |
diff -pur old/misc.h new/misc.h |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
256 |
--- old/misc.h |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
257 |
+++ new/misc.h |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
258 |
@@ -38,6 +38,11 @@ struct ForwardOptions { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
259 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
260 |
char *chop(char *); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
261 |
char *strdelim(char **); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
262 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
263 |
+int ssh_FIPS_mode(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
264 |
+int ssh_FIPS_mode_set_if_capable(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
265 |
+void ssh_FIPS_check_status(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
266 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
267 |
int set_nonblock(int); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
268 |
int unset_nonblock(int); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
269 |
void set_nodelay(int); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
270 |
diff -pur old/myproposal.h new/myproposal.h |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
271 |
--- old/myproposal.h |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
272 |
+++ new/myproposal.h |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
273 |
@@ -131,6 +131,15 @@ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
274 |
CAST128 \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
275 |
"aes192-cbc,aes256-cbc,arcfour,[email protected]" |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
276 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
277 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
278 |
+#define KEX_FIPS_SERVER_ENCRYPT \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
279 |
+ "aes128-ctr,aes192-ctr,aes256-ctr" \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
280 |
+ AESGCM_CIPHER_MODES |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
281 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
282 |
+#define KEX_FIPS_CLIENT_ENCRYPT KEX_FIPS_SERVER_ENCRYPT "," \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
283 |
+ "aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc,[email protected]" |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
284 |
+#endif /* ENABLE_OPENSSL_FIPS */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
285 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
286 |
#define KEX_SERVER_MAC \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
287 |
"[email protected]," \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
288 |
"[email protected]," \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
289 |
@@ -154,6 +163,20 @@ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
290 |
"hmac-sha1-96," \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
291 |
"hmac-md5-96" |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
292 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
293 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
294 |
+#define KEX_FIPS_SERVER_MAC \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
295 |
+ "[email protected]," \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
296 |
+ "[email protected]," \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
297 |
+ "[email protected]," \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
298 |
+ "hmac-sha2-256," \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
299 |
+ "hmac-sha2-512," \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
300 |
+ "hmac-sha1" |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
301 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
302 |
+#define KEX_FIPS_CLIENT_MAC KEX_FIPS_SERVER_MAC "," \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
303 |
+ "[email protected]," \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
304 |
+ "hmac-sha1-96" |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
305 |
+#endif /* ENABLE_OPENSSL_FIPS */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
306 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
307 |
#else |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
308 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
309 |
#define KEX_SERVER_KEX \ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
310 |
diff -pur old/readconf.c new/readconf.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
311 |
--- old/readconf.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
312 |
+++ new/readconf.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
313 |
@@ -1760,6 +1760,11 @@ fill_default_options_for_canonicalizatio |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
314 |
void |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
315 |
fill_default_options(Options * options) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
316 |
{ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
317 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
318 |
+ char *encs; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
319 |
+ char *macs; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
320 |
+#endif /* ENABLE_OPENSSL_FIPS */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
321 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
322 |
if (options->forward_agent == -1) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
323 |
options->forward_agent = 0; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
324 |
if (options->forward_x11 == -1) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
325 |
@@ -1934,8 +1939,15 @@ fill_default_options(Options * options) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
326 |
options->fingerprint_hash = SSH_FP_HASH_DEFAULT; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
327 |
if (options->update_hostkeys == -1) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
328 |
options->update_hostkeys = 0; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
329 |
+#ifndef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
330 |
if (kex_assemble_names(KEX_CLIENT_ENCRYPT, &options->ciphers) != 0 || |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
331 |
kex_assemble_names(KEX_CLIENT_MAC, &options->macs) != 0 || |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
332 |
+#else |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
333 |
+ encs = ssh_FIPS_mode() ? KEX_FIPS_CLIENT_ENCRYPT : KEX_CLIENT_ENCRYPT; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
334 |
+ macs = ssh_FIPS_mode() ? KEX_FIPS_CLIENT_MAC : KEX_CLIENT_MAC; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
335 |
+ if (kex_assemble_names(encs, &options->ciphers) != 0 || |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
336 |
+ kex_assemble_names(macs, &options->macs) != 0 || |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
337 |
+#endif /* ENABLE_OPENSSL_FIPS */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
338 |
kex_assemble_names(KEX_CLIENT_KEX, &options->kex_algorithms) != 0 || |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
339 |
kex_assemble_names(KEX_DEFAULT_PK_ALG, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
340 |
&options->hostbased_key_types) != 0 || |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
341 |
diff -pur old/servconf.c new/servconf.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
342 |
--- old/servconf.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
343 |
+++ new/servconf.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
344 |
@@ -195,6 +195,10 @@ void |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
345 |
fill_default_server_options(ServerOptions *options) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
346 |
{ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
347 |
int i; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
348 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
349 |
+ char *encs; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
350 |
+ char *macs; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
351 |
+#endif /* ENABLE_OPENSSL_FIPS */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
352 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
353 |
/* Portable-specific options */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
354 |
if (options->use_pam == -1) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
355 |
@@ -382,8 +386,15 @@ fill_default_server_options(ServerOption |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
356 |
if (options->fingerprint_hash == -1) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
357 |
options->fingerprint_hash = SSH_FP_HASH_DEFAULT; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
358 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
359 |
+#ifndef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
360 |
if (kex_assemble_names(KEX_SERVER_ENCRYPT, &options->ciphers) != 0 || |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
361 |
kex_assemble_names(KEX_SERVER_MAC, &options->macs) != 0 || |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
362 |
+#else |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
363 |
+ encs = ssh_FIPS_mode() ? KEX_FIPS_SERVER_ENCRYPT : KEX_SERVER_ENCRYPT; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
364 |
+ macs = ssh_FIPS_mode() ? KEX_FIPS_SERVER_MAC : KEX_SERVER_MAC; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
365 |
+ if (kex_assemble_names(encs, &options->ciphers) != 0 || |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
366 |
+ kex_assemble_names(macs, &options->macs) != 0 || |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
367 |
+#endif /* ENABLE_OPENSSL_FIPS */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
368 |
kex_assemble_names(KEX_SERVER_KEX, &options->kex_algorithms) != 0 || |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
369 |
kex_assemble_names(KEX_DEFAULT_PK_ALG, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
370 |
&options->hostbased_key_types) != 0 || |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
371 |
diff -pur old/ssh-add.1 new/ssh-add.1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
372 |
--- old/ssh-add.1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
373 |
+++ new/ssh-add.1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
374 |
@@ -114,6 +114,8 @@ and |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
375 |
.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
376 |
The default is |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
377 |
.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
378 |
+If OpenSSL is running in FIPS-140 mode, the only supported option is |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
379 |
+.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
380 |
.It Fl e Ar pkcs11 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
381 |
Remove keys provided by the PKCS#11 shared library |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
382 |
.Ar pkcs11 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
383 |
diff -pur old/ssh-add.c new/ssh-add.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
384 |
--- old/ssh-add.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
385 |
+++ new/ssh-add.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
386 |
@@ -493,6 +493,12 @@ main(int argc, char **argv) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
387 |
__progname = ssh_get_progname(argv[0]); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
388 |
seed_rng(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
389 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
390 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
391 |
+ if (ssh_FIPS_mode_set_if_capable()) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
392 |
+ fprintf(stderr, "Setting FIPS mode failed!"); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
393 |
+ exit(1); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
394 |
+ } |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
395 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
396 |
#ifdef WITH_OPENSSL |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
397 |
OpenSSL_add_all_algorithms(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
398 |
#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
399 |
diff -pur old/ssh-agent.1 new/ssh-agent.1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
400 |
--- old/ssh-agent.1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
401 |
+++ new/ssh-agent.1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
402 |
@@ -110,6 +110,8 @@ and |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
403 |
.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
404 |
The default is |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
405 |
.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
406 |
+If OpenSSL is running in FIPS-140 mode, the only supported option is |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
407 |
+.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
408 |
.It Fl k |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
409 |
Kill the current agent (given by the |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
410 |
.Ev SSH_AGENT_PID |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
411 |
diff -pur old/ssh-agent.c new/ssh-agent.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
412 |
--- old/ssh-agent.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
413 |
+++ new/ssh-agent.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
414 |
@@ -1187,6 +1187,7 @@ main(int ac, char **av) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
415 |
struct timeval *tvp = NULL; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
416 |
size_t len; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
417 |
mode_t prev_mask; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
418 |
+ int fips_err; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
419 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
420 |
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
421 |
sanitise_stdfd(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
422 |
@@ -1200,6 +1201,9 @@ main(int ac, char **av) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
423 |
prctl(PR_SET_DUMPABLE, 0); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
424 |
#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
425 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
426 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
427 |
+ fips_err = ssh_FIPS_mode_set_if_capable(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
428 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
429 |
#ifdef WITH_OPENSSL |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
430 |
OpenSSL_add_all_algorithms(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
431 |
#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
432 |
@@ -1330,7 +1334,18 @@ main(int ac, char **av) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
433 |
printf(format, SSH_AUTHSOCKET_ENV_NAME, socket_name, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
434 |
SSH_AUTHSOCKET_ENV_NAME); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
435 |
printf("echo Agent pid %ld;\n", (long)parent_pid); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
436 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
437 |
+ ssh_FIPS_check_status(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
438 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
439 |
goto skip; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
440 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
441 |
+ } else { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
442 |
+ /* we still need to error out on FIPS_mode_set failure */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
443 |
+ if (fips_err) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
444 |
+ fprintf(stderr, "Setting FIPS mode failed!"); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
445 |
+ cleanup_exit(1); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
446 |
+ } |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
447 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
448 |
} |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
449 |
pid = fork(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
450 |
if (pid == -1) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
451 |
diff -pur old/ssh-keygen.1 new/ssh-keygen.1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
452 |
--- old/ssh-keygen.1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
453 |
+++ new/ssh-keygen.1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
454 |
@@ -268,6 +268,8 @@ and |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
455 |
.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
456 |
The default is |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
457 |
.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
458 |
+If OpenSSL is running in FIPS-140 mode, the only supported option is |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
459 |
+.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
460 |
.It Fl e |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
461 |
This option will read a private or public OpenSSH key file and |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
462 |
print to stdout the key in one of the formats specified by the |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
463 |
diff -pur old/ssh-keygen.c new/ssh-keygen.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
464 |
--- old/ssh-keygen.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
465 |
+++ new/ssh-keygen.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
466 |
@@ -2224,11 +2224,18 @@ main(int argc, char **argv) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
467 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
468 |
__progname = ssh_get_progname(argv[0]); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
469 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
470 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
471 |
+ ssh_FIPS_mode_set_if_capable(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
472 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
473 |
#ifdef WITH_OPENSSL |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
474 |
OpenSSL_add_all_algorithms(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
475 |
#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
476 |
log_init(argv[0], SYSLOG_LEVEL_INFO, SYSLOG_FACILITY_USER, 1); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
477 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
478 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
479 |
+ ssh_FIPS_check_status(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
480 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
481 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
482 |
seed_rng(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
483 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
484 |
/* we need this for the home * directory. */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
485 |
diff -pur old/ssh-keysign.c new/ssh-keysign.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
486 |
--- old/ssh-keysign.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
487 |
+++ new/ssh-keysign.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
488 |
@@ -175,6 +175,7 @@ main(int argc, char **argv) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
489 |
u_char *signature, *data, rver; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
490 |
char *host, *fp; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
491 |
size_t slen, dlen; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
492 |
+ int fips_err; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
493 |
#ifdef WITH_OPENSSL |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
494 |
u_int32_t rnd[256]; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
495 |
#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
496 |
@@ -223,6 +224,16 @@ main(int argc, char **argv) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
497 |
if (found == 0) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
498 |
fatal("could not open any host key"); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
499 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
500 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
501 |
+ fips_err = ssh_FIPS_mode_set_if_capable(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
502 |
+#ifdef DEBUG_SSH_KEYSIGN |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
503 |
+ ssh_FIPS_check_status(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
504 |
+#else |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
505 |
+ /* we still need to error out on FIPS_mode_set failure */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
506 |
+ if (fips_err) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
507 |
+ fatal("Setting FIPS mode failed!"); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
508 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
509 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
510 |
#ifdef WITH_OPENSSL |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
511 |
OpenSSL_add_all_algorithms(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
512 |
arc4random_buf(rnd, sizeof(rnd)); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
513 |
diff -pur old/ssh.1 new/ssh.1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
514 |
--- old/ssh.1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
515 |
+++ new/ssh.1 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
516 |
@@ -92,6 +92,9 @@ If |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
517 |
is specified, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
518 |
it is executed on the remote host instead of a login shell. |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
519 |
.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
520 |
+If ssh links with FIPS-capable OpenSSL, ssh runs in FIPS-140 mode. |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
521 |
+In FIPS-140 mode non-FIPS approved ciphers, MACs and digests are disabled. |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
522 |
+.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
523 |
The options are as follows: |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
524 |
.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
525 |
.Bl -tag -width Ds -compact |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
526 |
diff -pur old/ssh.c new/ssh.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
527 |
--- old/ssh.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
528 |
+++ new/ssh.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
529 |
@@ -588,6 +588,11 @@ main(int ac, char **av) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
530 |
*/ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
531 |
initialize_options(&options); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
532 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
533 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
534 |
+ /* determine FIPS mode early to limit ciphers and macs */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
535 |
+ ssh_FIPS_mode_set_if_capable(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
536 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
537 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
538 |
/* Parse command-line arguments. */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
539 |
host = NULL; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
540 |
use_syslog = 0; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
541 |
@@ -997,6 +1002,10 @@ main(int ac, char **av) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
542 |
#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
543 |
); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
544 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
545 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
546 |
+ ssh_FIPS_check_status(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
547 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
548 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
549 |
/* Parse the configuration files */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
550 |
process_config_files(host_arg, pw, 0); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
551 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
552 |
diff -pur old/ssh_api.c new/ssh_api.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
553 |
--- old/ssh_api.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
554 |
+++ new/ssh_api.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
555 |
@@ -81,6 +81,10 @@ ssh_init(struct ssh **sshp, int is_serve |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
556 |
int r; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
557 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
558 |
if (!called) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
559 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
560 |
+ ssh_FIPS_mode_set_if_capable(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
561 |
+ ssh_FIPS_check_status(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
562 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
563 |
#ifdef WITH_OPENSSL |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
564 |
OpenSSL_add_all_algorithms(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
565 |
#endif /* WITH_OPENSSL */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
566 |
diff -pur old/ssh_config.5 new/ssh_config.5 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
567 |
--- old/ssh_config.5 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
568 |
+++ new/ssh_config.5 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
569 |
@@ -423,6 +423,13 @@ aes128-cbc,3des-cbc,blowfish-cbc,cast128 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
570 |
aes192-cbc,aes256-cbc,arcfour |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
571 |
.Ed |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
572 |
.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
573 |
+The following ciphers are FIPS-140 approved and are supported in FIPS-140 mode: |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
574 |
+.Bd -literal -offset indent |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
575 |
+aes128-ctr,aes192-ctr,aes256-ctr, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
576 |
[email protected],[email protected], |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
577 |
+aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
578 |
+.Ed |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
579 |
+.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
580 |
The list of available ciphers may also be obtained using the |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
581 |
.Fl Q |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
582 |
option of |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
583 |
@@ -662,6 +669,8 @@ and |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
584 |
.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
585 |
The default is |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
586 |
.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
587 |
+In FIPS-140 mode the only supported option is |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
588 |
+.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
589 |
.It Cm ForwardAgent |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
590 |
Specifies whether the connection to the authentication agent (if any) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
591 |
will be forwarded to the remote machine. |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
592 |
@@ -1110,6 +1119,16 @@ hmac-md5,hmac-sha1,hmac-ripemd160, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
593 |
hmac-sha1-96,hmac-md5-96 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
594 |
.Ed |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
595 |
.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
596 |
+The following MACs are FIPS-140 approved and are supported in FIPS-140 mode: |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
597 |
+.Bd -literal -offset indent |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
598 |
[email protected], |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
599 |
[email protected], |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
600 |
+hmac-sha2-256,hmac-sha2-512, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
601 |
[email protected], |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
602 |
[email protected] |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
603 |
+hmac-sha1,hmac-sha1-96 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
604 |
+.Ed |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
605 |
+.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
606 |
The list of available MAC algorithms may also be obtained using the |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
607 |
.Fl Q |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
608 |
option of |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
609 |
diff -pur old/sshconnect.c new/sshconnect.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
610 |
--- old/sshconnect.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
611 |
+++ new/sshconnect.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
612 |
@@ -523,8 +523,14 @@ send_client_banner(int connection_out, i |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
613 |
{ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
614 |
/* Send our own protocol version identification. */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
615 |
if (compat20) { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
616 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
617 |
+ xasprintf(&client_version_string, "SSH-%d.%d-%.100s%s\r\n", |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
618 |
+ PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
619 |
+ ssh_FIPS_mode() ? " FIPS" : ""); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
620 |
+#else |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
621 |
xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n", |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
622 |
PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
623 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
624 |
} else { |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
625 |
xasprintf(&client_version_string, "SSH-%d.%d-%.100s\n", |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
626 |
PROTOCOL_MAJOR_1, minor1, SSH_VERSION); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
627 |
diff -pur old/sshd.8 new/sshd.8 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
628 |
--- old/sshd.8 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
629 |
+++ new/sshd.8 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
630 |
@@ -86,6 +86,9 @@ rereads its configuration file when it r |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
631 |
by executing itself with the name and options it was started with, e.g.\& |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
632 |
.Pa /usr/sbin/sshd . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
633 |
.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
634 |
+If sshd links with FIPS-capable OpenSSL, sshd runs in FIPS-140 mode. |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
635 |
+In FIPS-140 mode non-FIPS approved ciphers, MACs and digests are disabled. |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
636 |
+.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
637 |
The options are as follows: |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
638 |
.Bl -tag -width Ds |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
639 |
.It Fl 4 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
640 |
diff -pur old/sshd.c new/sshd.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
641 |
--- old/sshd.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
642 |
+++ new/sshd.c |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
643 |
@@ -431,10 +431,18 @@ sshd_exchange_identification(int sock_in |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
644 |
minor = PROTOCOL_MINOR_1; |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
645 |
} |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
646 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
647 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
648 |
+ xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s%s", |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
649 |
+ major, minor, SSH_VERSION, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
650 |
+ ssh_FIPS_mode() ? " FIPS" : " ", |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
651 |
+ *options.version_addendum == '\0' ? "" : " ", |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
652 |
+ options.version_addendum, newline); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
653 |
+#else |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
654 |
xasprintf(&server_version_string, "SSH-%d.%d-%.100s%s%s%s", |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
655 |
major, minor, SSH_VERSION, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
656 |
*options.version_addendum == '\0' ? "" : " ", |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
657 |
options.version_addendum, newline); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
658 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
659 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
660 |
/* Send our protocol version identification. */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
661 |
if (roaming_atomicio(vwrite, sock_out, server_version_string, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
662 |
@@ -1501,6 +1509,10 @@ main(int ac, char **av) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
663 |
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
664 |
sanitise_stdfd(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
665 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
666 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
667 |
+ ssh_FIPS_mode_set_if_capable(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
668 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
669 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
670 |
/* Initialize configuration options to their default values. */ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
671 |
initialize_server_options(&options); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
672 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
673 |
@@ -1653,6 +1665,10 @@ main(int ac, char **av) |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
674 |
SYSLOG_FACILITY_AUTH : options.log_facility, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
675 |
log_stderr || !inetd_flag); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
676 |
|
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
677 |
+#ifdef ENABLE_OPENSSL_FIPS |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
678 |
+ ssh_FIPS_check_status(); |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
679 |
+#endif |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
680 |
+ |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
681 |
/* |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
682 |
* Unset KRB5CCNAME, otherwise the user's session may inherit it from |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
683 |
* root's environment |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
684 |
diff -pur old/sshd_config.5 new/sshd_config.5 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
685 |
--- old/sshd_config.5 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
686 |
+++ new/sshd_config.5 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
687 |
@@ -481,6 +481,13 @@ aes128-ctr,aes192-ctr,aes256-ctr, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
688 |
[email protected],[email protected] |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
689 |
.Ed |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
690 |
.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
691 |
+The following ciphers are FIPS-140 approved and are supported in FIPS-140 mode: |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
692 |
+.Bd -literal -offset indent |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
693 |
+aes128-ctr,aes192-ctr,aes256-ctr, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
694 |
[email protected],[email protected], |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
695 |
+aes128-cbc,3des-cbc,aes192-cbc,aes256-cbc |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
696 |
+.Ed |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
697 |
+.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
698 |
The list of available ciphers may also be obtained using the |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
699 |
.Fl Q |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
700 |
option of |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
701 |
@@ -577,6 +584,8 @@ and |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
702 |
.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
703 |
The default is |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
704 |
.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
705 |
+In FIPS-140 mode the only supported option is |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
706 |
+.Dq sha256 . |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
707 |
.It Cm ForceCommand |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
708 |
Forces the execution of the command specified by |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
709 |
.Cm ForceCommand , |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
710 |
@@ -1023,6 +1032,16 @@ [email protected],[email protected] |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
711 |
hmac-sha2-256,hmac-sha2-512 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
712 |
.Ed |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
713 |
.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
714 |
+The following MACs are FIPS-140 approved and are supported in FIPS-140 mode: |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
715 |
+.Bd -literal -offset indent |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
716 |
[email protected], |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
717 |
[email protected], |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
718 |
+hmac-sha2-256,hmac-sha2-512, |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
719 |
[email protected], |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
720 |
[email protected] |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
721 |
+hmac-sha1,hmac-sha1-96 |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
722 |
+.Ed |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
723 |
+.Pp |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
724 |
The list of available MAC algorithms may also be obtained using the |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
725 |
.Fl Q |
a06a01eef195
22051483 Dynamically enabling FIPS mode in OpenSSH
Tomas Kuthan <tomas.kuthan@oracle.com>
parents:
diff
changeset
|
726 |
option of |