Browse Source

Merge branch 'unrealircd:unreal60_dev' into piss60

piss60
angryce 2 months ago committed by GitHub
parent
commit
4bdc4219ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      Makefile.windows
  2. 15
      README.md
  3. 5
      doc/conf/modules.default.conf
  4. 2
      src/modules/Makefile.in
  5. 108
      src/modules/geoip-tag.c

4
Makefile.windows

@ -278,6 +278,7 @@ DLL_FILES=\
src/modules/geoip_base.dll \
src/modules/geoip_classic.dll \
src/modules/geoip_csv.dll \
src/modules/geoip-tag.dll \
src/modules/globops.dll \
src/modules/help.dll \
src/modules/hideserver.dll \
@ -900,6 +901,9 @@ src/modules/geoip_classic.dll: src/modules/geoip_classic.c $(INCLUDES)
src/modules/geoip_csv.dll: src/modules/geoip_csv.c $(INCLUDES)
$(CC) $(MODCFLAGS) src/modules/geoip_csv.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/geoip_csv.pdb $(MODLFLAGS)
src/modules/geoip-tag.dll: src/modules/geoip-tag.c $(INCLUDES)
$(CC) $(MODCFLAGS) src/modules/geoip-tag.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/geoip-tag.pdb $(MODLFLAGS)
src/modules/geoip_maxmind.dll: src/modules/geoip_maxmind.c $(INCLUDES)
$(CC) $(MODCFLAGS) src/modules/geoip_maxmind.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/geoip_maxmind.pdb $(MODLFLAGS)

15
README.md

