From 13653b52027d3b3c6e1f161b5dee4b60f2f068a1 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Tue, 30 Dec 2025 02:27:09 -0500 Subject: [PATCH] fix #2284 (#2317) Send a configurable NOTICE on first connection that hopm can detect via target_string --- default.yaml | 4 ++++ docs/MANUAL.md | 8 +++++++- irc/client.go | 5 +++++ irc/config.go | 3 ++- traditional.yaml | 4 ++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/default.yaml b/default.yaml index 007d8e18..c71cfd0a 100644 --- a/default.yaml +++ b/default.yaml @@ -180,6 +180,10 @@ server: # if this is true, the motd is escaped using formatting codes like $c, $b, and $i motd-formatting: true + # send a configurable notice to clients immediately after they connect, + # as a way of detecting open proxies + #initial-notice: "*** Welcome to the Ergo IRC server" + # idle timeouts for inactive clients idle-timeouts: # give the client this long to complete connection registration (i.e. the initial diff --git a/docs/MANUAL.md b/docs/MANUAL.md index cfa3ddc9..5797935e 100644 --- a/docs/MANUAL.md +++ b/docs/MANUAL.md @@ -1072,9 +1072,12 @@ You can import user and channel registrations from an Anope or Atheme database i ## Hybrid Open Proxy Monitor (HOPM) -[hopm](https://github.com/ircd-hybrid/hopm) can be used to monitor your server for connections from open proxies, then automatically ban them. To configure hopm to work with Ergo, add operator blocks like this to your Ergo config file, which grant hopm the necessary privileges: +[hopm](https://github.com/ircd-hybrid/hopm) can be used to monitor your server for connections from open proxies, then automatically ban them. To configure hopm to work with Ergo, configure `server.initial_notice` and add operator blocks like this to your Ergo config file, which grant hopm the necessary privileges: ````yaml +server: + initial-notice: "Welcome to the Ergo IRC server" + # operator classes oper-classes: # hopm @@ -1109,6 +1112,9 @@ opers: Then configure hopm like this: ```` +/* replace with the exact notice your server sends on first connection */ +target_string = ":ergo.test NOTICE * :*** Welcome to the Ergo IRC server" + /* ergo */ connregex = ".+-.+CONNECT.+-.+ Client Connected \\[([^ ]+)\\] \\[u:([^ ]+)\\] \\[h:([^ ]+)\\] \\[ip:([^ ]+)\\] .+"; diff --git a/irc/client.go b/irc/client.go index 42a6dc95..7e7b4ba4 100644 --- a/irc/client.go +++ b/irc/client.go @@ -414,6 +414,11 @@ func (server *Server) RunClient(conn IRCConn) { session.certfp, session.peerCerts, _ = utils.GetCertFP(wConn.Conn, RegisterTimeout) } + if config.Server.InitialNotice != "" { + // send initial notice for HOPM to recognize + client.Send(nil, client.server.name, "NOTICE", "*", config.Server.InitialNotice) + } + if session.isTor { session.rawHostname = config.Server.TorListeners.Vhost client.rawHostname = session.rawHostname diff --git a/irc/config.go b/irc/config.go index 91d8b6d7..f8e2ed70 100644 --- a/irc/config.go +++ b/irc/config.go @@ -580,7 +580,8 @@ type Config struct { CoerceIdent string `yaml:"coerce-ident"` MOTD string motdLines []string - MOTDFormatting bool `yaml:"motd-formatting"` + MOTDFormatting bool `yaml:"motd-formatting"` + InitialNotice string `yaml:"initial-notice"` IdleTimeouts struct { Registration time.Duration Ping time.Duration diff --git a/traditional.yaml b/traditional.yaml index 0e36ec8c..bf44d60f 100644 --- a/traditional.yaml +++ b/traditional.yaml @@ -154,6 +154,10 @@ server: # if this is true, the motd is escaped using formatting codes like $c, $b, and $i motd-formatting: true + # send a configurable notice to clients immediately after they connect, + # as a way of detecting open proxies + #initial-notice: "*** Welcome to the Ergo IRC server" + # idle timeouts for inactive clients idle-timeouts: # give the client this long to complete connection registration (i.e. the initial