Add certificate generation and revokation
This commit is contained in:
parent
9324f6f5fa
commit
ede5bb18b1
8 changed files with 577 additions and 2 deletions
36
libfic/certificate.go
Normal file
36
libfic/certificate.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package fic
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func GenerateCA() string {
|
||||
// Call the script and return its standard and error output
|
||||
cmd := exec.Command("./CA.sh", "-newca")
|
||||
|
||||
if output, err := cmd.CombinedOutput(); err != nil {
|
||||
return string(output) + err.Error()
|
||||
} else {
|
||||
return string(output)
|
||||
}
|
||||
}
|
||||
|
||||
func (t Team) GenerateCert() string {
|
||||
cmd := exec.Command("./CA.sh", "-newclient", t.Name)
|
||||
|
||||
if output, err := cmd.CombinedOutput(); err != nil {
|
||||
return string(output) + err.Error()
|
||||
} else {
|
||||
return string(output)
|
||||
}
|
||||
}
|
||||
|
||||
func (t Team) RevokeCert() string {
|
||||
cmd := exec.Command("./CA.sh", "-revoke", t.Name)
|
||||
|
||||
if output, err := cmd.CombinedOutput(); err != nil {
|
||||
return string(output) + err.Error()
|
||||
} else {
|
||||
return string(output)
|
||||
}
|
||||
}
|
||||
Reference in a new issue