mirror of
				https://github.com/optim-enterprises-bv/vault.git
				synced 2025-10-31 02:28:09 +00:00 
			
		
		
		
	Add missing option for RSA2048 signature (#22227)
Add support to use the new RSA2048 signature to validate EC2 instances. Co-authored-by: Violet Hynes <violet.hynes@hashicorp.com>
This commit is contained in:
		| @@ -56,7 +56,7 @@ const ( | |||||||
| // passed as a parameter to the client.Auth().Login method. | // passed as a parameter to the client.Auth().Login method. | ||||||
| // | // | ||||||
| // Supported options: WithRole, WithMountPath, WithIAMAuth, WithEC2Auth, | // Supported options: WithRole, WithMountPath, WithIAMAuth, WithEC2Auth, | ||||||
| // WithPKCS7Signature, WithIdentitySignature, WithIAMServerIDHeader, WithNonce, WithRegion | // WithPKCS7Signature, WithIdentitySignature, WithRSA2048Signature, WithIAMServerIDHeader, WithNonce, WithRegion | ||||||
| func NewAWSAuth(opts ...LoginOption) (*AWSAuth, error) { | func NewAWSAuth(opts ...LoginOption) (*AWSAuth, error) { | ||||||
| 	a := &AWSAuth{ | 	a := &AWSAuth{ | ||||||
| 		mountPath:     defaultMountPath, | 		mountPath:     defaultMountPath, | ||||||
| @@ -262,6 +262,19 @@ func WithPKCS7Signature() LoginOption { | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // WithRSA2048Signature will explicitly tell the client to send the RSA2048 | ||||||
|  | // signature to verify EC2 auth logins. Only used by EC2 auth type. | ||||||
|  | // If this option is not provided, will default to using the PKCS #7 signature. | ||||||
|  | // The signature type used should match the type of the public AWS cert Vault | ||||||
|  | // has been configured with to verify EC2 instance identity. | ||||||
|  | // https://www.vaultproject.io/api/auth/aws#create-certificate-configuration | ||||||
|  | func WithRSA2048Signature() LoginOption { | ||||||
|  | 	return func(a *AWSAuth) error { | ||||||
|  | 		a.signatureType = rsa2048Type | ||||||
|  | 		return nil | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| func WithIAMServerIDHeader(headerValue string) LoginOption { | func WithIAMServerIDHeader(headerValue string) LoginOption { | ||||||
| 	return func(a *AWSAuth) error { | 	return func(a *AWSAuth) error { | ||||||
| 		a.iamServerIDHeaderValue = headerValue | 		a.iamServerIDHeaderValue = headerValue | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Mauro Leggieri
					Mauro Leggieri