install: $(MODULES)
install -d $(PREFIX)/modules/syn
install -t $(PREFIX)/modules/syn $(MODULES)
+ install -d $(PREFIX)/help/syn
+ install -t $(PREFIX)/help/syn help/*
command_add(&syn_facility_rmbl, &syn_facility_cmds);
command_add(&syn_facility_show, &syn_facility_cmds);
+ help_addentry(syn_helptree, "FACILITY", "help/syn/facility", NULL);
+ help_addentry(syn_helptree, "FACILITY ADD", "help/syn/facility_add", NULL);
+ help_addentry(syn_helptree, "FACILITY DEL", "help/syn/facility_del", NULL);
+ help_addentry(syn_helptree, "FACILITY SET", "help/syn/facility_set", NULL);
+ help_addentry(syn_helptree, "FACILITY ADDBL", "help/syn/facility_addbl", NULL);
+ help_addentry(syn_helptree, "FACILITY RMBL", "help/syn/facility_rmbl", NULL);
+ help_addentry(syn_helptree, "FACILITY LIST", "help/syn/facility_list", NULL);
+
facility_heap = BlockHeapCreate(sizeof(facility_t), HEAP_USER);
blacklist_heap = BlockHeapCreate(sizeof(bl_entry_t), HEAP_USER);
facilities = mowgli_dictionary_create(strcasecmp);
{
save_facilities();
+ help_delentry(syn_helptree, "FACILITY");
+ help_delentry(syn_helptree, "FACILITY ADD");
+ help_delentry(syn_helptree, "FACILITY DEL");
+ help_delentry(syn_helptree, "FACILITY SET");
+ help_delentry(syn_helptree, "FACILITY ADDBL");
+ help_delentry(syn_helptree, "FACILITY RMBL");
+ help_delentry(syn_helptree, "FACILITY LIST");
hook_del_hook("user_add", facility_newuser);
command_delete(&syn_facility, syn_cmdtree);
mowgli_dictionary_destroy(facilities, free_facility, NULL);
--- /dev/null
+#include "atheme.h"
+
+#include "syn.h"
+
+DECLARE_MODULE_V1
+(
+ "syn/help", false, _modinit, _moddeinit,
+ "$Revision$",
+ "Stephen Bennett <stephen -at- freenode.net>"
+);
+
+static void syn_cmd_help(sourceinfo_t *si, int parc, char *parv[]);
+
+command_t syn_help = { "HELP", N_("Displays contextual help information."), "syn:general", 1, syn_cmd_help };
+
+void _modinit(module_t *m)
+{
+ use_syn_main_symbols(m);
+
+ command_add(&syn_help, syn_cmdtree);
+ help_addentry(syn_helptree, "HELP", "help/help", NULL);
+}
+
+void _moddeinit()
+{
+ command_delete(&syn_help, syn_cmdtree);
+ help_delentry(syn_helptree, "HELP");
+}
+
+/* HELP <command> [params] */
+void syn_cmd_help(sourceinfo_t *si, int parc, char *parv[])
+{
+ char *command = parv[0];
+
+ if (!command)
+ {
+ command_success_nodata(si, "***** \2%s Help\2 *****", syn->nick);
+
+ command_success_nodata(si, "\2%s\2 is a utility service to control access to the network.", syn->nick);
+ command_success_nodata(si, " ");
+
+ command_help(si, syn_cmdtree);
+
+ command_success_nodata(si, _("***** \2End of Help\2 *****"));
+
+ return;
+ }
+
+ /* take the command through the hash table */
+ help_display(si, command, syn_helptree);
+}
--- /dev/null
+Help for \ 2FACILITY\ 2:
+
+The FACILITY command displays and manipulates facility
+definitions.
+
+A facility is roughly a related group of gateways, defined
+by a host prefix. Any new client connecting is checked
+against the list of facilities, and various actions may be
+taken based on this.
+
+Each facility has some or all of the following information
+defined:
+
+ - The hostname prefix
+ - Whether this facility is currently blocked
+ - The message to send to clients blocked by this facility.
+ - A throttle limit. This is of the form x,y and translates
+ rougly to y clients per x*y seconds.
+ - The message to send to clients denied because of this
+ facility's throttle.
+ - The cloaking scheme applied to matching clients.
+ - A blacklist of regular expressions. If any of these match
+ a client that matches this facility, it will be denied.
+
+Facilities are checked in order from least specific to most
+specific. If any facility is blocked, the client is killed,
+with the exception that a negative block value can override
+a positive one from a more general facility. If the client
+is determined to be blocked, the most specific configured
+block message is used.
+
+The throttle settings for every matching facility are
+checked and updated, even if the client is blocked. If the
+client is denied due to throttling, the most specific
+configured throttle message is used.
+
+For every matching facility, the client is checked against
+that facility's blacklist. If any of those regular
+expressions matches, then the client is denied, and the most
+specific block message so far encountered is used.
+
+If the client is allowed to connect, then the cloaking
+setting is used to determine whether to modify the client's
+visible host name. Again the most specific configured value
+is used. Possible values are:
+
+ - none. Leave the client's host alone.
+ - random. A 'session' marker in the client's host is
+ replaced by a random text string.
+ - hexip. The user's ident is treated as a hex-encoded IP
+ address, as used by several web gateways. A 'session'
+ marker in the user's host is replaced by
+ 'ip.<decoded ip>'. If the ident cannot be decoded this
+ way, it falls back to the random method.
+
+Valid subcommands are: \ 2FACILITY <LIST|ADD|DEL|SET|ADDBL|RMBL|SHOW>\ 2
--- /dev/null
+Help for \ 2FACILITY ADD\ 2:
+
+This command will add a new facility definition. The
+hostpart is a hostname prefix used to identify this gateway,
+and matched against connecting users. The optional cloaking
+argument determines the cloaking scheme used for users
+matching this gateway -- the default is \ 2undefined\ 2. See
+\ 2/msg &nick& HELP FACILITY\ 2 for valid cloaking values.
+
+Syntax: FACILITY ADD <hostpart> [cloaking]
+
+Examples:
+ /msg &nick& FACILITY ADD gateway/web/ajax/mibbit.com hexip
+ /msg &nick& FACILITY ADD gateway/tor random
+ /msg &nick& FACILITY ADD gateway/web
--- /dev/null
+Help for \ 2FACILITY ADDBL\ 2:
+
+This adds a blacklist entry to a facility. Clients that
+match a given facility are checked against all blacklist
+entries for that facility, and any that match are denied.
+
+The regex is a PCRE expression, matched against
+"<nick>!<user>@<host> <gecos>".
+
+Syntax: /msg &nick& FACILITY ADDBL <hostpart> <regex>
+
+Examples:
+ /msg &nick& FACILITY ADDBL gateway/web !~?576a466a@
--- /dev/null
+Help for \ 2FACILITY DEL\ 2
+
+This permanently removes a facility definition, and all
+information associated with it. Use with caution.
+
+Syntax: FACILITY DEL <hostpart>
+
+Examples:
+ /msg &nick& FACILITY DEL gateway/web/cgiirc/defunct.site
--- /dev/null
+Help for \ 2FACILITY LIST\ 2:
+
+This displays the list of currently configured facilities,
+with brief information about settings.
+
+Syntax: /msg &nick& FACILITY LIST
--- /dev/null
+Help for \ 2FACILITY RMBL\ 2:
+
+This removes a blacklist entry from a facility.
+
+See also: /msg &nick& HELP FACILITY ADDBL
+ /msg &nick& HELP FACILITY
+
+Syntax: /msg &nick& FACILITY RMBL <hostpart> <regex>
+
+Examples:
+ /msg &nick& FACILITY RMBL gateway/web !~?576a466a@
+
--- /dev/null
+Help for \ 2FACILITY SET\ 2:
+
+Modifies a facility definition.
+
+Possible settings are:
+
+ - cloaking
+ - blocked
+ - throttle
+ - blockmessage
+ - throttlemessage
+
+See \ 2/msg &nick& HELP FACILITY\ 2 for the meaning of each
+setting.
+
+Syntax: /msg &nick& FACILITY SET <hostpart> <setting> <value>
+
+Examples:
+ /msg &nick& FACILITY SET gateway/web/ajax/mibbit.com blocked 1
+ /msg &nick& FACILITY SET gateway/tor throttle 5,3
+ /msg &nick& FACILITY SET gateway/web/cgiirc/site.com cloaking hexip