Skip to content

Commit

Permalink
bugfix for issue #30
Browse files Browse the repository at this point in the history
  • Loading branch information
d3vilh committed Oct 20, 2023
1 parent aa60ba9 commit 665756d
Showing 1 changed file with 23 additions and 10 deletions.
33 changes: 23 additions & 10 deletions controllers/certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,29 @@ func validateCertParams(cert NewCertParams) map[string]map[string]string {
func (c *CertificatesController) saveClientConfig(keysPath string, name string) (string, error) {
cfg := clientconfig.New()
keysPathCa := filepath.Join(state.GlobalCfg.OVConfigPath, "pki")
ServerAddress := models.OVClientConfig{Profile: "default"}
_ = ServerAddress.Read("Profile")
cfg.ServerAddress = ServerAddress.ServerAddress
OpenVpnServerPort := models.OVClientConfig{Profile: "default"}
_ = OpenVpnServerPort.Read("Profile")
cfg.OpenVpnServerPort = OpenVpnServerPort.OpenVpnServerPort

AuthUserPass := models.OVClientConfig{Profile: "default"}
_ = AuthUserPass.Read("Profile")
cfg.AuthUserPass = AuthUserPass.AuthUserPass

ovClientConfig := &models.OVClientConfig{Profile: "default"}
if err := ovClientConfig.Read("Profile"); err != nil {
return "", err
}
cfg.ServerAddress = ovClientConfig.ServerAddress
cfg.OpenVpnServerPort = ovClientConfig.OpenVpnServerPort
cfg.AuthUserPass = ovClientConfig.AuthUserPass
cfg.ResolveRetry = ovClientConfig.ResolveRetry
cfg.OVClientUser = ovClientConfig.OVClientUser
cfg.OVClientGroup = ovClientConfig.OVClientGroup
cfg.PersistTun = ovClientConfig.PersistTun
cfg.PersistKey = ovClientConfig.PersistKey
cfg.RemoteCertTLS = ovClientConfig.RemoteCertTLS
cfg.RedirectGateway = ovClientConfig.RedirectGateway
// cfg.Proto = ovClientConfig.Proto // this will be set from server config
cfg.Device = ovClientConfig.Device
cfg.AuthNoCache = ovClientConfig.AuthNoCache
cfg.TlsClient = ovClientConfig.TlsClient
cfg.Verbose = ovClientConfig.Verbose
cfg.CustomConfOne = ovClientConfig.CustomConfOne
cfg.CustomConfTwo = ovClientConfig.CustomConfTwo
cfg.CustomConfThree = ovClientConfig.CustomConfThree

ca, err := os.ReadFile(filepath.Join(keysPathCa, "ca.crt"))
if err != nil {
Expand Down

0 comments on commit 665756d

Please sign in to comment.