Changeset 290

Show
Ignore:
Timestamp:
11/22/04 16:45:58 (4 years ago)
Author:
alexcv
Message:

Massive update

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wifidog/ChangeLog

    r281 r290  
    11# $Header$ 
     2 
     32004-11-22 Alexandre Carmel-Veilleux <acv@acv.ca> 
     4        * libhttpd/api.c: Fix leak in HttpdEndRequest(). 
     5        * src/ping_thread.c: Fix auth_server IP change code with latest 
     6          from previous branch. 
     7        * src/conf.h: Same as above. 
     8        * src/fw_iptables.c: Same as above. 
     9        * src/conf.[ch]: Firewall rule set parsing code. 
     10        * wifidog.conf: Default firewall rule set defined. 
     11        * src/fw_iptables.[ch]: Firewall rule set enacting code. 
     12 
    2132004-11-18 Benoit Gr�ire  <bock@step.polymtl.ca> 
    314        * src/ping_thread.c: Merge phil's bug fixes from stable branch 
  • trunk/wifidog/libhttpd/api.c

    r274 r290  
    602602{ 
    603603        _httpd_freeVariables(r->variables); 
    604         r->variables = NULL; 
    605604        shutdown(r->clientSock,2); 
    606605        close(r->clientSock); 
     606        free(r); 
    607607} 
    608608 
  • trunk/wifidog/src/conf.c

    r277 r290  
    8282        oWdctlSocket, 
    8383        oSyslogFacility, 
    84         oFirewallRule 
     84        oFirewallRule, 
     85        oFirewallRuleSet 
    8586} OpCodes; 
    8687 
     
    112113        { "httpport",           oAuthServHTTPPort }, 
    113114        { "path",               oAuthServPath }, 
     115        { "firewallruleset",    oFirewallRuleSet }, 
    114116        { "firewallrule",       oFirewallRule }, 
    115117        { NULL,                 oBadOption }, 
     
    120122static int parse_boolean_value(char *); 
    121123static void parse_auth_server(FILE *, char *, int *); 
    122 static int parse_firewall_rule(char *token, char *leftover); 
     124static int parse_firewall_rule(char *ruleset, char *leftover); 
     125static void parse_firewall_ruleset(char *, FILE *, char *, int *); 
    123126 
    124127/** Accessor for the current gateway configuration 
     
    153156        config.log_syslog = DEFAULT_LOG_SYSLOG; 
    154157        config.wdctl_sock = strdup(DEFAULT_WDCTL_SOCK); 
    155         config.rules = NULL; 
     158        config.rulesets = NULL; 
    156159} 
    157160 
     
    332335} while (0) 
    333336 
     337/** @internal 
     338Parses firewall rule set information 
     339*/ 
     340static void 
     341parse_firewall_ruleset(char *ruleset, FILE *file, char *filename, int *linenum) 
     342{ 
     343        char            line[MAX_BUF], 
     344                        *p1, 
     345                        *p2; 
     346        int             opcode; 
     347 
     348        debug(LOG_DEBUG, "Adding Firewall Rule Set %s", ruleset); 
     349         
     350        /* Read first line */    
     351        memset(line, 0, MAX_BUF); 
     352        fgets(line, MAX_BUF - 1, file); 
     353        (*linenum)++; /* increment line counter. */ 
     354 
     355        /* Parsing loop */ 
     356        while ((line[0] != '\0') && (strchr(line, '}') == NULL)) { 
     357                /* skip leading blank spaces */ 
     358                for (p1 = line; isblank(*p1); p1++); 
     359 
     360                /* End at end of line */ 
     361                if ((p2 = strchr(p1, '#')) != NULL) { 
     362                        *p2 = '\0'; 
     363                } else if ((p2 = strchr(p1, '\r')) != NULL) { 
     364                        *p2 = '\0'; 
     365                } else if ((p2 = strchr(p1, '\n')) != NULL) { 
     366                        *p2 = '\0'; 
     367                } 
     368 
     369                /* next, we coopt the parsing of the regular config */ 
     370                if (strlen(p1) > 0) { 
     371                        p2 = p1; 
     372                        /* keep going until word boundary is found. */ 
     373                        while ((*p2 != '\0') && (!isblank(*p2))) 
     374                                p2++; 
     375 
     376                        /* Terminate first word. */ 
     377                        *p2 = '\0'; 
     378                        p2++; 
     379 
     380                        /* skip all further blanks. */ 
     381                        while (isblank(*p2)) 
     382                                p2++; 
     383                         
     384                        /* Get opcode */ 
     385                        opcode = config_parse_token(p1, filename, *linenum); 
     386 
     387                        debug(LOG_DEBUG, "p1 = [%s]; p2 = [%s]", p1, p2); 
     388                         
     389                        switch (opcode) { 
     390                                case oFirewallRule: 
     391                                        parse_firewall_rule(ruleset, p2); 
     392                                        break; 
     393 
     394                                case oBadOption: 
     395                                default: 
     396                                        debug(LOG_ERR, "Bad option on line %d " 
     397                                                        "in %s.", *linenum, 
     398                                                        filename); 
     399                                        debug(LOG_ERR, "Exiting..."); 
     400                                        exit(-1); 
     401                                        break; 
     402                        } 
     403                } 
     404 
     405                /* Read next line */ 
     406                memset(line, 0, MAX_BUF); 
     407                fgets(line, MAX_BUF - 1, file); 
     408                (*linenum)++; /* increment line counter. */ 
     409        } 
     410 
     411        debug(LOG_DEBUG, "Firewall Rule Set %s added.", ruleset); 
     412} 
     413 
    334414static int 
    335 parse_firewall_rule(char *token, char *leftover) 
     415parse_firewall_rule(char *ruleset, char *leftover) 
    336416{ 
    337417        int i; 
     
    339419        int all_nums = 1; /**< If 0, port contained non-numerics */ 
    340420        int finished = 0; /**< reached end of line */ 
     421        char *token = NULL; /**< First word */ 
    341422        char *port = NULL; /**< port to open/block */ 
    342423        char *protocol = NULL; /**< protocol to block, tcp/udp/icmp */ 
    343424        char *mask = NULL; /**< Netmask */ 
    344425        char *other_kw = NULL; /**< other key word */ 
     426        t_firewall_ruleset *tmpr; 
     427        t_firewall_ruleset *tmpr2; 
    345428        t_firewall_rule *tmp; 
    346429        t_firewall_rule *tmp2; 
    347430 
    348         debug(LOG_DEBUG, "leftover: %s", ++leftover); 
    349         debug(LOG_DEBUG, "token: %s", token); 
    350          
     431        debug(LOG_DEBUG, "leftover: %s", leftover); 
     432 
    351433        /* lower case */ 
    352434        for (i = 0; *(leftover + i) != '\0' 
    353435                        && (*(leftover + i) = tolower(*(leftover + i))); i++); 
    354436         
     437        token = leftover; 
     438        TO_NEXT_WORD(leftover, finished); 
     439         
    355440        /* Parse token */ 
    356         if (!strcasecmp(token, "block")) { 
     441        if (!strcasecmp(token, "block") || finished) { 
    357442                block_allow = 0; 
    358443        } else if (!strcasecmp(token, "allow")) { 
     
    366451        /* Parse the remainder */ 
    367452        /* Get the protocol */ 
    368         protocol = leftover; 
    369         TO_NEXT_WORD(leftover, finished); 
    370         if (strcmp(protocol, "tcp") && strcmp(protocol, "udp") 
    371                         && strcmp(protocol, "icmp") || finished) { 
    372                 debug(LOG_ERR, "Invalid protocol %s in FirewallRule", 
    373                                 protocol); 
    374                 return -1; /*< Fail */ 
     453        if (strncmp(leftover, "tcp", 3) == 0 
     454                        || strncmp(leftover, "udp", 3) == 0 
     455                        || strncmp(leftover, "icmp", 4) == 0) { 
     456                protocol = leftover; 
     457                TO_NEXT_WORD(leftover, finished); 
    375458        } 
    376459 
    377460        /* should be exactly "port" */ 
    378         other_kw = leftover; 
    379         TO_NEXT_WORD(leftover, finished); 
    380         if (strcmp(other_kw, "port") || finished) { 
    381                 debug(LOG_ERR, "Invalid or unexpected keyword %s, " 
    382                                 "expecting \"port\"", other_kw); 
    383                 return -2; /*< Fail */ 
    384         } 
    385  
    386         /* Get port now */ 
    387         port = leftover; 
    388         TO_NEXT_WORD(leftover, finished); 
    389         for (i = 0; *(port + i) != '\0'; i++) 
    390                 if (!isdigit(*(port + i))) 
    391                         all_nums = 0; /*< No longer only digits */ 
    392         if (!all_nums) { 
    393                 debug(LOG_ERR, "Invalid port %s", port); 
    394                 return -3; /*< Fail */ 
     461        if (strncmp(leftover, "port", 4) == 0) { 
     462                TO_NEXT_WORD(leftover, finished); 
     463                /* Get port now */ 
     464                port = leftover; 
     465                TO_NEXT_WORD(leftover, finished); 
     466                for (i = 0; *(port + i) != '\0'; i++) 
     467                        if (!isdigit(*(port + i))) 
     468                                all_nums = 0; /*< No longer only digits */ 
     469                if (!all_nums) { 
     470                        debug(LOG_ERR, "Invalid port %s", port); 
     471                        return -3; /*< Fail */ 
     472                } 
    395473        } 
    396474 
     
    424502        memset((void *)tmp, 0, sizeof(t_firewall_rule)); 
    425503        tmp->block_allow = block_allow; 
    426         tmp->protocol = strdup(protocol); 
    427         tmp->port = strdup(port); 
     504        if (protocol != NULL) 
     505                tmp->protocol = strdup(protocol); 
     506        if (port != NULL) 
     507                tmp->port = strdup(port); 
    428508        if (mask == NULL) 
    429509                tmp->mask = strdup("0.0.0.0/0"); 
     
    435515         
    436516        /* Append the rule record */ 
    437         if (config.rules == NULL) { 
    438                 config.rules = tmp; 
     517        if (config.rulesets == NULL) { 
     518                config.rulesets = (t_firewall_ruleset *)malloc( 
     519                                        sizeof(t_firewall_ruleset)); 
     520                memset(config.rulesets, 0, sizeof(t_firewall_ruleset)); 
     521                config.rulesets->name = strdup(ruleset); 
     522                tmpr = config.rulesets; 
    439523        } else { 
    440                 tmp2 = config.rules; 
     524                tmpr2 = tmpr = config.rulesets; 
     525                while (tmpr != NULL && (strcmp(tmpr->name, ruleset) != 0)) { 
     526                        tmpr2 = tmpr; 
     527                        tmpr = tmpr->next; 
     528                } 
     529                if (tmpr == NULL) { 
     530                        /* Rule did not exist */ 
     531                        tmpr = (t_firewall_ruleset *)malloc( 
     532                                                sizeof(t_firewall_ruleset)); 
     533                        memset(tmpr, 0, sizeof(t_firewall_ruleset)); 
     534                        tmpr->name = strdup(ruleset); 
     535                        tmpr2->next = tmpr; 
     536                } 
     537        } 
     538 
     539        /* At this point, tmpr == current ruleset */ 
     540        if (tmpr->rules == NULL) { 
     541                /* No rules... */ 
     542                tmpr->rules = tmp; 
     543        } else { 
     544                tmp2 = tmpr->rules; 
    441545                while (tmp2->next != NULL) 
    442546                        tmp2 = tmp2->next; 
     
    445549         
    446550        return 1; 
     551} 
     552 
     553t_firewall_rule * 
     554get_ruleset(char *ruleset) 
     555{ 
     556        t_firewall_ruleset      *tmp; 
     557 
     558        for (tmp = config.rulesets; tmp != NULL 
     559                        && strcmp(tmp->name, ruleset) != 0; tmp = tmp->next); 
     560 
     561        return(tmp->rules); 
    447562} 
    448563 
     
    524639                                                        &linenum); 
    525640                                        break; 
    526                                 case oFirewallRule: 
    527                                         parse_firewall_rule(p1, p2); 
     641                                case oFirewallRuleSet: 
     642                                        parse_firewall_ruleset(p1, fd, 
     643                                                        filename, &linenum); 
    528644                                        break; 
    529645                                case oHTTPDName: 
  • trunk/wifidog/src/conf.h

    r277 r290  
    6262                                     listens on */ 
    6363    int authserv_use_ssl;       /**< @brief Use SSL or not */ 
    64     struct in_addr *last_ip;  /**< @brief Last ip used by authserver */ 
     64    char *last_ip;    /**< @brief Last ip used by authserver */ 
    6565    struct _auth_serv_t *next; 
    6666} t_auth_serv; 
     
    7676    struct _firewall_rule_t *next; 
    7777} t_firewall_rule; 
     78 
     79/** 
     80 * Firewall rulesets 
     81 */ 
     82typedef struct _firewall_ruleset_t { 
     83    char                        *name; 
     84    t_firewall_rule             *rules; 
     85    struct _firewall_ruleset_t  *next; 
     86} t_firewall_ruleset; 
    7887 
    7988/** 
     
    108117    int syslog_facility;        /**< @brief facility to use when using syslog for 
    109118                                     logging */ 
    110     t_firewall_rule    *rules;        /**< @brief firewall rules */ 
     119    t_firewall_ruleset *rulesets;     /**< @brief firewall rules */ 
    111120} s_config; 
    112121 
     
    132141void mark_auth_server_bad(t_auth_serv *); 
    133142 
     143/** @brief Fetch a firewall rule set. */ 
     144t_firewall_rule *get_ruleset(char *); 
     145 
    134146#define LOCK_CONFIG() do { \ 
    135147        debug(LOG_DEBUG, "Locking config"); \ 
  • trunk/wifidog/src/fw_iptables.c

    r277 r290  
    3636#include <pthread.h> 
    3737 
     38#include "common.h" 
     39 
    3840#include "conf.h" 
    3941#include "fw_iptables.h" 
     
    4446 
    4547static int iptables_do_command(char *format, ...); 
     48static char *iptables_compile(char *, t_firewall_rule *); 
     49static void iptables_load_ruleset(char *, char *); 
    4650 
    4751extern pthread_mutex_t  client_list_mutex; 
     
    7377} 
    7478 
     79/** 
     80 * @internal 
     81 * Compiles a struct definition of a firewall rule into a valid iptables 
     82 * command. 
     83 * @arg chain Chain that the command will be (-A)ppended to. 
     84 * @arg rule Definition of a rule into a struct, from conf.c. 
     85 */ 
     86static char * 
     87iptables_compile(char *chain, t_firewall_rule *rule) 
     88{ 
     89    char        command[MAX_BUF], 
     90                *mode; 
     91     
     92    memset(command, 0, MAX_BUF); 
     93     
     94    if (rule->block_allow == 1) { 
     95        mode = strdup("ACCEPT"); 
     96    } else { 
     97        mode = strdup("DROP"); 
     98    } 
     99     
     100    snprintf(command, sizeof(command),  "-t nat -A %s ", chain); 
     101    if (rule->mask != NULL) { 
     102        snprintf((command + strlen(command)), (sizeof(command) -  
     103                strlen(command)), "-d %s ", rule->mask); 
     104    } 
     105    if (rule->protocol != NULL) { 
     106        snprintf((command + strlen(command)), (sizeof(command) - 
     107                strlen(command)), "-p %s ", rule->protocol); 
     108    } 
     109    if (rule->port != NULL) { 
     110        snprintf((command + strlen(command)), (sizeof(command) - 
     111                strlen(command)), "--dport %s ", rule->port); 
     112    } 
     113    snprintf((command + strlen(command)), (sizeof(command) -  
     114            strlen(command)), "-j %s", mode); 
     115     
     116    free(mode); 
     117 
     118    /* XXX The buffer command, an automatic variable, will get cleaned 
     119     * off of the stack when we return, so we strdup() it. */ 
     120    return(strdup(command)); 
     121} 
     122 
     123/** 
     124 * @internal 
     125 * Load all the rules in a rule set. 
     126 * @arg ruleset Name of the ruleset 
     127 * @arg chain IPTables chain the rules go into 
     128 */ 
     129static void 
     130iptables_load_ruleset(char *ruleset, char *chain) 
     131{ 
     132        t_firewall_rule         *rules; 
     133        char                    *cmd; 
     134 
     135        debug(LOG_DEBUG, "Load ruleset %s into chain %s", ruleset, chain); 
     136         
     137        for (rules = get_ruleset(ruleset); rules != NULL; rules = rules->next) { 
     138                cmd = iptables_compile(chain, rules); 
     139                debug(LOG_DEBUG, "Loading rule \"%s\" into %s", cmd, chain); 
     140                iptables_do_command(cmd); 
     141        } 
     142 
     143        debug(LOG_DEBUG, "Ruleset %s loaded into %s", ruleset, chain); 
     144} 
     145 
    75146void 
    76147iptables_fw_clear_authservers(void) 
     
    92163    for (auth_server = config->auth_servers; auth_server != NULL; 
    93164                    auth_server = auth_server->next) { 
    94         iptables_do_command("-t nat -A " TABLE_WIFIDOG_AUTHSERVERS " -d %s -j ACCEPT", auth_server->authserv_hostname); 
     165        if (auth_server->last_ip == NULL || 
     166                strcmp(auth_server->last_ip, "0.0.0.0") == 0) { 
     167            iptables_do_command("-t nat -A " TABLE_WIFIDOG_AUTHSERVERS " -d %s -j ACCEPT", auth_server->authserv_hostname); 
     168        } else { 
     169            iptables_do_command("-t nat -A " TABLE_WIFIDOG_AUTHSERVERS " -d %s -j ACCEPT", auth_server->last_ip); 
     170        } 
    95171    } 
    96172 
     
    119195 
    120196    /** Insert global rules BEFORE the "defaults" */ 
    121      
    122     iptables_do_command("-t nat -A " TABLE_WIFIDOG_VALIDATE " -p udp --dport 67 -j ACCEPT"); 
    123     iptables_do_command("-t nat -A " TABLE_WIFIDOG_VALIDATE " -p tcp --dport 67 -j ACCEPT"); 
    124     iptables_do_command("-t nat -A " TABLE_WIFIDOG_VALIDATE " -p udp --dport 53 -j ACCEPT"); 
    125     iptables_do_command("-t nat -A " TABLE_WIFIDOG_VALIDATE " -p tcp --dport 80 -j ACCEPT"); 
    126     iptables_do_command("-t nat -A " TABLE_WIFIDOG_VALIDATE " -p tcp --dport 110 -j ACCEPT"); 
    127     iptables_do_command("-t nat -A " TABLE_WIFIDOG_VALIDATE " -p tcp --dport 995 -j ACCEPT"); 
    128     iptables_do_command("-t nat -A " TABLE_WIFIDOG_VALIDATE " -p tcp --dport 143 -j ACCEPT"); 
    129     iptables_do_command("-t nat -A " TABLE_WIFIDOG_VALIDATE " -p tcp --dport 993 -j ACCEPT"); 
    130     iptables_do_command("-t nat -A " TABLE_WIFIDOG_VALIDATE " -p tcp --dport 220 -j ACCEPT"); 
    131     iptables_do_command("-t nat -A " TABLE_WIFIDOG_VALIDATE " -p tcp --dport 993 -j ACCEPT"); 
    132     iptables_do_command("-t nat -A " TABLE_WIFIDOG_VALIDATE " -p tcp --dport 443 -j ACCEPT"); 
    133     iptables_do_command("-t nat -A " TABLE_WIFIDOG_VALIDATE " -j DROP"); 
     197    iptables_load_ruleset("global", TABLE_WIFIDOG_VALIDATE); 
     198    iptables_load_ruleset("validating-users", TABLE_WIFIDOG_VALIDATE); 
    134199 
    135200    LOCK_CONFIG(); 
     
    142207     
    143208    /** Insert global rules BEFORE the "defaults" */ 
    144  
    145     iptables_do_command("-t nat -A " TABLE_WIFIDOG_UNKNOWN " -p udp --dport 67 -j ACCEPT"); 
    146     iptables_do_command("-t nat -A " TABLE_WIFIDOG_UNKNOWN " -p tcp --dport 67 -j ACCEPT"); 
    147     iptables_do_command("-t nat -A " TABLE_WIFIDOG_UNKNOWN " -p udp --dport 53 -j ACCEPT"); 
    148  
    149     LOCK_CONFIG(); 
    150      
     209    iptables_load_ruleset("global", TABLE_WIFIDOG_UNKNOWN); 
     210    iptables_load_ruleset("unknown-users", TABLE_WIFIDOG_UNKNOWN); 
     211    LOCK_CONFIG(); 
     212    /* XXX If there's a rule in global for port 80, it overrides this. */ 
    151213    iptables_do_command("-t nat -A " TABLE_WIFIDOG_UNKNOWN " -p tcp --dport 80 -j REDIRECT --to-ports %d", config->gw_port); 
    152  
    153     UNLOCK_CONFIG(); 
    154      
     214    UNLOCK_CONFIG(); 
    155215    iptables_do_command("-t nat -A " TABLE_WIFIDOG_UNKNOWN " -j DROP"); 
    156216 
    157217    iptables_do_command("-t nat -N " TABLE_WIFIDOG_KNOWN); 
    158  
    159218    /** Insert global rules BEFORE the "defaults" */ 
    160  
    161     iptables_do_command("-t nat -A " TABLE_WIFIDOG_KNOWN " -j ACCEPT"); 
     219    iptables_load_ruleset("global", TABLE_WIFIDOG_KNOWN); 
     220    iptables_load_ruleset("known-users", TABLE_WIFIDOG_KNOWN); 
    162221 
    163222    iptables_do_command("-t nat -N " TABLE_WIFIDOG_LOCKED); 
    164     iptables_do_command("-t nat -A " TABLE_WIFIDOG_LOCKED " -j DROP"); 
    165  
     223    iptables_load_ruleset("locked-users", TABLE_WIFIDOG_KNOWN); 
     224     
    166225    iptables_do_command("-t nat -N " TABLE_WIFIDOG_CLASS); 
    167  
    168     LOCK_CONFIG(); 
    169      
     226    LOCK_CONFIG(); 
    170227    iptables_do_command("-t nat -A " TABLE_WIFIDOG_CLASS " -i %s -m mark --mark 0x%u -j " TABLE_WIFIDOG_VALIDATE, config->gw_interface, FW_MARK_PROBATION); 
    171228    iptables_do_command("-t nat -A " TABLE_WIFIDOG_CLASS " -i %s -m mark --mark 0x%u -j " TABLE_WIFIDOG_KNOWN, config->gw_interface, FW_MARK_KNOWN); 
  • trunk/wifidog/src/ping_thread.c

    r281 r290  
    9797                                i; 
    9898        t_auth_serv             *auth_server; 
    99         char                    request[MAX_BUF]; 
     99        char                    request[MAX_BUF], 
     100                                *tmp_addr; 
    100101        struct in_addr          *h_addr; 
    101102        struct sockaddr_in      their_addr; 
     
    127128 
    128129        if (auth_server->last_ip == NULL) { 
    129                 auth_server->last_ip = (struct in_addr *)malloc( 
    130                                 sizeof(struct in_addr)); 
     130                auth_server->last_ip = strdup(inet_ntoa(*h_addr)); 
    131131                if (auth_server->last_ip == NULL) { 
    132132                        debug(LOG_CRIT, "Could not allocate memory, Banzai!"); 
    133133                        exit(-1); 
    134134                } 
    135                 memcpy(auth_server->last_ip, h_addr, sizeof(struct in_addr)); 
    136135        } else { 
    137            
    138                 for (i = 0; i < sizeof(struct in_addr) 
    139                                 && (*((char *)auth_server->last_ip + i) 
    140                                         == *((char *)h_addr + i)); i++); 
    141                 if (i < sizeof(struct in_addr)) { 
    142                   memcpy(auth_server->last_ip, h_addr, sizeof(struct in_addr)); 
     136                tmp_addr = strdup(inet_ntoa(*h_addr)); 
     137                if (strcmp(auth_server->last_ip, tmp_addr) == 0) { 
     138                        free(auth_server->last_ip); 
     139                        auth_server->last_ip = tmp_addr; 
    143140                        fw_clear_authservers(); 
    144141                        fw_set_authservers(); 
     142                } else { 
     143                        free(tmp_addr); 
    145144                } 
    146145        } 
  • trunk/wifidog/wifidog.conf

    r221 r290  
    22# WiFiDog Configuration file 
    33 
    4 # Parm: GatewayID 
     4# Parameter: GatewayID 
    55# Default: default 
    66# Optional but essential for monitoring purposes 
     
    1212GatewayID default 
    1313 
    14 # Parm: ExternalInterface 
     14# Parameter: ExternalInterface 
    1515# Default: NONE 
    1616# Mandatory 
     
    2020ExternalInterface eth0 
    2121 
    22 # Parm: GatewayInterface 
     22# Parameter: GatewayInterface 
    2323# Default: NONE 
    2424# Mandatory 
     
    2828GatewayInterface eth1 
    2929 
    30 # Parm: GatewayAddress 
     30# Parameter: GatewayAddress 
    3131# Default: NONE 
    3232# Mandatory 
     
    3636GatewayAddress 192.168.1.1 
    3737 
    38 # Parm: AuthServMaxTries 
     38# Parameter: AuthServMaxTries 
    3939# Default: 1 
    4040# Optional 
     
    4646# AuthServMaxTries 3 
    4747 
    48 # Parm: AuthServer 
     48# Parameter: AuthServer 
    4949# Default: NONE 
    5050# Mandatory 
     
    7979#} 
    8080 
    81 # Parm: Daemon 
     81# Parameter: Daemon 
    8282# Default: 1 
    8383# Optional 
     
    8686# Daemon 1 
    8787 
    88 # Parm: GatewayPort 
     88# Parameter: GatewayPort 
    8989# Default: 2060 
    9090# Optional 
     
    9393# GatewayPort 2060 
    9494 
    95 # Parm: HTTPDName 
     95# Parameter: HTTPDName 
    9696# Default: WiFiDog 
    9797# Optional 
     
    100100# HTTPDName WiFiDog 
    101101 
    102 # Parm: HTTPDMaxConn 
     102# Parameter: HTTPDMaxConn 
    103103# Default: 10 
    104104# Optional 
     
    107107# HTTPDMaxConn 10 
    108108 
    109 # Parm: CheckInterval 
     109# Parameter: CheckInterval 
    110110# Default: 60 
    111111# Optional 
     
    114114CheckInterval 60 
    115115 
    116 # Parm: ClientTimeout 
     116# Parameter: ClientTimeout 
    117117# Default: 5 
    118118# Optional 
     
    122122ClientTimeout 5 
    123123 
     124# Parameter: FirewallRuleSet 
     125# Default: none 
     126# Mandatory 
     127# 
     128# Groups a number of FirewallRule statements together. 
     129 
     130# Parameter: FirewallRule 
     131# Default: none 
     132#  
     133# Define one firewall rule in a rule set. 
     134 
     135# Rule Set: global 
     136#  
     137# Used for rules to be applied to all other rulesets except locked. 
     138# This is the default config for the Teliphone service. 
     139FirewallRuleSet global { 
     140        FirewallRule allow udp to 69.90.89.192/27 
     141        FirewallRule allow udp to 69.90.85.0/27 
     142        FirewallRule allow tcp port 80 to 69.90.89.205 
     143} 
     144 
     145# Rule Set: validating-users 
     146# 
     147# Used for new users validating their account 
     148FirewallRuleSet validating-users { 
     149        FirewallRule allow udp port 67 
     150        FirewallRule allow tdp port 67 
     151        FirewallRule allow udp port 53 
     152        FirewallRule allow tcp port 53 
     153        FirewallRule allow tcp port 80 
     154        FirewallRule allow tcp port 110 
     155        FirewallRule allow tcp port 995 
     156        FirewallRule allow tcp port 143 
     157        FirewallRule allow tcp port 993 
     158        FirewallRule allow tcp port 220 
     159        FirewallRule allow tcp port 443 
     160        FirewallRule block to 0.0.0.0/0 
     161} 
     162 
     163# Rule Set: known-users 
     164# 
     165# Used for normal validated users. 
     166FirewallRuleSet known-users { 
     167        FirewallRule allow to 0.0.0.0/0 
     168} 
     169 
     170# Rule Set: unknown-users 
     171# 
     172# Used for unvalidated users, this is the ruleset that gets redirected. 
     173FirewallRuleSet unknown-users { 
     174        FirewallRule allow udp port 53 
     175        FirewallRule allow tcp port 53 
     176        FirewallRule allow udp port 67 
     177        FirewallRule allow tcp port 67 
     178} 
     179 
     180# Rule Set: locked-users 
     181# 
     182# Used for users that have been locked out. 
     183FirewallRuleSet locked-users { 
     184        FirewallRule block to 0.0.0.0/0 
     185}