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

624 Commits

Author SHA1 Message Date
Bram Matthys 1f47cc7824 Support for dated log files such as log "ircd.%Y-%m-%d.log" { }
Suggested by Amiga600 in https://bugs.unrealircd.org/view.php?id=5784

This also fixes a bug with log::maxsize on Windows (cannot overwrite
existing file with .old).

It simplifies the logging code a little and makes it a tad more readable.

And it adds an unreal_strftime() function to make things easy.
2021-03-08 10:37:28 +01:00
Bram Matthys 636b068062 New option allow::global-maxperip, defaults to allow::maxperip+1.
Suggested by Jobe and PeGaSuS in https://bugs.unrealircd.org/view.php?id=5802
2021-03-07 11:30:02 +01:00
Bram Matthys dc40d27cd8 Move set::anti-flood::unknown-flood-* to set::anti-flood::handshake-data-flood
which is a new block, documented at:
https://www.unrealircd.org/docs/Set_block#set::anti-flood::handshake-data-flood
The reason for this is better naming and allowing to tweak ban-action.
2021-02-28 07:52:33 +01:00
Bram Matthys 1baf5f9f7d Show reputation score and some other info in "Client connecting"
notices to IRCOps and in ircd.log.
See the release notes for more details.

Module coders:
You can use HOOKTYPE_CONNECT_EXTINFO to add your own additional
information as well. See get_connect_extinfo() for inspiration.
Use nvplist_add() or nvplist_add_fmt() to easily add your info
to the list.

Module coders II:
Small note: this moves the sending of the far connect notice
to /under/ HOOKTYPE_REMOTE_CONNECT instead of /above/.
2021-01-31 18:30:49 +01:00
Bram Matthys 82da314cf4 Dev docs: document svid better
[skip ci]
2021-01-29 19:12:51 +01:00
Bram Matthys 3a922d6ed5 Disable handshake delay for users that are exempt from blacklist checking.
The handshake delay exists so results from DNSBL's can be checked before
the user is fully online. Whenever someone is exempt from DNSBL checking
it serves no purpose, so we mark it that the user has no handshake delay.
This will speed up connecting by up to 2 seconds (by default).
Also updated WebIRC example to suggest this now:
https://www.unrealircd.org/docs/WebIRC_block#UnrealIRCd-side
2021-01-17 08:25:14 +01:00
Bram Matthys fa15ec1bec Add default security-group "tls-users" and "tls-and-known-users" 2021-01-01 18:42:27 +01:00
Bram Matthys 53d23038e5 Support for security groups and new +b ~G:unknown-users:
* There are two security groups by default: known-users and unknown-users.
  See https://www.unrealircd.org/docs/Security-group_block
* New extended ban ~G:securitygroupname, with the typical usage being
  MODE #chan +b ~G:unknown-users, which will ban all users from the
  channel that are not identified to services and have a reputation
  score below 25.
2020-12-30 12:42:56 +01:00
Bram Matthys f494707a47 Doxygen: document list_for_each_entry with examples and
add 'channels' to the page as well.
2020-11-23 10:25:49 +01:00
Bram Matthys c369551721 Commit first 40% of Hook API Documentation in doxygen.
The remaining 60% consists of placeholders at the moment.

Note: if you are running git then don't try to live-reload these
changes, ircd must restart.
2020-11-08 16:16:59 +01:00
Bram Matthys 6778b3e26d Warn when SSL/TLS certificate is expired or expires soon (<7d).
Since an expired certificate usually means that users cannot connect
we will actively warn all IRCOps about this situation twice a day.
2020-10-11 15:00:09 +02:00
Bram Matthys 8619d1e763 Add optional allow::options::reject-on-auth-failure, as requested
by armyn in https://bugs.unrealircd.org/view.php?id=5769.

The default behavior in 5.x is to continue matching:
allow { ip *@*; class clients; maxperip 2; }
allow { ip *@*; password "iwantmore"; class clients; maxperip 10; }
This so users who provide a password get additional rights,
such as a higher maxperip or a different class, etc.
If the user connects without a password then we simply continue
to the next block and use the general block with only 2 maxperip.

