Use system self signed certificate as default SSL certificate

This commit is contained in:
Manuel de Brito Fontes 2016-07-21 11:40:47 -04:00
parent 2c7d921d76
commit 9f64273b9c
7 changed files with 85 additions and 30 deletions

View file

@ -18,6 +18,7 @@ package main
import (
"fmt"
"io/ioutil"
"os"
"strings"
"time"
@ -273,3 +274,24 @@ func isNGINXIngress(ing *extensions.Ingress) bool {
class := ingAnnotations(ing.ObjectMeta.Annotations).ingressClass()
return class == "" || class == nginxIngressClass
}
const (
snakeOilPem = "/etc/ssl/certs/ssl-cert-snakeoil.pem"
snakeOilKey = "/etc/ssl/private/ssl-cert-snakeoil.key"
)
// getFakeSSLCert returns the snake oil ssl certificate created by the command
// make-ssl-cert generate-default-snakeoil --force-overwrite
func getFakeSSLCert() (string, string) {
cert, err := ioutil.ReadFile(snakeOilPem)
if err != nil {
return "", ""
}
key, err := ioutil.ReadFile(snakeOilKey)
if err != nil {
return "", ""
}
return string(cert), string(key)
}