Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mutt/neomutt: work around S/MIME issues with application/pgp-encrypted #50927

Merged
merged 1 commit into from Nov 27, 2018

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Nov 22, 2018

Motivation for this change

The original issue can be reproduced when sending with an unpatched
mutt or neomutt an email with an attachement which as han .asc
extension. This will be interpreted as application/pgp-encrypted which
experiences special logic, in the end the attachement will contain
"Version: 1"[1][2][3]

Right now, there are the following issues in the {,neo}mutt packages:

  • mutt.override { smimeSupport = true } fails to build since the
    Debian patch results in a 404. Debian moved their packages to
    salsa.debian.org.

    However we can't use a versioned URL for this as Debian only tracks
    the Mutt versions that are available in their releases. The patch
    doesn't touch Mutt's core and is therefore simple to rebase, so
    sticking to the 1.10.2 patch for now should be sufficient.

  • The original issue was never fixed in NeoMutt, currently we use the
    S/MIME database from pkgs.mime-types which contains the issue with
    application/pgp-encrypted as well.

    It seems as it's more reliable to use the default neomutt database
    for now which lives in doc/mime.types and place it into PKGDATADIR
    ($out/share/neomutt).

[1] https://bugs.archlinux.org/task/43319
[2] https://bugs.gentoo.org/534658
[3] https://github.com/neomutt/neomutt/blob/neomutt-20180716/sendlib.c#L490-L496

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Mic92
Copy link
Member

Mic92 commented Nov 23, 2018

cc @flokli

@c0bw3b
Copy link
Contributor

c0bw3b commented Nov 24, 2018

@Ma27 I believe mime-types-9 is outdated.

I just packaged mailcap that provides a fresher /etc/mime.types in #50987
You could patch mutt and neomutt to use this file to be sure .asc files are seen as text/plain MIME types.

@Ma27
Copy link
Member Author

Ma27 commented Nov 25, 2018

I believe mime-types-9 is outdated.

@c0bw3b I figured that, but I orignally thought that it would be best to use the default MIME database distributed with the package.

I'll have a deeper look at mailcap tomorrow (the patch itself seems good), then we can optionally merge that PR and continue with the discussion here whether to use mailcap for MIME discovery :)

@Ma27 Ma27 force-pushed the fix-smime-for-mutt-and-neomutt branch from e4bde7e to 6fc611b Compare November 25, 2018 21:23
@Ma27
Copy link
Member Author

Ma27 commented Nov 25, 2018

@c0bw3b I updated the neomutt expression which now simply replaces mime-types with mailcap and confirmed that this works. Thanks a lot for bringing this up!

@c0bw3b
Copy link
Contributor

c0bw3b commented Nov 25, 2018

No problem. Actually your PR made me wonder where Nixpkgs/NixOS was sourcing its /etc/mime.types and look at other distros.

FWIW Arch seem to use mailcap mime.types for mutt too. But they don't need to patch anything since the file will be available in its standard location under /etc.

On a side note: Debian sources moved to their GitLab on https://salsa.debian.org
Patches for mutt are under https://salsa.debian.org/mutt-team/mutt/tree/debian/1.10.1-2/debian/patches/

@Ma27 Ma27 force-pushed the fix-smime-for-mutt-and-neomutt branch from 6fc611b to 8d101a4 Compare November 26, 2018 00:49
@Ma27
Copy link
Member Author

Ma27 commented Nov 26, 2018

@c0bw3b thanks for the note, I updated the PR accordingly. (I've seen salsa before, but I wasn't sure if this applies for all of their packages ^^)

The original issue can be reproduced when sending with an unpatched
`mutt` or `neomutt` an email with an attachement which as han `.asc`
extension. This will be interpreted as `application/pgp-encrypted` which
experiences special logic, in the end the attachement will contain
"Version: 1"[1][2][3]

Right now, there are the following issues in the {,neo}mutt packages:

* `mutt.override { smimeSupport = true }` fails to build since the
  Debian patch results in a 404. Debian moved their packages to
  `salsa.debian.org`.

  However we can't use a versioned URL for this as Debian only tracks
  the Mutt versions that are available in their releases. The patch
  doesn't touch Mutt's core and is therefore simple to rebase, so
  sticking to the 1.10.2 patch for now should be sufficient.

