Commit 8d8f204
committed
Bug 2009927 - Add support for rpmsign in the gpg2 signer
This mimics what autograph is doing for debsign. While the signature of
RPM is simple gpg, we can't use the plain gpg2 signer for it because we
cannot attach a detached signature easily, all the tools that are
available for this would require some fairly serious hacking.
The addition itself is fairly straightforward, there's a bit of plumbing
to add it as a signer type, but overall it's sharing all the same code
paths as the debsign signer. The one main difference is how we're
passing the passphrase to it...
The key's passphrase must be given to gpg2 itself, which both debsign
and rpmsign would normally do through pinentry. The config says to use
the caller (rpm/debsign) to get the passphrase from (`pinentry-mode
loopback` in gpg.conf). Autograph uses that and `passphrase-fd 0` to
write the passphrase onto debsign's stdin which is forwarded to the gpg
subprocess and everything works fine there.
Rpmsign on the other hand invokes gpg and changes the stdin for it to a
pipe in which it passes the value to be signed [1]. That means that when
we try to write a passphrase onto rpmsign's stdin, it ends up in the
"void" since it's not forwarded to the gpg subprocess. And `passphrase-fd
0` means that it will read the value to be signed instead of the actual
passphrase which as you can expect doesn't go very well...
Instead of doing that, we force the fd 3 for rpmsign to be a pipe on our
control, and we tell gpg to read from that for the passphrase, and write
it there. It used to do that automatically on its own (setup a fd 3 in
which one could pipe in a passphrase) until rpm 4.13 [2] but got
removed because gpg 2.1 doesn't allow `passphrase-fd` by default anymore.
[1]: https://github.com/rpm-software-management/rpm/blob/4623d4601ee83b5e0ecd16dd3f54d2182b519b30/sign/rpmgensig.c#L254
[2]: rpm-software-management/rpm@0bce5fc1 parent 7638e3a commit 8d8f204
File tree
7 files changed
+363
-54
lines changed- signer/gpg2
- test/fixtures
7 files changed
+363
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
918 | 918 | | |
919 | 919 | | |
920 | 920 | | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
921 | 1017 | | |
922 | 1018 | | |
923 | 1019 | | |
| |||
1675 | 1771 | | |
1676 | 1772 | | |
1677 | 1773 | | |
| 1774 | + | |
1678 | 1775 | | |
1679 | 1776 | | |
1680 | 1777 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
700 | 700 | | |
701 | 701 | | |
702 | 702 | | |
703 | | - | |
| 703 | + | |
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| |||
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
65 | | - | |
66 | | - | |
| 68 | + | |
| 69 | + | |
67 | 70 | | |
68 | 71 | | |
69 | 72 | | |
| |||
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
103 | | - | |
| 106 | + | |
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
110 | | - | |
| 113 | + | |
111 | 114 | | |
112 | 115 | | |
113 | 116 | | |
| |||
140 | 143 | | |
141 | 144 | | |
142 | 145 | | |
143 | | - | |
| 146 | + | |
144 | 147 | | |
145 | 148 | | |
146 | 149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
34 | 37 | | |
35 | 38 | | |
36 | 39 | | |
| |||
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
| 107 | + | |
104 | 108 | | |
105 | 109 | | |
106 | 110 | | |
107 | 111 | | |
108 | | - | |
| 112 | + | |
109 | 113 | | |
110 | 114 | | |
111 | 115 | | |
| |||
136 | 140 | | |
137 | 141 | | |
138 | 142 | | |
139 | | - | |
140 | | - | |
141 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
142 | 146 | | |
143 | 147 | | |
144 | 148 | | |
| |||
371 | 375 | | |
372 | 376 | | |
373 | 377 | | |
374 | | - | |
375 | | - | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
376 | 381 | | |
377 | | - | |
378 | | - | |
| 382 | + | |
| 383 | + | |
379 | 384 | | |
380 | 385 | | |
381 | 386 | | |
| |||
384 | 389 | | |
385 | 390 | | |
386 | 391 | | |
387 | | - | |
| 392 | + | |
388 | 393 | | |
389 | 394 | | |
390 | 395 | | |
| |||
397 | 402 | | |
398 | 403 | | |
399 | 404 | | |
400 | | - | |
401 | | - | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
402 | 414 | | |
403 | 415 | | |
404 | 416 | | |
405 | 417 | | |
406 | | - | |
| 418 | + | |
407 | 419 | | |
408 | 420 | | |
409 | 421 | | |
| |||
412 | 424 | | |
413 | 425 | | |
414 | 426 | | |
415 | | - | |
416 | | - | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
421 | | - | |
422 | | - | |
423 | | - | |
424 | | - | |
425 | | - | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
426 | 464 | | |
427 | 465 | | |
428 | | - | |
| 466 | + | |
| 467 | + | |
429 | 468 | | |
430 | | - | |
| 469 | + | |
431 | 470 | | |
| 471 | + | |
432 | 472 | | |
433 | | - | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
438 | | - | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
439 | 478 | | |
440 | | - | |
441 | | - | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
442 | 486 | | |
443 | | - | |
| 487 | + | |
| 488 | + | |
444 | 489 | | |
445 | | - | |
| 490 | + | |
446 | 491 | | |
447 | 492 | | |
448 | 493 | | |
449 | 494 | | |
450 | 495 | | |
451 | 496 | | |
452 | | - | |
| 497 | + | |
453 | 498 | | |
454 | 499 | | |
455 | 500 | | |
456 | 501 | | |
457 | 502 | | |
458 | 503 | | |
459 | | - | |
| 504 | + | |
460 | 505 | | |
461 | 506 | | |
0 commit comments