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

745 Commits

Author SHA1 Message Date
Bram Matthys 39688517b0 Make "./unrealircd rehash" show output on the terminal, same for
"./unrealircd reloadtls" and there is now also a "./unrealircd status"

The output is colorized if the terminal supports it (just like on the
boot screen) and also the exit status is 0 for success and non-0 for
failure. The purpose of all this is that you can easily detect rehash
errors on the command line.

These three commands communicate to UnrealIRCd via the new control
UNIX socket, which is in ~/data/unrealircd.ctl.
This also does a lot of other stuff because we now have an internal
tool called bin/unrealircdctl which is called by ./unrealircd for
some of the commands to communicate to the unrealircd.ctl socket.
Later on more of the existing functionality may be moved to that
tool and we may also provide it on Windows in CLI mode so people
have more of the same functionality as on *NIX.
2022-01-02 20:17:36 +01:00
Bram Matthys dbef19cd7a Add initial implementation of UNIX domain sockets (listen::file).
Various things still need to be done: a lot more testing, ability to
set permissions on the file, #ifdef's because of lack of support
on Windows (currently won't compile), etc.

One thing that I don't intend to change is that I chose not to display
the socket in the host but have clients show up as 'localhost' (and
ip '127.0.0.1'). Doing it this way keeps things easy, otherwise we risk
a lot of breakage for nearly nothing gained, really.

Things can be tested via:
listen {
        file "/tmp/listen";
}

and then with netcat:
nc -U /tmp/listen
USER x x x x
NICK hai
etc...
2022-01-01 18:48:17 +01:00
Bram Matthys d677ce04de New option set::server-notice-show-event which, if set to 'no', can be used
to hide the event information (eg. connect.LOCAL_CLIENT_CONNECT) in
server notices. This can be overriden in oper::server-notice-show-event.

See https://www.unrealircd.org/docs/Set_block#set::server-notice-show-event
2021-12-30 11:29:30 +01:00
Bram Matthys 0f52ff76e8 Add link to https://www.unrealircd.org/docs/Log_block#Logging_to_a_channel
in the release notes.
Also add the sub-options: color, json-message-tag and oper-only.
2021-12-30 10:40:01 +01:00
Bram Matthys b078a9c8b5 Fix cut-off and expansion issues with MODE, which is a possible problem when
using mixed UnrealIRCd 5 and UnrealIRCd 6 networks.

This is a slightly complex rewrite of make_mode_str() and do_mode(),
as we nog go from single mode lines to potentially multiple mode lines.

In short: whenever we would be near buffer cut-off point (the famous
512 byte limit) then previously we would prevent the mode, though not
succesfully in all cases where a network consists of mixed 5.x and 6.x.
From this point onward we no longer do that. Instead we convert one
MODE command to two MODE lines if that is needed.
The benefit of this is that we no longer prevent it BEFORE processing
the MODE, which is a flawed method and could be wrong (causing desyncs).
And also, we no longer partially ignore MODE lines from clients when
they would cause the limit to be exceeded, as we replace them with
two MODE lines instead.

These are more changes than I wanted at such a late point but.. they seem
to be necessary to prevent U5-U6 compatibility issues.
2021-11-19 13:53:21 +01:00
Bram Matthys f9c46f9f10 Add escaping option for URLs.
In the config file if you have a value that is 100% an URL (eg no
spaces and all that) then it is seen as a remote include and will
be fetched. Eg: file "https://something/"
We already had that.

Now we add a new option to make it NOT interpret this as an URL.
Probably only used in rare cases, but, it is needed for modules
like extjwt where you configure an URL.
The solution is simple: use single quotes instead of double:
Eg: url 'https://something/'

Note that single quotes are only supported in this version onwards,
they were not supported in earlier UnrealIRCd versions.

It is also only supported in values at the moment (not names),
since that is the only place where URLs are actually fetched for.
2021-11-10 18:41:22 +01:00
Bram Matthys d74ab4cfb1 Add set::server-notice-colors and oper::server-notice-colors so one
can turn colors in snomask server notices on or off.
2021-11-10 08:22:00 +01:00
Bram Matthys 4c9a83365c Fix read-after-free due to commit from a few minutes ago.
An URL that did not need to be fetched (due to url-refresh time) could
cause a download complete message ending up in a call to rehash_internal().
This was too soon, as we were still adding and processing other config
files.
2021-11-07 14:23:00 +01:00
Bram Matthys 520804edc2 Add set::whois-detail which allows you to configure which items
to expose to which users and in what detail.

The default configuration is as follows:

set {
	whois-details {
		basic		{ everyone full; }
		modes		{ everyone none;	self full;	oper full; }
		realhost	{ everyone none;	self full;	oper full; }
		registered-nick	{ everyone full; }
		channels	{ everyone limited;	self full;	oper full; }
		server		{ everyone full; }
		away		{ everyone full; }
		oper		{ everyone limited;	self full;	oper full; }
		secure		{ everyone limited;	self full;	oper full; }
		bot		{ everyone full; }
		services	{ everyone full; }
		reputation	{ everyone none;	self none;	oper full; }
		geo		{ everyone none;	self none;	oper full; }
		certfp		{ everyone full; }
		shunned		{ everyone none;	self none;	oper full; }
		account		{ everyone full; }
		swhois		{ everyone full; }
		idle		{ everyone limited;	self full;	oper full; }
	}
}

Oh, yeah, and for "secure" this also adds displaying of the TLS cipher
in /WHOIS for ircops and self by default. For all others it is limited
to just "is using a Secure Connection".

This also removes the newly added set::geoip::whois-for-anyone since
it is now configured via set::whois-details::geo.

Module coders: HOOKTYPE_WHOIS changed and you may no longer send
directly to the client from this hook. Instead, you should use
add to the NameValuePrioList, usually via the functions
add_nvplist_numeric() and add_nvplist_numeric_fmt().
For inspiration see bot_whois in src/modules/usermodes/bot.c
and reputation_whois in src/modules/reputation.c
2021-09-27 17:27:26 +02:00
Bram Matthys ee8cc0e8e2 Get rid of Usermode_Table[] and use a linked list called usermodes.
Just like already done for Channelmode_Table[] -> channelmodes.
2021-09-26 12:46:34 +02:00
Bram Matthys 3033fd9b6d Fix some todo items such as validating extban letter and names in ExtbanAdd() 2021-09-25 16:38:15 +02:00
Bram Matthys cac8c34bcc JSON logging: expand operlogin and operclass for users who are ircop.
This uses the new get_operlogin() / get_operclass() functions.
Also updated whois code to use them too.
2021-09-25 10:58:39 +02:00
Bram Matthys c582a29f09 Update doxygen docs a bit (minimal) for channel access functions. 2021-09-25 08:13:18 +02:00
Bram Matthys fabe16a95c Get rid of has_voice(), is_half_op(), is_skochanop(), is_chan_op(), is_chanadmin(),
is_chanowner(). Using check_channel_access() instead now.
2021-09-25 08:00:57 +02:00
Bram Matthys 864aef89da LOG_DEST_OTHER => LOG_DEST_DISK 2021-09-24 16:37:24 +02:00
Bram Matthys d3dfa5f40c Make negative matching work in log sources, update default snomasks.
No longer log to all ircops if no matching snomasks.
So yeah, if you don't load snomask.default.conf you will see nothing
(TODO: some warning / error for this)
2021-09-24 11:07:25 +02:00
Bram Matthys b41311ddaf Update default snomask to +bBcdfkqsSoO 2021-09-24 10:03:18 +02:00
Bram Matthys 20c4ac2cd1 Move all wallops code out of the core. 2021-09-23 19:21:19 +02:00
Bram Matthys 720f597ad6 Get rid of current snomask system and allow ircops to set any snomask
(that is: a-z A-Z) so to use the dynamic system with the new logging.
Largely untested.
2021-09-22 15:49:20 +02:00
Bram Matthys 4cea88645c Modularize member modes (vhoaq).
Still need to clean up a bit after this, but it passes all tests :)
2021-09-13 18:44:18 +02:00
Bram Matthys 8353a9e17b Change char *parv[] to const char *parv[] everywhere. This is a BIG change.
It means you can no longer modify eg parv[1] in-place with strtoken and such.

The main reason for this is that as a command handler you have no idea
where the arguments may come from. It could be from a do_cmd() with
read-only storage (eg a string literal) and so on.

It started with an experiment of how far I could get and how annoying the
side-effects would be, but they seem to be quite managable, so I'm
committing this stuff.

Hopefully this catches/solves some stupid bugs somewhere :)
2021-09-11 16:02:44 +02:00
Bram Matthys d4d4da6a8d Add another const to ValidatePermissionsForPath. Fix Windows build, maybe? 2021-09-10 12:58:15 +02:00
Bram Matthys 66a51fb659 Massive conversions from 'char *' to 'const char *' and 'char **' to 'const char **' 2021-09-10 12:46:31 +02:00
Bram Matthys 13dc17f5dc Code cleanup: remove unused structs and variables. 2021-09-03 21:07:38 +02:00
Bram Matthys 617288991e Remove find_except(), conf_except and struct ConfigItem_except.
These are all unused since the addition of ELINE.
2021-09-03 20:46:06 +02:00
k4be fe51aaf357 Add wATCH_EVENT defines 2021-08-24 19:58:05 +02:00
Bram Matthys 9838378550 Massive rename of:
* channel->mode.extmode to channel->mode.mode
* channel->mode.extmodeparams to channel->mode.mode_params