* The original issue was never fixed in NeoMutt, currently we use the
  S/MIME database from `pkgs.mime-types` which contains the issue with
  `application/pgp-encrypted` as well.

  After some discussion[4] it seems to be the best decision to use the
  `mailcap` database distributed by Fedora[5] which fixes the issue
  rather than `mime-types` v9 from 2012.

[1] https://bugs.archlinux.org/task/43319
[2] https://bugs.gentoo.org/534658
[3] https://github.com/neomutt/neomutt/blob/neomutt-20180716/sendlib.c#L490-L496
[4] NixOS#50927 (comment)
[5] https://pagure.io/mailcap
@Ma27 Ma27 force-pushed the fix-smime-for-mutt-and-neomutt branch from 8d101a4 to 991d4bf Compare November 26, 2018 00:51
@c0bw3b
Copy link
Contributor

c0bw3b commented Nov 26, 2018

@GrahamcOfBorg build mutt

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: mutt

Partial log (click to expand)

shrinking /nix/store/hawpc70ky7cm0q0d6iqny05wnpx6lyr8-mutt-1.10.1/bin/pgpewrap
gzipping man pages under /nix/store/hawpc70ky7cm0q0d6iqny05wnpx6lyr8-mutt-1.10.1/share/man/
strip is /nix/store/n4hb93w6j076xcjw5pm09rdmc09s075b-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/hawpc70ky7cm0q0d6iqny05wnpx6lyr8-mutt-1.10.1/bin
patching script interpreter paths in /nix/store/hawpc70ky7cm0q0d6iqny05wnpx6lyr8-mutt-1.10.1
/nix/store/hawpc70ky7cm0q0d6iqny05wnpx6lyr8-mutt-1.10.1/bin/flea: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
/nix/store/hawpc70ky7cm0q0d6iqny05wnpx6lyr8-mutt-1.10.1
/nix/store/hawpc70ky7cm0q0d6iqny05wnpx6lyr8-mutt-1.10.1/bin/smime_keys: interpreter directive changed from " /usr/bin/perl -w" to "/nix/store/svqh993szsgi152vywx5ybyh1k22l5j1-perl-5.28.0/bin/perl -w"
/nix/store/hawpc70ky7cm0q0d6iqny05wnpx6lyr8-mutt-1.10.1/bin/muttbug: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
checking for references to /build in /nix/store/hawpc70ky7cm0q0d6iqny05wnpx6lyr8-mutt-1.10.1...

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: mutt

Partial log (click to expand)

shrinking /nix/store/lj4xy9992gvpzs6f4wwa8c20q22ds7zx-mutt-1.10.1/bin/mutt
gzipping man pages under /nix/store/lj4xy9992gvpzs6f4wwa8c20q22ds7zx-mutt-1.10.1/share/man/
strip is /nix/store/qjrnv0qw44bw1hc23zhfh26xd1c25dfs-binutils-2.30/bin/strip
stripping (with command strip and flags -S) in /nix/store/lj4xy9992gvpzs6f4wwa8c20q22ds7zx-mutt-1.10.1/bin
patching script interpreter paths in /nix/store/lj4xy9992gvpzs6f4wwa8c20q22ds7zx-mutt-1.10.1
/nix/store/lj4xy9992gvpzs6f4wwa8c20q22ds7zx-mutt-1.10.1/bin/smime_keys: interpreter directive changed from " /usr/bin/perl -w" to "/nix/store/nv50smxc219sc49cwgvp0fi9w172y1b4-perl-5.28.0/bin/perl -w"
/nix/store/lj4xy9992gvpzs6f4wwa8c20q22ds7zx-mutt-1.10.1/bin/flea: interpreter directive changed from "/bin/sh" to "/nix/store/bpspdmsl0yys24gs70flsvcw3wcnl7lx-bash-4.4-p23/bin/sh"
/nix/store/lj4xy9992gvpzs6f4wwa8c20q22ds7zx-mutt-1.10.1/bin/muttbug: interpreter directive changed from "/bin/sh" to "/nix/store/bpspdmsl0yys24gs70flsvcw3wcnl7lx-bash-4.4-p23/bin/sh"
checking for references to /build in /nix/store/lj4xy9992gvpzs6f4wwa8c20q22ds7zx-mutt-1.10.1...
/nix/store/lj4xy9992gvpzs6f4wwa8c20q22ds7zx-mutt-1.10.1

@Ma27
Copy link
Member Author

Ma27 commented Nov 27, 2018

