Changeset 106
- Timestamp:
- 11/15/06 17:30:14 (2 years ago)
- Files:
-
- wifidog/wifidog-1.1.3_beta4/src/conf.c (modified) (5 diffs)
- wifidog/wifidog-1.1.3_beta4/src/conf.h (modified) (2 diffs)
- wifidog/wifidog-1.1.3_beta4/src/fw_iptables.c (modified) (2 diffs)
- wifidog/wifidog-1.1.3_beta4/src/http.c (modified) (12 diffs)
- wifidog/wifidog-1.1.3_beta4/src/ping_thread.c (modified) (2 diffs)
- wifidog/wifidog-1.1.3_beta4/src/util.c (modified) (3 diffs)
- wifidog/wifidog-1.1.3_beta4/src/util.h (modified) (1 diff)
- wifidog/wifidog-1.1.3_beta4/src/wdctl_thread.c (modified) (1 diff)
- wifidog/wifidog-1.1.3_beta4/wifidog.conf (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
wifidog/wifidog-1.1.3_beta4/src/conf.c
r105 r106 86 86 oFirewallRuleSet, 87 87 oTrustedMACList, 88 oProprietary 88 oProprietary, 89 oNetwork, 90 oLat, 91 oLon, 92 oTinyproxyPort, 89 93 } OpCodes; 90 94 … … 119 123 { "trustedmaclist", oTrustedMACList }, 120 124 { "proprietary", oProprietary }, 125 { "network", oNetwork }, 126 { "lat", oLat }, 127 { "lon", oLon }, 128 { "tinyproxyport", oTinyproxyPort }, 121 129 { NULL, oBadOption }, 122 130 }; … … 158 166 config.trustedmaclist = NULL; 159 167 config.Proprietary = NULL; 168 config.Network = DEFAULT_NETWORK; 169 config.Lat = "0"; 170 config.Lon = "0"; 171 config.tinyproxy_port = 0; 160 172 } 161 173 … … 655 667 config.Proprietary = safe_strdup(p1); 656 668 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; 657 678 case oHTTPDMaxConn: 658 679 sscanf(p1, "%d", &config.httpdmaxconn); … … 677 698 case oSyslogFacility: 678 699 sscanf(p1, "%d", &config.syslog_facility); 700 break; 701 case oTinyproxyPort: 702 sscanf(p1, "%d", &config.tinyproxy_port); 679 703 break; 680 704 } wifidog/wifidog-1.1.3_beta4/src/conf.h
r105 r106 49 49 /** Note: The path must be prefixed by /, and must be suffixed /. Put / for the server root.*/ 50 50 #define DEFAULT_AUTHSERVPATH "/wifidog/" 51 #define DEFAULT_NETWORK "default-network" 51 52 /*@}*/ 52 53 … … 127 128 t_trusted_mac *trustedmaclist; /**< @brief list of trusted macs */ 128 129 char *Proprietary; 130 char *Network; /* Name of network */ 131 char *Lat; 132 char *Lon; 133 int tinyproxy_port; 129 134 } s_config; 130 135 wifidog/wifidog-1.1.3_beta4/src/fw_iptables.c
r98 r106 191 191 int gw_port = 0; 192 192 t_trusted_mac *p; 193 int tinyproxy_port; 193 194 194 195 fw_quiet = 0; … … 246 247 247 248 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 249 257 iptables_do_command("-t nat -A " TABLE_WIFIDOG_WIFI_TO_INTERNET " -m mark --mark 0x%u -j ACCEPT", FW_MARK_PROBATION); 250 258 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 23 23 @brief HTTP IO functions 24 24 @author Copyright (C) 2004 Philippe April <papril777@yahoo.com> 25 @author 2006 Pascal Rullier <pascal.rullier@wireless-fr.org> 25 26 */ 26 27 … … 80 81 if (!is_online()) { 81 82 /* 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); 87 88 http_wifidog_footer(r); 88 89 debug(LOG_INFO, "Sent %s an apology since I am not online - no point sending them to auth server", r->clientAddr); … … 90 91 else if (!is_auth_online()) { 91 92 /* 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); 96 97 http_wifidog_footer(r); 97 98 debug(LOG_INFO, "Sent %s an apology since auth server not online - no point sending them to auth server", r->clientAddr); … … 139 140 http_callback_about(httpd *webserver, request *r) 140 141 { 141 http_wifidog_header(r, "A boutWiFiDog");142 httpdOutput(r, " This isWiFiDog version <b>" VERSION "</b>");142 http_wifidog_header(r, "A propos de WiFiDog"); 143 httpdOutput(r, "WiFiDog version <b>" VERSION "</b>"); 143 144 http_wifidog_footer(r); 144 145 } … … 148 149 { 149 150 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"); 152 153 httpdOutput(r, "<pre>"); 153 154 httpdOutput(r, status); … … 209 210 httpdOutput(r, " margin: 10px 60px 0 60px; \n"); 210 211 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"); 212 214 httpdOutput(r, "}\n"); 213 215 214 216 httpdOutput(r, "a {\n"); 215 httpdOutput(r, " color: # 46a43a;\n");217 httpdOutput(r, " color: #00f;\n"); 216 218 httpdOutput(r, "}\n"); 217 219 218 220 httpdOutput(r, "a:active {\n"); 219 httpdOutput(r, " color: # 46a43a;\n");221 httpdOutput(r, " color: #00f;\n"); 220 222 httpdOutput(r, "}\n"); 221 223 222 224 httpdOutput(r, "a:link {\n"); 223 httpdOutput(r, " color: # 46a43a;\n");225 httpdOutput(r, " color: #00f;\n"); 224 226 httpdOutput(r, "}\n"); 225 227 226 228 httpdOutput(r, "a:visited {\n"); 227 httpdOutput(r, " color: # 46a43a;\n");229 httpdOutput(r, " color: #00f;\n"); 228 230 httpdOutput(r, "}\n"); 229 231 230 232 httpdOutput(r, "#header {\n"); 231 233 httpdOutput(r, " height: 30px;\n"); 232 httpdOutput(r, " background-color: # B4F663;\n");234 httpdOutput(r, " background-color: #eeeeff;\n"); 233 235 httpdOutput(r, " padding: 20px;\n"); 234 236 httpdOutput(r, " font-size: 20pt;\n"); 235 237 httpdOutput(r, " text-align: center;\n"); 236 httpdOutput(r, " border: 2px solid # 46a43a;\n");238 httpdOutput(r, " border: 2px solid #2481ff;\n"); 237 239 httpdOutput(r, " border-bottom: 0;\n"); 238 240 httpdOutput(r, "}\n"); … … 241 243 httpdOutput(r, " width: 200px;\n"); 242 244 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"); 245 247 httpdOutput(r, " font-size: 80%;\n"); 246 248 httpdOutput(r, " min-height: 300px;\n"); … … 249 251 httpdOutput(r, "#menu h2 {\n"); 250 252 httpdOutput(r, " margin: 0;\n"); 251 httpdOutput(r, " background-color: # 46a43a;\n");253 httpdOutput(r, " background-color: #2481ff;\n"); 252 254 httpdOutput(r, " text-align: center;\n"); 253 httpdOutput(r, " color: # B4F663;\n");255 httpdOutput(r, " color: #fff;\n"); 254 256 httpdOutput(r, "}\n"); 255 257 … … 259 261 httpdOutput(r, "#content {\n"); 260 262 httpdOutput(r, " padding: 20px;\n"); 261 httpdOutput(r, " border: 2px solid # 46a43a;\n");263 httpdOutput(r, " border: 2px solid #2481ff;\n"); 262 264 httpdOutput(r, " min-height: 300px;\n"); 263 265 httpdOutput(r, "}\n"); … … 279 281 httpdOutput(r, " <li>Version: " VERSION "\n"); 280 282 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); 281 285 httpdOutput(r, " </ul>\n"); 282 286 httpdOutput(r, " <br>\n"); … … 284 288 httpdOutput(r, " <h2>Menu</h2>\n"); 285 289 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"); 289 294 httpdOutput(r, " </ul>\n"); 290 295 httpdOutput(r, "</div>\n"); … … 300 305 301 306 httpdOutput(r, "<div id=\"copyright\">\n"); 302 httpdOutput(r, "Copyright (C) 2004-200 5. 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"); 303 308 httpdOutput(r, "</div>\n"); 304 309 wifidog/wifidog-1.1.3_beta4/src/ping_thread.c
r105 r106 141 141 * Prep & send request 142 142 */ 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" 144 144 "User-Agent: WiFiDog %s\r\n" 145 145 "Host: %s\r\n" … … 152 152 (long unsigned int)((long unsigned int)time(NULL) - (long unsigned int)started_time), 153 153 config_get_config()->Proprietary, 154 config_get_config()->Network, 155 config_get_config()->Lat, 156 config_get_config()->Lon, 154 157 VERSION, 155 158 config_get_config()->auth_servers->authserv_hostname); wifidog/wifidog-1.1.3_beta4/src/util.c
r98 r106 332 332 * @return A string containing human-readable status text. MUST BE free()d by caller 333 333 */ 334 char * get_status_text( ) {334 char * get_status_text(int showtrusted) { 335 335 char buffer[STATUS_BUF_SIZ]; 336 336 ssize_t len; … … 379 379 len = strlen(buffer); 380 380 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 381 390 snprintf((buffer + len), (sizeof(buffer) - len), "Clients served this session: %lu\n\n", served_this_session); 382 391 len = strlen(buffer); 392 393 394 383 395 384 396 LOCK_CLIENT_LIST(); … … 422 434 UNLOCK_CLIENT_LIST(); 423 435 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 } 435 450 436 451 snprintf((buffer + len), (sizeof(buffer) - len), "\nAuthentication servers:\n"); wifidog/wifidog-1.1.3_beta4/src/util.h
r98 r106 61 61 * @brief Creates a human-readable paragraph of the status of wifidog 62 62 */ 63 char * get_status_text( );63 char * get_status_text(int showtrusted); 64 64 65 65 #define LOCK_GHBN() do { \ wifidog/wifidog-1.1.3_beta4/src/wdctl_thread.c
r98 r106 210 210 int len = 0; 211 211 212 status = get_status_text( );212 status = get_status_text(1); 213 213 len = strlen(status); 214 214 wifidog/wifidog-1.1.3_beta4/wifidog.conf
r98 r106 12 12 13 13 # GatewayID default 14 #GatewayID Syrus 14 15 15 16 # Parameter: ExternalInterface … … 19 20 # Set this to the external interface. Typically vlan1 for OpenWrt, and eth0 or ppp0 otherwise 20 21 21 # ExternalInterface eth0 22 ExternalInterface vlan1 22 23 23 24 # Parameter: GatewayInterface … … 27 28 # Set this to the internal interface. Typically br0 for OpenWrt, and eth1 otherwise 28 29 29 GatewayInterface eth1 30 GatewayInterface eth0 31 #GatewayInterface wds0.49153 32 # Proprietary of the node (enrolled nickname on the auth server) 33 34 Proprietary Syrus 35 36 Network mplwireless 37 38 Lat 39 Lon 40 41 TinyproxyPort 8888 30 42 31 43 # Parameter: GatewayAddress … … 52 64 #} 53 65 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 #} 66 AuthServer { 67 Hostname null.wireless-fr.org 68 SSLAvailable yes 69 Path / 70 } 71 71 72 72 # Parameter: Portal … … 75 75 # 76 76 # 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/ 78 78 79 79 # Parameter: Daemon … … 110 110 # 111 111 # How many seconds should we wait between timeout checks 112 CheckInterval 60 112 CheckInterval 600 113 113 114 114 # Parameter: ClientTimeout … … 118 118 # Set this to the desired of number of CheckInterval of inactivity before a client is logged out 119 119 # The timeout will be INTERVAL * TIMEOUT 120 ClientTimeout 5120 ClientTimeout 1 121 121 122 122 # Parameter: TrustedMACList … … 127 127 # through without authentication 128 128 #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 132 TrustedMACList 00:18:39:c5:dc:3d,00:18:39:C5:DC:C4 129 133 130 134 # Parameter: FirewallRuleSet … … 144 148 # This is the default config for the Teliphone service. 145 149 FirewallRuleSet 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 149 164 } 150 165 … … 153 168 # Used for new users validating their account 154 169 FirewallRuleSet validating-users { 155 FirewallRule block tcp port 25 156 FirewallRule allow to 0.0.0.0/0 170 FirewallRule allow tcp port 22 171 FirewallRule allow udp port 67 172 FirewallRule allow tcp port 67 173 FirewallRule allow udp port 53 174 FirewallRule allow tcp port 53 175 FirewallRule allow tcp port 80 176 FirewallRule allow tcp port 110 177 FirewallRule allow tcp port 995 178 FirewallRule allow tcp port 143 179 FirewallRule allow tcp port 993 180 FirewallRule allow tcp port 220 181 FirewallRule allow tcp port 443 182 FirewallRule block to 0.0.0.0/0 157 183 } 158 184 … … 161 187 # Used for normal validated users. 162 188 FirewallRuleSet known-users { 163 FirewallRule allow to 0.0.0.0/0 189 FirewallRule allow udp port 67 190 FirewallRule allow tcp port 67 191 FirewallRule allow udp port 53 192 FirewallRule allow tcp port 53 193 FirewallRule allow tcp port 80 194 FirewallRule allow tcp port 110 195 FirewallRule allow tcp port 995 196 FirewallRule allow tcp port 143 197 FirewallRule allow tcp port 993 198 FirewallRule allow tcp port 220 199 FirewallRule allow tcp port 443 200 FirewallRule allow tcp port 6667 201 # Skype 202 FirewallRule allow tcp port 1468 203 FirewallRule allow tcp port 22 204 FirewallRule allow tcp port 5222 205 FirewallRule allow tcp port 5223 206 FirewallRule allow tcp port 1863 207 FirewallRule allow udp port 1863 208 FirewallRule allow udp port 4000 209 FirewallRule allow tcp port 4000 210 FirewallRule allow tcp port 7000 211 FirewallRule block to 0.0.0.0/0 164 212 } 165 213
