Merge pull request #20 from UKHomeOffice/bundle_format

bundle format
This commit is contained in:
Rohith 2016-06-30 14:16:17 +01:00 committed by GitHub
commit e6435f3f44
3 changed files with 30 additions and 7 deletions

View file

@ -1,4 +1,12 @@
#### **Version v0.1.0**
##### FEATURES
BUGS
* Fixed the bundle format to produce four file, a bundle with cert+ca, and the FILENAME-ca.pem, FILENAME-key.pem,
and the FILENAME.pem certificate
#### **Version v0.0.9-1**
##### FEATURES

View file

@ -90,18 +90,33 @@ func writeCertificateFile(filename string, data map[string]interface{}) error {
}
func writeCertificateBundleFile(filename string, data map[string]interface{}) error {
certificateFile := fmt.Sprintf("%s.crt", filename)
caFile := fmt.Sprintf("%s.ca", filename)
certificate := fmt.Sprintf("%s\n\n%s", data["certificate"], data["private_key"])
ca := fmt.Sprintf("%s", data["issuing_ca"])
bundleFile := fmt.Sprintf("%s-bundle.pem", filename)
keyFile := fmt.Sprintf("%s-key.pem", filename)
caFile := fmt.Sprintf("%s-ca.pem", filename)
certFile := fmt.Sprintf("%s.pem", filename)
if err := writeFile(certificateFile, []byte(certificate)); err != nil {
bundle := fmt.Sprintf("%s\n\n%s", data["certificate"], data["issuing_ca"])
key := fmt.Sprintf("%s\n", data["private_key"])
ca := fmt.Sprintf("%s\n", data["issuing_ca"])
certificate := fmt.Sprintf("%s\n", data["certificate"])
if err := writeFile(bundleFile, []byte(bundle)); err != nil {
glog.Errorf("failed to write the bundled certificate file, error: %s", err)
return err
}
if err := writeFile(certFile, []byte(certificate)); err != nil {
glog.Errorf("failed to write the certificate file, errro: %s", err)
return err
}
if err := writeFile(caFile, []byte(ca)); err != nil {
glog.Errorf("failed to write the ca certificate file, errro: %s", err)
glog.Errorf("failed to write the ca file, errro: %s", err)
return err
}
if err := writeFile(keyFile, []byte(key)); err != nil {
glog.Errorf("failed to write the key file, errro: %s", err)
return err
}

View file

@ -26,7 +26,7 @@ import (
const (
Prog = "vault-sidekick"
Version = "v0.0.9-2"
Version = "v0.1.0"
)
func main() {