Skip to content

Commit 91d8716

Browse files
0xMax42wxiaoguang
andauthored
feat(debian): use explicit, stronger defaults for newly generated repo signing keys (#36236)
Make Debian repository signing key generation use explicit stronger defaults and embed the creation time in the OpenPGP comment for newly created keys. --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 parent 094104b commit 91d8716

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

services/packages/debian/repository.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"bytes"
88
"compress/gzip"
99
"context"
10+
"crypto"
1011
"errors"
1112
"fmt"
1213
"io"
@@ -67,7 +68,14 @@ func GetOrCreateKeyPair(ctx context.Context, ownerID int64) (string, string, err
6768
}
6869

6970
func generateKeypair() (string, string, error) {
70-
e, err := openpgp.NewEntity("", "Debian Registry", "", nil)
71+
// Repository signing keys are long-lived and there is currently no rotation mechanism, choose stronger algorithms
72+
cfg := &packet.Config{
73+
RSABits: 4096,
74+
DefaultHash: crypto.SHA256,
75+
DefaultCipher: packet.CipherAES256,
76+
}
77+
78+
e, err := openpgp.NewEntity("", "Automatically generated Debian Registry Key; created "+time.Now().UTC().Format(time.RFC3339), "", cfg)
7179
if err != nil {
7280
return "", "", err
7381
}

0 commit comments

Comments
 (0)