diff options
| author | 2021-04-11 18:34:08 +0100 | |
|---|---|---|
| committer | 2021-04-11 18:34:08 +0100 | |
| commit | 6d205fc3fb8d9d7d8d2fc569002bae2f12eb3de9 (patch) | |
| tree | da2b718eb46d2b958d8fd1b25468c3b1cc71d8a4 | |
| parent | Remove <cgiirc:opernotice>. (diff) | |
Rename the cgiirc module to gateway.
| -rw-r--r-- | docs/conf/inspircd.conf.example | 2 | ||||
| -rw-r--r-- | docs/conf/modules.conf.example | 16 | ||||
| -rw-r--r-- | include/modules.h | 3 | ||||
| -rw-r--r-- | src/modules/m_dnsbl.cpp | 3 | ||||
| -rw-r--r-- | src/modules/m_gateway.cpp (renamed from src/modules/m_cgiirc.cpp) | 28 | ||||
| -rw-r--r-- | src/modules/m_rline.cpp | 2 |
6 files changed, 25 insertions, 29 deletions
diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index 74d358ca2..848818040 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -308,7 +308,7 @@ #usests="no" # webirc: Restricts usage of this class to the specified WebIRC gateway. - # This setting only has effect when the cgiirc module is loaded. + # This setting only has effect when the gateway module is loaded. #webirc="name" # limit: How many users are allowed in this class diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index c2d062425..1660bcf24 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -328,13 +328,13 @@ #<badword text="fluffy capybaras"> # #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# -# CGI:IRC module: Enables forwarding the real IP address of a user from +# Gateway module: Enables forwarding the real IP address of a user from # a gateway to the IRC server. -#<module name="cgiirc"> +#<module name="gateway"> # -#-#-#-#-#-#-#-#-#-#-#-# CGIIRC CONFIGURATION #-#-#-#-#-#-#-#-#-#-#-#-# +#-#-#-#-#-#-#-#-#-#-#-# GATEWAY CONFIGURATION #-#-#-#-#-#-#-#-#-#-#-#-# # -# If you use the cgiirc module then you must specify the gateways which +# If you use the gateway module then you must specify the gateways which # are authorised to forward IP/host information to your server. There # are currently two ways to do this: # @@ -348,10 +348,10 @@ # either a TLS client certificate fingerprint for the gateway or # a password to be sent in the WEBIRC command. # -# <cgihost type="webirc" +# <gateway type="webirc" # fingerprint="bd90547b59c1942b85f382bc059318f4c6ca54c5" # mask="192.0.2.0/24 198.51.100.*"> -# <cgihost type="webirc" +# <gateway type="webirc" # password="$2a$10$WEUpX9GweJiEF1WxBDSkeODBstIBMlVPweQTG9cKM8/Vd58BeM5cW" # hash="bcrypt" # mask="*.webirc.gateway.example.com"> @@ -367,10 +367,10 @@ # ident to avoid leaking the real IP address of gateway clients # (defaults to "gateway" if not set). # -# <cgihost type="ident" +# <gateway type="ident" # mask="198.51.100.0/24 203.0.113.*" # newident="wibble"> -# <cgihost type="ident" +# <gateway type="ident" # mask="*.ident.gateway.example.com" # newident="wobble"> # diff --git a/include/modules.h b/include/modules.h index 79c42f2ad..b1e3f31dc 100644 --- a/include/modules.h +++ b/include/modules.h @@ -965,8 +965,7 @@ class CoreExport Module : public Cullable, public usecountbase virtual ModResult OnNumeric(User* user, const Numeric::Numeric& numeric); - /** Called whenever a local user's IP is set for the first time, or when a local user's IP changes due to - * a module like m_cgiirc changing it. + /** Called whenever a local user's IP is set or changed. * @param user The user whose IP is being set */ virtual void OnSetUserIP(LocalUser* user); diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 85c756f40..6a050f1af 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -57,9 +57,6 @@ class DNSBLConfEntry } }; - -/** Resolver for CGI:IRC hostnames encoded in ident/real name - */ class DNSBLResolver : public DNS::Request { private: diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_gateway.cpp index b05f110c0..9484e1bb9 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_gateway.cpp @@ -211,7 +211,7 @@ class GatewayExtBan GatewayExtBan(Module* Creator) : ExtBan::MatchingBase(Creator, "gateway", 'w') - , gateway(Creator, "cgiirc_gateway", ExtensionItem::EXT_USER, true) + , gateway(Creator, "webirc-gateway", ExtensionItem::EXT_USER, true) { } @@ -235,8 +235,8 @@ class CommandWebIRC : public SplitCommand CommandWebIRC(Module* Creator) : SplitCommand(Creator, "WEBIRC", 4) , extban(Creator) - , realhost(Creator, "cgiirc_realhost", ExtensionItem::EXT_USER, true) - , realip(Creator, "cgiirc_realip", ExtensionItem::EXT_USER, true) + , realhost(Creator, "gateway-realhost", ExtensionItem::EXT_USER, true) + , realip(Creator, "gateway-realip", ExtensionItem::EXT_USER, true) , sslapi(Creator) , webircevprov(Creator, "event/webirc") { @@ -314,7 +314,7 @@ class CommandWebIRC : public SplitCommand } }; -class ModuleCgiIRC +class ModuleGateway : public Module , public WebIRC::EventListener , public Whois::EventListener @@ -325,7 +325,7 @@ class ModuleCgiIRC std::vector<IdentHost> hosts; public: - ModuleCgiIRC() + ModuleGateway() : Module(VF_VENDOR, "Adds the ability for IRC gateways to forward the real IP address of users connecting through them.") , WebIRC::EventListener(this) , Whois::EventListener(this) @@ -336,7 +336,7 @@ class ModuleCgiIRC void init() override { - ServerInstance->SNO.EnableSnomask('w', "CGIIRC"); + ServerInstance->SNO.EnableSnomask('w', "GATEWAY"); } void ReadConfig(ConfigStatus& status) override @@ -344,16 +344,16 @@ class ModuleCgiIRC std::vector<IdentHost> identhosts; std::vector<WebIRCHost> webirchosts; - for (const auto& [_, tag] : ServerInstance->Config->ConfTags("cgihost")) + for (const auto& [_, tag] : ServerInstance->Config->ConfTags("gateway", ServerInstance->Config->ConfTags("cgihost"))) { MaskList masks; irc::spacesepstream maskstream(tag->getString("mask")); for (std::string mask; maskstream.GetToken(mask); ) masks.push_back(mask); - // Ensure that we have the <cgihost:mask> parameter. + // Ensure that we have the <gateway:mask> parameter. if (masks.empty()) - throw ModuleException("<cgihost:mask> is a mandatory field, at " + tag->source.str()); + throw ModuleException("<" + tag->name + ":mask> is a mandatory field, at " + tag->source.str()); // Determine what lookup type this host uses. const std::string type = tag->getString("type"); @@ -372,11 +372,11 @@ class ModuleCgiIRC // WebIRC blocks require a password. if (fingerprint.empty() && password.empty()) - throw ModuleException("When using <cgihost type=\"webirc\"> either the fingerprint or password field is required, at " + tag->source.str()); + throw ModuleException("When using <" + tag->name + " type=\"webirc\"> either the fingerprint or password field is required, at " + tag->source.str()); if (!password.empty() && stdalgo::string::equalsci(passwordhash, "plaintext")) { - ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "<cgihost> tag at %s contains an plain text password, this is insecure!", + ServerInstance->Logs.Log(MODNAME, LOG_DEFAULT, "<" + tag->name + "> tag at %s contains an plain text password, this is insecure!", tag->source.str().c_str()); } @@ -384,7 +384,7 @@ class ModuleCgiIRC } else { - throw ModuleException(type + " is an invalid <cgihost:mask> type, at " + tag->source.str()); + throw ModuleException(type + " is an invalid <" + tag->name + ":mask> type, at " + tag->source.str()); } } @@ -434,7 +434,7 @@ class ModuleCgiIRC if (!host.Matches(user)) continue; - // We have matched an <cgihost> block! Try to parse the encoded IPv4 address + // We have matched an gateway block! Try to parse the encoded IPv4 address // out of the ident. irc::sockets::sockaddrs address(user->client_sa); if (!CommandHexIP::ParseIP(user->ident, address)) @@ -531,4 +531,4 @@ class ModuleCgiIRC } }; -MODULE_INIT(ModuleCgiIRC) +MODULE_INIT(ModuleGateway) diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index fe9bd7e48..a59eb00b0 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -338,7 +338,7 @@ class ModuleRLine void Prioritize() override { - Module* mod = ServerInstance->Modules.Find("cgiirc"); + Module* mod = ServerInstance->Modules.Find("gateway"); ServerInstance->Modules.SetPriority(this, I_OnUserRegister, PRIORITY_AFTER, mod); } }; |