@c0bw3b is there anything that keeps us from merging?

@c0bw3b
Copy link
Contributor

c0bw3b commented Nov 27, 2018

One last check
@GrahamcOfBorg build neomutt

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: neomutt

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/libexec  /nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/bin
patching script interpreter paths in /nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/share/doc/neomutt/keybase/pgpverify.sh: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/share/doc/neomutt/keybase/install.sh: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/share/doc/neomutt/keybase/decrypt.sh: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/share/doc/neomutt/keybase/verify.sh: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/share/doc/neomutt/keybase/pgpdecrypt.sh: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/libexec/neomutt/smime_keys: interpreter directive changed from " /usr/bin/perl -w" to "/nix/store/svqh993szsgi152vywx5ybyh1k22l5j1-perl-5.28.0/bin/perl -w"
checking for references to /build in /nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716...
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: neomutt

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/libexec  /nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/bin
patching script interpreter paths in /nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/share/doc/neomutt/keybase/verify.sh: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/share/doc/neomutt/keybase/decrypt.sh: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/share/doc/neomutt/keybase/pgpverify.sh: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/share/doc/neomutt/keybase/pgpdecrypt.sh: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/share/doc/neomutt/keybase/install.sh: interpreter directive changed from "/bin/sh" to "/nix/store/yal8k8rgbaj8p9vi08q1kh21ls0ndq95-bash-4.4-p23/bin/sh"
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716/libexec/neomutt/smime_keys: interpreter directive changed from " /usr/bin/perl -w" to "/nix/store/svqh993szsgi152vywx5ybyh1k22l5j1-perl-5.28.0/bin/perl -w"
checking for references to /build in /nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716...
/nix/store/nvk18kfi04h3al08zsgwk6ch9x2lz6ml-neomutt-20180716

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: neomutt

Partial log (click to expand)

strip is /nix/store/mvpvjar6m4jpjcz48715w2pax53djv6g-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/i1v4j8g9995bmy3sdr6cl7fiirb2nr1a-neomutt-20180716/libexec  /nix/store/i1v4j8g9995bmy3sdr6cl7fiirb2nr1a-neomutt-20180716/bin
patching script interpreter paths in /nix/store/i1v4j8g9995bmy3sdr6cl7fiirb2nr1a-neomutt-20180716
/nix/store/i1v4j8g9995bmy3sdr6cl7fiirb2nr1a-neomutt-20180716/libexec/neomutt/smime_keys: interpreter directive changed from " /usr/bin/perl -w" to "/nix/store/maxij11md81wwwc9nh9c7nz40b7m0n1w-perl-5.28.0/bin/perl -w"
/nix/store/i1v4j8g9995bmy3sdr6cl7fiirb2nr1a-neomutt-20180716/share/doc/neomutt/keybase/decrypt.sh: interpreter directive changed from "/bin/sh" to "/nix/store/sv35yjk452mggg76bz94nppibj96a66h-bash-4.4-p23/bin/sh"
/nix/store/i1v4j8g9995bmy3sdr6cl7fiirb2nr1a-neomutt-20180716/share/doc/neomutt/keybase/install.sh: interpreter directive changed from "/bin/sh" to "/nix/store/sv35yjk452mggg76bz94nppibj96a66h-bash-4.4-p23/bin/sh"
/nix/store/i1v4j8g9995bmy3sdr6cl7fiirb2nr1a-neomutt-20180716/share/doc/neomutt/keybase/pgpdecrypt.sh: interpreter directive changed from "/bin/sh" to "/nix/store/sv35yjk452mggg76bz94nppibj96a66h-bash-4.4-p23/bin/sh"
/nix/store/i1v4j8g9995bmy3sdr6cl7fiirb2nr1a-neomutt-20180716/share/doc/neomutt/keybase/pgpverify.sh: interpreter directive changed from "/bin/sh" to "/nix/store/sv35yjk452mggg76bz94nppibj96a66h-bash-4.4-p23/bin/sh"
/nix/store/i1v4j8g9995bmy3sdr6cl7fiirb2nr1a-neomutt-20180716/share/doc/neomutt/keybase/verify.sh: interpreter directive changed from "/bin/sh" to "/nix/store/sv35yjk452mggg76bz94nppibj96a66h-bash-4.4-p23/bin/sh"
/nix/store/i1v4j8g9995bmy3sdr6cl7fiirb2nr1a-neomutt-20180716

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: neomutt