However, some people want to use passwords to keep other users out.
That is entirely understandable as it is an 'allow block' after all.
For example:
allow { ip *@*; class clients; maxperip 2; }
allow { ip *@*.nl; password "tehdutch"; class clients; maxperip 2; options { reject-on-auth-failure; } }
In this case anyone without the correct password will be rejected access.
2020-10-11 09:24:11 +02:00
Bram Matthys 578f8f248c Warn user when undocumented set::ssl::dh / set::tls::dh is present.
That option specified a Diffie Hellman parameter file. Since
UnrealIRCd 5.0.0 we no longer process this option.
This option has never been documented in the wiki docs.
We prefer and use ECDHE/EECDH with SSL_OP_SINGLE_ECDH_USE since 2015
to provide Forward Secrecy in SSL/TLS. And indeed, by now in 2020,
any properly maintained software uses it and old DH(E) usage has
fallen to less than 1%.

What this patch does is remove the unused code (since Dec 2019) and
show a warning if you have a ::dh config directive, so that at least
you are informed that it is unused/ignored. Since it was undocumented
it probably hardly affects anyone, but still, it is proper to inform.
2020-09-12 09:38:17 +02:00
Bram Matthys 3acf71458d Module coders: Add CAP_INVERT option. Patch from k4be. 2020-05-25 14:17:22 +02:00
Bram Matthys 57f524cbed Support for +draft/typing
This is the work from May 3rd.. need to commit it so i can merge the
flood protection that is related to this...
The final implementation will still need tweaking before pushed.
[skip ci]
2020-05-05 20:16:56 +02:00
Bram Matthys 0302ef9733 Operclass permission change: immune:target-limit is now called
immune:max-concurrent-conversations since it bypasses
set::anti-flood::max-concurrent-conversations.
Indirectly reported by westor.
2020-01-29 09:01:25 +01:00
Bram Matthys b5c9ee8ec5 Fix screwing up nearly everything 2020-01-20 18:03:16 +01:00
Bram Matthys fde678aacc Fix clash of CHFL_* flags. Found after bug report from k4be. 2020-01-20 16:00:33 +01:00
Bram Matthys 870057d4f3 Add "./unrealircd genlinkblock" which spits out a link { } block. Hmm...
we'll see later if this is a good idea or not.. it has pros and cons.
2020-01-19 19:34:11 +01:00
Bram Matthys 596cf8e7de New: extended server bans: exempt by certificate fingerprint and SASL account.
See https://www.unrealircd.org/docs/Extended_server_bans

Examples with ELINE:
/ELINE ~a:TrustedAccount kg 0 This user can bypass kline/gline when using SASL
/ELINE ~S:1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef kgf 0 Trusted user with this certificate fingerprint
It also works with bans, although this would be less common:
/GLINE ~a:EvilAccount
A more useful purpose would be to use ~r (realname):
/GLINE ~r:*some*stupid*real*name*
(Although you could already ban realnames via spamfilter 'u')

For third party module coders:
If you have an extban in group 3 (a "matcher"-extban) then you
can opt-in to support this. You do so at extban registration time:
req.options = EXTBOPT_TKL;
or, if you already had another flag set, like for +I, then:
req.options = EXTBOPT_INVEX|EXTBOPT_TKL;
In any case, you set the .options before you call ExtbanAdd().

Note that if you do indicate support then your is_ok function
will be called like:
extban->is_ok(client, NULL, mask, EXBCHK_PARAM, MODE_ADD, EXBTYPE_TKL);
Important here is the NULL channel (since there is none)

Similarly your is_banned function will be called with BANCHK_CONNECT:
extban->is_banned(client, NULL, banstr, BANCHK_JOIN, &msg, &errmsg);
Here too, it is important to note that channel is NULL.
2020-01-10 11:45:25 +01:00
Bram Matthys fccb3b2f5b Add /ELINE exception type 'm' to bypass allow::maxperip.
In the configuration item you can now achieve the same via:
except ban { mask 1.2.3.4; type maxperip; }
Or even:
except ban { mask { 1.2.3.4; 8.8.8.8; }; type maxperip; }
etc.

