Mercurial > prosody-hg
annotate util/tlsref.lua @ 14218:926f25af2ffe 13.0
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Previously we embedded this data directly into core.certmanager. This splits
it out, for various benefits:
- Removes data from the business logic (the config parsing is complex enough
as it is)
- Allows easier testing and tracking of the data (this commit adds various
consistency checks, so that we can have more confidence in future updates
to the data not breaking stuff)
This library also supports multiple versions of the recommendations.
Previously we picked a single version, and put that into certmanager. But this
meant we had to make choices for our users, and one of the choices is between
advancing security standards and ensuring we don't break connectivity for
people doing minor upgrades (deterring people from performing minor upgrades
would have a security impact too).
This library supports the concept of a "default" and a "latest" version, so we
are now free to add new versions into stable releases, and admins can pick
between compatibility and security.
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 12 Jun 2026 13:01:56 +0100 |
| parents | |
| children | ad7f7b5f4792 |
| rev | line source |
|---|---|
|
14218
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 local array = require "prosody.util.array"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 local it = require "prosody.util.iterators"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 local version_compare = require "prosody.util.human.io".simple_version_compare; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 local latest_version = "6.0" |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 local default_version = "5.7"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 local default_profile = "intermediate"; -- should exist in all profiles |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 -- https://datatracker.ietf.org/doc/html/rfc7919#appendix-A.1 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 local ffdhe2048 = [[ |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 -----BEGIN DH PARAMETERS----- |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 MIIBCAKCAQEA//////////+t+FRYortKmq/cViAnPTzx2LnFg84tNpWp4TZBFGQz |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 +8yTnc4kmz75fS/jY2MMddj2gbICrsRhetPfHtXV/WVhJDP1H18GbtCFY2VVPe0a |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 87VXE15/V8k1mE8McODmi3fipona8+/och3xWKE2rec1MKzKT0g6eXq8CrGCsyT7 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 YdEIqUuyyOP7uWrat2DX9GgdT0Kj3jlN9K5W7edjcrsZCwenyO4KbXCeAvzhzffi |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
16 7MA0BM0oNC9hkXL+nOmFg/+OTxIy7vKBg8P+OxtMb61zO7X8vC7CIAXFjvGDfRaD |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
17 ssbzSibBsu/6iGtCOGEoXJf//////////wIBAg== |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
18 -----END DH PARAMETERS----- |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 ]]; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 local profiles = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 -- https://wiki.mozilla.org/Security/Server_Side_TLS |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 ["6.0"] = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
24 -- Version 6.0 as of 2026-04-08 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 modern = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
26 protocol = "tlsv1_3"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
27 options = { cipher_server_preference = false }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
28 ciphers = "DEFAULT"; -- TLS 1.3 uses 'ciphersuites' rather than these |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
29 curveslist = { "X25519MLKEM768"; "X25519"; "prime256v1"; "secp384r1" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 ciphersuites = { "TLS_AES_128_GCM_SHA256"; "TLS_AES_256_GCM_SHA384"; "TLS_CHACHA20_POLY1305_SHA256" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
31 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
32 intermediate = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
33 protocol = "tlsv1_2+"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
34 dhparam = ffdhe2048; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
35 options = { cipher_server_preference = false }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
36 ciphers = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
37 "ECDHE-ECDSA-AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
38 "ECDHE-RSA-AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
39 "ECDHE-ECDSA-AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
40 "ECDHE-RSA-AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
41 "ECDHE-ECDSA-CHACHA20-POLY1305"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
42 "ECDHE-RSA-CHACHA20-POLY1305"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
43 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
44 curveslist = { "X25519MLKEM768"; "X25519"; "prime256v1"; "secp384r1" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
45 ciphersuites = { "TLS_AES_128_GCM_SHA256"; "TLS_AES_256_GCM_SHA384"; "TLS_CHACHA20_POLY1305_SHA256" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
46 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
47 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
48 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
49 ["5.8"] = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
50 -- Version 5.8 as of 2026-04-08 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
51 modern = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
52 protocol = "tlsv1_3"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
53 options = { cipher_server_preference = false }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
54 ciphers = "DEFAULT"; -- TLS 1.3 uses 'ciphersuites' rather than these |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
55 curveslist = { "X25519MLKEM768"; "X25519"; "prime256v1"; "secp384r1" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
56 ciphersuites = { "TLS_AES_128_GCM_SHA256"; "TLS_AES_256_GCM_SHA384"; "TLS_CHACHA20_POLY1305_SHA256" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
57 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
58 intermediate = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
59 protocol = "tlsv1_2+"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
60 dhparam = ffdhe2048; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
61 options = { cipher_server_preference = false }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
62 ciphers = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
63 "ECDHE-ECDSA-AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
64 "ECDHE-RSA-AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
65 "ECDHE-ECDSA-AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
66 "ECDHE-RSA-AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
67 "ECDHE-ECDSA-CHACHA20-POLY1305"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
68 "ECDHE-RSA-CHACHA20-POLY1305"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
69 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
70 curveslist = { "X25519MLKEM768"; "X25519"; "prime256v1"; "secp384r1" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
71 ciphersuites = { "TLS_AES_128_GCM_SHA256"; "TLS_AES_256_GCM_SHA384"; "TLS_CHACHA20_POLY1305_SHA256" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
72 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
73 old = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
74 protocol = "tlsv1+"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
75 dhparam = ffdhe2048; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
76 options = { cipher_server_preference = true }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
77 ciphers = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
78 "ECDHE-ECDSA-AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
79 "ECDHE-RSA-AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
80 "ECDHE-ECDSA-AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
81 "ECDHE-RSA-AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
82 "ECDHE-ECDSA-CHACHA20-POLY1305"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
83 "ECDHE-RSA-CHACHA20-POLY1305"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
84 "ECDHE-ECDSA-AES128-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
85 "ECDHE-RSA-AES128-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
86 "ECDHE-ECDSA-AES128-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
87 "ECDHE-RSA-AES128-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
88 "ECDHE-ECDSA-AES256-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
89 "ECDHE-RSA-AES256-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
90 "ECDHE-ECDSA-AES256-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
91 "ECDHE-RSA-AES256-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
92 "AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
93 "AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
94 "AES128-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
95 "AES256-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
96 "AES128-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
97 "AES256-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
98 "DES-CBC3-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
99 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
100 curveslist = { "X25519MLKEM768"; "X25519"; "prime256v1"; "secp384r1" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
101 ciphersuites = { "TLS_AES_128_GCM_SHA256"; "TLS_AES_256_GCM_SHA384"; "TLS_CHACHA20_POLY1305_SHA256" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
102 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
103 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
104 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
105 ["5.7"] = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
106 -- Version 5.7 as of 2023-07-09 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
107 modern = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
108 protocol = "tlsv1_3"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
109 options = { cipher_server_preference = false }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
110 ciphers = "DEFAULT"; -- TLS 1.3 uses 'ciphersuites' rather than these |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
111 curveslist = { "X25519"; "prime256v1"; "secp384r1" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
112 ciphersuites = { "TLS_AES_128_GCM_SHA256"; "TLS_AES_256_GCM_SHA384"; "TLS_CHACHA20_POLY1305_SHA256" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
113 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
114 intermediate = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
115 protocol = "tlsv1_2+"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
116 dhparam = ffdhe2048; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
117 options = { cipher_server_preference = false }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
118 ciphers = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
119 "ECDHE-ECDSA-AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
120 "ECDHE-RSA-AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
121 "ECDHE-ECDSA-AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
122 "ECDHE-RSA-AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
123 "ECDHE-ECDSA-CHACHA20-POLY1305"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
124 "ECDHE-RSA-CHACHA20-POLY1305"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
125 "DHE-RSA-AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
126 "DHE-RSA-AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
127 "DHE-RSA-CHACHA20-POLY1305"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
128 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
129 curveslist = { "X25519"; "prime256v1"; "secp384r1" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
130 ciphersuites = { "TLS_AES_128_GCM_SHA256"; "TLS_AES_256_GCM_SHA384"; "TLS_CHACHA20_POLY1305_SHA256" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
131 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
132 old = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
133 protocol = "tlsv1+"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
134 dhparam = nil; -- openssl dhparam 1024 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
135 options = { cipher_server_preference = true }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
136 ciphers = { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
137 "ECDHE-ECDSA-AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
138 "ECDHE-RSA-AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
139 "ECDHE-ECDSA-AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
140 "ECDHE-RSA-AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
141 "ECDHE-ECDSA-CHACHA20-POLY1305"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
142 "ECDHE-RSA-CHACHA20-POLY1305"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
143 "DHE-RSA-AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
144 "DHE-RSA-AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
145 "DHE-RSA-CHACHA20-POLY1305"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
146 "ECDHE-ECDSA-AES128-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
147 "ECDHE-RSA-AES128-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
148 "ECDHE-ECDSA-AES128-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
149 "ECDHE-RSA-AES128-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
150 "ECDHE-ECDSA-AES256-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
151 "ECDHE-RSA-AES256-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
152 "ECDHE-ECDSA-AES256-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
153 "ECDHE-RSA-AES256-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
154 "DHE-RSA-AES128-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
155 "DHE-RSA-AES256-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
156 "AES128-GCM-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
157 "AES256-GCM-SHA384"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
158 "AES128-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
159 "AES256-SHA256"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
160 "AES128-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
161 "AES256-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
162 "DES-CBC3-SHA"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
163 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
164 curveslist = { "X25519"; "prime256v1"; "secp384r1" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
165 ciphersuites = { "TLS_AES_128_GCM_SHA256"; "TLS_AES_256_GCM_SHA384"; "TLS_CHACHA20_POLY1305_SHA256" }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
166 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
167 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
168 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
169 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
170 local function get_valid_versions() |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
171 return array.collect(it.keys(profiles)):sort(version_compare):reverse(); |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
172 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
173 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
174 local pref_order = { modern = 100, intermediate = 50, old = 0 }; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
175 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
176 local function sort_profile_by_pref(a, b) |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
177 local pref_a, pref_b = pref_order[a] or 0, pref_order[b] or 0; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
178 return pref_a > pref_b; -- Best first |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
179 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
180 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
181 local function get_valid_profile_names(version) |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
182 if version == "latest" then |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
183 version = latest_version; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
184 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
185 local version_profiles = profiles[version or default_version]; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
186 if not version_profiles then |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
187 return nil, "unknown-version"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
188 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
189 return array.collect(it.keys(version_profiles)):sort(sort_profile_by_pref); |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
190 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
191 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
192 local function get_profile(version, profile_name) |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
193 if version == "latest" then |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
194 version = latest_version; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
195 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
196 local version_profiles = profiles[version or default_version]; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
197 if not version_profiles then |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
198 return nil, "unknown-version"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
199 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
200 local profile = version_profiles[profile_name or default_profile]; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
201 if not profile then |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
202 return nil, "unknown-profile"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
203 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
204 return profile; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
205 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
206 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
207 local function get_default_version() |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
208 return default_version; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
209 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
210 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
211 local function get_latest_version() |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
212 return latest_version; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
213 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
214 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
215 local function get_default_profile_name(version) |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
216 -- Default profile name is currently the same across all versions, |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
217 -- but can't guarantee this in the future - ensure valid version |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
218 if version ~= "latest" and not profiles[version or default_version] then |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
219 return nil, "unknown-version"; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
220 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
221 return default_profile; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
222 end |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
223 |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
224 return { |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
225 profiles = profiles; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
226 get_default_version = get_default_version; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
227 get_latest_version = get_latest_version; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
228 get_default_profile_name = get_default_profile_name; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
229 get_valid_versions = get_valid_versions; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
230 get_valid_profile_names = get_valid_profile_names; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
231 get_profile = get_profile; |
|
926f25af2ffe
util.tlsref: New util library to encapsulate the Mozilla/TLSRef recommendations
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
232 }; |
