diff options
| author | Lars Ingebrigtsen | 2015-12-29 14:46:20 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2015-12-29 14:46:20 +0100 |
| commit | de5c44fe8811b07eaad6ab5fc53d498e465a43d4 (patch) | |
| tree | e1be39b72ff322fdcd482840bbf91a7d8289693d | |
| parent | 1ba1e35fbed820ec9d9e1dafbe150f88f29342d8 (diff) | |
| download | emacs-de5c44fe8811b07eaad6ab5fc53d498e465a43d4.tar.gz emacs-de5c44fe8811b07eaad6ab5fc53d498e465a43d4.zip | |
Make tls.el use trustfiles by default
* lisp/net/tls.el (tls-program): Add a certfile by default (bug#21227).
(open-tls-stream): Insert the trustfile by looking at
`gnutls-trustfiles'.
| -rw-r--r-- | lisp/net/tls.el | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/lisp/net/tls.el b/lisp/net/tls.el index 6745e5d8282..72fb50ed923 100644 --- a/lisp/net/tls.el +++ b/lisp/net/tls.el | |||
| @@ -44,6 +44,8 @@ | |||
| 44 | 44 | ||
| 45 | ;;; Code: | 45 | ;;; Code: |
| 46 | 46 | ||
| 47 | (require 'gnutls) | ||
| 48 | |||
| 47 | (autoload 'format-spec "format-spec") | 49 | (autoload 'format-spec "format-spec") |
| 48 | (autoload 'format-spec-make "format-spec") | 50 | (autoload 'format-spec-make "format-spec") |
| 49 | 51 | ||
| @@ -74,9 +76,10 @@ and `gnutls-cli' (version 2.0.1) output." | |||
| 74 | :type 'regexp | 76 | :type 'regexp |
| 75 | :group 'tls) | 77 | :group 'tls) |
| 76 | 78 | ||
| 77 | (defcustom tls-program '("gnutls-cli -p %p %h" | 79 | (defcustom tls-program |
| 78 | "gnutls-cli -p %p %h --protocols ssl3" | 80 | '("gnutls-cli --x509cafile %t -p %p %h" |
| 79 | "openssl s_client -connect %h:%p -no_ssl2 -ign_eof") | 81 | "gnutls-cli --x509cafile %t -p %p %h --protocols ssl3" |
| 82 | "openssl s_client -connect %h:%p -no_ssl2 -ign_eof") | ||
| 80 | "List of strings containing commands to start TLS stream to a host. | 83 | "List of strings containing commands to start TLS stream to a host. |
| 81 | Each entry in the list is tried until a connection is successful. | 84 | Each entry in the list is tried until a connection is successful. |
| 82 | %h is replaced with server hostname, %p with port to connect to. | 85 | %h is replaced with server hostname, %p with port to connect to. |
| @@ -89,24 +92,20 @@ successful negotiation." | |||
| 89 | :type | 92 | :type |
| 90 | '(choice | 93 | '(choice |
| 91 | (const :tag "Default list of commands" | 94 | (const :tag "Default list of commands" |
| 92 | ("gnutls-cli -p %p %h" | 95 | ("gnutls-cli --x509cafile %t -p %p %h" |
| 93 | "gnutls-cli -p %p %h --protocols ssl3" | 96 | "gnutls-cli --x509cafile %t -p %p %h --protocols ssl3" |
| 94 | "openssl s_client -connect %h:%p -no_ssl2 -ign_eof")) | 97 | "openssl s_client -CAfile %t -connect %h:%p -no_ssl2 -ign_eof")) |
| 95 | (list :tag "Choose commands" | 98 | (list :tag "Choose commands" |
| 96 | :value | 99 | :value |
| 97 | ("gnutls-cli -p %p %h" | 100 | ("gnutls-cli --x509cafile %t -p %p %h" |
| 98 | "gnutls-cli -p %p %h --protocols ssl3" | 101 | "gnutls-cli --x509cafile %t -p %p %h --protocols ssl3" |
| 99 | "openssl s_client -connect %h:%p -no_ssl2 -ign_eof") | 102 | "openssl s_client -connect %h:%p -no_ssl2 -ign_eof") |
| 100 | (set :inline t | 103 | (set :inline t |
| 101 | ;; FIXME: add brief `:tag "..."' descriptions. | 104 | ;; FIXME: add brief `:tag "..."' descriptions. |
| 102 | ;; (repeat :inline t :tag "Other" (string)) | 105 | ;; (repeat :inline t :tag "Other" (string)) |
| 103 | ;; See `tls-checktrust': | ||
| 104 | (const "gnutls-cli --x509cafile /etc/ssl/certs/ca-certificates.crt -p %p %h") | ||
| 105 | (const "gnutls-cli --x509cafile /etc/ssl/certs/ca-certificates.crt -p %p %h --protocols ssl3") | ||
| 106 | (const "openssl s_client -connect %h:%p -CAfile /etc/ssl/certs/ca-certificates.crt -no_ssl2 -ign_eof") | ||
| 107 | ;; No trust check: | 106 | ;; No trust check: |
| 108 | (const "gnutls-cli -p %p %h") | 107 | (const "gnutls-cli --insecure -p %p %h") |
| 109 | (const "gnutls-cli -p %p %h --protocols ssl3") | 108 | (const "gnutls-cli --insecure -p %p %h --protocols ssl3") |
| 110 | (const "openssl s_client -connect %h:%p -no_ssl2 -ign_eof")) | 109 | (const "openssl s_client -connect %h:%p -no_ssl2 -ign_eof")) |
| 111 | (repeat :inline t :tag "Other" (string))) | 110 | (repeat :inline t :tag "Other" (string))) |
| 112 | (list :tag "List of commands" | 111 | (list :tag "List of commands" |
| @@ -232,6 +231,7 @@ Fourth arg PORT is an integer specifying a port to connect to." | |||
| 232 | (format-spec | 231 | (format-spec |
| 233 | cmd | 232 | cmd |
| 234 | (format-spec-make | 233 | (format-spec-make |
| 234 | ?t (car (gnutls-trustfiles)) | ||
| 235 | ?h host | 235 | ?h host |
| 236 | ?p (if (integerp port) | 236 | ?p (if (integerp port) |
| 237 | (int-to-string port) | 237 | (int-to-string port) |