Commit graph

90 commits

Author SHA1 Message Date
Jimmy Yuen Ho Wong
682578fcf7
Add option to bypass NSM TLS checks on local networks
* lisp/net/net-utils.el (nslookup-host-ipv4, nslookup-host-ipv6,
  ipv6-expand): New functions to lookup IPv4 and IPv6 addresses from
  DNS.

* lisp/net/nsm.el (nsm-trust-local-network, nsm-should-check,
  nsm-check-tls-connection, nsm-check-plain-connection): New defcustom
  `nsm-trust-local-network' lets users customize whether NSM should
  check for TLS problems when connecting to the hosts on their local
  networks.  `nsm-should-check' determines whether
  `nsm-check-tls-connection' and `nsm-check-plain-connection' should
  perform checks.  localhost is implicitly trusted, thus checks are
  never performed there.
2018-07-14 17:50:44 +01:00
Jimmy Yuen Ho Wong
534a3d5d3a
Revamp Network Security manager checks for TLS
* lisp/net/nsm.el (network-security-level, nsm-level,
  nsm-new-fingerprint-ok-p): Remove `paranoid' level and related code.

* lisp/net/nsm.el (nsm-tls-checks, nsm-tls-check-version,
    nsm-tls-check-compression, nsm-tls-check-renegotiation-info-ext,
    nsm-tls-check-verify-cert, nsm-tls-check-same-cert,
    nsm-tls-check-null-suite, nsm-tls-check-export-kx,
    nsm-tls-check-anon-kx, nsm-tls-check-md5-sig,
    nsm-tls-check-rc4-cipher, nsm-tls-check-dhe-prime-kx,
    nsm-tls-check-sha1-sig, nsm-tls-check-ecdsa-cbc-cipher
    nsm-tls-check-dhe-kx, nsm-tls-check-rsa-kx,
    nsm-tls-check-3des-cipher, nsm-tls-check-cbc-cipher,
    nsm-save-fingerprint-maybe, nsm-tls-post-check-functions): New
    options and functions for checking TLS handshake problems.

* lisp/net/nsm.el (nsm-check-certificate,
  network-security-protocol-checks,
  nsm-protocol-check--diffie-hellman-prime-bits,
  nsm-protocol-check--3des, nsm-protocol-check--rc4,
  nsm-protocol-check--signature-sha1,
  nsm-protocol-check--intermediate-sha1, nsm-protocol-check--ssl,
  nsm-check-protocol): Remove in favor of `nsm-tls-checks' and
  `nsm-tls-check-*' functions.

* lisp/net/nsm.el (nsm-verify-connection): Ensure connection is
  checked even when `network-security-level' is `low'.

* lisp/net/nsm.el (nsm-check-tls-connection): Batch all problems found
  before querying the user.

