forked from remind101/empire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
certs.go
41 lines (32 loc) · 1.28 KB
/
certs.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"os"
"github.com/remind101/empire/pkg/heroku"
)
var cmdCertAttach = &Command{
Run: runCertAttach,
Usage: "cert-attach <aws_cert_arn>",
NeedsApp: true,
Category: "certs",
Short: "attach a certificate to an app",
Long: `
Attaches an SSL certificate to an applications web process. When using the ECS backend, this will attach an IAM server certificate to the applications ELB.
Before running this command, you should upload your SSL certificate and key to IAM using the AWS CLI.
Examples:
$ aws iam upload-server-certificate --server-certificate-name myServerCertificate --certificate-body file://public_key_cert_file.pem --private-key file://my_private_key.pem --certificate-chain file://my_certificate_chain_file.pem
# ^^ The above command will return the ARN of the certificate, you'll need that for the command below
# Say it returns the arn arn:aws:iam::123456789012:server-certificate/myServerCertificate, you'd use that like this:
$ emp cert-attach arn:aws:iam::123456789012:server-certificate/myServerCertificate -a myapp
`,
}
func runCertAttach(cmd *Command, args []string) {
if len(args) == 0 {
cmd.PrintUsage()
os.Exit(2)
}
cert := args[0]
_, err := client.AppUpdate(mustApp(), &heroku.AppUpdateOpts{
Cert: &cert,
})
must(err)
}