Browse Source

fixing compile errors and adding json parameter names

master v2.4.0-beta.2-forest
forest 7 months ago
parent
commit
ef3f3796cd
4 changed files with 4 additions and 39 deletions
  1. +3
    -3
      admin.go
  2. +0
    -14
      caddy.go
  3. +0
    -12
      caddyconfig/httpcaddyfile/options.go
  4. +1
    -10
      caddyconfig/httploader.go

+ 3
- 3
admin.go View File

@ -62,9 +62,9 @@ type AdminConfig struct {
Config *ConfigSettings `json:"config,omitempty"`
// Forest's quick & simple replacement for the weak default admin endpoint security & the beta remote management feature
TLSKeyFile string
TLSCertFile string
AuthorizedClientsCAFile string
TLSKeyFile string `json:"tls_key_file,omitempty"`
TLSCertFile string `json:"tls_cert_file,omitempty"`
AuthorizedClientsCAFile string `json:"authorized_clients_ca_file,omitempty"`
}
// ConfigSettings configures the management of configuration.


+ 0
- 14
caddy.go View File

@ -459,20 +459,6 @@ func run(newCfg *Config, start bool) error {
// finishSettingUp should be run after all apps have successfully started.
func finishSettingUp(ctx Context, cfg *Config) error {
// establish this server's identity (only after apps are loaded
// so that cert management of this endpoint doesn't prevent user's
// servers from starting which likely also use HTTP/HTTPS ports;
// but before remote management which may depend on these creds)
err := manageIdentity(ctx, cfg)
if err != nil {
return fmt.Errorf("provisioning remote admin endpoint: %v", err)
}
// replace any remote admin endpoint
err = replaceRemoteAdminServer(ctx, cfg)
if err != nil {
return fmt.Errorf("provisioning remote admin endpoint: %v", err)
}
// if dynamic config is requested, set that up and run it
if cfg != nil && cfg.Admin != nil && cfg.Admin.Config != nil && cfg.Admin.Config.LoadRaw != nil {


+ 0
- 12
caddyconfig/httpcaddyfile/options.go View File

@ -276,18 +276,6 @@ func parseOptAdmin(d *caddyfile.Dispenser, _ interface{}) (interface{}, error) {
}
}
}
for nesting := d.Nesting(); d.NextBlock(nesting); {
switch d.Val() {
case "enforce_origin":
adminCfg.EnforceOrigin = true
case "origins":
adminCfg.Origins = d.RemainingArgs()
default:
return nil, d.Errf("unrecognized parameter '%s'", d.Val())
}
}
}
if adminCfg.Listen == "" && !adminCfg.Disabled {
adminCfg.Listen = caddy.DefaultAdminListen


+ 1
- 10
caddyconfig/httploader.go View File

@ -106,16 +106,7 @@ func (hl HTTPLoader) makeClient(ctx caddy.Context) (*http.Client, error) {
var tlsConfig *tls.Config
// client authentication
if hl.TLS.UseServerIdentity {
certs, err := ctx.IdentityCredentials(ctx.Logger(hl))
if err != nil {
return nil, fmt.Errorf("getting server identity credentials: %v", err)
}
if tlsConfig == nil {
tlsConfig = new(tls.Config)
}
tlsConfig.Certificates = certs
} else if hl.TLS.ClientCertificateFile != "" && hl.TLS.ClientCertificateKeyFile != "" {
if hl.TLS.ClientCertificateFile != "" && hl.TLS.ClientCertificateKeyFile != "" {
cert, err := tls.LoadX509KeyPair(hl.TLS.ClientCertificateFile, hl.TLS.ClientCertificateKeyFile)
if err != nil {
return nil, err


Loading…
Cancel
Save