* lisp/net/nsm.el (nsm--encryption): Renamed to `nsm-cipher-suite'.

* lisp/net/nsm.el (nsm-fingerprint-ok-p): No longer prompt when
  certificate fingerprints mismatch.  Returns a boolean instead when
  the fingerprint of the certificate received matches the saved
  fingerprints.

* lisp/net/nsm.el (nsm-query): Change signature.  Accepts a list of
  problems and a preformatted message instead of just a message format
  and the arguments for the message.

* lisp/net/nsm.el (nsm-query-user): Change signature.  Accepts a
  preformatted message and the peer status of the handshake instead of
  a message format, its arguments and the certificate for the host.

* lisp/net/nsm.el (nsm-save-host): Change signature.  Accepts a list of
  problems after the WHAT parameter.  Saves multiple fingerprints for
  the same host in case the host load balances a TLS server with more
  than one certificates signed with different keys.  Makes sure
  conditions are not removed when updating a fingerprint.

* lisp/net/nsm.el (nsm-format-certificate): Display the TLS handshake's
  renegotiation info extension, compression level, encrypt-then-MAC
  extension, and key exchange prime bit length.

* src/gnutls.c (gnutls-peer-status-warning-describe,
  gnutls-peer-status): Check for certificate verification problems
  introduced since GnuTLS 3.1.

* src/gnutls.c (gnutls-peer-status): `:compression', `:encrypt-then-mac'
  and `:safe-renegotiation' are now contained in the peer status
  result return value.
2018-07-14 17:50:44 +01:00
Lars Ingebrigtsen
c6de1f1592 Fix typo in sha1-intermediate check
* lisp/net/nsm.el (nsm-protocol-check--intermediate-sha1): Allow
storing the exception with a correct name.
2018-07-08 16:14:06 +02:00
Lars Ingebrigtsen
27a21970f6 Fix spelling of "intermediate" (it's not "intermediary")
* doc/emacs/misc.texi (Network Security): Ditto.

* lisp/net/nsm.el (network-security-protocol-checks): Fix spelling
on "intermediate".
(nsm-protocol-check--intermediate-sha1): Ditto.
2018-06-25 18:56:55 +02:00
Lars Ingebrigtsen
3e7692f07d Make the intermediary-sha1 check work
* lisp/net/nsm.el (nsm-protocol-check--intermediary-sha1): Make
the "skip the root cert" logic work (suggested by Noam Postavsky).
2018-06-25 02:40:25 +02:00
Lars Ingebrigtsen
5a285a4db9 Make more TLS checks trigger on the default `medium' level
* doc/emacs/misc.texi (Network Security): Update the doc to say
what's on the different levels.