Suggested by The_Myth in https://bugs.unrealircd.org/view.php?id=5507

Also, fixed an issue where the IRCd was counting servers as
clients for maxperip, which doesn't make much sense in practice,
so it only counts users now.
2019-12-30 18:23:55 +01:00
Bram Matthys e3b806ec60 Fix command override priorities again. Lowest value is called first,
just like hooks now. Yeah we've messed up a few times by now.
Seems only Gottem uses them :D
So now it would call for example: prio -10, prio 0, 10, 20, cmd.
This matches the behavior of hook priorities (and swhois etc.)
2019-12-23 13:10:33 +01:00
Bram Matthys 0bbb935a32 Rename CHECKPROTO() to CHECKSERVERPROTO() to avoid mixing up server caps
and client caps in the future.
2019-12-06 08:32:36 +01:00
Bram Matthys dfa83aa6e5 Add module manager. See https://www.unrealircd.org/docs/Module_manager
Also update release notes and some unrelated changes.
BIG commits. Lots of work. Requires more testing.
2019-11-01 12:57:12 +01:00
Bram Matthys fb8055c6ef Add './unrealircd configtest' which tests the configuration but does
not actually start the server. Any warnings and errors are printed
only to the console.
Suggested in https://bugs.unrealircd.org/view.php?id=5219
2019-10-26 18:55:26 +02:00
Bram Matthys da5aefaad7 Get rid of class.h 2019-10-26 10:02:00 +02:00
Bram Matthys 24c60fd85e Fix some doxygen tags (eg @notes to @note) 2019-10-26 09:33:09 +02:00
Bram Matthys 845f9ca8ed Uniform spelling: seetle on sync/synced/desync/desynced, rather than
synch/synched/desynch/desynched.
2019-10-25 14:07:58 +02:00
Bram Matthys 49c2f7c2c3 Get rid of this whole kill path nonsense. 2019-10-16 11:11:46 +02:00
Bram Matthys e1b0b0bc8e Make tracing bugs easier if you used AddListItem twice - or at least
detect some cases of it (it will not detect the case where it is
a single-item list).
2019-10-14 08:53:05 +02:00
Bram Matthys 44f9423e13 Remove ID() macro as client->id always contains a proper UID now. 2019-10-13 20:11:58 +02:00
Bram Matthys 154aab6ec4 No need for clear functions since PROTOCTL does not allow it. 2019-10-13 09:42:29 +02:00
Bram Matthys bcfd2ab529 Rip out support for servers lacking TKLEXT/TKLEXT2 (always send TKLEXT2 format) 2019-10-13 09:39:00 +02:00
Bram Matthys 560b73b6f7 Similar to previous commits, but for UMODE2. Actually no change, though,
since lack of UMODE2 was not supported in U4 anyway (maybe even 3.2.x).
2019-10-13 09:35:31 +02:00
Bram Matthys a9890448d8 Rip out support for servers lacking SJ3 2019-10-13 09:33:39 +02:00
Bram Matthys 545c2560e6 Rip out support for servers lacking SIDs/UIDs.
More cleanups will follow later for this one.
2019-10-13 09:24:26 +02:00
Bram Matthys 930ede1c86 Rip out support for servers lacking SJOIN/SJOIN2 2019-10-13 09:09:59 +02:00
Bram Matthys 0670bfffb9 Rip out support for servers lacking NICKIP 2019-10-13 08:59:26 +02:00
Bram Matthys fb4d994f40 Rip out support for servers lacking NOQUIT. 2019-10-13 08:56:05 +02:00
Bram Matthys 8d5f896790 Rip out support for servers lacking NICKv2 2019-10-13 08:54:16 +02:00
Bram Matthys 03645750f1 Protect against services that don't reply to SASL: time out the SASL
session after a 15 seconds timeout. The exact timeout value can be
changed by adjusting set::sasl-timeout, which should be (quite a bit)
less than set::handshake-timeout by the way. 15<30 now, so fine.
2019-10-11 19:17:59 +02:00
Bram Matthys 394168c288 Style fixes: "char* " -> "char *" etc. 2019-10-11 12:23:45 +02:00
Bram Matthys 798b223ee3 Convert some more stuff to enums (config preprocessor mostly). 2019-10-06 07:54:46 +02:00
Bram Matthys 798f502875 Mass change (at least this one could be fully automated): 'chptr' -> 'channel'
to be consistent with the 'sptr' -> 'client' rename earlier.
2019-10-05 08:49:10 +02:00
Bram Matthys 3a64077f51 Use 'client' everywhere (if there is no confusion) instead of 'sptr' or 'cptr'.
This so I - and others - don't constantly have to wonder whether the client
is called sptr, cptr or acptr in a simple routine.
Insane --> 212 files changed, 6814 insertions(+), 6945 deletions(-)
Couldn't just mass-replace of course since there are places where there
are multiple clients involved. So had to check each function.
Also renamed some 'acptr' to 'target' and such.

