server, service: added running as effective user
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
func CreateX509SelfSignedCert(subject string, hostnames ...string) ([]byte, []byte, error) {
|
||||
func CreateCertKey(subject string, hostnames ...string) ([]byte, []byte, error) {
|
||||
var err error
|
||||
|
||||
certPem := make([]byte, 0)
|
||||
@@ -72,7 +72,7 @@ func CreateX509SelfSignedCert(subject string, hostnames ...string) ([]byte, []by
|
||||
return certPem, keyPem, err
|
||||
}
|
||||
|
||||
func CreateX509CACert(commonName string) ([]byte, []byte, error) {
|
||||
func CreateCACert(commonName string) ([]byte, []byte, error) {
|
||||
var err error
|
||||
certPem := make([]byte, 0)
|
||||
keyPem := make([]byte, 0)
|
||||
|
||||
@@ -10,22 +10,16 @@ import (
|
||||
)
|
||||
|
||||
func TestCert(t *testing.T) {
|
||||
|
||||
{
|
||||
//caCert, caKey, err := CreateX509SelfSignedCert("test1")
|
||||
//require.NoError(t, err)
|
||||
//fmt.Println(string(caCert))
|
||||
//fmt.Println(string(caKey))
|
||||
}
|
||||
{
|
||||
caCert, caKey, err := CreateX509CACert("test1")
|
||||
caCert, caKey, err := CreateCertKey("test1")
|
||||
require.NoError(t, err)
|
||||
fmt.Println(string(caCert))
|
||||
fmt.Println(string(caKey))
|
||||
}
|
||||
{
|
||||
caCert, caKey, err := CreateCACert("test1")
|
||||
require.NoError(t, err)
|
||||
fmt.Println(string(caCert))
|
||||
fmt.Println(string(caKey))
|
||||
|
||||
// caCert, caKey, err = CreateX509Cert("test1", caKey)
|
||||
// require.NoError(t, err)
|
||||
// fmt.Println(string(caCert))
|
||||
// fmt.Println(string(caKey))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user