Github messages for mblaze
 help / color / mirror / Atom feed
* [ISSUE] Handling of encrypted PGP/MIME multipart messages
@ 2020-05-16 19:53 nmeum
  2020-05-16 20:03 ` leahneukirchen
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: nmeum @ 2020-05-16 19:53 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1678 bytes --]

New issue by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/175

Description:
I recently noticed that `contrib/mpgp` doesn't seem to handle encrypted PGP/MIME multipart messages well. For instance, consider an encrypted PGP/MIME messages which consists of text + attachments (e.g. tarballs). Since `mpgp` is a filter it does not seem to be possible to extract  attachments from such a message (e.g. through `mshow -x`) or at least, I didn't manage to do so.

In case anybody else is encountering this issue, I wrote myself the following script (`mshowpgp`) which I use instead of `mpgp`:

```shell
#!/bin/sh
# Decryptes current mblaze (PGP/MIME) message.
set -e

# See ENVIRONMENT section in mseq(1).
MBLAZE="${MBLAZE:-$HOME/.mblaze}"
MAILCUR="${MAILCUR:-$MBLAZE/cur}"

n=$(mshow -t | awk -F: '
	/: application\/pgp-encrypted/ {supported = 1}
	/: application\/octet-stream/ {if (supported) { print $1; exit }}')

if [ "$n" ]; then
	mshow -n -O "$MAILCUR" "$n" | gpg --decrypt | mshow -n /dev/stdin "$@"
	exit 0
else
	echo "Current mblaze message is not PGP/MIME encrypted" 1>&2
	exit 1
fi
```

If the current message is PGP/MIME encrypted its attachments can be extracted using `mshowpgp -x` as usual. The script also illustrates some shortcomings of `mshow`:

1. There doesn't seem to be any portable way of reading messages from standard input (iirc `/dev/stdin` is not specified by POSIX).
2. If `mshow -x` or `mshow -O` is used it does not seem to be possible to use the current message without explicitly specifying its path.

If there is any way to extract attachments with the `mpgp` filter please let me know.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Handling of encrypted PGP/MIME multipart messages
  2020-05-16 19:53 [ISSUE] Handling of encrypted PGP/MIME multipart messages nmeum
@ 2020-05-16 20:03 ` leahneukirchen
  2020-05-16 20:05 ` leahneukirchen
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: leahneukirchen @ 2020-05-16 20:03 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/175#issuecomment-629699181

Comment:
`/dev/stdin` is indeed not POSIX, but exist on every system except for AIX it seems. ;)
I can't use `-` as that is the previous message.

`mshow -x . 3` should work fine?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Handling of encrypted PGP/MIME multipart messages
  2020-05-16 19:53 [ISSUE] Handling of encrypted PGP/MIME multipart messages nmeum
  2020-05-16 20:03 ` leahneukirchen
@ 2020-05-16 20:05 ` leahneukirchen
  2020-05-17  8:34 ` [ISSUE] [CLOSED] " nmeum
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: leahneukirchen @ 2020-05-16 20:05 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 182 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/175#issuecomment-629699370

Comment:
I dunno an easier way to solve your problem.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ISSUE] [CLOSED] Handling of encrypted PGP/MIME multipart messages
  2020-05-16 19:53 [ISSUE] Handling of encrypted PGP/MIME multipart messages nmeum
  2020-05-16 20:03 ` leahneukirchen
  2020-05-16 20:05 ` leahneukirchen
@ 2020-05-17  8:34 ` nmeum
  2020-05-23 13:35 ` leahneukirchen
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: nmeum @ 2020-05-17  8:34 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1679 bytes --]

Closed issue by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/175

Description:
I recently noticed that `contrib/mpgp` doesn't seem to handle encrypted PGP/MIME multipart messages well. For instance, consider an encrypted PGP/MIME messages which consists of text + attachments (e.g. tarballs). Since `mpgp` is a filter it does not seem to be possible to extract  attachments from such a message (e.g. through `mshow -x`) or at least, I didn't manage to do so.

In case anybody else is encountering this issue, I wrote myself the following script (`mshowpgp`) which I use instead of `mpgp`:

```shell
#!/bin/sh
# Decryptes current mblaze PGP/MIME message.
set -e

# See ENVIRONMENT section in mseq(1).
MBLAZE="${MBLAZE:-$HOME/.mblaze}"
MAILCUR="${MAILCUR:-$MBLAZE/cur}"

n=$(mshow -t | awk -F: '
	/: application\/pgp-encrypted/ {supported = 1}
	/: application\/octet-stream/ {if (supported) { print $1; exit }}')

if [ "$n" ]; then
	mshow -n -O "$MAILCUR" "$n" | gpg --decrypt | mshow -n /dev/stdin "$@"
	exit 0
else
	echo "Current mblaze message is not PGP/MIME encrypted" 1>&2
	exit 1
fi
```

If the current message is PGP/MIME encrypted its attachments can be extracted using `mshowpgp -x` as usual. The script also illustrates some shortcomings of `mshow`:

1. There doesn't seem to be any portable way of reading messages from standard input (iirc `/dev/stdin` is not specified by POSIX).
2. If `mshow -x` or `mshow -O` is used it does not seem to be possible to use the current message without explicitly specifying its path.

If there is any way to extract attachments with the `mpgp` filter please let me know.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Handling of encrypted PGP/MIME multipart messages
  2020-05-16 19:53 [ISSUE] Handling of encrypted PGP/MIME multipart messages nmeum
                   ` (2 preceding siblings ...)
  2020-05-17  8:34 ` [ISSUE] [CLOSED] " nmeum
@ 2020-05-23 13:35 ` leahneukirchen
  2020-05-23 15:10 ` nmeum
  2023-02-12 13:13 ` xelxebar
  5 siblings, 0 replies; 7+ messages in thread
From: leahneukirchen @ 2020-05-23 13:35 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 383 bytes --]

New comment by leahneukirchen on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/175#issuecomment-633055063

Comment:
Reopening this. I looked into using filters for mshow -t and -x, but it seems like a waste to run them just because of the exit status.

Perhaps mgpg should just be integrated into mshow directly (and spawn gpg via a pipe).

Patches welcome.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Handling of encrypted PGP/MIME multipart messages
  2020-05-16 19:53 [ISSUE] Handling of encrypted PGP/MIME multipart messages nmeum
                   ` (3 preceding siblings ...)
  2020-05-23 13:35 ` leahneukirchen
@ 2020-05-23 15:10 ` nmeum
  2023-02-12 13:13 ` xelxebar
  5 siblings, 0 replies; 7+ messages in thread
From: nmeum @ 2020-05-23 15:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

New comment by nmeum on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/175#issuecomment-633073063

Comment:
> Perhaps mgpg should just be integrated into mshow directly (and spawn gpg via a pipe).

I am personally happy with my setup where I decrypt mails using a separate mshowpgp program. If someone implements PGP support in mshow itself, be careful not to run into [efail](https://efail.de/) in combination with text/html filters.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Handling of encrypted PGP/MIME multipart messages
  2020-05-16 19:53 [ISSUE] Handling of encrypted PGP/MIME multipart messages nmeum
                   ` (4 preceding siblings ...)
  2020-05-23 15:10 ` nmeum
@ 2023-02-12 13:13 ` xelxebar
  5 siblings, 0 replies; 7+ messages in thread
From: xelxebar @ 2023-02-12 13:13 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

New comment by xelxebar on mblaze repository

https://github.com/leahneukirchen/mblaze/issues/175#issuecomment-1427030335

Comment:
Late to the party here, but I'm just doing something way dumber here: `mgpgshow(){ mraw "$1" | gpg --decrypt | mshow -;}`.

That said. It would be nice to also verify the signature.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-02-12 13:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-16 19:53 [ISSUE] Handling of encrypted PGP/MIME multipart messages nmeum
2020-05-16 20:03 ` leahneukirchen
2020-05-16 20:05 ` leahneukirchen
2020-05-17  8:34 ` [ISSUE] [CLOSED] " nmeum
2020-05-23 13:35 ` leahneukirchen
2020-05-23 15:10 ` nmeum
2023-02-12 13:13 ` xelxebar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).