I will write a page with new style rules later.. but in short if there is
only 1 client involved it will now be called 'client'.
2019-10-04 15:25:35 +02:00
Bram Matthys 40cd6aa639 Get rid of reference counting in User, which was unused. 2019-10-04 13:25:56 +02:00
Bram Matthys e8c17e3aed Get rid of pseudo ID's. This also means that SASL with anope won't work
anymore if you run latest anope 2.0.6. You need the fix from Feb 9, 2019:
https://github.com/anope/anope/commit/da6e2730c259d6d6356a0a948e85730ae34663ab
(.. which also fixes SASL problems with anope + UnrealIRCd 4 by the way)
or just run anope latest git (2.0 branch).

Not sure about atheme... should test this.

Technical details: we used a pseudo ID / sasl cookie until recently,
this has always been planned to be phased out when we got UID's.
I didn't phase it out in U4 (but could have done so) but just did now in U5.
This simplifies everything as now you can just refer from the services
side to the user with the UID/SID. This also makes it so services can now
target the user in other functions as well, like NOTICE.
(Feel free to request other functions if something isn't working)
2019-10-04 13:13:46 +02:00
Bram Matthys 3d5e49e701 Get rid of FLUSH_BUFFER, since we no longer signal things that way.
Merge check_init and AllowClient into one single AllowClient()
and make it use the more logic 1 and 0 return values for allow / deny.
Similarly, use logic 1 / 0 return values for verify_link.

Module coders:
HOOKTYPE_CHECK_INIT and HOOKTYPE_PRE_LOCAL_CONNECT, changed the
return value, you should now use HOOK_*, eg HOOK_DENY to stop
processing (eg client killed).
2019-10-04 12:30:51 +02:00
Bram Matthys 9e4dbf8c89 dead_link() -> dead_socket() since that is more descriptive 2019-10-04 11:36:34 +02:00
Bram Matthys 3126a3fae4 BIG changes internally that will break all modules and required many
code changes in UnrealIRCd itself:
1) Clients are no longer freed directly by exit_client. Most fields
   are freed, but 'sptr' itself is not, so you can use IsDead() on it.
2) exit_client now returns void rather than int
3) ALL command functions return void rather than int.
   Of course this also affects do_cmd, command overrides, etc.

This is a direct consequence of the removal of 'cptr' earlier, as that
was used to signal certain things that are now no longer possible
(and it raises the question if things were always correctly signaled
in the first place, so may fix some bugs).
It also makes the code more resillient against cases where you forgot
to check if the client was freed. Still, you are encouraged to do an
IsDead(sptr) if you are calling functions that may kill clients,
such as command functions or things that may use spamfilter.

More changes will follow, such as the removal of FLUSH_BUFFER.
2019-10-04 10:28:41 +02:00