/***********************************************************************
X3 ChangeLog
+2006-07-31 Neil Spierling <sirvulcan@gmail.com>
+
+ * x3.conf.example: Added SHUN setting for DEFCON.
+
+ * doc/DEFCON: Added SHUN setting for DEFCON.
+
+ * src/opserv.c: Moved the gline check to here. Also added a SHUN
+ check.
+
+ * src/opserv.h: Added SHUN setting for DEFCON.
+
+ * src/proto-p10.c: Moved the DEFCON gline check to opserv.c
+
2006-07-31 Neil Spierling <sirvulcan@gmail.com>
* x3.conf.example: Added new Defcon system settings
Services will silently ignore everyone but opers 128
GLINE all new clients trying to connect 256
No new memos sent to block MemoServ attacks 512
+ SHUN all new clients trying to connect 1024
These are the values used to determine each defcon setting, are set via:
{ "OSMSG_DEFCON_OPER_ONLY", "Allowing Services Communication With Opers Only" },
{ "OSMSG_DEFCON_SILENT_OPER_ONLY", "Allowing Services Communication With Opers Only AND Silently Ignoring Regular Users" },
{ "OSMSG_DEFCON_GLINE_NEW_CLIENTS", "Glining New Clients" },
+ { "OSMSG_DEFCON_SHUN_NEW_CLIENTS", "Shunning New Clients" },
{ "OSMSG_DEFCON_NO_NEW_MEMOS", "Disallowing New Memos" },
{ NULL, NULL }
if (checkDefCon(DEFCON_GLINE_NEW_CLIENTS))
reply("OSMSG_DEFCON_GLINE_NEW_CLIENTS");
+ if (checkDefCon(DEFCON_SHUN_NEW_CLIENTS))
+ reply("OSMSG_DEFCON_SHUN_NEW_CLIENTS");
+
if (checkDefCon(DEFCON_NO_NEW_MEMOS))
reply("OSMSG_DEFCON_NO_NEW_MEMOS");
return 0;
}
+ if ( (checkDefCon(DEFCON_GLINE_NEW_CLIENTS) || checkDefCon(DEFCON_SHUN_NEW_CLIENTS)) && !IsOper(user)) {
+ char target[IRC_NTOP_MAX_SIZE + 3] = { '*', '@', '\0' };
+
+ strcpy(target + 2, user->hostname);
+ if (checkDefCon(DEFCON_GLINE_NEW_CLIENTS))
+ gline_add(opserv->nick, target, DefConGlineExpire, DefConGlineReason, now, 1, 0);
+ else if (checkDefCon(DEFCON_SHUN_NEW_CLIENTS))
+ shun_add(opserv->nick, target, DefConGlineExpire, DefConGlineReason, now, 1);
+
+ return 0;
+ }
+
/* Only warn or G-line if there's an untrusted max and their IP is sane. */
if (opserv_conf.untrusted_max
&& irc_in_addr_is_valid(user->ip)
#define DEFCON_NO_NEW_CHANNELS 1 /* No New Channel Registrations */
#define DEFCON_NO_NEW_NICKS 2 /* No New Nick Registrations */
-#define DEFCON_NO_MODE_CHANGE 4 /* No SET MODE changes */
+#define DEFCON_NO_MODE_CHANGE 4 /* No channel MODE changes */
#define DEFCON_FORCE_CHAN_MODES 8 /* Force Chan Mode */
#define DEFCON_REDUCE_SESSION 16 /* Reduce Session Limit */
#define DEFCON_NO_NEW_CLIENTS 32 /* Kill any NEW clients */
#define DEFCON_SILENT_OPER_ONLY 128 /* Silently ignore non-opers */
#define DEFCON_GLINE_NEW_CLIENTS 256 /* Gline any new clients */
#define DEFCON_NO_NEW_MEMOS 512 /* No New Memos Sent */
+#define DEFCON_SHUN_NEW_CLIENTS 1024 /* Shun any new clients */
extern int DefCon[6];
extern int checkDefCon(int level);
extern void DefConProcess(struct userNode *user);
extern void defcon_timeout(UNUSED_ARG(void *data));
+
void init_opserv(const char *nick);
unsigned int gag_create(const char *mask, const char *owner, const char *reason, time_t expires);
int opserv_bad_channel(const char *name);
extern int off_channel;
extern int DefConLevel;
-extern int DefConGlineExpire;
extern int DefConTimeOut;
extern char *DefConChanModes;
-extern char *DefConGlineReason;
static int parse_oplevel(char *str);
else
strcpy(modes, "+");
nuser = AddUser(serv, argv[1], argv[4], argv[5], modes, argv[argc-2], argv[argc-1], atoi(argv[3]), argv[argc-3]);
- if (checkDefCon(DEFCON_GLINE_NEW_CLIENTS) && !IsOper(nuser)) {
- char target[IRC_NTOP_MAX_SIZE + 3] = { '*', '@', '\0' };
- const char *str;
-
- str = conf_get_data("services/opserv/nick", RECDB_QSTRING);
- if (str) {
- strcpy(target + 2, nuser->hostname);
- gline_add(str, target, DefConGlineExpire, DefConGlineReason, now, 1, 0);
- }
- return 0;
- }
}
return 1;
}
// Services will silently ignore everyone but opers 128
// GLINE all new clients trying to connect 256
// No new memos sent to block MemoServ attacks 512
+ // SHUN all new clients trying to connect 1024
//
// These are the values are added together to determine each defcon setting:
"DefCon1" "415";
// If defcon is limiting sessions then how many sessions should O3 allow?
"DefConSessionLimit" "2";
- // Length of the gline set on newly connecting clients, if defcon is glining
- // newly connecting clients
+ // Length of glines and shuns set on newly connecting clients, if defcon is glining
+ // or shunning newly connecting clients
"DefConGlineExpire" "5m";
// Mode to set on all channels if defcon is forcing channel modes on all channels
// This notice will be used if GlobalOnDefcon and GlobalOnDefconMore are off
"DefConOffMessage" "Services are now back to normal, sorry for any inconvenience";
- // Reason placed in defcon Glines.
+ // Reason placed in defcon Glines and Shuns.
"DefConGlineReason" "This network is currently not accepting connections, please try again later";
// ------------------------------------------------------------------