From 522c202a9ca8f848fdc1f6c1223ca21699204625 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 8 Oct 2024 01:29:56 +0100 Subject: Revert "Tell people to use the main ChatSpike domain not our alias". This reverts commit 78c4f3bd97d003d0f528d98752e0528023b27045. --- docs/LICENSE.txt | 2 +- docs/conf/motd.txt.example | 2 +- docs/conf/opermotd.txt.example | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/LICENSE.txt b/docs/LICENSE.txt index e8de3f876..6e2ceda85 100644 --- a/docs/LICENSE.txt +++ b/docs/LICENSE.txt @@ -2,7 +2,7 @@ "Upgrading" to a later version of the GENERAL PUBLIC LICENSE is not permitted. For further information on - this, please contact us at irc.chatspike.net on #inspircd. + this, please contact us at irc.inspircd.org on #inspircd. ---------------------------------------------------------------------- diff --git a/docs/conf/motd.txt.example b/docs/conf/motd.txt.example index 412451396..cd993e9a3 100644 --- a/docs/conf/motd.txt.example +++ b/docs/conf/motd.txt.example @@ -24,7 +24,7 @@ +---- To change this see \bmotd.txt.example\x ----+ | | | * \bWeb:\x https://www.inspircd.org | - | * \bIRC:\x irc.chatspike.net #inspircd | + | * \bIRC:\x irc.inspircd.org #inspircd | | * \bDocs:\x https://docs.inspircd.org | | * \bIssues:\x https://git.io/JIuYi | | * \bDiscussions:\x https://git.io/JIuYv | diff --git a/docs/conf/opermotd.txt.example b/docs/conf/opermotd.txt.example index 40d49d7a5..b0d9b4816 100644 --- a/docs/conf/opermotd.txt.example +++ b/docs/conf/opermotd.txt.example @@ -24,7 +24,7 @@ +-- To change this see \bopermotd.txt.example\x --+ | | | * \bWeb:\x https://www.inspircd.org | - | * \bIRC:\x irc.chatspike.net #inspircd | + | * \bIRC:\x irc.inspircd.org #inspircd | | * \bDocs:\x https://docs.inspircd.org | | * \bIssues:\x https://git.io/JIuYi | | * \bDiscussions:\x https://git.io/JIuYv | -- cgit v1.3.1-10-gc9f91 From f5564849d2480ed3d868ed16b611237a3c21be9f Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 11 Oct 2024 21:00:00 +0100 Subject: Use PRIVMSG instead of SQUERY in the example aliases. We can guarantee that the target is a service here so it doesn't make sense to use SQUERY. --- docs/conf/modules.example.conf | 6 ++--- docs/conf/services/atheme.example.conf | 32 +++++++++++++------------- docs/conf/services/generic.example.conf | 40 ++++++++++++++++----------------- 3 files changed, 39 insertions(+), 39 deletions(-) (limited to 'docs') diff --git a/docs/conf/modules.example.conf b/docs/conf/modules.example.conf index e174b00f7..3bd950f73 100644 --- a/docs/conf/modules.example.conf +++ b/docs/conf/modules.example.conf @@ -118,10 +118,10 @@ # An example of using the format value to create an alias with two # different behaviours depending on the format of the parameters. # -# # -# # # You may also add aliases to trigger based on something said in a @@ -130,7 +130,7 @@ # command must be preceded by the fantasy prefix when used. # # +# replace="PRIVMSG ChanServ :$1 $chan $2-" requires="ChanServ" service="yes"> # # This would be used as "!cs ", with the channel # being automatically inserted after the command in the message to diff --git a/docs/conf/services/atheme.example.conf b/docs/conf/services/atheme.example.conf index 507ec7c8b..1f5883239 100644 --- a/docs/conf/services/atheme.example.conf +++ b/docs/conf/services/atheme.example.conf @@ -6,27 +6,27 @@ # Long hand aliases for services pseudoclients. - - - - - - - - + + + + + + + + # Short hand aliases for services pseudoclients. - - - - - - + + + + + + # These short hand aliases conflict with other pseudoclients. You can enable # them but you will need to comment out the uncommented ones above first, -# -# +# +# # Prevent clients from using the nicknames of services pseudoclients. diff --git a/docs/conf/services/generic.example.conf b/docs/conf/services/generic.example.conf index 7adf5d5be..649dd4b49 100644 --- a/docs/conf/services/generic.example.conf +++ b/docs/conf/services/generic.example.conf @@ -4,34 +4,34 @@ # Long hand aliases for services pseudoclients. - - - - - - - - + + + + + + + + # Short hand aliases for services pseudoclients. - - - - - - - - + + + + + + + + # /ID [account] # Identifies to a services account. - - - + + + # /LOGOUT # Logs out of a services account. - + # Prevent clients from using the nicknames of services pseudoclients. -- cgit v1.3.1-10-gc9f91 From 25e4a6330510be171b872f9514f0cbd6da4ba53e Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 11 Oct 2024 22:05:25 +0100 Subject: Tweak to allow only showing to opers. This can help opers avoid accidentally invading a secret channel that they can see because of their privileges. --- docs/conf/inspircd.example.conf | 10 +++++++--- src/coremods/core_list.cpp | 19 ++++++++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/conf/inspircd.example.conf b/docs/conf/inspircd.example.conf index 0b229cb99..db4f3f4cc 100644 --- a/docs/conf/inspircd.example.conf +++ b/docs/conf/inspircd.example.conf @@ -665,9 +665,13 @@ # %type% - The type of X-line which was matched. xlinequit="%fulltype%: %reason%" - # modesinlist: If enabled then the current channel modes will be shown - # in the /LIST response. Defaults to yes. - modesinlist="no" + # modesinlist: Whether to show the current channel modes in the /LIST + # output. Can be set to any one of: + # - yes Show the current channel modes to all users. + # - opers Show the current channel modes to server operators with the + # channels/auspex privilege. This is the default. + # - no Do not show the current channel modes in /LIST. + modesinlist="opers" # extbanformat: The method to use for normalising extbans. Can be set # to one of: diff --git a/src/coremods/core_list.cpp b/src/coremods/core_list.cpp index 7d88c93c3..ec242ea36 100644 --- a/src/coremods/core_list.cpp +++ b/src/coremods/core_list.cpp @@ -27,6 +27,14 @@ #include "inspircd.h" #include "modules/isupport.h" +enum class ShowModes + : uint8_t +{ + NOBODY, + OPERS, + ALL, +}; + class CommandList final : public Command { @@ -48,7 +56,7 @@ private: public: // Whether to show modes in the LIST response. - bool showmodes; + ShowModes showmodes; CommandList(Module* parent) : Command(parent, "LIST") @@ -129,6 +137,7 @@ CmdResult CommandList::Handle(User* user, const Params& parameters) } const bool has_privs = user->HasPrivPermission("channels/auspex"); + const bool show_modes = (showmodes == ShowModes::ALL) || (showmodes == ShowModes::OPERS && has_privs); user->WriteNumeric(RPL_LISTSTART, "Channel", "Users Name"); @@ -168,7 +177,7 @@ CmdResult CommandList::Handle(User* user, const Params& parameters) // Channel is private (+p) and user is outside/not privileged user->WriteNumeric(RPL_LIST, '*', users, ""); } - else if (showmodes) + else if (show_modes) { // Show the list response with the modes and topic. user->WriteNumeric(RPL_LIST, chan->name, users, INSP_FORMAT("[+{}] {}", chan->ChanModes(n), chan->topic)); @@ -203,7 +212,11 @@ public: void ReadConfig(ConfigStatus& status) override { const auto& tag = ServerInstance->Config->ConfValue("options"); - cmd.showmodes = tag->getBool("modesinlist"); + cmd.showmodes = tag->getEnum("showmodes", ShowModes::OPERS, { + { "no", ShowModes::NOBODY }, + { "opers", ShowModes::OPERS }, + { "yes", ShowModes::ALL }, + }); } void OnBuildISupport(ISupport::TokenMap& tokens) override -- cgit v1.3.1-10-gc9f91 From 5d436585ca4ff306765eeacbb14265b88770656f Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 11 Oct 2024 22:08:03 +0100 Subject: Fix the indentation of . --- docs/conf/inspircd.example.conf | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'docs') diff --git a/docs/conf/inspircd.example.conf b/docs/conf/inspircd.example.conf index db4f3f4cc..badc60b35 100644 --- a/docs/conf/inspircd.example.conf +++ b/docs/conf/inspircd.example.conf @@ -651,19 +651,19 @@ # banned from the server. xlinemessage="You're banned! Email irc@&networkDomain; with the ERROR line below for help." - # xlinequit: The quit message to show to opers and affected users when - # a user is [KGZ]-lined. The variables you can use in this are: - # - # %created% - The date/time at which the X-line was created. - # %duration% - The duration of the X-line. - # %expiry% - The date/time at which the X-line expires. - # %fulltype% - The type of X-line which was matched, suffixed with - # "-lined" if its name is one or two characters. - # %reason% - The reason the X-line was added. - # %remaining% - The duration remaining on the X-line. - # %setter% - The name of the X-line setter. - # %type% - The type of X-line which was matched. - xlinequit="%fulltype%: %reason%" + # xlinequit: The quit message to show to opers and affected users when + # a user is [KGZ]-lined. The variables you can use in this are: + # + # %created% - The date/time at which the X-line was created. + # %duration% - The duration of the X-line. + # %expiry% - The date/time at which the X-line expires. + # %fulltype% - The type of X-line which was matched, suffixed with + # "-lined" if its name is one or two characters. + # %reason% - The reason the X-line was added. + # %remaining% - The duration remaining on the X-line. + # %setter% - The name of the X-line setter. + # %type% - The type of X-line which was matched. + xlinequit="%fulltype%: %reason%" # modesinlist: Whether to show the current channel modes in the /LIST # output. Can be set to any one of: -- cgit v1.3.1-10-gc9f91 From d0740145ec3bc46f3945c5f2a3549343916f7889 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 13 Oct 2024 09:36:25 +0100 Subject: Resynchronise our copy of the GPLv2 with the latest FSF copy. --- docs/LICENSE.txt | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'docs') diff --git a/docs/LICENSE.txt b/docs/LICENSE.txt index 6e2ceda85..9efa6fbc9 100644 --- a/docs/LICENSE.txt +++ b/docs/LICENSE.txt @@ -1,16 +1,8 @@ - NOTE: InspIRCd is licensed under GPL version 2 only. - - "Upgrading" to a later version of the GENERAL PUBLIC - LICENSE is not permitted. For further information on - this, please contact us at irc.inspircd.org on #inspircd. - ----------------------------------------------------------------------- - GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -312,8 +304,7 @@ the "copyright" line and a pointer to where the full notice is found. GNU General Public License for more details. You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + with this program; if not, see . Also add information on how to contact you by electronic and paper mail. @@ -337,8 +328,8 @@ necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. - , 1 April 1989 - Ty Coon, President of Vice + , 1 April 1989 + Moe Ghoul, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may -- cgit v1.3.1-10-gc9f91 From 7763a034a836e18a2c417a4870d3e119444784ce Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 13 Oct 2024 09:41:26 +0100 Subject: Tell people to connect to Teranova directly instead of our alias. --- .github/ISSUE_TEMPLATE/BUG_REPORT.md | 2 +- .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md | 2 +- .github/SECURITY.md | 2 +- README.md | 6 +++--- docs/conf/motd.txt.example | 2 +- docs/conf/opermotd.txt.example | 2 +- make/configure.pm | 2 +- make/directive.pm | 4 ++-- make/template/help.txt | 4 ++-- make/template/inspircd-genssl.1 | 2 +- make/template/inspircd-testssl.1 | 2 +- make/template/inspircd.1 | 2 +- tools/testssl | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) (limited to 'docs') diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md index e299326fb..950d439df 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.md +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -12,7 +12,7 @@ The GitHub issue tracker is for bug reports ONLY. General support can be found a Discussions: https://github.com/inspircd/inspircd/discussions Docs: https://docs.inspircd.org -IRC: irc.inspircd.org #inspircd +IRC: ircs://irc.teranova.net/inspircd Example configs: https://github.com/inspircd/inspircd/tree/insp3/docs/conf --> diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md index 12109cc5d..07993271d 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -10,7 +10,7 @@ The GitHub issue tracker is for feature requests ONLY. General support can be fo Discussions: https://github.com/inspircd/inspircd/discussions Docs: https://docs.inspircd.org -IRC: irc.inspircd.org #inspircd +IRC: ircs://irc.teranova.net/inspircd Example configs: https://github.com/inspircd/inspircd/tree/insp3/docs/conf --> diff --git a/.github/SECURITY.md b/.github/SECURITY.md index b39b39693..a8b92eb0e 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -18,6 +18,6 @@ Version | Supported ## Reporting a Vulnerability -Please do not report security vulnerabilities on GitHub. Instead, get the attention of a developer in our development IRC channel at irc.inspircd.org #inspircd.dev and PM them the details. +Please do not report security vulnerabilities on GitHub. Instead, get the attention of a developer in our development IRC channel at ircs://irc.teranova.net/inspircd.dev and PM them the details. We will triage your issue as soon as possible and try to release a fixed version within a week of receiving your report. diff --git a/README.md b/README.md index 24671618a..c5ddbb902 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,6 @@ InspIRCd is licensed under [version 2 of the GNU General Public License](https:/ * [Documentation](https://docs.inspircd.org) * [GitHub](https://github.com/inspircd) * [Social Media](https://docs.inspircd.org/social) -* Support IRC channel — \#inspircd on irc.inspircd.org -* Development IRC channel — \#inspircd.dev on irc.inspircd.org -* InspIRCd test network — testnet.inspircd.org +* Support IRC channel — \#inspircd on irc.teranova.net (TLS only) +* Development IRC channel — \#inspircd.dev on irc.teranova.net (TLS only) +* InspIRCd test network — testnet.inspircd.org (TLS only) diff --git a/docs/conf/motd.txt.example b/docs/conf/motd.txt.example index cd993e9a3..a441011c1 100644 --- a/docs/conf/motd.txt.example +++ b/docs/conf/motd.txt.example @@ -24,7 +24,7 @@ +---- To change this see \bmotd.txt.example\x ----+ | | | * \bWeb:\x https://www.inspircd.org | - | * \bIRC:\x irc.inspircd.org #inspircd | + | * \bIRC:\x ircs://irc.teranova.net/inspircd | | * \bDocs:\x https://docs.inspircd.org | | * \bIssues:\x https://git.io/JIuYi | | * \bDiscussions:\x https://git.io/JIuYv | diff --git a/docs/conf/opermotd.txt.example b/docs/conf/opermotd.txt.example index b0d9b4816..5461d7f40 100644 --- a/docs/conf/opermotd.txt.example +++ b/docs/conf/opermotd.txt.example @@ -24,7 +24,7 @@ +-- To change this see \bopermotd.txt.example\x --+ | | | * \bWeb:\x https://www.inspircd.org | - | * \bIRC:\x irc.inspircd.org #inspircd | + | * \bIRC:\x ircs://irc.teranova.net/inspircd | | * \bDocs:\x https://docs.inspircd.org | | * \bIssues:\x https://git.io/JIuYi | | * \bDiscussions:\x https://git.io/JIuYv | diff --git a/make/configure.pm b/make/configure.pm index a31c6ee79..7bdf44389 100644 --- a/make/configure.pm +++ b/make/configure.pm @@ -180,7 +180,7 @@ non-interactive configuration is started and any omitted values are defaulted. <|BOLD INSPIRCD_VERBOSE=<0|1>|> Shows additional information for debugging. If you have any problems with configuring InspIRCd then visit our IRC channel -at irc.inspircd.org #InspIRCd or create a support discussion at +at ircs://irc.teranova.net/inspircd or create a support discussion at https://github.com/inspircd/inspircd/discussions. Packagers: see https://docs.inspircd.org/packaging/ for packaging advice. diff --git a/make/directive.pm b/make/directive.pm index ed3f88fc2..948a8b0c8 100644 --- a/make/directive.pm +++ b/make/directive.pm @@ -153,8 +153,8 @@ sub __error { push @message, ''; push @message, 'If you would like help with fixing this problem then visit our IRC'; - push @message, 'channel at irc.inspircd.org #InspIRCd or create a support discussion'; - push @message, 'at https://github.com/inspircd/inspircd/discussions.'; + push @message, 'channel at ircs://irc.teranova.net/inspircd or create a support'; + push @message, 'discussion at https://github.com/inspircd/inspircd/discussions.'; push @message, ''; print_error @message; diff --git a/make/template/help.txt b/make/template/help.txt index c2d798d35..f97082ba4 100644 --- a/make/template/help.txt +++ b/make/template/help.txt @@ -4,8 +4,8 @@ In order to get your server running you need to create config files. Examples can be found at `@EXAMPLE_DIR@`. If you need any help with this then you can visit our support channel at -irc.inspircd.org #inspircd, open a support discussion at https://git.io/JIuYv, -or refer to the the docs site: +ircs://irc.teranova.net/inspircd, open a support discussion at +https://git.io/JIuYv, or refer to the the docs site: https://docs.inspircd.org/@VERSION_MAJOR@/configuration https://docs.inspircd.org/@VERSION_MAJOR@/modules diff --git a/make/template/inspircd-genssl.1 b/make/template/inspircd-genssl.1 index e71806381..f7c7c270b 100644 --- a/make/template/inspircd-genssl.1 +++ b/make/template/inspircd-genssl.1 @@ -42,6 +42,6 @@ Generates certificates using GnuTLS. Generates certificates using OpenSSL. .SH "SUPPORT" -IRC support for InspIRCd can be found at ircs://irc.inspircd.org/inspircd. +IRC support for InspIRCd can be found at ircs://irc.teranova.net/inspircd. Bug reports and feature requests can be filed at https://github.com/inspircd/inspircd/issues. diff --git a/make/template/inspircd-testssl.1 b/make/template/inspircd-testssl.1 index c9125ac47..4c116b1da 100644 --- a/make/template/inspircd-testssl.1 +++ b/make/template/inspircd-testssl.1 @@ -41,6 +41,6 @@ The TCP port to connect to. Disables checking whether the server certificate is signed by a Certificate Authority. .SH "SUPPORT" -IRC support for InspIRCd can be found at ircs://irc.inspircd.org/inspircd. +IRC support for InspIRCd can be found at ircs://irc.teranova.net/inspircd. Bug reports and feature requests can be filed at https://github.com/inspircd/inspircd/issues. diff --git a/make/template/inspircd.1 b/make/template/inspircd.1 index 7ddefd112..ea3cb56e6 100644 --- a/make/template/inspircd.1 +++ b/make/template/inspircd.1 @@ -103,6 +103,6 @@ The server exited because it was unable to load a module on first run. The server exited because it received SIGTERM. .SH "SUPPORT" -IRC support for InspIRCd can be found at ircs://irc.inspircd.org/inspircd. +IRC support for InspIRCd can be found at ircs://irc.teranova.net/inspircd. Bug reports and feature requests can be filed at https://github.com/inspircd/inspircd/issues. diff --git a/tools/testssl b/tools/testssl index 543993cbd..5d62d6c19 100755 --- a/tools/testssl +++ b/tools/testssl @@ -176,5 +176,5 @@ You may also find running some of the following commands to be helpful: openssl s_client -connect $hostip:$port -debug -security_debug If you need any help working out what is wrong then visit our support channel -at irc.inspircd.org #inspircd. +at ircs://irc.teranova.net/inspircd. EOM -- cgit v1.3.1-10-gc9f91 From e9018ab0557c201410c431d33d49166add7e1c9c Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 13 Oct 2024 13:08:55 +0100 Subject: Add text replies for DNSBL responses. Closes #1243. --- docs/conf/providers/dronebl.example.conf | 78 +++++++++++++++++++++++++++++- docs/conf/providers/efnet-rbl.example.conf | 22 ++++++++- docs/conf/providers/torexit.example.conf | 4 ++ src/modules/m_dnsbl.cpp | 35 +++++++++++++- 4 files changed, 135 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/conf/providers/dronebl.example.conf b/docs/conf/providers/dronebl.example.conf index 12c25fcda..5f3b289b1 100644 --- a/docs/conf/providers/dronebl.example.conf +++ b/docs/conf/providers/dronebl.example.conf @@ -8,4 +8,80 @@ records="3,5,6,7,8,9,10,11,13,14,15,16,17,19" action="zline" duration="7d" - reason="You are listed in DroneBL. Please visit https://dronebl.org/lookup.do?ip=%ip%&network=%network.url% for more information."> + reason="You are listed in DroneBL: %reason%. Please visit https://dronebl.org/lookup.do?ip=%ip%&network=%network.url% for more information."> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/conf/providers/efnet-rbl.example.conf b/docs/conf/providers/efnet-rbl.example.conf index 78dce53cb..0130951dc 100644 --- a/docs/conf/providers/efnet-rbl.example.conf +++ b/docs/conf/providers/efnet-rbl.example.conf @@ -8,4 +8,24 @@ records="1,2,3,4,5" action="zline" duration="7d" - reason="You are listed in the EFnet RBL. Please visit https://rbl.efnetrbl.org/?i=%ip% for more information."> + reason="You are listed in the EFnet RBL: %reason%. Please visit https://rbl.efnetrbl.org/?i=%ip% for more information."> + + + + + + + + + + diff --git a/docs/conf/providers/torexit.example.conf b/docs/conf/providers/torexit.example.conf index abc35c696..1be1a5b40 100644 --- a/docs/conf/providers/torexit.example.conf +++ b/docs/conf/providers/torexit.example.conf @@ -10,3 +10,7 @@ action="zline" duration="7d" reason="Tor exit nodes are not allowed on this network. See https://metrics.torproject.org/rs.html#search/%ip% for more information."> + + diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 737ed2c62..bda050480 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -96,6 +96,9 @@ public: // A range of DNSBL result types to match against. CharState records; + // A map of DNSBL replies to their descriptions. + insp::flat_map replies; + // The message to send to users who's IP address is in a DNSBL. std::string reason; @@ -365,12 +368,16 @@ public: if (match) { + const auto it = config->replies.find(result); + const auto reasonstr = it == config->replies.end() ? INSP_FORMAT("Result {}", result) : it->second; + const std::string reason = Template::Replace(config->reason, { { "dnsbl", config->name }, { "dnsbl.url", Percent::Encode(config->name) }, { "ip", them->GetAddress() }, { "network", ServerInstance->Config->Network }, { "network.url", Percent::Encode(ServerInstance->Config->Network) }, + { "reason", reasonstr }, { "result", ConvToStr(result) }, }); @@ -421,9 +428,9 @@ public: } } - ServerInstance->SNO.WriteGlobalSno('d', "{} {} ({}) detected as being on the '{}' DNSBL with result {}{}", + ServerInstance->SNO.WriteGlobalSno('d', "{} {} ({}) detected as being on the '{}' DNSBL: {}{}", them->IsFullyConnected() ? "User" : "Connecting user", them->GetRealMask(), them->GetAddress(), - config->name, result, them->exempt ? " -- exempt" : ""); + config->name, reasonstr, them->exempt ? " -- exempt" : ""); } else config->stats_misses++; @@ -594,6 +601,30 @@ public: auto entry = std::make_shared(this, tag); newdnsbls.push_back(entry); } + for (const auto& [_, tag] : ServerInstance->Config->ConfTags("dnsblreply")) + { + const auto dnsblname = tag->getString("name"); + auto dnsbl = std::find_if(newdnsbls.begin(), newdnsbls.end(), [&dnsblname](const auto& d) + { + return insp::equalsci(d->name, dnsblname); + }); + if (dnsbl == newdnsbls.end()) + throw ModuleException(this, " must be set to the name of a DNSBL at " + tag->source.str()); + + const auto dnsbldesc = tag->getString("description"); + if (dnsbldesc.empty()) + throw ModuleException(this, " must not be empty at " + tag->source.str()); + + const auto dnsblreply = tag->getNum("reply", std::numeric_limits::max()); + if (dnsblreply > 16'777'215) + { + throw ModuleException(this, INSP_FORMAT(" ({}) is not a valid DNSBL reply at {}", + dnsblreply, tag->source.str())); + } + + (*dnsbl)->replies[dnsblreply] = dnsbldesc; + } + data.dnsbls.swap(newdnsbls); } -- cgit v1.3.1-10-gc9f91 From 37a820efcb53b9d6bda8f6821a5a0c0142b776a3 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sun, 27 Oct 2024 14:41:27 +0000 Subject: Add support for regex flags to the filter module. --- docs/conf/modules.example.conf | 8 +++++++- src/modules/m_filter.cpp | 26 +++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/conf/modules.example.conf b/docs/conf/modules.example.conf index 3bd950f73..66593afa5 100644 --- a/docs/conf/modules.example.conf +++ b/docs/conf/modules.example.conf @@ -983,6 +983,9 @@ # stdregex - stdlib regexps, provided via regex_stdlib, see comment # # at the tag for info on availability. # # # +# If enableflags is set, you can specify flags that modify matching # +# of the regular expression. # +# # # If notifyuser is set to no, the user will not be notified when # # their message is blocked. # # # @@ -991,7 +994,10 @@ # warning will be sent to opers instead. This stops spambots which # # send their spam message to themselves first to check if it is being # # filtered by the server. # -# +# # # # Your choice of regex engine must match on all servers network-wide. # # # diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index a84fce2b6..8fe610e7a 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -85,7 +85,7 @@ public: bool flag_strip_color; bool flag_no_registered; - FilterResult(Regex::EngineReference& RegexEngine, const std::string& free, const std::string& rea, FilterAction act, unsigned long gt, const std::string& fla, bool cfg) + FilterResult(Regex::EngineReference& RegexEngine, const std::string& free, const std::string& rea, FilterAction act, unsigned long gt, const std::string& fla, bool cfg, bool ef) : freeform(free) , reason(rea) , action(act) @@ -94,7 +94,7 @@ public: { if (!RegexEngine) throw ModuleException(thismod, "Regex module implementing '"+RegexEngine.GetProvider()+"' is not loaded!"); - regex = RegexEngine->Create(free); + regex = ef ? RegexEngine->CreateHuman(free) : RegexEngine->Create(free); this->FillFlags(fla); } @@ -202,6 +202,7 @@ private: Account::API accountapi; bool initing = true; + bool enableflags; bool notifyuser; bool warnonselfmsg; bool dirty = false; @@ -233,6 +234,7 @@ public: bool DeleteFilter(const std::string& freeform, std::string& reason); std::pair AddFilter(const std::string& freeform, FilterAction type, const std::string& reason, unsigned long duration, const std::string& flags, bool config = false); void ReadConfig(ConfigStatus& status) override; + void CompareLinkData(const LinkData& otherdata, LinkDataDiff& diffs) override; void GetLinkData(LinkData& data, std::string& compatdata) override; static std::string EncodeFilter(const FilterResult& filter); FilterResult DecodeFilter(const std::string& data); @@ -645,6 +647,7 @@ void ModuleFilter::ReadConfig(ConfigStatus& status) const auto& tag = ServerInstance->Config->ConfValue("filteropts"); std::string newrxengine = tag->getString("engine"); + enableflags = tag->getBool("enableflags"); notifyuser = tag->getBool("notifyuser", true); warnonselfmsg = tag->getBool("warnonselfmsg"); filterconf = tag->getString("filename"); @@ -680,6 +683,20 @@ void ModuleFilter::ReadConfig(ConfigStatus& status) ReadFilters(); } +void ModuleFilter::CompareLinkData(const LinkData& otherdata, LinkDataDiff& diffs) +{ + Module::CompareLinkData(otherdata, diffs); + + auto it = diffs.find("flags"); + if (it == diffs.end()) + return; // Should never happen. + + if (!it->second.first) + it->second.first = "no"; + if (!it->second.second) + it->second.second = "no"; +} + void ModuleFilter::GetLinkData(LinkData& data, std::string& compatdata) { if (RegexEngine) @@ -689,6 +706,9 @@ void ModuleFilter::GetLinkData(LinkData& data, std::string& compatdata) } else data["regex"] = "broken"; + + if (enableflags) + data["flags"] = "yes"; } std::string ModuleFilter::EncodeFilter(const FilterResult& filter) @@ -815,7 +835,7 @@ std::pair ModuleFilter::AddFilter(const std::string& freeform try { - filters.emplace_back(RegexEngine, freeform, reason, type, duration, flgs, config); + filters.emplace_back(RegexEngine, freeform, reason, type, duration, flgs, config, enableflags); dirty = true; } catch (const ModuleException& e) -- cgit v1.3.1-10-gc9f91