diff --git a/default.yaml b/default.yaml index 063e736b..6415f072 100644 --- a/default.yaml +++ b/default.yaml @@ -335,7 +335,11 @@ server: # oragono will write files to disk under certain circumstances, e.g., # CPU profiling or data export. by default, these files will be written # to the working directory. set this to customize: - # output-path: "/home/oragono/out" + #output-path: "/home/oragono/out" + + # the hostname used by "services", e.g., NickServ, defaults to "localhost", + # e.g., `NickServ!NickServ@localhost`. uncomment this to override: + #override-services-hostname: "example.network" # account options accounts: diff --git a/irc/config.go b/irc/config.go index 94bc5277..72c414fa 100644 --- a/irc/config.go +++ b/irc/config.go @@ -526,17 +526,18 @@ type Config struct { forceTrailing bool SendUnprefixedSasl bool `yaml:"send-unprefixed-sasl"` } - isupport isupport.List - IPLimits connection_limits.LimiterConfig `yaml:"ip-limits"` - Cloaks cloaks.CloakConfig `yaml:"ip-cloaking"` - SecureNetDefs []string `yaml:"secure-nets"` - secureNets []net.IPNet - supportedCaps *caps.Set - capValues caps.Values - Casemapping Casemapping - EnforceUtf8 bool `yaml:"enforce-utf8"` - OutputPath string `yaml:"output-path"` - IPCheckScript ScriptConfig `yaml:"ip-check-script"` + isupport isupport.List + IPLimits connection_limits.LimiterConfig `yaml:"ip-limits"` + Cloaks cloaks.CloakConfig `yaml:"ip-cloaking"` + SecureNetDefs []string `yaml:"secure-nets"` + secureNets []net.IPNet + supportedCaps *caps.Set + capValues caps.Values + Casemapping Casemapping + EnforceUtf8 bool `yaml:"enforce-utf8"` + OutputPath string `yaml:"output-path"` + IPCheckScript ScriptConfig `yaml:"ip-check-script"` + OverrideServicesHostname string `yaml:"override-services-hostname"` } Roleplay struct { diff --git a/irc/server.go b/irc/server.go index c983fa00..13d6764f 100644 --- a/irc/server.go +++ b/irc/server.go @@ -530,6 +530,8 @@ func (server *Server) applyConfig(config *Config) (err error) { } else if oldConfig.Server.IPCheckScript.MaxConcurrency != config.Server.IPCheckScript.MaxConcurrency || oldConfig.Accounts.AuthScript.MaxConcurrency != config.Accounts.AuthScript.MaxConcurrency { return fmt.Errorf("Cannot change max-concurrency for scripts after launching the server, rehash aborted") + } else if oldConfig.Server.OverrideServicesHostname != config.Server.OverrideServicesHostname { + return fmt.Errorf("Cannot change override-services-hostname after launching the server, rehash aborted") } } @@ -563,6 +565,10 @@ func (server *Server) applyConfig(config *Config) (err error) { if maxAuthConc != 0 { server.semaphores.AuthScript.Initialize(maxAuthConc) } + + if err := overrideServicePrefixes(config.Server.OverrideServicesHostname); err != nil { + return err + } } if oldConfig != nil { diff --git a/irc/services.go b/irc/services.go index 9abcebf7..c4451c34 100644 --- a/irc/services.go +++ b/irc/services.go @@ -316,6 +316,19 @@ func makeServiceHelpTextGenerator(cmd string, banner string) func(*Client) strin } } +func overrideServicePrefixes(hostname string) error { + if hostname == "" { + return nil + } + if !utils.IsHostname(hostname) { + return fmt.Errorf("`%s` is an invalid services hostname", hostname) + } + for _, serv := range OragonoServices { + serv.prefix = fmt.Sprintf("%s!%s@%s", serv.Name, serv.Name, hostname) + } + return nil +} + func initializeServices() { // this modifies the global Commands map, // so it must be called from irc/commands.go's init() diff --git a/traditional.yaml b/traditional.yaml index b836de48..7e163919 100644 --- a/traditional.yaml +++ b/traditional.yaml @@ -307,7 +307,11 @@ server: # oragono will write files to disk under certain circumstances, e.g., # CPU profiling or data export. by default, these files will be written # to the working directory. set this to customize: - # output-path: "/home/oragono/out" + #output-path: "/home/oragono/out" + + # the hostname used by "services", e.g., NickServ, defaults to "localhost", + # e.g., `NickServ!NickServ@localhost`. uncomment this to override: + #override-services-hostname: "example.network" # account options accounts: