Changeset 106

Show
Ignore:
Timestamp:
11/15/06 17:30:14 (2 years ago)
Author:
syrus
Message:

Rajout network_id lat lon tinyproxyport

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wifidog/wifidog-1.1.3_beta4/src/conf.c

    r105 r106  
    8686        oFirewallRuleSet, 
    8787        oTrustedMACList, 
    88         oProprietary 
     88        oProprietary, 
     89        oNetwork, 
     90        oLat, 
     91        oLon, 
     92        oTinyproxyPort, 
    8993} OpCodes; 
    9094 
     
    119123        { "trustedmaclist",         oTrustedMACList }, 
    120124        { "proprietary",        oProprietary }, 
     125        { "network",            oNetwork }, 
     126        { "lat",                oLat }, 
     127        { "lon",                oLon }, 
     128        { "tinyproxyport",      oTinyproxyPort }, 
    121129        { NULL,                 oBadOption }, 
    122130}; 
     
    158166        config.trustedmaclist = NULL; 
    159167        config.Proprietary = NULL; 
     168        config.Network = DEFAULT_NETWORK; 
     169        config.Lat = "0"; 
     170        config.Lon = "0"; 
     171        config.tinyproxy_port = 0; 
    160172} 
    161173 
     
    655667                                  config.Proprietary = safe_strdup(p1); 
    656668                                  break; 
     669                                case oNetwork: 
     670                                  config.Network = safe_strdup(p1); 
     671                                  break; 
     672                                case oLat: 
     673                                  config.Lat = safe_strdup(p1); 
     674                                  break; 
     675                                case oLon: 
     676                                  config.Lon = safe_strdup(p1); 
     677                                  break; 
    657678                                case oHTTPDMaxConn: 
    658679                                        sscanf(p1, "%d", &config.httpdmaxconn); 
     
    677698                                case oSyslogFacility: 
    678699                                        sscanf(p1, "%d", &config.syslog_facility); 
     700                                        break; 
     701                                case oTinyproxyPort: 
     702                                        sscanf(p1, "%d", &config.tinyproxy_port); 
    679703                                        break; 
    680704                                } 
  • wifidog/wifidog-1.1.3_beta4/src/conf.h

    r105 r106  
    4949/** Note:  The path must be prefixed by /, and must be suffixed /.  Put / for the server root.*/ 
    5050#define DEFAULT_AUTHSERVPATH "/wifidog/" 
     51#define DEFAULT_NETWORK "default-network" 
    5152/*@}*/  
    5253 
     
    127128    t_trusted_mac *trustedmaclist; /**< @brief list of trusted macs */ 
    128129  char *Proprietary; 
     130  char *Network;       /* Name of network */ 
     131  char *Lat; 
     132  char *Lon; 
     133  int tinyproxy_port; 
    129134} s_config; 
    130135 
  • wifidog/wifidog-1.1.3_beta4/src/fw_iptables.c

    r98 r106  
    191191         int gw_port = 0; 
    192192     t_trusted_mac *p; 
     193     int tinyproxy_port; 
    193194    
    194195    fw_quiet = 0; 
     
    246247 
    247248                        iptables_do_command("-t nat -A " TABLE_WIFIDOG_OUTGOING " -j " TABLE_WIFIDOG_WIFI_TO_INTERNET); 
    248                         iptables_do_command("-t nat -A " TABLE_WIFIDOG_WIFI_TO_INTERNET " -m mark --mark 0x%u -j ACCEPT", FW_MARK_KNOWN); 
     249                         
     250                        if((tinyproxy_port=config_get_config()->tinyproxy_port) != 0){ 
     251                          debug(LOG_INFO,"Tinyproxy port set, setting tinyproxy rule"); 
     252                          iptables_do_command("-t nat -A " TABLE_WIFIDOG_WIFI_TO_INTERNET " -p tcp --dport 80 -m mark --mark 0x%u -j REDIRECT --to-port %u", FW_MARK_KNOWN, tinyproxy_port); 
     253                        } else { 
     254                          iptables_do_command("-t nat -A " TABLE_WIFIDOG_WIFI_TO_INTERNET " -m mark --mark 0x%u -j ACCEPT", FW_MARK_KNOWN); 
     255                        } 
     256 
    249257                        iptables_do_command("-t nat -A " TABLE_WIFIDOG_WIFI_TO_INTERNET " -m mark --mark 0x%u -j ACCEPT", FW_MARK_PROBATION); 
    250258                        iptables_do_command("-t nat -A " TABLE_WIFIDOG_WIFI_TO_INTERNET " -j " TABLE_WIFIDOG_UNKNOWN); 
  • wifidog/wifidog-1.1.3_beta4/src/http.c

    r98 r106  
    2323  @brief HTTP IO functions 
    2424  @author Copyright (C) 2004 Philippe April <papril777@yahoo.com> 
     25  @author 2006 Pascal Rullier <pascal.rullier@wireless-fr.org> 
    2526 */ 
    2627 
     
    8081        if (!is_online()) { 
    8182                /* The internet connection is down at the moment  - apologize and do not redirect anywhere */ 
    82                 http_wifidog_header(r, "<h2>Uh oh! Internet access unavailable</h2>"); 
    83                 httpdOutput(r, "<p>We apologize, but it seems that the internet connection that powers this hotspot is temporarily unavailable.</p>"); 
    84                 httpdOutput(r, "<p>If at all possible, please notify the owners of this hotspot that the internet connection is out of service.</p>"); 
    85                 httpdOutput(r, "<p>The maintainers of this network are aware of this disruption.  We hope that this situation will be resolved soon.</p>"); 
    86                 httpdPrintf(r, "<p>In a while please <a href='%s'>click here</a> to try your request again.</p>", tmp_url); 
     83                http_wifidog_header(r, "L'accés internet est indisponible"); 
     84                httpdOutput(r, "<p>Nous sommes désolés, mais il semble que la connexion internet est temporairement indisponible.</p>"); 
     85                httpdOutput(r, "<p>Si cela est possible, veuillez avertir les propriétaires de ce point d'accés.</p>"); 
     86                httpdOutput(r, "<p>Les administrateurs de ce réseau sont au courant de cette interruption. Nous espèrons que cette situation sera résolue bientôt.</p>"); 
     87                httpdPrintf(r, "<p>Dans un moment, veuillez <a href='%s'>cliquer ici</a> pour relancer votre requète.</p>", tmp_url); 
    8788                http_wifidog_footer(r); 
    8889                debug(LOG_INFO, "Sent %s an apology since I am not online - no point sending them to auth server", r->clientAddr); 
     
    9091        else if (!is_auth_online()) { 
    9192                /* The auth server is down at the moment - apologize and do not redirect anywhere */ 
    92                 http_wifidog_header(r, "<h2>Uh oh! Login screen unavailable</h2>"); 
    93                 httpdOutput(r, "<p>We apologize, but it seems that we are currently unable to re-direct you to the login screen.</p>"); 
    94                 httpdOutput(r, "<p>The maintainers of this network are aware of this disruption.  We hope that this situation will be resolved soon.</p>"); 
    95                 httpdPrintf(r, "<p>In a couple of minutes please <a href='%s'>click here</a> to try your request again.</p>", tmp_url); 
     93                http_wifidog_header(r, "L'écran de connexion est indisponible"); 
     94                httpdOutput(r, "<p>Nous sommes désolés, mais il semble que nous sommes actuellement incapables de vous rediriger sur la page de connexion.</p>"); 
     95                httpdOutput(r, "<p>Les administrateurs de ce réseau sont au courant de cette interruption. Nous espèrons que cette situation sera bientôt résolue.</p>"); 
     96                httpdPrintf(r, "<p>Dans un moment, veuillez <a href='%s'>cliquer ici</a> pour relancer votre requète.</p>", tmp_url); 
    9697                http_wifidog_footer(r); 
    9798                debug(LOG_INFO, "Sent %s an apology since auth server not online - no point sending them to auth server", r->clientAddr); 
     
    139140http_callback_about(httpd *webserver, request *r) 
    140141{ 
    141         http_wifidog_header(r, "About WiFiDog"); 
    142         httpdOutput(r, "This is WiFiDog version <b>" VERSION "</b>"); 
     142        http_wifidog_header(r, "A propos de WiFiDog"); 
     143        httpdOutput(r, "WiFiDog version <b>" VERSION "</b>"); 
    143144        http_wifidog_footer(r); 
    144145} 
     
    148149{ 
    149150        char * status = NULL; 
    150         status = get_status_text(); 
    151         http_wifidog_header(r, "WiFiDog Status"); 
     151        status = get_status_text(0); 
     152        http_wifidog_header(r, "Etat WiFiDog"); 
    152153        httpdOutput(r, "<pre>"); 
    153154        httpdOutput(r, status); 
     
    209210    httpdOutput(r, "  margin: 10px 60px 0 60px; \n"); 
    210211    httpdOutput(r, "  font-family : bitstream vera sans, sans-serif;\n"); 
    211     httpdOutput(r, "  color: #46a43a;\n"); 
     212    // httpdOutput(r, "  color: #46a43a;\n"); 
     213    httpdOutput(r, "  color: #2222ff;\n"); 
    212214    httpdOutput(r, "}\n"); 
    213215 
    214216    httpdOutput(r, "a {\n"); 
    215     httpdOutput(r, "  color: #46a43a;\n"); 
     217    httpdOutput(r, "  color: #00f;\n"); 
    216218    httpdOutput(r, "}\n"); 
    217219 
    218220    httpdOutput(r, "a:active {\n"); 
    219     httpdOutput(r, "  color: #46a43a;\n"); 
     221    httpdOutput(r, "  color: #00f;\n"); 
    220222    httpdOutput(r, "}\n"); 
    221223 
    222224    httpdOutput(r, "a:link {\n"); 
    223     httpdOutput(r, "  color: #46a43a;\n"); 
     225    httpdOutput(r, "  color: #00f;\n"); 
    224226    httpdOutput(r, "}\n"); 
    225227 
    226228    httpdOutput(r, "a:visited {\n"); 
    227     httpdOutput(r, "  color: #46a43a;\n"); 
     229    httpdOutput(r, "  color: #00f;\n"); 
    228230    httpdOutput(r, "}\n"); 
    229231 
    230232    httpdOutput(r, "#header {\n"); 
    231233    httpdOutput(r, "  height: 30px;\n"); 
    232     httpdOutput(r, "  background-color: #B4F663;\n"); 
     234    httpdOutput(r, "  background-color: #eeeeff;\n"); 
    233235    httpdOutput(r, "  padding: 20px;\n"); 
    234236    httpdOutput(r, "  font-size: 20pt;\n"); 
    235237    httpdOutput(r, "  text-align: center;\n"); 
    236     httpdOutput(r, "  border: 2px solid #46a43a;\n"); 
     238    httpdOutput(r, "  border: 2px solid #2481ff;\n"); 
    237239    httpdOutput(r, "  border-bottom: 0;\n"); 
    238240    httpdOutput(r, "}\n"); 
     
    241243    httpdOutput(r, "  width: 200px;\n"); 
    242244    httpdOutput(r, "  float: right;\n"); 
    243     httpdOutput(r, "  background-color: #B4F663;\n"); 
    244     httpdOutput(r, "  border: 2px solid #46a43a;\n"); 
     245    httpdOutput(r, "  background-color: #eeeeff;\n"); 
     246    httpdOutput(r, "  border: 2px solid #2481ff;\n"); 
    245247    httpdOutput(r, "  font-size: 80%;\n"); 
    246248    httpdOutput(r, "  min-height: 300px;\n"); 
     
    249251    httpdOutput(r, "#menu h2 {\n"); 
    250252    httpdOutput(r, "  margin: 0;\n"); 
    251     httpdOutput(r, "  background-color: #46a43a;\n"); 
     253    httpdOutput(r, "  background-color: #2481ff;\n"); 
    252254    httpdOutput(r, "  text-align: center;\n"); 
    253     httpdOutput(r, "  color: #B4F663;\n"); 
     255    httpdOutput(r, "  color: #fff;\n"); 
    254256    httpdOutput(r, "}\n"); 
    255257 
     
    259261    httpdOutput(r, "#content {\n"); 
    260262    httpdOutput(r, "  padding: 20px;\n"); 
    261     httpdOutput(r, "  border: 2px solid #46a43a;\n"); 
     263    httpdOutput(r, "  border: 2px solid #2481ff;\n"); 
    262264    httpdOutput(r, "  min-height: 300px;\n"); 
    263265    httpdOutput(r, "}\n"); 
     
    279281    httpdOutput(r, "    <li>Version: " VERSION "\n"); 
    280282    httpdPrintf(r, "    <li>Node ID: %s\n", config_get_config()->gw_id); 
     283    httpdPrintf(r, "    <li>Réseau : %s\n", config_get_config()->Network); 
     284    httpdPrintf(r, "    <li>Propriétaire : %s\n", config_get_config()->Proprietary); 
    281285    httpdOutput(r, "    </ul>\n"); 
    282286    httpdOutput(r, "    <br>\n"); 
     
    284288    httpdOutput(r, "    <h2>Menu</h2>\n"); 
    285289    httpdOutput(r, "    <ul>\n"); 
    286     httpdOutput(r, "    <li><a href='/wifidog/status'>WiFiDog Status</a>\n"); 
    287     httpdOutput(r, "    <li><a href='/wifidog/about'>About WiFiDog</a>\n"); 
    288     httpdOutput(r, "    <li><a href='http://www.wifidog.org'>WiFiDog's homepage</a>\n"); 
     290    httpdOutput(r, "    <li><a href='/wifidog/status'>Etat WiFiDog</a>\n"); 
     291    httpdOutput(r, "    <li><a href='/wifidog/about'>A propos de WiFiDog</a>\n"); 
     292    httpdOutput(r, "    <li><a href='http://www.wifidog.org/'>Page d'accueil WiFiDog</a>\n"); 
     293    httpdOutput(r, "    <li><a href='http://www.wireless-fr.org/'>Page d'accueil France Wireless</a>\n"); 
    289294    httpdOutput(r, "    </ul>\n"); 
    290295    httpdOutput(r, "</div>\n"); 
     
    300305 
    301306    httpdOutput(r, "<div id=\"copyright\">\n"); 
    302     httpdOutput(r, "Copyright (C) 2004-2005.  This software is released under the GNU GPL license.\n"); 
     307    httpdOutput(r, "Copyright (C) 2004-2006 Wifidog/France Wireless.  Ce logiciel est sous la license GNU GPL.\n"); 
    303308    httpdOutput(r, "</div>\n"); 
    304309 
  • wifidog/wifidog-1.1.3_beta4/src/ping_thread.c

    r105 r106  
    141141         * Prep & send request 
    142142         */ 
    143         snprintf(request, sizeof(request) - 1, "GET %sping/?gw_id=%s&sys_uptime=%lu&sys_memfree=%u&sys_load=%.2f&wifidog_uptime=%lu&prop=%s HTTP/1.0\r\n" 
     143        snprintf(request, sizeof(request) - 1, "GET %sping/?gw_id=%s&sys_uptime=%lu&sys_memfree=%u&sys_load=%.2f&wifidog_uptime=%lu&prop=%s&network_id=%s&lat=%s&lon=%s HTTP/1.0\r\n" 
    144144                 "User-Agent: WiFiDog %s\r\n" 
    145145                 "Host: %s\r\n" 
     
    152152                 (long unsigned int)((long unsigned int)time(NULL) - (long unsigned int)started_time), 
    153153                 config_get_config()->Proprietary, 
     154                 config_get_config()->Network, 
     155                 config_get_config()->Lat, 
     156                 config_get_config()->Lon, 
    154157                 VERSION, 
    155158                 config_get_config()->auth_servers->authserv_hostname); 
  • wifidog/wifidog-1.1.3_beta4/src/util.c

    r98 r106  
    332332 * @return A string containing human-readable status text. MUST BE free()d by caller 
    333333 */ 
    334 char * get_status_text() { 
     334char * get_status_text(int showtrusted) { 
    335335        char buffer[STATUS_BUF_SIZ]; 
    336336        ssize_t len; 
     
    379379        len = strlen(buffer); 
    380380 
     381        snprintf((buffer + len), (sizeof(buffer) - len), "Node ID: %s\n", config_get_config()->gw_id); 
     382        len = strlen(buffer); 
     383 
     384        snprintf((buffer + len), (sizeof(buffer) - len), "Proprietary: %s\n", config_get_config()->Proprietary); 
     385        len = strlen(buffer); 
     386 
     387        snprintf((buffer + len), (sizeof(buffer) - len), "Network : %s\n", config_get_config()->Network); 
     388        len = strlen(buffer); 
     389 
    381390        snprintf((buffer + len), (sizeof(buffer) - len), "Clients served this session: %lu\n\n", served_this_session); 
    382391        len = strlen(buffer); 
     392 
     393 
     394 
    383395 
    384396        LOCK_CLIENT_LIST(); 
     
    422434        UNLOCK_CLIENT_LIST(); 
    423435 
    424     config = config_get_config(); 
    425      
    426     if (config->trustedmaclist != NULL) { 
    427         snprintf((buffer + len), (sizeof(buffer) - len), "\nTrusted MAC addresses:\n"); 
    428         len = strlen(buffer); 
    429  
    430         for (p = config->trustedmaclist; p != NULL; p = p->next) { 
    431             snprintf((buffer + len), (sizeof(buffer) - len), "  %s\n", p->mac); 
    432             len = strlen(buffer); 
    433         } 
    434     } 
     436        config = config_get_config(); 
     437 
     438        if(showtrusted) 
     439          { 
     440            if (config->trustedmaclist != NULL) { 
     441              snprintf((buffer + len), (sizeof(buffer) - len), "\nTrusted MAC addresses:\n"); 
     442              len = strlen(buffer); 
     443               
     444              for (p = config->trustedmaclist; p != NULL; p = p->next) { 
     445                snprintf((buffer + len), (sizeof(buffer) - len), "  %s\n", p->mac); 
     446                len = strlen(buffer); 
     447              } 
     448            } 
     449          } 
    435450 
    436451    snprintf((buffer + len), (sizeof(buffer) - len), "\nAuthentication servers:\n"); 
  • wifidog/wifidog-1.1.3_beta4/src/util.h

    r98 r106  
    6161 * @brief Creates a human-readable paragraph of the status of wifidog 
    6262 */ 
    63 char * get_status_text(); 
     63char * get_status_text(int showtrusted); 
    6464 
    6565#define LOCK_GHBN() do { \ 
  • wifidog/wifidog-1.1.3_beta4/src/wdctl_thread.c

    r98 r106  
    210210        int len = 0; 
    211211 
    212         status = get_status_text(); 
     212        status = get_status_text(1); 
    213213        len = strlen(status); 
    214214 
  • wifidog/wifidog-1.1.3_beta4/wifidog.conf

    r98 r106  
    1212 
    1313# GatewayID default 
     14#GatewayID Syrus 
    1415 
    1516# Parameter: ExternalInterface 
     
    1920# Set this to the external interface.  Typically vlan1 for OpenWrt, and eth0 or ppp0 otherwise 
    2021 
    21 # ExternalInterface eth0 
     22ExternalInterface vlan1 
    2223 
    2324# Parameter: GatewayInterface 
     
    2728# Set this to the internal interface.    Typically br0 for OpenWrt, and eth1 otherwise 
    2829 
    29 GatewayInterface eth1 
     30GatewayInterface eth0 
     31#GatewayInterface wds0.49153 
     32# Proprietary of the node (enrolled nickname on the auth server) 
     33 
     34Proprietary Syrus  
     35 
     36Network mplwireless 
     37 
     38Lat 
     39Lon  
     40 
     41TinyproxyPort 8888 
    3042 
    3143# Parameter: GatewayAddress 
     
    5264#} 
    5365 
    54 #AuthServer { 
    55 #    Hostname auth.ilesansfil.org 
    56 #    SSLAvailable yes 
    57 #    Path / 
    58 #} 
    59  
    60 #AuthServer { 
    61 #    Hostname auth2.ilesansfil.org 
    62 #    SSLAvailable yes 
    63 #    Path / 
    64 #} 
    65  
    66 #AuthServer { 
    67 #    Hostname auth3.ilesansfil.org 
    68 #    SSLAvailable yes 
    69 #    Path / 
    70 #} 
     66AuthServer { 
     67    Hostname null.wireless-fr.org 
     68    SSLAvailable yes 
     69    Path / 
     70
    7171 
    7272# Parameter: Portal 
     
    7575# 
    7676# Set this to a URL for your portal, if you run without an auth server 
    77 # Portal http://www.ilesansfil.org
     77# Portal http://www.montpellier-wirless.com
    7878 
    7979# Parameter: Daemon 
     
    110110# 
    111111# How many seconds should we wait between timeout checks 
    112 CheckInterval 60 
     112CheckInterval 600 
    113113 
    114114# Parameter: ClientTimeout 
     
    118118# Set this to the desired of number of CheckInterval of inactivity before a client is logged out 
    119119# The timeout will be INTERVAL * TIMEOUT 
    120 ClientTimeout 5 
     120ClientTimeout 1 
    121121 
    122122# Parameter: TrustedMACList 
     
    127127# through without authentication 
    128128#TrustedMACList 00:00:DE:AD:BE:AF,00:00:C0:1D:F0:0D 
     129# TrustedMACList 00:13:CE:D2:D7:56 
     130 
     131# AP blueup/baloard 
     132TrustedMACList 00:18:39:c5:dc:3d,00:18:39:C5:DC:C4 
    129133 
    130134# Parameter: FirewallRuleSet 
     
    144148# This is the default config for the Teliphone service. 
    145149FirewallRuleSet global { 
    146     FirewallRule allow udp to 69.90.89.192/27 
    147     FirewallRule allow udp to 69.90.85.0/27 
    148     FirewallRule allow tcp port 80 to 69.90.89.205 
     150    # SIP pour Freephonie  
     151    FirewallRule allow udp to 212.27.52.5 
     152    # SIP pour wengo 
     153    FirewallRule allow udp to 213.91.9.210 
     154    # SIP pour phonesystems 
     155    FirewallRule allow udp to 213.11.62.39 
     156    FirewallRule allow udp to 62.39.136.151 
     157    # 
     158    # Web vers montpellier-wireless.com 
     159    FirewallRule allow tcp port 80 to 80.245.57.3 
     160    # FirewallRule allow to 10.34.0.0/16 
     161    # NMNS 
     162    FirewallRule allow to 213.251.186.125 
     163    FirewallRule allow to 10.0.0.0/8 
    149164} 
    150165 
     
    153168# Used for new users validating their account 
    154169FirewallRuleSet validating-users { 
    155     FirewallRule block tcp port 25 
    156     FirewallRule allow to 0.0.0.0/0 
     170FirewallRule allow tcp port 22 
     171FirewallRule allow udp port 67 
     172FirewallRule allow tcp port 67 
     173FirewallRule allow udp port 53 
     174FirewallRule allow tcp port 53 
     175FirewallRule allow tcp port 80 
     176FirewallRule allow tcp port 110 
     177FirewallRule allow tcp port 995 
     178FirewallRule allow tcp port 143 
     179FirewallRule allow tcp port 993 
     180FirewallRule allow tcp port 220 
     181FirewallRule allow tcp port 443 
     182FirewallRule block to 0.0.0.0/0 
    157183} 
    158184 
     
    161187# Used for normal validated users. 
    162188FirewallRuleSet known-users { 
    163     FirewallRule allow to 0.0.0.0/0 
     189FirewallRule allow udp port 67 
     190FirewallRule allow tcp port 67 
     191FirewallRule allow udp port 53 
     192FirewallRule allow tcp port 53 
     193FirewallRule allow tcp port 80 
     194FirewallRule allow tcp port 110 
     195FirewallRule allow tcp port 995 
     196FirewallRule allow tcp port 143 
     197FirewallRule allow tcp port 993 
     198FirewallRule allow tcp port 220 
     199FirewallRule allow tcp port 443 
     200FirewallRule allow tcp port 6667 
     201# Skype 
     202FirewallRule allow tcp port 1468 
     203FirewallRule allow tcp port 22 
     204FirewallRule allow tcp port 5222 
     205FirewallRule allow tcp port 5223 
     206FirewallRule allow tcp port 1863 
     207FirewallRule allow udp port 1863 
     208FirewallRule allow udp port 4000 
     209FirewallRule allow tcp port 4000 
     210FirewallRule allow tcp port 7000 
     211FirewallRule block to 0.0.0.0/0 
    164212} 
    165213