1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-28 20:46:38 +02:00
Commit Graph

2720 Commits

Author SHA1 Message Date
Bram Matthys 3fbdb7fd4b Move StripControlCodes() from message.c to misc.c.
Because I need in the core (again) due to early calls / calls during
rehashes / etc...
2022-05-23 10:10:47 +02:00
Bram Matthys 5d9a201df8 Don't show security-groups of ulines like NickServ (since it is irrelevant anyway).
Reported by Lord255.
2022-05-16 11:22:57 +02:00
Bram Matthys 2108bb48fa Run labeled-response through the quick path. 2022-05-16 09:53:23 +02:00
Bram Matthys 519d027a62 Fix geoip_base_unserialize() check being the wrong way around.
Could have caused a memory leak but likely did not happen at all
in practice.
2022-05-15 19:34:46 +02:00
Bram Matthys c037486263 Add blacklist::except for exempting users from individual blacklists,
this is a https://www.unrealircd.org/docs/Mask_item so very flexible.

Note that most people would want to use except ban { } instead to
simply exempt from ALL blacklists. (that one does not yet have the
flexible mask capability though.. but it wil have it soon..)
2022-05-15 15:13:19 +02:00
Bram Matthys 0b45e34e62 Simplifly RPL_HOSTHIDDEN notification.
Pretty much everywhere we had:
0001 userhost_changed(client);
0002 if (MyUser(client))
0003         sendnumeric(client, RPL_HOSTHIDDEN, client->user->virthost);

Lines 2-3 are now integrated in userhost_changed().

Also fix two issues with CHGHOST in make_oper():
* if user was -x, modes had +x and a vhost, it would send the cloaked
  host in the original vhost, while it should have been the real host
* if user was -x and went +x without vhost (so only uncloaked to cloaked)
  then no CHGHOST message was sent at all
2022-05-15 07:45:00 +02:00
Bram Matthys 9e0340d4c1 Change restrict-commands to use ::except which is a
https://www.unrealircd.org/docs/Mask_item so has more functionality.

The old style config still works and UnrealIRCd won't complain
about it for now.
2022-05-14 18:50:24 +02:00
Bram Matthys 3241338cf3 Add set::connthrottle::except, which is a mask item.
Automatically convert the old options ::sasl-bypass, ::webirc-bypass
and ::minimum-reputation-score, so nobody needs to update their config.

The example.conf has been updated.
2022-05-14 15:31:30 +02:00
Bram Matthys 915b603a6a Add set::antirandom::except, which is a mask item.
Automatically convert the old style ::except-hosts and ::except-webirc
so nobody needs to update their config.
2022-05-14 15:17:29 +02:00
Bram Matthys f0ddbdaa44 Add set::antimixedutf8::except, which is a mask item too. 2022-05-14 15:07:33 +02:00
Bram Matthys e09470b0bd Integrate security-group functionality in link::incoming::mask. 2022-05-14 08:28:26 +02:00
Bram Matthys 67fdd63bc3 Integrate security-group functionality in vhost::mask. 2022-05-14 08:19:05 +02:00
Bram Matthys ec4df2da7d Integrate security-group functionality in tld::mask. 2022-05-14 08:10:20 +02:00
Bram Matthys 759908ba3a Integrate security-group functionality in oper::mask. 2022-05-14 08:03:12 +02:00
Bram Matthys 510b4b5505 Integrate security-group functionality in allow::mask.
(Also call it allow::match in the future, but accept allow::mask still)

This is the first of several commits to convert all ::mask items.
See https://www.unrealircd.org/docs/Mask_item for the consequences.
In short, you can now use all of the security-group items directly
in a mask, eg:
allow {
    mask { account TrustedUser; }
    class clients;
    maxperip 10;
}
2022-05-14 07:51:51 +02:00
Bram Matthys 10bddc1232 Extended server bans are now more clearly exposed in security-group { }.
The extban module API is used behind the scenes. To the server admin
the functionality appears in a more natural way:
        account { <list>; };
        country { <list>; };
        realname { <list>; };
        certfp { <list>; };
In the same way, they appear as exclude-xxx options too:
        exclude-account { <list>; };
        exclude-country { <list>; };
        exclude-realname { <list>; };
        exclude-certfp { <list>; };

Modules can add additional fields (3rd party modules too!).

