From a95fd447ee34dd670345b5d73e6a3f7ea4a586fd Mon Sep 17 00:00:00 2001 From: Nic Klaassen Date: Mon, 21 Oct 2024 16:28:41 -0700 Subject: [PATCH] lint against rsa.GenerateKey (#47775) * lint against rsa.GenerateKey * update e ref --- .golangci.yml | 5 ++++ e | 2 +- lib/auth/native/native.go | 59 --------------------------------------- 3 files changed, 6 insertions(+), 60 deletions(-) delete mode 100644 lib/auth/native/native.go diff --git a/.golangci.yml b/.golangci.yml index dd70e4302e6d..7dcf0342101f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -80,6 +80,7 @@ linters: - testifylint - unconvert - unused + - forbidigo linters-settings: depguard: @@ -228,6 +229,10 @@ linters-settings: - len - suite-extra-assert-call - suite-thelper + forbidigo: + forbid: + - p: '^rsa\.GenerateKey$' + msg: 'generating RSA keys is slow, use lib/cryptosuites to generate an appropriate key type' output: uniq-by-line: false diff --git a/e b/e index d3347acb2791..e4f948c67221 160000 --- a/e +++ b/e @@ -1 +1 @@ -Subproject commit d3347acb2791ad6b527cb5cce3283778ac0b6b26 +Subproject commit e4f948c6722147398b9abb2fe1075456443c4dde diff --git a/lib/auth/native/native.go b/lib/auth/native/native.go deleted file mode 100644 index e8128fa06c2d..000000000000 --- a/lib/auth/native/native.go +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Teleport - * Copyright (C) 2023 Gravitational, Inc. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -// Package native will be deleted as soon as references are removed from -// teleport.e. -package native - -import ( - "crypto/rsa" - "testing" - - "github.com/gravitational/trace" - - "github.com/gravitational/teleport/lib/cryptosuites" - "github.com/gravitational/teleport/lib/modules" -) - -// GenerateRSAPrivateKey will be deleted as soon as references are removed from -// teleport.e. -func GenerateRSAPrivateKey() (*rsa.PrivateKey, error) { - key, err := cryptosuites.GenerateKeyWithAlgorithm(cryptosuites.RSA2048) - if err != nil { - return nil, trace.Wrap(err) - } - return key.(*rsa.PrivateKey), nil -} - -// PrecomputeKeys is an alias of [cryptosuites.PrecomputeRSAKeys]. It will be -// deleted as soon as references are removed from teleport.e. -func PrecomputeKeys() { - cryptosuites.PrecomputeRSAKeys() -} - -// PrecomputeTestKeys is an alias of [cryptosuites.PrecomputeRSATestKeys]. It -// will be deleted as soon as references are removed from teleport.e. -func PrecomputeTestKeys(m *testing.M) { - cryptosuites.PrecomputeRSATestKeys(m) -} - -// IsBoringBinary is an alias of [modules.IsBoringBinary]. It will be deleted as -// soon as references are removed from teleport.e. -func IsBoringBinary() bool { - return modules.IsBoringBinary() -}