diff options
| author | Lars Ingebrigtsen | 2019-08-23 11:51:54 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-08-23 11:51:54 +0200 |
| commit | b4065de33cf397b80e15c22740d34b4a03cfdc17 (patch) | |
| tree | b750c1b21263cb119f4467c109cb9ac421de968d | |
| parent | 7b0d49854675eae962c6baf8ae6fd90a2c87889b (diff) | |
| download | emacs-b4065de33cf397b80e15c22740d34b4a03cfdc17.tar.gz emacs-b4065de33cf397b80e15c22740d34b4a03cfdc17.zip | |
Rename renamed nsm.el variables and functions back
* doc/emacs/misc.texi (Network Security): Start working on
updating the NSM bits, but it's unclear how much of the new stuff
to document.
* lisp/net/nsm.el: Rename all nsm-tls-check-* functions to
nsm-protocol-check--* to bring them back into line with the
documentation.
(network-security-protocol-checks): Renamed back again from
`nsm-tls-checks', as this variable is documented and can't just go
away.
| -rw-r--r-- | doc/emacs/misc.texi | 12 | ||||
| -rw-r--r-- | lisp/net/nsm.el | 102 |
2 files changed, 57 insertions, 57 deletions
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi index 5877c4b0de1..83fb8acf7c2 100644 --- a/doc/emacs/misc.texi +++ b/doc/emacs/misc.texi | |||
| @@ -302,7 +302,10 @@ the Transport Layer Security (@acronym{TLS}) features. | |||
| 302 | @vindex network-security-level | 302 | @vindex network-security-level |
| 303 | The @code{network-security-level} variable determines the security | 303 | The @code{network-security-level} variable determines the security |
| 304 | level that @acronym{NSM} enforces. If its value is @code{low}, no | 304 | level that @acronym{NSM} enforces. If its value is @code{low}, no |
| 305 | security checks are performed. | 305 | security checks are performed. This is not recommended, and will |
| 306 | basically mean that your network connections can't be trusted. | ||
| 307 | However, the setting can be useful in limited circumstances, as when | ||
| 308 | testing network issues. | ||
| 306 | 309 | ||
| 307 | If this variable is @code{medium} (which is the default), a number of | 310 | If this variable is @code{medium} (which is the default), a number of |
| 308 | checks will be performed. If as result @acronym{NSM} determines that | 311 | checks will be performed. If as result @acronym{NSM} determines that |
| @@ -325,13 +328,12 @@ The protocol network checks is controlled via the | |||
| 325 | @code{network-security-protocol-checks} variable. | 328 | @code{network-security-protocol-checks} variable. |
| 326 | 329 | ||
| 327 | It's an alist where the first element of each association is the name | 330 | It's an alist where the first element of each association is the name |
| 328 | of the check, the second element is the security level where the check | 331 | of the check, and the second element is the security level where the |
| 329 | should be used, and the optional third element is a parameter supplied | 332 | check should be used. |
| 330 | to the check. | ||
| 331 | 333 | ||
| 332 | An element like @code{(rc4 medium)} will result in the function | 334 | An element like @code{(rc4 medium)} will result in the function |
| 333 | @code{nsm-protocol-check--rc4} being called like thus: | 335 | @code{nsm-protocol-check--rc4} being called like thus: |
| 334 | @w{@code{(nsm-protocol-check--rc4 host port status optional-parameter)}}. | 336 | @w{@code{(nsm-protocol-check--rc4 host port status settings)}}. |
| 335 | The function should return non-@code{nil} if the connection should | 337 | The function should return non-@code{nil} if the connection should |
| 336 | proceed and @code{nil} otherwise. | 338 | proceed and @code{nil} otherwise. |
| 337 | 339 | ||
diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el index 69dc86f76fd..ed700bc9b5d 100644 --- a/lisp/net/nsm.el +++ b/lisp/net/nsm.el | |||
| @@ -138,27 +138,27 @@ unencrypted." | |||
| 138 | (nsm-save-host host port status 'fingerprint nil 'always)) | 138 | (nsm-save-host host port status 'fingerprint nil 'always)) |
| 139 | process))))) | 139 | process))))) |
| 140 | 140 | ||
| 141 | (defcustom nsm-tls-checks | 141 | (defcustom network-security-protocol-checks |
| 142 | '(;; Old Known Weaknesses. | 142 | '(;; Old Known Weaknesses. |
| 143 | (nsm-tls-check-version . medium) | 143 | (version medium) |
| 144 | (nsm-tls-check-compression . medium) | 144 | (compression medium) |
| 145 | (nsm-tls-check-renegotiation-info-ext . medium) | 145 | (renegotiation-info-ext medium) |
| 146 | (nsm-tls-check-verify-cert . medium) | 146 | (verify-cert medium) |
| 147 | (nsm-tls-check-same-cert . medium) | 147 | (same-cert medium) |
| 148 | (nsm-tls-check-null-suite . medium) | 148 | (null-suite medium) |
| 149 | (nsm-tls-check-export-kx . medium) | 149 | (export-kx medium) |
| 150 | (nsm-tls-check-anon-kx . medium) | 150 | (anon-kx medium) |
| 151 | (nsm-tls-check-md5-sig . medium) | 151 | (md5-sig medium) |
| 152 | (nsm-tls-check-rc4-cipher . medium) | 152 | (rc4-cipher medium) |
| 153 | ;; Weaknesses made known after 2013. | 153 | ;; Weaknesses made known after 2013. |
| 154 | (nsm-tls-check-dhe-prime-kx . medium) | 154 | (dhe-prime-kx medium) |
| 155 | (nsm-tls-check-sha1-sig . medium) | 155 | (sha1-sig medium) |
| 156 | (nsm-tls-check-ecdsa-cbc-cipher . medium) | 156 | (ecdsa-cbc-cipher medium) |
| 157 | ;; Towards TLS 1.3 | 157 | ;; Towards TLS 1.3 |
| 158 | (nsm-tls-check-dhe-kx . high) | 158 | (dhe-kx high) |
| 159 | (nsm-tls-check-rsa-kx . high) | 159 | (rsa-kx high) |
| 160 | (nsm-tls-check-3des-cipher . high) | 160 | (3des-cipher high) |
| 161 | (nsm-tls-check-cbc-cipher . high)) | 161 | (cbc-cipher high)) |
| 162 | "This variable specifies what TLS connection checks to perform. | 162 | "This variable specifies what TLS connection checks to perform. |
| 163 | It's an alist where the key is the name of the check, and the | 163 | It's an alist where the key is the name of the check, and the |
| 164 | value is the minimum security level the check should begin. | 164 | value is the minimum security level the check should begin. |
| @@ -252,9 +252,10 @@ otherwise." | |||
| 252 | (defun nsm-check-tls-connection (process host port status settings) | 252 | (defun nsm-check-tls-connection (process host port status settings) |
| 253 | "Check TLS connection against potential security problems. | 253 | "Check TLS connection against potential security problems. |
| 254 | 254 | ||
| 255 | This function runs each test defined in `nsm-tls-checks' in the | 255 | This function runs each test defined in |
| 256 | order specified against the TLS connection's peer status STATUS | 256 | `network-security-protocol-checks' in the order specified against |
| 257 | for the host HOST and port PORT. | 257 | the TLS connection's peer status STATUS for the host HOST and |
| 258 | port PORT. | ||
| 258 | 259 | ||
| 259 | If one or more problems are found, this function will collect all | 260 | If one or more problems are found, this function will collect all |
| 260 | the error messages returned by the check functions, and confirm | 261 | the error messages returned by the check functions, and confirm |
| @@ -268,23 +269,23 @@ terminating the connection. | |||
| 268 | This function returns the process PROCESS if no problems are | 269 | This function returns the process PROCESS if no problems are |
| 269 | found, and nil otherwise. | 270 | found, and nil otherwise. |
| 270 | 271 | ||
| 271 | See also: `nsm-tls-checks' and `nsm-noninteractive'" | 272 | See also: `network-security-protocol-checks' and `nsm-noninteractive'" |
| 272 | (when (nsm-should-check host) | 273 | (when (nsm-should-check host) |
| 273 | (let* ((results | 274 | (let* ((results |
| 274 | (cl-loop | 275 | (cl-loop |
| 275 | for check in nsm-tls-checks | 276 | for check in network-security-protocol-checks |
| 276 | for type = (intern (format ":%s" | 277 | for type = (intern (format ":%s" (car check)) obarray) |
| 277 | (string-remove-prefix | ||
| 278 | "nsm-tls-check-" | ||
| 279 | (symbol-name (car check)))) | ||
| 280 | obarray) | ||
| 281 | ;; Skip the check if the user has already said that this | 278 | ;; Skip the check if the user has already said that this |
| 282 | ;; host is OK for this type of "error". | 279 | ;; host is OK for this type of "error". |
| 283 | for result = (and (not (memq type | 280 | for result = (and (not (memq type |
| 284 | (plist-get settings :conditions))) | 281 | (plist-get settings :conditions))) |
| 285 | (>= (nsm-level network-security-level) | 282 | (>= (nsm-level network-security-level) |
| 286 | (nsm-level (cdr check))) | 283 | (nsm-level (cadr check))) |
| 287 | (funcall (car check) host port status settings)) | 284 | (funcall |
| 285 | (intern (format "nsm-protocol-check--%s" | ||
| 286 | (car check)) | ||
| 287 | obarray) | ||
| 288 | host port status settings)) | ||
| 288 | when result | 289 | when result |
| 289 | collect (cons type result))) | 290 | collect (cons type result))) |
| 290 | (problems (nconc (plist-get status :warnings) (map-keys results)))) | 291 | (problems (nconc (plist-get status :warnings) (map-keys results)))) |
| @@ -325,21 +326,18 @@ See also: `nsm-tls-checks' and `nsm-noninteractive'" | |||
| 325 | (declare-function gnutls-peer-status-warning-describe "gnutls.c" | 326 | (declare-function gnutls-peer-status-warning-describe "gnutls.c" |
| 326 | (status-symbol)) | 327 | (status-symbol)) |
| 327 | 328 | ||
| 328 | (defun nsm-tls-check-verify-cert (host port status settings) | 329 | (defun nsm-protocol-check--verify-cert (host port status settings) |
| 329 | "Check for warnings from the certificate verification status. | 330 | "Check for warnings from the certificate verification status. |
| 330 | 331 | ||
| 331 | This is the most basic security check for a TLS connection. If | 332 | This is the most basic security check for a TLS connection. If |
| 332 | certificate verification fails, it means the server's identity | 333 | certificate verification fails, it means the server's identity |
| 333 | cannot be verified by the credentials received. | 334 | cannot be verified by the credentials received." |
| 334 | |||
| 335 | Think very carefully before removing this check from | ||
| 336 | `nsm-tls-checks'." | ||
| 337 | (let ((warnings (plist-get status :warnings))) | 335 | (let ((warnings (plist-get status :warnings))) |
| 338 | (and warnings | 336 | (and warnings |
| 339 | (not (nsm-warnings-ok-p status settings)) | 337 | (not (nsm-warnings-ok-p status settings)) |
| 340 | (mapconcat #'gnutls-peer-status-warning-describe warnings "\n")))) | 338 | (mapconcat #'gnutls-peer-status-warning-describe warnings "\n")))) |
| 341 | 339 | ||
| 342 | (defun nsm-tls-check-same-cert (host port status settings) | 340 | (defun nsm-protocol-check--same-cert (host port status settings) |
| 343 | "Check for certificate fingerprint mismatch. | 341 | "Check for certificate fingerprint mismatch. |
| 344 | 342 | ||
| 345 | If the fingerprints saved do not match the fingerprint of the | 343 | If the fingerprints saved do not match the fingerprint of the |
| @@ -351,7 +349,7 @@ man-in-the-middle attack." | |||
| 351 | 349 | ||
| 352 | ;; Key exchange checks | 350 | ;; Key exchange checks |
| 353 | 351 | ||
| 354 | (defun nsm-tls-check-rsa-kx (host port status &optional settings) | 352 | (defun nsm-protocol-check--rsa-kx (host port status &optional settings) |
| 355 | "Check for static RSA key exchange. | 353 | "Check for static RSA key exchange. |
| 356 | 354 | ||
| 357 | Static RSA key exchange methods do not offer perfect forward | 355 | Static RSA key exchange methods do not offer perfect forward |
| @@ -381,7 +379,7 @@ Security (DTLS)\", \"(4.1. General Guidelines)\" | |||
| 381 | "RSA key exchange method (%s) does not offer perfect forward secrecy" | 379 | "RSA key exchange method (%s) does not offer perfect forward secrecy" |
| 382 | kx)))) | 380 | kx)))) |
| 383 | 381 | ||
| 384 | (defun nsm-tls-check-dhe-prime-kx (host port status &optional settings) | 382 | (defun nsm-protocol-check--dhe-prime-kx (host port status &optional settings) |
| 385 | "Check for the key strength of DH key exchange based on integer factorization. | 383 | "Check for the key strength of DH key exchange based on integer factorization. |
| 386 | 384 | ||
| 387 | This check is a response to Logjam[1]. Logjam is an attack that | 385 | This check is a response to Logjam[1]. Logjam is an attack that |
| @@ -397,7 +395,7 @@ exchange in June 2018[2]. To provide a balance between | |||
| 397 | compatibility and security, this function only checks for a | 395 | compatibility and security, this function only checks for a |
| 398 | minimum key strength of 1024-bit. | 396 | minimum key strength of 1024-bit. |
| 399 | 397 | ||
| 400 | See also: `nsm-tls-check-dhe-kx' | 398 | See also: `nsm-protocol-check--dhe-kx' |
| 401 | 399 | ||
| 402 | Reference: | 400 | Reference: |
| 403 | 401 | ||
| @@ -412,7 +410,7 @@ Diffie-Hellman Fails in Practice\", `https://weakdh.org/' | |||
| 412 | "Diffie-Hellman key strength (%s bits) too weak (%s bits)" | 410 | "Diffie-Hellman key strength (%s bits) too weak (%s bits)" |
| 413 | prime-bits 1024)))) | 411 | prime-bits 1024)))) |
| 414 | 412 | ||
| 415 | (defun nsm-tls-check-dhe-kx (host port status &optional settings) | 413 | (defun nsm-protocol-check--dhe-kx (host port status &optional settings) |
| 416 | "Check for existence of DH key exchange based on integer factorization. | 414 | "Check for existence of DH key exchange based on integer factorization. |
| 417 | 415 | ||
| 418 | In the years since the discovery of Logjam, it was discovered | 416 | In the years since the discovery of Logjam, it was discovered |
| @@ -436,7 +434,7 @@ Diffie-Hellman Backdoors in TLS.\", | |||
| 436 | "unable to verify Diffie-Hellman key exchange method (%s) parameters" | 434 | "unable to verify Diffie-Hellman key exchange method (%s) parameters" |
| 437 | kx)))) | 435 | kx)))) |
| 438 | 436 | ||
| 439 | (defun nsm-tls-check-export-kx (host port status &optional settings) | 437 | (defun nsm-protocol-check--export-kx (host port status &optional settings) |
| 440 | "Check for RSA-EXPORT key exchange. | 438 | "Check for RSA-EXPORT key exchange. |
| 441 | 439 | ||
| 442 | EXPORT cipher suites are a family of 40-bit and 56-bit effective | 440 | EXPORT cipher suites are a family of 40-bit and 56-bit effective |
| @@ -461,7 +459,7 @@ of user-visible changes.\" Version 3.4.0, | |||
| 461 | "EXPORT level key exchange (%s) is insecure" | 459 | "EXPORT level key exchange (%s) is insecure" |
| 462 | kx))))) | 460 | kx))))) |
| 463 | 461 | ||
| 464 | (defun nsm-tls-check-anon-kx (host port status &optional settings) | 462 | (defun nsm-protocol-check--anon-kx (host port status &optional settings) |
| 465 | "Check for anonymous key exchange. | 463 | "Check for anonymous key exchange. |
| 466 | 464 | ||
| 467 | Anonymous key exchange exposes the connection to | 465 | Anonymous key exchange exposes the connection to |
| @@ -480,7 +478,7 @@ authentication\", | |||
| 480 | 478 | ||
| 481 | ;; Cipher checks | 479 | ;; Cipher checks |
| 482 | 480 | ||
| 483 | (defun nsm-tls-check-cbc-cipher (host port status &optional settings) | 481 | (defun nsm-protocol-check--cbc-cipher (host port status &optional settings) |
| 484 | "Check for CBC mode ciphers. | 482 | "Check for CBC mode ciphers. |
| 485 | 483 | ||
| 486 | CBC mode cipher in TLS versions earlier than 1.3 are problematic | 484 | CBC mode cipher in TLS versions earlier than 1.3 are problematic |
| @@ -509,7 +507,7 @@ Security (TLS) and Datagram Transport Layer Security (DTLS)\", | |||
| 509 | "CBC mode cipher (%s) can be insecure" | 507 | "CBC mode cipher (%s) can be insecure" |
| 510 | cipher))))) | 508 | cipher))))) |
| 511 | 509 | ||
| 512 | (defun nsm-tls-check-ecdsa-cbc-cipher (host port status &optional settings) | 510 | (defun nsm-protocol-check--ecdsa-cbc-cipher (host port status &optional settings) |
| 513 | "Check for CBC mode cipher usage under ECDSA key exchange. | 511 | "Check for CBC mode cipher usage under ECDSA key exchange. |
| 514 | 512 | ||
| 515 | CBC mode cipher in TLS versions earlier than 1.3 are problematic | 513 | CBC mode cipher in TLS versions earlier than 1.3 are problematic |
| @@ -547,7 +545,7 @@ Security (TLS) and Datagram Transport Layer Security (DTLS)\", | |||
| 547 | "CBC mode cipher (%s) can be insecure" | 545 | "CBC mode cipher (%s) can be insecure" |
| 548 | cipher))))) | 546 | cipher))))) |
| 549 | 547 | ||
| 550 | (defun nsm-tls-check-3des-cipher (host port status &optional settings) | 548 | (defun nsm-protocol-check--3des-cipher (host port status &optional settings) |
| 551 | "Check for 3DES ciphers. | 549 | "Check for 3DES ciphers. |
| 552 | 550 | ||
| 553 | Due to its use of 64-bit block size, it is known that a | 551 | Due to its use of 64-bit block size, it is known that a |
| @@ -568,7 +566,7 @@ Current Use and Deprecation of TDEA\", | |||
| 568 | "3DES cipher (%s) is weak" | 566 | "3DES cipher (%s) is weak" |
| 569 | cipher)))) | 567 | cipher)))) |
| 570 | 568 | ||
| 571 | (defun nsm-tls-check-rc4-cipher (host port status &optional settings) | 569 | (defun nsm-protocol-check--rc4-cipher (host port status &optional settings) |
| 572 | "Check for RC4 ciphers. | 570 | "Check for RC4 ciphers. |
| 573 | 571 | ||
| 574 | RC4 cipher has been prohibited by RFC 7465[1]. | 572 | RC4 cipher has been prohibited by RFC 7465[1]. |
| @@ -592,7 +590,7 @@ Reference: | |||
| 592 | 590 | ||
| 593 | ;; Signature checks | 591 | ;; Signature checks |
| 594 | 592 | ||
| 595 | (defun nsm-tls-check-sha1-sig (host port status &optional settings) | 593 | (defun nsm-protocol-check--sha1-sig (host port status &optional settings) |
| 596 | "Check for SHA1 signatures on certificates. | 594 | "Check for SHA1 signatures on certificates. |
| 597 | 595 | ||
| 598 | The first SHA1 collision was found in 2017[1], as a precaution | 596 | The first SHA1 collision was found in 2017[1], as a precaution |
| @@ -627,7 +625,7 @@ SHA-1 for SSL/TLS Certificates in Microsoft Edge and Internet Explorer | |||
| 627 | algo) | 625 | algo) |
| 628 | end)) | 626 | end)) |
| 629 | 627 | ||
| 630 | (defun nsm-tls-check-md5-sig (host port status &optional settings) | 628 | (defun nsm-protocol-check--md5-sig (host port status &optional settings) |
| 631 | "Check for MD5 signatures on certificates. | 629 | "Check for MD5 signatures on certificates. |
| 632 | 630 | ||
| 633 | In 2008, a group of researchers were able to forge an | 631 | In 2008, a group of researchers were able to forge an |
| @@ -660,7 +658,7 @@ the MD5 Message-Digest and the HMAC-MD5 Algorithms\", | |||
| 660 | 658 | ||
| 661 | ;; Extension checks | 659 | ;; Extension checks |
| 662 | 660 | ||
| 663 | (defun nsm-tls-check-renegotiation-info-ext (host port status | 661 | (defun nsm-protocol-check--renegotiation-info-ext (host port status |
| 664 | &optional settings) | 662 | &optional settings) |
| 665 | "Check for renegotiation_info TLS extension status. | 663 | "Check for renegotiation_info TLS extension status. |
| 666 | 664 | ||
| @@ -681,7 +679,7 @@ Layer Security (TLS) Renegotiation Indication Extension\", | |||
| 681 | 679 | ||
| 682 | ;; Compression checks | 680 | ;; Compression checks |
| 683 | 681 | ||
| 684 | (defun nsm-tls-check-compression (host port status &optional settings) | 682 | (defun nsm-protocol-check--compression (host port status &optional settings) |
| 685 | "Check for TLS compression. | 683 | "Check for TLS compression. |
| 686 | 684 | ||
| 687 | TLS compression attacks such as CRIME would allow an attacker to | 685 | TLS compression attacks such as CRIME would allow an attacker to |
| @@ -701,7 +699,7 @@ Security (DTLS)\", `https://tools.ietf.org/html/rfc7525'" | |||
| 701 | 699 | ||
| 702 | ;; Protocol version checks | 700 | ;; Protocol version checks |
| 703 | 701 | ||
| 704 | (defun nsm-tls-check-version (host port status &optional settings) | 702 | (defun nsm-protocol-check--version (host port status &optional settings) |
| 705 | "Check for SSL/TLS protocol version. | 703 | "Check for SSL/TLS protocol version. |
| 706 | 704 | ||
| 707 | This function guards against the usage of SSL3.0, which has been | 705 | This function guards against the usage of SSL3.0, which has been |
| @@ -726,7 +724,7 @@ Early TLS\" | |||
| 726 | 724 | ||
| 727 | ;; Full suite checks | 725 | ;; Full suite checks |
| 728 | 726 | ||
| 729 | (defun nsm-tls-check-null-suite (host port status &optional settings) | 727 | (defun nsm-protocol-check--null-suite (host port status &optional settings) |
| 730 | "Check for NULL cipher suites. | 728 | "Check for NULL cipher suites. |
| 731 | 729 | ||
| 732 | This function checks for NULL key exchange, cipher and message | 730 | This function checks for NULL key exchange, cipher and message |