@ -16,10 +16,17 @@ online documentation.
* UnrealIRCd 6 is the *stable* series since December 2021. All new features go in there.
* UnrealIRCd 5 is the *oldstable* series. It will receive bug fixes until
July 1, 2022 plus another 12 months of security fixes.
* For full details of release scheduling and EOL dates, see
[UnrealIRCd releases](https://www.unrealircd.org/docs/UnrealIRCd_releases) on the wiki
## How to get started
Please consult our excellent online documentation at https://www.unrealircd.org/docs/
when setting up the IRCd!
### Use the wiki!
**IMPORTANT:** We recommend you follow our installation guide on the wiki instead of the
steps in this README. The wiki has more detailed information and is more easy to navigate.
* [Installing from source for *NIX](https://www.unrealircd.org/docs/Installing_from_source)
* [Installating instructions for Windows](https://www.unrealircd.org/docs/Installing_(Windows))
Please consult the online documentation at https://www.unrealircd.org/docs/ when setting up the IRCd!
### Step 1: Installation
#### Windows
@ -39,11 +46,11 @@ Do the following steps under a separate account for running UnrealIRCd,
* Now change to the directory where you installed UnrealIRCd, e.g. `cd /home/xxxx/unrealircd`
### Step 2: Configuration
Configuration files are stored in the conf/ folder by default (eg: /home/xxxx/unrealircd/conf)
Configuration files are stored in the `conf/` folder by default (eg: `/home/xxxx/unrealircd/conf`)
#### Create a configuration file
If you are new, then you need to create your own configuration file:
Copy conf/examples/example.conf to conf/ and call it unrealircd.conf.
Copy `conf/examples/example.conf` to `conf/` and call it `unrealircd.conf`.
Then open it in an editor and carefully modify it using the documentation and FAQ as a guide (see below).
### Step 3: Booting

5
doc/conf/modules.default.conf

@ -249,8 +249,9 @@ loadmodule "rmtkl"; /* Easily remove *-Lines in bulk with /RMTKL */
loadmodule "restrict-commands"; /* Provides set::restrict-commands settings */
loadmodule "reputation"; /* used by Connthrottle and others, see next */
loadmodule "connthrottle"; /* see https://www.unrealircd.org/docs/Connthrottle */
loadmodule "userip-tag"; /* unrealircd.org/userip tag for ircops */
loadmodule "userhost-tag"; /* unrealircd.org/userhost tag for ircops */
loadmodule "userip-tag"; /* unrealircd.org/userip tag for ircops (IP address) */
loadmodule "userhost-tag"; /* unrealircd.org/userhost tag for ircops (real host) */
loadmodule "geoip-tag"; /* unrealircd.org/geoip tag for ircops (country) */
loadmodule "json-log-tag"; /* unrealircd.org/json-log tag and CAP for ircops */
loadmodule "targetfloodprot"; /* set::anti-flood::target-flood protection */
loadmodule "watch-backend"; /* used by watch and other modules */

2
src/modules/Makefile.in

@ -71,7 +71,7 @@ MODULES= \
message-tags.so batch.so \
account-tag.so labeled-response.so link-security.so \
message-ids.so plaintext-policy.so server-time.so sts.so \
echo-message.so userip-tag.so userhost-tag.so \
echo-message.so userip-tag.so userhost-tag.so geoip-tag.so \
bot-tag.so reply-tag.so json-log-tag.so \
typing-indicator.so \
ident_lookup.so history.so chathistory.so \

108
src/modules/geoip-tag.c

@ -0,0 +1,108 @@
/*
* IRC - Internet Relay Chat, src/modules/geoip-tag.c
* (C) 2022 westor, Syzop and The UnrealIRCd Team
*
* See file AUTHORS in IRC package for additional names of
* the programmers.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "unrealircd.h"
ModuleHeader MOD_HEADER
= {
"geoip-tag",
"6.0",
"geoip message tag",
"UnrealIRCd Team",
"unrealircd-6",
};
/* Forward declarations */
int geoip_mtag_is_ok(Client *client, const char *name, const char *value);
int geoip_mtag_should_send_to_client(Client *target);
void mtag_add_geoip(Client *client, MessageTag *recv_mtags, MessageTag **mtag_list, const char *signature);
MOD_INIT()
{
MessageTagHandlerInfo mtag;
MARK_AS_OFFICIAL_MODULE(modinfo);
memset(&mtag, 0, sizeof(mtag));
mtag.name = "unrealircd.org/geoip";
mtag.is_ok = geoip_mtag_is_ok;
mtag.should_send_to_client = geoip_mtag_should_send_to_client;
mtag.flags = MTAG_HANDLER_FLAGS_NO_CAP_NEEDED;
MessageTagHandlerAdd(modinfo->handle, &mtag);
HookAddVoid(modinfo->handle, HOOKTYPE_NEW_MESSAGE, 0, mtag_add_geoip);
return MOD_SUCCESS;
}
MOD_LOAD()
{
return MOD_SUCCESS;
}
MOD_UNLOAD()
{
return MOD_SUCCESS;
}
/** This function verifies if the client sending
* 'geoip-tag' is permitted to do so and uses a permitted
* syntax.
* We simply allow geoip-tag ONLY from servers and with any syntax.
*/
int geoip_mtag_is_ok(Client *client, const char *name, const char *value)
{
if (IsServer(client))
return 1;
return 0;
}
void mtag_add_geoip(Client *client, MessageTag *recv_mtags, MessageTag **mtag_list, const char *signature)
{
MessageTag *m;
GeoIPResult *geoip;
if (IsUser(client) && ((geoip = geoip_client(client))))
{
MessageTag *m = find_mtag(recv_mtags, "unrealircd.org/geoip");
if (m)
{
m = duplicate_mtag(m);
} else {
m = safe_alloc(sizeof(MessageTag));
safe_strdup(m->name, "unrealircd.org/geoip");
safe_strdup(m->value, geoip->country_code);
}
AddListItem(m, *mtag_list);
}
}
/** Outgoing filter for this message tag */
int geoip_mtag_should_send_to_client(Client *target)
{
if (IsServer(target) || IsOper(target))
return 1;
return 0;
}
Loading…
Cancel
Save