Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/, man/
Date: Thu, 27 Oct 2016 19:33:10
Message-Id: 1477595655.98c250cceaf380d6dbeacac90482a5d1956dcb80.zmedico@gentoo
1 commit: 98c250cceaf380d6dbeacac90482a5d1956dcb80
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Mon Oct 24 05:10:55 2016 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 27 19:14:15 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=98c250cc
7
8 emerge-webrsync: use gkeys to verify OpenPGP signatures (bug 597918)
9
10 Use gkeys to verify OpenPGP signatures by default. Refresh the gentoo
11 snapshot signing key before signature verification, in order to ensure
12 that the latest revocation data is available. Add an --insecure option
13 which disables signature verification. Warn about man-in-the-middle
14 attacks when the --insecure option is used. Deprecate the pre-existing
15 webrsync-gpg feature since it requires manual gpg configuration.
16
17 X-Gentoo-Bug: 597918
18 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=597918
19 Acked-by: Brian Dolbec <dolsen <AT> gentoo.org>
20
21 bin/emerge-webrsync | 51 +++++++++++++++++++++++++++++++++++++++++++++++----
22 man/make.conf.5 | 6 ++++--
23 2 files changed, 51 insertions(+), 6 deletions(-)
24
25 diff --git a/bin/emerge-webrsync b/bin/emerge-webrsync
26 index 9961ad8..bdd08e9 100755
27 --- a/bin/emerge-webrsync
28 +++ b/bin/emerge-webrsync
29 @@ -66,13 +66,24 @@ fi
30 do_verbose=0
31 do_debug=0
32 keep=false
33 +insecure=false
34 +
35 +insecure_bypass_msg() {
36 + wecho "The --insecure option can be used to bypass this step."
37 + insecure_warning_msg
38 +}
39 +
40 +insecure_warning_msg() {
41 + wecho "The --insecure option prevents detection of"
42 + wecho "man-in-the-middle attacks!"
43 +}
44
45 if has webrsync-gpg ${FEATURES} ; then
46 - WEBSYNC_VERIFY_SIGNATURE=1
47 + VERIFY_SIGNATURE_LEGACY_MODE=1
48 else
49 - WEBSYNC_VERIFY_SIGNATURE=0
50 + VERIFY_SIGNATURE_LEGACY_MODE=0
51 fi
52 -if [ ${WEBSYNC_VERIFY_SIGNATURE} != 0 -a -z "${PORTAGE_GPG_DIR}" ]; then
53 +if [ ${VERIFY_SIGNATURE_LEGACY_MODE} != 0 -a -z "${PORTAGE_GPG_DIR}" ]; then
54 eecho "please set PORTAGE_GPG_DIR in make.conf"
55 exit 1
56 fi
57 @@ -176,7 +187,7 @@ check_file_signature() {
58 local file="$2"
59 local r=1
60
61 - if [ ${WEBSYNC_VERIFY_SIGNATURE} != 0 ]; then
62 + if [ ${VERIFY_SIGNATURE_LEGACY_MODE} != 0 ]; then
63
64 __vecho "Checking signature ..."
65
66 @@ -186,6 +197,17 @@ check_file_signature() {
67 eecho "cannot check signature: gpg binary not found"
68 exit 1
69 fi
70 + elif ! ${insecure}; then
71 + __vecho "Checking signature ..."
72 +
73 + # gkeys requires that the signature file be in the same directory
74 + # as the snapshot
75 + if [[ ${signature} != ${file}.gpgsig ]]; then
76 + # this should not happen
77 + eecho "assertion failed: ${signature} != ${file}.gpgsig"
78 + exit 1
79 + fi
80 + gkeys verify -C gentoo -n snapshot -F "${file}" && r=0
81 else
82 r=0
83 fi
84 @@ -445,6 +467,7 @@ usage() {
85
86 Options:
87 --revert=yyyymmdd Revert to snapshot
88 + --insecure Disable OpenPGP signature verification
89 -k, --keep Keep snapshots in DISTDIR (don't delete)
90 -q, --quiet Only output errors
91 -v, --verbose Enable verbose output
92 @@ -467,6 +490,7 @@ main() {
93 local v=${arg#*=}
94 case ${arg} in
95 -h|--help) usage ;;
96 + --insecure) insecure=true ;;
97 -k|--keep) keep=true ;;
98 -q|--quiet) PORTAGE_QUIET=1 ;;
99 -v|--verbose) do_verbose=1 ;;
100 @@ -512,6 +536,25 @@ main() {
101 exit 1
102 fi
103
104 + if ${insecure}; then
105 + insecure_warning_msg
106 + elif [[ ${VERIFY_SIGNATURE_LEGACY_MODE} == 1 ]]; then
107 + wecho "FEATURES=webrsync-gpg is deprecated."
108 + wecho "By default, the new gkeys verification mode will be used"
109 + wecho "when FEATURES=webrsync-gpg is not enabled."
110 + else
111 + if ! type -P gkeys >/dev/null; then
112 + eecho "gkeys: command not found"
113 + eecho "Please try again after installing gkeys: emerge app-crypt/gkeys"
114 + insecure_bypass_msg
115 + exit 1
116 + elif ! gkeys refresh-key -C gentoo -n snapshot; then
117 + eecho "gkeys refresh-key failed"
118 + insecure_bypass_msg
119 + exit 1
120 + fi
121 + fi
122 +
123 [[ ${do_debug} -eq 1 ]] && set -x
124
125 if [[ -n ${revert_date} ]] ; then
126
127 diff --git a/man/make.conf.5 b/man/make.conf.5
128 index aea189e..5b809ed 100644
129 --- a/man/make.conf.5
130 +++ b/man/make.conf.5
131 @@ -1,4 +1,4 @@
132 -.TH "MAKE.CONF" "5" "Feb 2016" "Portage VERSION" "Portage"
133 +.TH "MAKE.CONF" "5" "Oct 2016" "Portage VERSION" "Portage"
134 .SH "NAME"
135 make.conf \- custom settings for Portage
136 .SH "SYNOPSIS"
137 @@ -663,7 +663,9 @@ Portage would have to waste time validating ownership for each and every sync
138 operation.
139 .TP
140 .B webrsync-gpg
141 -Enable GPG verification when using \fIemerge\-webrsync\fR.
142 +Enable legacy GPG verification mode when using \fIemerge\-webrsync\fR.
143 +This feature is deprecated. By default, the new \fBgkeys\fR(1) verification
144 +mode will be used when this feature is not enabled.
145 .TP
146 .B xattr
147 Preserve extended attributes (filesystem-stored metadata) when installing