aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorTed Zlatanov2012-02-13 16:48:14 -0500
committerTed Zlatanov2012-02-13 16:48:14 -0500
commit7ee99f32e16e182f94aacd01f5bfee61f672c908 (patch)
treee3033933f29c550fd4565d85df469321d4fa3833 /lisp
parent0ca43699556cef0f6fb46f70b66b39b71d14d85b (diff)
downloademacs-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/ChangeLog5
-rw-r--r--lisp/net/gnutls.el31
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 @@
12012-02-13 Teodor Zlatanov <tzz@lifelogs.com>
2
3 * net/gnutls.el (gnutls-trustfiles): New variable.
4 (gnutls-negotiate): Use it.
5
12012-02-13 Lars Ingebrigtsen <larsi@gnus.org> 62012-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,
49set this variable to \"normal:-dhe-rsa\"." 49set 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.
61The files may be in PEM or DER format, as per the GnuTLS documentation.
62The 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.
118PROCESS is a process returned by `open-network-stream'. 131PROCESS is a process returned by `open-network-stream'.
119HOSTNAME is the remote hostname. It must be a valid string. 132HOSTNAME is the remote hostname. It must be a valid string.
120PRIORITY-STRING is as per the GnuTLS docs, default is \"NORMAL\". 133PRIORITY-STRING is as per the GnuTLS docs, default is \"NORMAL\".
121TRUSTFILES is a list of CA bundles. 134TRUSTFILES is a list of CA bundles. It defaults to `gnutls-trustfiles'.
122CRLFILES is a list of CRL files. 135CRLFILES is a list of CRL files.
123KEYLIST is an alist of (client key file, client cert file) pairs. 136KEYLIST is an alist of (client key file, client cert file) pairs.
124MIN-PRIME-BITS is the minimum acceptable size of Diffie-Hellman keys 137MIN-PRIME-BITS is the minimum acceptable size of Diffie-Hellman keys
@@ -156,18 +169,20 @@ here's a recent version of the list.
156It must be omitted, a number, or nil; if omitted or nil it 169It must be omitted, a number, or nil; if omitted or nil it
157defaults to GNUTLS_VERIFY_ALLOW_X509_V1_CA_CRT." 170defaults 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