Skip to content

Commit ffa3e8b

Browse files
committed
Allow RSA 2047 bit keys (go-gitea#20272)
Backport go-gitea#20272 Unfortunately it appears that 2048 bit RSA keys can occasionally be created in such a way that they appear to have 2047 bit length. This PR simply changes our defaults to allow these. Fix go-gitea#20249 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 3f5d727 commit ffa3e8b

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

custom/conf/app.example.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ ROUTER = console
12451245
;; Define allowed algorithms and their minimum key length (use -1 to disable a type)
12461246
;ED25519 = 256
12471247
;ECDSA = 256
1248-
;RSA = 2048
1248+
;RSA = 2047 ; we allow 2047 here because an otherwise valid 2048 bit RSA key can be reported as having 2047 bit length
12491249
;DSA = -1 ; set to 1024 to switch on
12501250

12511251
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/content/doc/advanced/config-cheat-sheet.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type
620620

621621
- `ED25519`: **256**
622622
- `ECDSA`: **256**
623-
- `RSA`: **2048**
623+
- `RSA`: **2047**: We set 2047 here because an otherwise valid 2048 RSA key can be reported as 2047 length.
624624
- `DSA`: **-1**: DSA is now disabled by default. Set to **1024** to re-enable but ensure you may need to reconfigure your SSHD provider
625625

626626
## Webhook (`webhook`)

modules/setting/setting.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ var (
170170
ServerMACs: []string{"[email protected]", "hmac-sha2-256", "hmac-sha1"},
171171
KeygenPath: "ssh-keygen",
172172
MinimumKeySizeCheck: true,
173-
MinimumKeySizes: map[string]int{"ed25519": 256, "ed25519-sk": 256, "ecdsa": 256, "ecdsa-sk": 256, "rsa": 2048},
173+
MinimumKeySizes: map[string]int{"ed25519": 256, "ed25519-sk": 256, "ecdsa": 256, "ecdsa-sk": 256, "rsa": 2047},
174174
ServerHostKeys: []string{"ssh/gitea.rsa", "ssh/gogs.rsa"},
175175
AuthorizedKeysCommandTemplate: "{{.AppPath}} --config={{.CustomConf}} serv key-{{.Key.ID}}",
176176
PerWriteTimeout: PerWriteTimeout,

0 commit comments

Comments
 (0)