Partial log (click to expand)

/nix/store/i1v4j8g9995bmy3sdr6cl7fiirb2nr1a-neomutt-20180716

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: neomutt

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/mqzi5wj70p1h4bck10g33hkdqjygv7aq-neomutt-20180716/libexec  /nix/store/mqzi5wj70p1h4bck10g33hkdqjygv7aq-neomutt-20180716/bin
patching script interpreter paths in /nix/store/mqzi5wj70p1h4bck10g33hkdqjygv7aq-neomutt-20180716
/nix/store/mqzi5wj70p1h4bck10g33hkdqjygv7aq-neomutt-20180716/libexec/neomutt/smime_keys: interpreter directive changed from " /usr/bin/perl -w" to "/nix/store/nv50smxc219sc49cwgvp0fi9w172y1b4-perl-5.28.0/bin/perl -w"
/nix/store/mqzi5wj70p1h4bck10g33hkdqjygv7aq-neomutt-20180716/share/doc/neomutt/keybase/verify.sh: interpreter directive changed from "/bin/sh" to "/nix/store/bpspdmsl0yys24gs70flsvcw3wcnl7lx-bash-4.4-p23/bin/sh"
/nix/store/mqzi5wj70p1h4bck10g33hkdqjygv7aq-neomutt-20180716/share/doc/neomutt/keybase/pgpverify.sh: interpreter directive changed from "/bin/sh" to "/nix/store/bpspdmsl0yys24gs70flsvcw3wcnl7lx-bash-4.4-p23/bin/sh"
/nix/store/mqzi5wj70p1h4bck10g33hkdqjygv7aq-neomutt-20180716/share/doc/neomutt/keybase/pgpdecrypt.sh: interpreter directive changed from "/bin/sh" to "/nix/store/bpspdmsl0yys24gs70flsvcw3wcnl7lx-bash-4.4-p23/bin/sh"
/nix/store/mqzi5wj70p1h4bck10g33hkdqjygv7aq-neomutt-20180716/share/doc/neomutt/keybase/install.sh: interpreter directive changed from "/bin/sh" to "/nix/store/bpspdmsl0yys24gs70flsvcw3wcnl7lx-bash-4.4-p23/bin/sh"
/nix/store/mqzi5wj70p1h4bck10g33hkdqjygv7aq-neomutt-20180716/share/doc/neomutt/keybase/decrypt.sh: interpreter directive changed from "/bin/sh" to "/nix/store/bpspdmsl0yys24gs70flsvcw3wcnl7lx-bash-4.4-p23/bin/sh"
checking for references to /build in /nix/store/mqzi5wj70p1h4bck10g33hkdqjygv7aq-neomutt-20180716...
/nix/store/mqzi5wj70p1h4bck10g33hkdqjygv7aq-neomutt-20180716

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: neomutt

Partial log (click to expand)

  /nix/store/dbh94f2w319aa2d863vnjfa3c13fga3b-libselinux-2.7.drv
  /nix/store/ll6673ym2zxmgval010qlnvqvrwia4nj-libungif-4.1.4.drv
  /nix/store/rdgv0jdkyiqzxyh8ky87sb52h59g40xb-libotf-0.9.16.drv
  /nix/store/ky5xzgp77gzrq4ijfvixfkgyfhw3ak8b-emacs-26.1.drv
  /nix/store/l7i4dx18ci8apz97j5wfifnpi5qdqlf1-bash-completion-2.8.drv
  /nix/store/xjm9wvcvhpf3gnxvhk5j3m1s6yb82msy-talloc-2.1.14.drv
  /nix/store/n3iigh5q4adk930wjgqydfvn64j71fq2-notmuch-0.28.drv
  /nix/store/1flsqy7pjx0k26j0pqakg43jaq11va2k-neomutt-20180716.drv
waiting for locks or build slots...
/nix/store/mqzi5wj70p1h4bck10g33hkdqjygv7aq-neomutt-20180716

@c0bw3b
Copy link
Contributor

c0bw3b commented Nov 27, 2018

( so I edited my message to correct a typo and it duplicated ofBorg jobs... that's dangerous :p )

LGTM

@c0bw3b c0bw3b merged commit 483914b into NixOS:master Nov 27, 2018
@Ma27 Ma27 deleted the fix-smime-for-mutt-and-neomutt branch November 27, 2018 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants