From 61704664a7d921b0bd2e9eca1af979c670c775ed Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 13 May 2020 17:38:17 +0100 Subject: Implement support for the CLIENTTAGDENY token. Ref: ircv3/ircv3-specifications#412. --- src/modules/m_ircv3_ctctags.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp index bf39bb381..3815b025d 100644 --- a/src/modules/m_ircv3_ctctags.cpp +++ b/src/modules/m_ircv3_ctctags.cpp @@ -329,6 +329,12 @@ class ModuleIRCv3CTCTags c2ctags.allowclientonlytags = ServerInstance->Config->ConfValue("ctctags")->getBool("allowclientonlytags", true); } + void On005Numeric(std::map& tokens) CXX11_OVERRIDE + { + if (!c2ctags.allowclientonlytags) + tokens["CLIENTTAGDENY"] = "*"; + } + ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE { return CopyClientTags(details.tags_in, details.tags_out); -- cgit v1.3.1-10-gc9f91 From e1211a68e5a7d85bca7ad7fc6d13418a2c12093b Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 21 May 2020 00:03:26 +0100 Subject: Add a file to the config directory telling new users what to do. --- make/template/help.txt | 19 +++++++++++++++++++ make/template/main.mk | 1 + 2 files changed, 20 insertions(+) create mode 100644 make/template/help.txt diff --git a/make/template/help.txt b/make/template/help.txt new file mode 100644 index 000000000..0afe91e02 --- /dev/null +++ b/make/template/help.txt @@ -0,0 +1,19 @@ +Thanks for installing InspIRCd! + +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 or refer to the the docs site: + + https://docs.inspircd.org/@VERSION_MAJOR@/configuration + https://docs.inspircd.org/@VERSION_MAJOR@/modules + +When you are done you can run the following command to start InspIRCd: + + @BINARY_DIR@/inspircd + +If you have installed from an official package you may need to prefix this +command with `sudo -g @GROUP@ -u @USER@` to run as the correct group/user. + +You can also use one of the helper scripts in `@SCRIPT_DIR@`. diff --git a/make/template/main.mk b/make/template/main.mk index 6bd1d390d..380d57f27 100644 --- a/make/template/main.mk +++ b/make/template/main.mk @@ -246,6 +246,7 @@ endif -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/providers/*.example $(EXAPATH)/providers -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/conf/services/*.example $(EXAPATH)/services -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) docs/sql/*.sql $(EXAPATH)/sql + -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_TXT) @CONFIGURE_DIRECTORY@/help.txt $(CONPATH) -$(INSTALL) -g @GID@ -o @UID@ -m $(INSTMODE_PRV) *.pem $(CONPATH) 2>/dev/null @echo "" @echo "*************************************" -- cgit v1.3.1-10-gc9f91 From 3c9d53eadd3fef84d7f6d0b59120ad8e43a79a04 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 21 May 2020 19:24:46 +0100 Subject: Document ModResult and switch the underlying type to char. --- include/modules.h | 72 +++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 21 deletions(-) diff --git a/include/modules.h b/include/modules.h index 73bfd0da6..380775305 100644 --- a/include/modules.h +++ b/include/modules.h @@ -58,43 +58,73 @@ enum ModuleFlags VF_OPTCOMMON = 8 }; +/** The event was explicitly allowed. */ #define MOD_RES_ALLOW (ModResult(1)) + +/** The event was not explicitly allowed or denied. */ #define MOD_RES_PASSTHRU (ModResult(0)) + +/** The event was explicitly denied. */ #define MOD_RES_DENY (ModResult(-1)) -/** Used to represent an allow/deny module result. - * Not constructed as an enum because it reverses the value logic of some functions; - * the compiler will inline accesses to have the same efficiency as integer operations. - */ -struct ModResult { - int res; - ModResult() : res(0) {} - explicit ModResult(int r) : res(r) {} - inline bool operator==(const ModResult& r) const +/** Represents the result of a module event. */ +class ModResult +{ + private: + /** The underlying result value. */ + char result; + + public: + /** Creates a new instance of the ModResult class which defaults to MOD_RES_PASSTHRU. */ + ModResult() + : result(0) + { + } + + /** Creates a new instance of the ModResult class with the specified value. */ + explicit ModResult(char res) + : result(res) + { + } + + /** Determines whether this ModResult has.the same value as \p res */ + inline bool operator==(const ModResult& res) const { - return res == r.res; + return result == res.result; } - inline bool operator!=(const ModResult& r) const + + /** Determines whether this ModResult has.a different value to \p res */ + inline bool operator!=(const ModResult& res) const { - return res != r.res; + return result != res.result; } + + /** Determines whether a non-MOD_RES_PASSTHRU result has been set. */ inline bool operator!() const { - return !res; + return !result; } + + /** Checks whether the result is an MOD_RES_ALLOW or MOD_RES_PASSTHRU when the default is to allow. */ inline bool check(bool def) const { - return (res == 1 || (res == 0 && def)); + return (result == 1 || (result == 0 && def)); } - /** - * Merges two results, preferring ALLOW to DENY - */ - inline ModResult operator+(const ModResult& r) const + + /* Merges two results preferring MOD_RES_ALLOW to MOD_RES_DENY. */ + inline ModResult operator+(const ModResult& res) const { - if (res == r.res || r.res == 0) + // If the results are identical or the other result is MOD_RES_PASSTHRU + // then return this result. + if (result == res.result || res.result == 0) return *this; - if (res == 0) - return r; + + // If this result is MOD_RES_PASSTHRU then return the other result. + if (result == 0) + return res; + + // Otherwise, + // they are different, and neither is passthru return MOD_RES_ALLOW; } -- cgit v1.3.1-10-gc9f91 From 1cb1430c70f224c8be0b1184ee4da1b23e83d0f4 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 22 May 2020 17:20:34 +0100 Subject: ModResult is a class now. --- include/modules.h | 4 +--- include/typedefs.h | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/modules.h b/include/modules.h index 380775305..a5e4440dc 100644 --- a/include/modules.h +++ b/include/modules.h @@ -123,9 +123,7 @@ class ModResult if (result == 0) return res; - // Otherwise, - - // they are different, and neither is passthru + // Otherwise, they are different, and neither is MOD_RES_PASSTHRU. return MOD_RES_ALLOW; } }; diff --git a/include/typedefs.h b/include/typedefs.h index 8dc5b4c54..8a7b59159 100644 --- a/include/typedefs.h +++ b/include/typedefs.h @@ -50,7 +50,7 @@ class XLine; class XLineManager; class XLineFactory; struct ConnectClass; -struct ModResult; +class ModResult; namespace ClientProtocol { -- cgit v1.3.1-10-gc9f91 From 8deed905c2f5231a212816034d30581aeac8f845 Mon Sep 17 00:00:00 2001 From: linuxdaemon Date: Sun, 24 May 2020 21:56:19 -0400 Subject: Fix watch example config --- docs/conf/modules.conf.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf/modules.conf.example b/docs/conf/modules.conf.example index 09d997b32..fbd29ffca 100644 --- a/docs/conf/modules.conf.example +++ b/docs/conf/modules.conf.example @@ -2342,7 +2342,7 @@ # # # Set the maximum number of entries on a user's watch list below. -# +# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # WebSocket module: Adds HTML5 WebSocket support. -- cgit v1.3.1-10-gc9f91 From 3c30de43c945a387a7faf5d49ce320f8bcaa5c43 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 26 May 2020 16:29:13 +0100 Subject: Use ChanModeReference for finding the op mode in ojoin. --- src/modules/m_ojoin.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/modules/m_ojoin.cpp b/src/modules/m_ojoin.cpp index 20ac41685..8bc264622 100644 --- a/src/modules/m_ojoin.cpp +++ b/src/modules/m_ojoin.cpp @@ -33,9 +33,11 @@ class CommandOjoin : public SplitCommand bool notice; bool op; ModeHandler* npmh; + ChanModeReference opmode; CommandOjoin(Module* parent, ModeHandler& mode) : SplitCommand(parent, "OJOIN", 1) , npmh(&mode) + , opmode(parent, "op") { flags_needed = 'o'; syntax = ""; @@ -73,8 +75,8 @@ class CommandOjoin : public SplitCommand // they're already in the channel Modes::ChangeList changelist; changelist.push_add(npmh, user->nick); - if (op) - changelist.push_add(ServerInstance->Modes->FindMode('o', MODETYPE_CHANNEL), user->nick); + if (op && opmode) + changelist.push_add(*opmode, user->nick); ServerInstance->Modes->Process(ServerInstance->FakeClient, channel, NULL, changelist); } return CMD_SUCCESS; @@ -121,8 +123,8 @@ class ModuleOjoin : public Module if (mycommand.active) { privs += np.GetModeChar(); - if (mycommand.op) - privs += 'o'; + if (mycommand.op && mycommand.opmode) + privs += mycommand.opmode->IsPrefixMode()->GetPrefix(); return MOD_RES_ALLOW; } -- cgit v1.3.1-10-gc9f91 From 581526122ae3e484b4c8e0586f6d8506bbab2100 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 29 May 2020 16:35:55 +0100 Subject: Update the v2 eol date. --- .github/SECURITY.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/SECURITY.md b/.github/SECURITY.md index 94e5b60e4..d8b772e22 100644 --- a/.github/SECURITY.md +++ b/.github/SECURITY.md @@ -2,14 +2,14 @@ ## Supported Versions -Currently the v2 (old stable) and v3 (stable) branches are actively receiving security fixes. Support for v2 will end on 2020-06-01. +Currently the v2 (old stable) and v3 (stable) branches are actively receiving security fixes. Support for v2 will end on 2021-01-01. The v4 branch is still early in development and only receives security fixes when they are synced from the v3 branch. Version | Supported ------- | --------- 4.x.y | :warning: -3.x.y | :white_check_mark: +3.x.y | :white_check_mark: 2.0.x | :white_check_mark: 1.2.y | :x: 1.1.y | :x: -- cgit v1.3.1-10-gc9f91 From dd9d0d023e044c0dd926e5cc5139037250995544 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 2 Jun 2020 19:25:29 +0100 Subject: Remove the DANE record hint from genssl. This was never adopted by clients and its easy for servers to get a valid cert now so this is unnecessary. --- tools/genssl | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/tools/genssl b/tools/genssl index dfe821f43..930f4b1d7 100755 --- a/tools/genssl +++ b/tools/genssl @@ -85,9 +85,6 @@ my $state = prompt('What state are you located in?', 'Example State'); my $country = prompt('What is the ISO 3166-1 code for the country you are located in?', 'XZ'); my $days = prompt('How many days do you want your certificate to be valid for?', '365'); -# Contains the SSL certificate in DER form. -my $dercert; - # Contains the exit code of openssl/gnutls-certtool. my $status = 0; @@ -119,7 +116,6 @@ __GNUTLS_END__ $status ||= system "$certtool --generate-self-signed --load-privkey key.pem --outfile cert.pem --template $tmp"; $status ||= system "$certtool --generate-request --load-privkey key.pem --outfile csr.pem --template $tmp"; $status ||= system "$certtool --generate-dh-params $sec_param --outfile dhparams.pem"; - $dercert = `$certtool --certificate-info --infile cert.pem --outder` unless $status; } elsif ($tool eq 'openssl') { my $tmp = new File::Temp(); print $tmp <<__OPENSSL_END__; @@ -137,18 +133,9 @@ __OPENSSL_END__ $status ||= system "cat $tmp | openssl req -x509 -nodes -newkey rsa:2048 -keyout key.pem -out cert.pem -days $days 2>/dev/null"; $status ||= system "cat $tmp | openssl req -new -nodes -key key.pem -out csr.pem 2>/dev/null"; $status ||= system 'openssl dhparam -out dhparams.pem 2048'; - $dercert = `openssl x509 -in cert.pem -outform DER` unless $status; } if ($status) { say STDERR "SSL generation failed: $tool exited with a non-zero status!"; exit 1; } - -if (defined $dercert && eval 'use Digest::SHA; 1') { - my $hash = Digest::SHA->new(256); - $hash->add($dercert); - say ''; - say 'If you are using the self-signed certificate then add this TLSA record to your domain for DANE support:'; - say "_6697._tcp." . $common_name . " TLSA 3 0 1 " . $hash->hexdigest; -} -- cgit v1.3.1-10-gc9f91 From 31815edd6a6b98434bace5359234d2b47397ee0a Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 6 Jun 2020 17:55:06 +0100 Subject: Add an ISUPPORT token for the bot mode and 'B' to the WHO flags. --- src/modules/m_botmode.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index e1f8a6894..7abf6f749 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -25,6 +25,7 @@ #include "inspircd.h" #include "modules/ctctags.h" +#include "modules/who.h" #include "modules/whois.h" enum @@ -60,7 +61,10 @@ class BotTag : public ClientProtocol::MessageTagProvider } }; -class ModuleBotMode : public Module, public Whois::EventListener +class ModuleBotMode + : public Module + , public Who::EventListener + , public Whois::EventListener { private: SimpleUserModeHandler bm; @@ -68,12 +72,30 @@ class ModuleBotMode : public Module, public Whois::EventListener public: ModuleBotMode() - : Whois::EventListener(this) + : Who::EventListener(this) + , Whois::EventListener(this) , bm(this, "bot", 'B') , tag(this, bm) { } + void On005Numeric(std::map& tokens) CXX11_OVERRIDE + { + tokens["BOT"] = ConvToStr(bm.GetModeChar()); + } + + ModResult OnWhoLine(const Who::Request& request, LocalUser* source, User* user, Membership* memb, Numeric::Numeric& numeric) CXX11_OVERRIDE + { + size_t flag_index; + if (!request.GetFieldIndex('f', flag_index)) + return MOD_RES_PASSTHRU; + + if (user->IsModeSet(bm)) + numeric.GetParams()[flag_index].push_back('B'); + + return MOD_RES_PASSTHRU; + } + Version GetVersion() CXX11_OVERRIDE { return Version("Adds user mode B (bot) which marks users with it set as bots in their /WHOIS response.",VF_VENDOR); -- cgit v1.3.1-10-gc9f91