This because all channel modes that are set there are extended channel
modes, only lists are still in core atm and they never get set here.
2021-08-22 18:36:00 +02:00
Bram Matthys e0504b2e52 Remove Mode.mode, it now only contains Mode.extmode and Mode.extmodeparams
Also make MODES_ON_JOIN point to iConf.modes_on_join.extmodes instead
of iConf.modes_on_join.mode

Actually in next commit I may reorder again...
2021-08-22 18:33:25 +02:00
Bram Matthys 783cc3ff5b Cmode API: change from Channelmode_Table[<num>] to channelmodes linked list.
And now we can easily sort the channel modes too, makes it easier for
our test cases.
2021-08-22 17:57:14 +02:00
k4be a2cdb8ff89 Merge branch 'unreal60_dev' of github.com:syzop/unrealircd-next into unreal60_dev 2021-08-22 13:36:06 +02:00
k4be be78ecebfc Parse "Forwarded:" header from proxy.
Not (yet) checking source address nor getting a hostname.
2021-08-22 13:34:54 +02:00
Bram Matthys 1a19de2de9 Move channel mode +r to module chanmodes/isregistered 2021-08-22 12:19:07 +02:00
Bram Matthys 57ec565051 Move channel mode +t to module chanmodes/topiclimit
TODO: move code from "topic" module to here, some hook call.
2021-08-22 12:09:53 +02:00
Bram Matthys 6dd539d760 Move channel mode +m to module chanmodes/moderated
(and nearly all the code related to it)
2021-08-22 12:01:54 +02:00
Bram Matthys 24f73c28e4 Move channel mode +l to module chanmodes/limit
(and all the code related to it)
2021-08-22 11:45:08 +02:00
Bram Matthys 1533c6431e Move channel mode +n to module chanmodes/noexternalmsgs
(and all the code related to it)
2021-08-22 11:22:33 +02:00
Bram Matthys 8066c13876 Move +s/+p to chanmodes/secret and chanmodes/private.
To be honest, the modules don't do much other than handling the
mode stuff, but.. we can look at that again later.
2021-08-22 11:11:26 +02:00
Bram Matthys 295b3505ef Move channel mode +i to module chanmodes/inviteonly 2021-08-22 10:37:37 +02:00
Bram Matthys c403a47daf Move channel mode +k to module chanmodes/key 2021-08-22 10:06:51 +02:00
Bram Matthys 5b90fd0c0d Get rid of old MOTD downloading code and several USE_LIBCURL defines
that are no longer needed.
2021-08-21 14:13:24 +02:00
Bram Matthys 5321dcb81b ConfigResource: get rid of rs->flag.type stuff and just use rs->type.
Also replace local variables 'inc' with 'rs'.
2021-08-19 09:37:28 +02:00
Bram Matthys ae6222e329 Get rid of errorbuf in ConfigResource as this is not used. 2021-08-19 09:34:33 +02:00
Bram Matthys 4e53bf874a Make remote includes caching work again. Both on-boot and on-rehash. 2021-08-19 09:33:46 +02:00
Bram Matthys 7b3c1165f8 Make tld::mask use the generic masks that we use everywhere
(and hence support multiple masks and server bans matching etc)
2021-08-18 18:45:23 +02:00
Bram Matthys e503ad4fd5 Reorder members in ConfigEntry struct a bit (optimize for L1/L2 cache)
Obviously name, value and next should be at the top.
2021-08-18 18:32:05 +02:00
Bram Matthys a60b9f3176 Handle duplicate URLs/downloads (only download once) 2021-08-18 16:43:42 +02:00
Bram Matthys ce3e23a5d2 Get rid of unnecessary included_from and included_from_line
members in ConfigResource (previously ConfigItem_include).
2021-08-18 16:31:48 +02:00
Bram Matthys 756fee58cb Rename ConfigItem_include to ConfigResource and also use it for non-includes
such as other items in the configuration file that are URLs.
2021-08-18 14:54:41 +02:00
Bram Matthys b74d15595b Change int rehash() to void request_rehash(), which is a better name
as it REQUESTS to rehash the server, but it may not be done immediately.
And making it void makes sure nobody relies on some sort of return
value which will differ between with vs without remote includes.

Also get rid of sig and loop.rehash_save_sig, as a NULL client
already indicates the same (or at least does so now).
2021-08-18 13:28:56 +02:00
Bram Matthys 675c1cab55 Rename loop struct members:
* loop.ircd_rehashing -> loop.rehashing
* loop.ircd_terminating -> loop.terminating
* loop.ircd_booted -> loop.booted
* loop.ircd_forked -> loop.forked
2021-08-18 13:08:42 +02:00