Documentation ¶
Index ¶
- func DecodePEMAndParseCertificate(certificate string) (*x509.Certificate, error)
- func GetIamInstanceProfileARN(output *ec2.DescribeInstancesOutput) (string, error)
- func GetPublicIPAddress(output *ec2.DescribeInstancesOutput) (string, error)
- func ValidateInstance(output *ec2.DescribeInstancesOutput, doc IdentityDocument, remoteAddr string) (role string, err error)
- type IdentityDocument
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodePEMAndParseCertificate ¶
func DecodePEMAndParseCertificate(certificate string) (*x509.Certificate, error)
DecodePEMAndParseCertificate decodes the PEM encoded certificate and parses it into a x509 cert.
func GetIamInstanceProfileARN ¶
func GetIamInstanceProfileARN(output *ec2.DescribeInstancesOutput) (string, error)
GetIamInstanceProfileARN extracts the ARN from the output of a call to DescribeInstances. The ARN is expected to be non-empty.
func GetPublicIPAddress ¶
func GetPublicIPAddress(output *ec2.DescribeInstancesOutput) (string, error)
GetPublicIPAddress extracts the public IP address from the output of a call to DescribeInstances. The response is expected to be non-empty if the instance has a public IP and empty ("") if the instance is private.
func ValidateInstance ¶
func ValidateInstance(output *ec2.DescribeInstancesOutput, doc IdentityDocument, remoteAddr string) (role string, err error)
ValidateInstance checks if an EC2 instance exists and it has the expected IP. It returns the name of the instance profile (the IAM role).
Note that this validation will not work for NATed VMs.
Types ¶
type IdentityDocument ¶
type IdentityDocument struct { InstanceID string `json:"instanceId,omitempty"` AccountID string `json:"accountId,omitempty"` Region string `json:"region,omitempty"` PendingTime time.Time `json:"pendingTime,omitempty"` }
func ParseAndVerifyIdentityDocument ¶
func ParseAndVerifyIdentityDocument(pkcs7b64 string) (*IdentityDocument, string, error)
ParseAndVerifyIdentityDocument parses and checks and identity document in PKCS#7 format. Only some relevant fields are returned.