diff options
| author | Ted Zlatanov | 2012-02-13 16:48:14 -0500 |
|---|---|---|
| committer | Ted Zlatanov | 2012-02-13 16:48:14 -0500 |
| commit | 7ee99f32e16e182f94aacd01f5bfee61f672c908 (patch) | |
| tree | e3033933f29c550fd4565d85df469321d4fa3833 /lisp | |
| parent | 0ca43699556cef0f6fb46f70b66b39b71d14d85b (diff) | |
| download | emacs-7ee99f32e16e182f94aacd01f5bfee61f672c908.tar.gz emacs-7ee99f32e16e182f94aacd01f5bfee61f672c908.zip | |
Introduce and use CA bundle locator `gnutls-trustfiles'.
* net/gnutls.el (gnutls-trustfiles): New variable.
(gnutls-negotiate): Use it.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/net/gnutls.el | 31 |
2 files changed, 28 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 026d81bc0b4..bbbfb8dd000 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-02-13 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * net/gnutls.el (gnutls-trustfiles): New variable. | ||
| 4 | (gnutls-negotiate): Use it. | ||
| 5 | |||
| 1 | 2012-02-13 Lars Ingebrigtsen <larsi@gnus.org> | 6 | 2012-02-13 Lars Ingebrigtsen <larsi@gnus.org> |
| 2 | 7 | ||
| 3 | * simple.el (mail-user-agent): Mention that `gnus-user-agent' only | 8 | * simple.el (mail-user-agent): Mention that `gnus-user-agent' only |
diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el index 5f1cb65782e..9b734637103 100644 --- a/lisp/net/gnutls.el +++ b/lisp/net/gnutls.el | |||
| @@ -49,7 +49,20 @@ For instance, if you want to skip the \"dhe-rsa\" algorithm, | |||
| 49 | set this variable to \"normal:-dhe-rsa\"." | 49 | set this variable to \"normal:-dhe-rsa\"." |
| 50 | :group 'gnutls | 50 | :group 'gnutls |
| 51 | :type '(choice (const nil) | 51 | :type '(choice (const nil) |
| 52 | string)) | 52 | string)) |
| 53 | |||
| 54 | (defcustom gnutls-trustfiles | ||
| 55 | '( | ||
| 56 | "/etc/ssl/certs/ca-certificates.crt" ; Debian, Ubuntu, Gentoo and Arch Linux | ||
| 57 | "/etc/pki/tls/certs/ca-bundle.crt" ; Fedora and RHEL | ||
| 58 | "/etc/ssl/ca-bundle.pem" ; Suse | ||
| 59 | ) | ||
| 60 | "List of CA bundle location filenames or a function returning said list. | ||
| 61 | The files may be in PEM or DER format, as per the GnuTLS documentation. | ||
| 62 | The files may not exist, in which case they will be ignored." | ||
| 63 | :group 'gnutls | ||
| 64 | :type '(choice (function :tag "Function to produce list of bundle filenames") | ||
| 65 | (repeat (file :tag "Bundle filename")))) | ||
| 53 | 66 | ||
| 54 | ;;;###autoload | 67 | ;;;###autoload |
| 55 | (defcustom gnutls-min-prime-bits nil | 68 | (defcustom gnutls-min-prime-bits nil |
| @@ -118,7 +131,7 @@ TYPE is `gnutls-x509pki' (default) or `gnutls-anon'. Use nil for the default. | |||
| 118 | PROCESS is a process returned by `open-network-stream'. | 131 | PROCESS is a process returned by `open-network-stream'. |
| 119 | HOSTNAME is the remote hostname. It must be a valid string. | 132 | HOSTNAME is the remote hostname. It must be a valid string. |
| 120 | PRIORITY-STRING is as per the GnuTLS docs, default is \"NORMAL\". | 133 | PRIORITY-STRING is as per the GnuTLS docs, default is \"NORMAL\". |
| 121 | TRUSTFILES is a list of CA bundles. | 134 | TRUSTFILES is a list of CA bundles. It defaults to `gnutls-trustfiles'. |
| 122 | CRLFILES is a list of CRL files. | 135 | CRLFILES is a list of CRL files. |
| 123 | KEYLIST is an alist of (client key file, client cert file) pairs. | 136 | KEYLIST is an alist of (client key file, client cert file) pairs. |
| 124 | MIN-PRIME-BITS is the minimum acceptable size of Diffie-Hellman keys | 137 | MIN-PRIME-BITS is the minimum acceptable size of Diffie-Hellman keys |
| @@ -156,18 +169,20 @@ here's a recent version of the list. | |||
| 156 | It must be omitted, a number, or nil; if omitted or nil it | 169 | It must be omitted, a number, or nil; if omitted or nil it |
| 157 | defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." | 170 | defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." |
| 158 | (let* ((type (or type 'gnutls-x509pki)) | 171 | (let* ((type (or type 'gnutls-x509pki)) |
| 159 | (default-trustfile "/etc/ssl/certs/ca-certificates.crt") | ||
| 160 | (trustfiles (or trustfiles | 172 | (trustfiles (or trustfiles |
| 161 | (when (file-exists-p default-trustfile) | 173 | (delq nil |
| 162 | (list default-trustfile)))) | 174 | (mapcar (lambda (f) (and f (file-exists-p f) f)) |
| 175 | (if (functionp gnutls-trustfiles) | ||
| 176 | (funcall gnutls-trustfiles) | ||
| 177 | gnutls-trustfiles))))) | ||
| 163 | (priority-string (or priority-string | 178 | (priority-string (or priority-string |
| 164 | (cond | 179 | (cond |
| 165 | ((eq type 'gnutls-anon) | 180 | ((eq type 'gnutls-anon) |
| 166 | "NORMAL:+ANON-DH:!ARCFOUR-128") | 181 | "NORMAL:+ANON-DH:!ARCFOUR-128") |
| 167 | ((eq type 'gnutls-x509pki) | 182 | ((eq type 'gnutls-x509pki) |
| 168 | (if gnutls-algorithm-priority | 183 | (if gnutls-algorithm-priority |
| 169 | (upcase gnutls-algorithm-priority) | 184 | (upcase gnutls-algorithm-priority) |
| 170 | "NORMAL"))))) | 185 | "NORMAL"))))) |
| 171 | (min-prime-bits (or min-prime-bits gnutls-min-prime-bits)) | 186 | (min-prime-bits (or min-prime-bits gnutls-min-prime-bits)) |
| 172 | (params `(:priority ,priority-string | 187 | (params `(:priority ,priority-string |
| 173 | :hostname ,hostname | 188 | :hostname ,hostname |