Module coders:
See src/modules/extbans/realname.c for a simple example. In short:
1) You need to register your extban in both MOD_TEST and MOD_INIT
2) Other than that, the existing rules for extended server bans apply:
   a) Your req.is_banned_events needs to include BANCHK_TKL
   b) Your req.options needs to include EXTBOPT_TKL
Be advised that for modules that are called in extended server bans
the client may be missing several fields, for example client->user could
be NULL, so be careful with accessing everything in your module.
2022-05-13 20:13:34 +02:00
Bram Matthys 085490d780 Show in WHOIS in which security-group a user is in (to IRCOps only)
The set::whois-details name for this is: security-groups.
https://www.unrealircd.org/docs/Set_block#set::whois-details
By default it is shown ONLY to IRCOps, not even to 'self' for normal users.

If you want to hide it for everyone, even to IRCOps, eg because you
feel it is useless information, then you can use:
set {
        whois-details {
		security-groups { everyone none; self none; oper none; }
	}
}
2022-05-13 13:14:46 +02:00
Bram Matthys f1a18ce37e Communicate "creationtime" of users. Right now this info is only known
locally, as the only timestamp regarding users that is communicated across
the network is about the "last nick change" ("has this nick since...").
2022-05-13 12:27:21 +02:00
Bram Matthys 4a03943996 Fix antirandom log message when user is denied (only showed nick).
Reported by PeGaSuS in https://bugs.unrealircd.org/view.php?id=6093
2022-05-13 08:09:46 +02:00
Bram Matthys 06c6eb164e Only validate for local users sending the tag 2022-05-13 07:56:30 +02:00
Valerie Pond 61f7dd746e Add IRCv3 +draft/channel-context (#205)
https://github.com/delthas/ircv3-specifications/blob/feature-channel/client-tags/channel-context.md
2022-05-13 07:39:41 +02:00
Bram Matthys b154591a58 Some source files indicated the license was "GPLv2", which was meant to
be (and is now clarified to be) "GPLv2 or later".
Reported by libsys in https://bugs.unrealircd.org/view.php?id=6099
2022-05-11 06:41:11 +02:00
Bram Matthys 50e5d91c79 Add SVSO command which services can use to make someone IRCOp.
This existed in UnrealIRCd 3.2.x but was later removed when
switching to the new operclass system.
Requested by Valware in https://bugs.unrealircd.org/view.php?id=6041

Syntax: SVSO <uid|nick> <oper account> <operclass> <class> <modes> <snomask> <vhost>
All these parameters need to be set, you cannot leave any of them out,
HOWEVER some can be set to "-" to skip setting them, this is true for:
<class>, <modes>, <snomask>, <vhost>

In UnrealIRCd the <operclass> will be prefixed by "services:" if not already
present. It is up to you to include or omit it.

If you want to set any swhoises you need to use the SWHOIS s2s command,
other than that this command basically does everything for you,
in fact it uses the same code as the OPER command does.
Most of the "user is now ircop" code has been moved out of cmd_oper() to
a new function make_oper() that is called by both cmd_oper() and cmd_svso().

This function also changes the hook HOOKTYPE_LOCAL_OPER:
It no longer passes a ConfigItem_oper struct, since we can't do that for
remote opers. Instead it passes oper name and oper class.
The complete definition is now:
int hooktype_local_oper(Client *client, int add, const char *oper_block, const char *operclass);
2022-05-07 18:53:59 +02:00
Bram Matthys 84f3efc105 Fix issue with modes-on-join and +f: 3t#b1 would be converted to 3t#b,
thus the 'unset time' would be stripped.
This was because the timedban module was seen as 'unavailable' when
checking the +f syntax so early in the booting process.
We now assume timedban is available during config testing, if it later
turns out it is not available the 'unset time' is still stripped
when setting the mode on JOIN.

Reported by ctcp.
2022-05-07 08:18:05 +02:00
Bram Matthys fea7995a02 Fix crash when using ~security-group in except ban { }
This makes us no longer call the .is_ok() function for extbans
that are added through except ban { }. This because normally
the is_ok() function communicates to 'client', which is NULL
when it is called from the config code.
The alternative would have been to update all the extban modules
to check for a NULL client and deal with that but that would
need stupid amounts of code and it would not be of much value
as the error would not end up displaying on the console.
So, we now only on the .conv_param() function, which was already
only used for cases such as remote bans and such, and is already
known to have a NULL 'client' in TKL cases. Note that conv_param()
could still reject the ban, but it does it generally only in
the more extreme cases.

Reported by musk / PeGaSuS.
2022-05-07 08:06:05 +02:00
Bram Matthys 03c0f24be8 Make autoconnect work with last commit (link::outgoing::file). 2022-05-06 17:17:02 +02:00
Ron Nnn 64e411aa34 Add support for linking servers via UNIX domain sockets (#202) 2022-05-06 17:05:54 +02:00
Bram Matthys 889bcd99dc Actually build and load module for unrealircd.org/geoip-tag by default. 2022-05-01 14:11:24 +02:00
westor a346b4a3e9 Add geoip-tag module (#197)
This module will work the same way as `userip-tag` or `userhost-tag` modules work now, the 90% of this code is part from these modules.
It will help especially the irc bots (AdiIRC/mIRC) to detect the geoip country code directly and easy when someone is talking on a channel and take actions, i hope this will help on most people.

Thanks @Valware for testing it out.

Short Example: `@unrealircd.org/geoip=GR;account=tester;msgid=tPTHDgymv9pgdGdYkI3WBd;time=2022-03-30T16:34:26.780Z :tester!Username@3765DB68:3AE9CB6C:B0540131:IP PRIVMSG #Test :test message`
2022-05-01 14:05:34 +02:00
alicetries 2018502e74 Fix various log messages which had missing $expansions (#198) 2022-05-01 13:52:45 +02:00
Bram Matthys b1daf5b832 Fix crash when hideserver module is loaded but LINKS is not blocked. 2022-05-01 13:36:37 +02:00
Bram Matthys 3451919b06 Fix issue with duplicate entries in the +b/+e/+I list of +P channels.
This was caused by the transition from letter extbans (eg ~a) to
named extbans (eg ~account) and a combination of the bug fix in 6.0.2
(60a70acd86) and the 'channeldb' module
not checking for duplicates while reading the database.

Reported by PeGaSuS in https://bugs.unrealircd.org/view.php?id=6091
2022-04-18 08:51:23 +02:00
Bram Matthys a9de2696d4 Allocated too much memory for the watchTable in the 6.0.3 change.
Now back to 256K (sizeof Watch *) instead of 1024K (sizeof Watch).
2022-04-08 08:53:23 +02:00
Bram Matthys 707510c1ce Fix crash in WATCH backend after doing /REHASH.
It often takes a while for the actual crash to occur but eventually an
attempt would be made to access inaccessible memory of the previously
freed .so module.

Reported by and traced with the help of both Wick and Krstarica.
2022-04-01 09:39:22 +02:00
Bram Matthys aba8eb7a2b Fix OOB write in packet sending routine.
Bug found internally, was not reported by anyone.
2022-04-01 09:17:11 +02:00
Bram Matthys 28c1b9cef9 Show operclass in "/STATS o".
Suggested by fo (w/patch) in https://bugs.unrealircd.org/view.php?id=6003
2022-03-23 12:54:27 +01:00
Bram Matthys ba1a88124a Re-indent src/modules/list.c 2022-03-23 07:24:29 +01:00
Bram Matthys da84223217 Make LIST option T<xx and T>xx always available, IOTW remove the need for
defining LIST_USE_T which was never done anywhere.

Reported by progval in https://github.com/unrealircd/unrealircd/pull/193
2022-03-23 07:15:40 +01:00
Val Lorentz f6ecbc6e63 Flip semantics of <xx and >xx in ELIST C and ELIST T (#194)
The spec <https://datatracker.ietf.org/doc/html/draft-hardy-irc-isupport-00#section-4.8>
is a little unclear on the semantics, and Unreal interprets 'C<val' as
a request for all chans created before <val> minutes ago, ditto.

This is a legitimate interpretation, but I think the other on makes more
sense (ie. that 'C<val' means all chans created less than <val> minutes
ago).

Additionally, the documentation for T did not match the implementation
before this commit.

Before this commit, Unreal was consistent with Hybrid/Plexus4 on ELIST C.

After this commit, Unreal will be consistent with Charybdis/Solanum,
InspIRCd, and ircu2 (and Hybrid/Plexus4 on ELIST T).
2022-03-23 07:09:37 +01:00
Bram Matthys f169a3cf77 Fix channel ops unable to -h someone, even though they could +h.
Reported by Jaka in https://bugs.unrealircd.org/view.php?id=6077 and
Valware and buayadarat in https://bugs.unrealircd.org/view.php?id=6078

This commit also makes the halfop rules for +h/-h match the ones in U5:

Previously in 6.0.0 - 6.0.2 it was:
* halfops can set +h on others
* halfops cannot set -h on others
* halfops can set -h on themselves

Now in 6.0.3+ it matches 5.x behavior again:
* halfops cannot set -h or +h on others
* halfops can set -h on themselves
2022-03-18 07:26:53 +01:00
Bram Matthys 29fd2e772a ** UnrealIRCd 6.0.2 ** 2022-01-28 17:02:19 +01:00
Bram Matthys 83e74893da Relookup reputation and geo information when client IP changes due to WEBIRC
or another type of proxy request.
This fixes a problem where ban user { } or except ban { } is not working
for ~country:XX when the request comes via a WEBIRC or other proxy.
Reported by CaoS in https://bugs.unrealircd.org/view.php?id=6058
It should also fix security-group being incorrect for ~security-group bans
or exempts.
2022-01-17 08:09:15 +01:00
Bram Matthys d4f09f8fed HOOKTYPE_*_CHANGED -> HOOKTYPE_*_CHANGE to be a bit more consistent with
the rest of the hooks, most of which do not use the past tense.
Only affects HOOKTYPE_USERHOST_CHANGE / HOOKTYPE_REALNAME_CHANGE.

This does, however, make it inconsistent with the userhost_changed()
call, though :D.
2022-01-17 08:02:18 +01:00
Bram Matthys f3d827c577 Add HOOKTYPE_IP_CHANGE and call it when the IP address changes.
Eg for WEBIRC or other proxy.

This does not yet fix any problem, it just changes the way things are
called. More to follow.
2022-01-17 07:55:45 +01:00
i c1ec164a65 fix flat-map display 2022-01-08 03:46:09 +03:00
Bram Matthys 60a70acd86 channeldb: convert letter extbans to named extbans (.db for +P channels) 2022-01-07 12:10:10 +01:00
Bram Matthys 329fd07f3a Revert set::spamfilter::utf8-support from yesterday.
This will be for a later release, needs more thought and work.
2022-01-06 18:03:26 +01:00
Bram Matthys bd05cdf779 Don't do GeoIP lookups for remote users. These are already looked up and
synced by the server the user is on, and this way the country will be
consistently the same on all servers (and not BE on one, and NL on another,
which would be confusing for the ban matching code, giving different
results on each server).
2022-01-06 15:31:54 +01:00
Bram Matthys dedff543b5 Add option set::spamfilter::utf8-support which defaults to 'no' for now.
When you set this to 'yes' you get more options...
See next (modified) copy-paste from April 2020, which had to be reverted
because PCRE2 was broken. Now it's an opt-in and hopefully matured a bit.

This means:
* Case insensitive matches work better in UTF8 now, such as extended Latin.
  For example, a spamfilter on "ę" now also matches "Ę", while previously
  it did not catch this.
* Other PCRE2 features such as https://www.pcre.org/current/doc/html/pcre2syntax.html#SEC5
  are now available. For example you can now set a spamfilter with the regex
  \p{Arabic} to block all Arabic script, or
  \p{Cyrillic} to block all Cyrillic script (such as Russian)
  Use these new tools with care, of course. Blocking an entire language,
  or script, is quite a drastic measure.

All of this was possible because of the new PCRE2_MATCH_INVALID_UTF
compile time option which was introduced in PCRE2 10.34. Now, that
version turned out to be buggy. As recent as PCRE 10.36 some major bugs
were fixed. This also means we now require at least PCRE2 10.36 version
so everyone can benefit from this new spamfilter UTF8 feature, IF they
enable set::spamfilter::utf8-support, that is.

Many systems come with older PCRE2 versions so this means we will
fall back to the shipped PCRE2 version in UnrealIRCd. This means
./Config will take a little longer to compile things.

For packagers (rpm/deb/ports): if you choose to patch configure to
not require such a recent PCRE2, then please do not allow enabling
of set::spamfilter::utf8-support since it will likely cause crashes
and misbehavior. Check PCRE2 changelog, CTRL+F at PCRE2_MATCH_INVALID_UTF
2022-01-05 18:08:52 +01:00
i 1c4da04346 add WHO parameter for searching by connect time 2022-01-04 21:25:36 +03:00