@@ -2,6 +2,7 @@ package main
2
2
3
3
import (
4
4
"fmt"
5
+ "log"
5
6
"os"
6
7
"path/filepath"
7
8
"strings"
@@ -22,18 +23,22 @@ func initSSL(certPath, keyPath string) ([]byte, error) {
22
23
23
24
func initSSLKey (keyPath string ) (out []byte , err error ) {
24
25
if fileExists (keyPath ) {
26
+ log .Println ("using existing SSL key:" , keyPath )
25
27
return
26
28
}
27
29
28
30
if err = mkdirP (keyPath ); err != nil {
29
31
return
30
32
}
31
33
34
+ log .Println ("SSL key does not exist" )
35
+ log .Println ("creating" , keyPath )
32
36
return runCommand (fmt .Sprintf ("openssl genrsa -out %s 4096" , keyPath ))
33
37
}
34
38
35
39
func initSSLCert (certPath , keyPath string ) (out []byte , err error ) {
36
40
if fileExists (certPath ) {
41
+ log .Println ("using existing SSL cert:" , certPath )
37
42
return
38
43
}
39
44
@@ -63,6 +68,8 @@ func initSSLCert(certPath, keyPath string) (out []byte, err error) {
63
68
certPath ,
64
69
}
65
70
71
+ log .Println ("SSL cert does not exist" )
72
+ log .Println ("creating" , certPath )
66
73
return runCommand ("openssl " + strings .Join (args , " " ))
67
74
}
68
75
@@ -72,6 +79,8 @@ func initRndFile() (out []byte, err error) {
72
79
return
73
80
}
74
81
82
+ log .Println ("openssl random seed file does not exist" )
83
+ log .Println ("creating" , rndPath )
75
84
command := fmt .Sprintf ("openssl rand -out %s -hex 256" , rndPath )
76
85
return runCommand (command )
77
86
}
0 commit comments