* lisp/net/nsm.el (nsm-protocol-check--intermediary-sha1): Check
intermediary certificates for SHA1.
(nsm-protocol-check--3des): Check for 3DES ciphers.
(network-security-protocol-checks): Put most of the checks on
`medium'.
2018-06-24 22:57:27 +02:00
Lars Ingebrigtsen
eaa054a94b Fix reverse test in previous check-in
* lisp/net/nsm.el (nsm-check-protocol): Fix reverse test in
previous check-in.
2018-06-24 15:40:43 +02:00
Lars Ingebrigtsen
6584bc6720 Refactor the protocol NSM checks for flexibility
* doc/emacs/misc.texi (Network Security): Mention
network-security-protocol-checks.

* lisp/net/nsm.el (network-security-protocol-checks): New variable.
(nsm-check-protocol): Refactor the checks into separate functions
for greater flexibility.
(nsm-protocol-check--diffie-hellman-prime-bits)
(nsm-protocol-check--rc4, nsm-protocol-check--ssl)
(nsm-protocol-check--signature-sha1): Refactored out of the big
function.
2018-06-24 15:37:00 +02:00
Paul Eggert
5c7dd8a783 Update copyright year to 2018
Run admin/update-copyright.
2018-01-01 00:57:59 -08:00
Mark Oteiza
295457ae52 Move read-multiple-choice to its own library
* lisp/emacs-lisp/rmc.el: New file.
* lisp/emacs-lisp/subr-x.el (read-multiple-choice): Remove.
* lisp/gnus/message.el:
* lisp/net/nsm.el: Change required library.
2017-10-06 10:42:06 -04:00
Paul Eggert
bc511a64f6 Prefer HTTPS to FTP and HTTP in documentation
Most of this change is to boilerplate commentary such as license URLs.
This change was prompted by ftp://ftp.gnu.org's going-away party,
planned for November.  Change these FTP URLs to https://ftp.gnu.org
instead.  Make similar changes for URLs to other organizations moving
away from FTP.  Also, change HTTP to HTTPS for URLs to gnu.org and
fsf.org when this works, as this will further help defend against
man-in-the-middle attacks (for this part I omitted the MS-DOS and
MS-Windows sources and the test tarballs to keep the workload down).
HTTPS is not fully working to lists.gnu.org so I left those URLs alone
for now.
2017-09-13 15:54:37 -07:00
Glenn Morris
0f83433946 Avoid unnecessary loading of subr-x at run-time
* lisp/doc-view.el, lisp/filenotify.el, lisp/info-look.el:
* lisp/svg.el, lisp/emacs-lisp/byte-opt.el, lisp/net/shr.el:
* lisp/textmodes/sgml-mode.el, test/lisp/dom-tests.el:
No need to load subr-x at run-time.
* lisp/gnus/nnheader.el: No need to load subr-x.
; * lisp/emacs-lisp/subr-x.el, lisp/gnus/message.el, lisp/net/nsm.el:
; Comments.
2017-04-18 19:07:28 -04:00
Paul Eggert
bcf244ef9b Merge from origin/emacs-25
2e2a806 Fix copyright years by hand
5badc81 Update copyright year to 2017
2017-01-01 01:10:47 -08:00
Paul Eggert
5badc81c1c Update copyright year to 2017
Run admin/update-copyright.
2016-12-31 19:42:26 -08:00
Lars Ingebrigtsen
ad90397c59 Move read-multiple-choice to subr-x.el
* lisp/faces.el (read-multiple-choice-face): Fix doc string.

* lisp/emacs-lisp/subr-x.el (read-multiple-choice): Move here
from subr.el.

* lisp/gnus/message.el (subr-x): Ditto.

* lisp/net/nsm.el: Require subr-x for read-multiple-choice.

read-multiple-choice doesn't need to be in the dumped Emacs, so move
it to a less central file.
2016-07-22 11:08:21 +02:00
Lars Ingebrigtsen
c6d4b63f25 Make the nsm query say what it did after the user interaction
* lisp/net/nsm.el (nsm-query): Issue a message about
aborting/accepting messages (suggested by N. Jackson)
(bug#22531).
2016-02-06 14:08:26 +11:00
Lars Ingebrigtsen
1ef309fc88 Restore window conf in nsm
* lisp/net/nsm.el (nsm-query-user): Restore the window configuration.

Backport:
2016-02-05 17:36:12 +11:00
Lars Ingebrigtsen
44b15ee2e3 Restore the window configuration
* lisp/net/nsm.el (nsm-query-user): Restore the window
configuration (bug#22532).
2016-02-05 17:34:44 +11:00
Lars Ingebrigtsen
e49c46f771 Make NSM prompting clearer
* lisp/net/nsm.el (nsm-query-user): Use read-multiple-choice
to prompt in a nicer way (bug#19368).
2016-02-05 14:32:35 +11:00
Mark Oteiza
3214a8b8d7 ; * lisp/net/nsm.el: Fix typo. 2016-01-25 17:45:27 -05:00
Lars Magne Ingebrigtsen
d20a9488dd * nsm.el (nsm-check-protocol): Fix typo in the message. 2016-01-03 12:19:13 +01:00
Lars Magne Ingebrigtsen
1da116f8ec Add SHA1 warnings for high network security settings
* nsm.el (nsm-check-protocol): When using high security, warn
about SHA1 certificates, which are now believed to be open to
spoofing.
2016-01-03 10:41:51 +01:00
Paul Eggert
0e963201d0 Update copyright year to 2016
Run admin/update-copyright.
2016-01-01 01:34:24 -08:00
Paul Eggert
fbb5531fa1 More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-23 22:39:06 -07:00
Glenn Morris
5b0af214c8 Quieten compilation, eg in --without-x builds.
* lisp/dired-aux.el (lpr-printer-switch):
* lisp/frame.el (tool-bar-height):
* lisp/linum.el (font-info):
* lisp/window.el (font-info, overflow-newline-into-fringe)
(tool-bar-height):
* lisp/emacs-lisp/package-x.el (tar-data-buffer):
* lisp/gnus/gnus-util.el (iswitchb-mode):
* lisp/mail/rmailmm.el (libxml-parse-html-region):
* lisp/net/nsm.el (gnutls-peer-status)
(gnutls-peer-status-warning-describe):
* lisp/net/shr.el (libxml-parse-xml-region):
* lisp/url/url-http.el (gnutls-peer-status): Declare.
2015-05-08 20:13:47 -04:00
Johan Bockgård
a3d11ecb83 * lisp/net/nsm.el (nsm-query-user): Use cursor-in-echo-area. 2015-04-12 15:37:50 +02:00
Paul Eggert
7e09ef09a4 Update copyright year to 2015
Run admin/update-copyright.
2015-01-01 14:26:41 -08:00
Lars Ingebrigtsen
be4304d8d8 Fixes: debbugs:19269
* lisp/net/nsm.el (nsm-save-host): Don't save the host name twice.
2014-12-21 17:20:54 +01:00
Lars Magne Ingebrigtsen
e9aaf96966 Make NSM warn on `high' for older protocols, and document
* doc/emacs/misc.texi (Network Security): Mention the new protocol-level
`high' NSM checks.

(nsm-check-protocol): Also warn if using SSL3 or older.
2014-12-08 22:51:54 +01:00
Lars Magne Ingebrigtsen
be6767d59b Make the NSM prompting have more data
(nsm-format-certificate): Include more data about the connection.
(nsm-query): Fill the text to that it looks nicer.
2014-12-08 22:40:57 +01:00
Lars Magne Ingebrigtsen
7befee11a8 * lisp/net/nsm.el (nsm-check-protocol): Test for RC4 on `high'. 2014-12-08 22:23:51 +01:00
Lars Magne Ingebrigtsen
b7768d785f (nsm-check-protocol): Check for weak Diffie-Hellman prime bits.
Fixes: debbugs:19153
2014-12-08 20:41:05 +01:00
Lars Magne Ingebrigtsen
6b1ab80ef9 `network-security-level' documentation simplification
* lisp/net/nsm.el (network-security-level): Remove the detailed
description, which was already outdated, and refer the users to
the manual.
2014-12-08 20:06:50 +01:00
Lars Magne Ingebrigtsen
f8b82217c7 * net/nsm.el (network-security-level): Change the default to `medium'. 2014-12-01 17:47:05 +01:00
Lars Magne Ingebrigtsen
666e90e5cc Better display for paranoid' network-security-level'
* net/nsm.el (nsm-new-fingerprint-ok-p): Display the certificate
when querying about new certificates.
2014-11-27 00:44:54 +01:00
Lars Magne Ingebrigtsen
ee4eb2810c Fix previous version of nsm-warnings-ok-p
* net/nsm.el (nsm-format-certificate): Don't bug out on missing
elements.
(nsm-warnings-ok-p): The new version of this function always
returned nil when everything was OK.
2014-11-25 16:30:36 +01:00
Lars Magne Ingebrigtsen
63ca64241c * net/nsm.el (nsm-format-certificate): Don't bug out on missing elements 2014-11-25 16:12:47 +01:00
Ted Zlatanov
59bf524c77 net/nsm.el: Use `gnutls-peer-status-warning-describe'.
* net/nsm.el (nsm-check-tls-connection, nsm-save-host)
(nsm-warnings-ok-p): Use `gnutls-peer-status-warning-describe'.
2014-11-25 09:09:11 -05:00
Lars Magne Ingebrigtsen
b10d900663 Rename nsm-security-level' to network-security-level'
* net/nsm.el (network-security-level): Rename from
`nsm-security-level' and documented.
2014-11-23 15:13:13 +01:00
Lars Magne Ingebrigtsen
4c298b2a73 Implement a Network Security Manager
* processes.texi (Network): Mention the new :warn-unless-encrypted
parameter to `open-network-stream'.
(Network): Mention the Network Security Manager.

* net/nsm.el: New file that implements a Network Security Manager.

* net/network-stream.el (open-network-stream): Add a new
:warn-unless-encrypted parameter.
(network-stream-open-plain): Allow warning unless encrypted.
(network-stream-open-starttls): Call the Network Security Manager.
(network-stream-open-tls): Ditto.
2014-11-23 14:56:43 +01:00