diff options
| -rw-r--r-- | Makefile | 1 | ||||
| -rw-r--r-- | opentracker.conf.sample | 7 | ||||
| -rw-r--r-- | src/ot_config.c | 11 | ||||
| -rw-r--r-- | src/ot_http.c | 5 |
4 files changed, 23 insertions, 1 deletions
| @@ -12,6 +12,7 @@ STRIP?=strip | |||
| 12 | #FEATURES+=-DWANT_IP_FROM_QUERY_STRING | 12 | #FEATURES+=-DWANT_IP_FROM_QUERY_STRING |
| 13 | 13 | ||
| 14 | #FEATURES+=-DWANT_RESTRICT_STATS | 14 | #FEATURES+=-DWANT_RESTRICT_STATS |
| 15 | #FEATURES+=-DWANT_RESTRICT_FULLSCRAPE | ||
| 15 | #FEATURES+=-DWANT_IP_FROM_PROXY | 16 | #FEATURES+=-DWANT_IP_FROM_PROXY |
| 16 | #FEATURES+=-DWANT_LOG_NUMWANT | 17 | #FEATURES+=-DWANT_LOG_NUMWANT |
| 17 | #FEATURES+=-DWANT_MODEST_FULLSCRAPES | 18 | #FEATURES+=-DWANT_MODEST_FULLSCRAPES |
diff --git a/opentracker.conf.sample b/opentracker.conf.sample index 7b35369..ba8497f 100644 --- a/opentracker.conf.sample +++ b/opentracker.conf.sample | |||
| @@ -119,7 +119,6 @@ | |||
| 119 | # | 119 | # |
| 120 | # access.stats_path stats | 120 | # access.stats_path stats |
| 121 | # | 121 | # |
| 122 | # II | ||
| 123 | # If opentracker lives behind one or multiple reverse proxies, | 122 | # If opentracker lives behind one or multiple reverse proxies, |
| 124 | # every http connection appears to come from these proxies. In order to | 123 | # every http connection appears to come from these proxies. In order to |
| 125 | # take the X-Forwarded-For address instead, compile opentracker with the | 124 | # take the X-Forwarded-For address instead, compile opentracker with the |
| @@ -128,6 +127,12 @@ | |||
| 128 | # access.proxy 10.0.1.23 | 127 | # access.proxy 10.0.1.23 |
| 129 | # access.proxy 192.0.0.0/8 | 128 | # access.proxy 192.0.0.0/8 |
| 130 | # | 129 | # |
| 130 | # Symmetrically, if you have restricted the access to fullscrapes with | ||
| 131 | # the WANT_RESTRICT_FULLSCRAPE compile option, this is how you bless ip | ||
| 132 | # addresses to fetch fullscrapes | ||
| 133 | # | ||
| 134 | # access.fullscrape 10.1.1.23 | ||
| 135 | # | ||
| 131 | 136 | ||
| 132 | # III) Live sync uses udp multicast packets to keep a cluster of opentrackers | 137 | # III) Live sync uses udp multicast packets to keep a cluster of opentrackers |
| 133 | # synchronized. This option tells opentracker which port to listen for | 138 | # synchronized. This option tells opentracker which port to listen for |
diff --git a/src/ot_config.c b/src/ot_config.c index 6b51c61..dfaef0d 100644 --- a/src/ot_config.c +++ b/src/ot_config.c | |||
| @@ -205,6 +205,7 @@ typedef enum { | |||
| 205 | CONFIG_ACCESS_STATS, | 205 | CONFIG_ACCESS_STATS, |
| 206 | CONFIG_ACCESS_STATS_PATH, | 206 | CONFIG_ACCESS_STATS_PATH, |
| 207 | CONFIG_ACCESS_PROXY, | 207 | CONFIG_ACCESS_PROXY, |
| 208 | CONFIG_ACCESS_FULLSCRAPE, | ||
| 208 | CONFIG_TRACKER_REDIRECT_URL, | 209 | CONFIG_TRACKER_REDIRECT_URL, |
| 209 | CONFIG_LIVESYNC_CLUSTER_NODE_IP, | 210 | CONFIG_LIVESYNC_CLUSTER_NODE_IP, |
| 210 | CONFIG_LIVESYNC_CLUSTER_LISTEN, | 211 | CONFIG_LIVESYNC_CLUSTER_LISTEN, |
| @@ -244,6 +245,9 @@ static const config_key config_keys[] = { | |||
| 244 | #ifdef WANT_IP_FROM_PROXY | 245 | #ifdef WANT_IP_FROM_PROXY |
| 245 | CONFIG_KEY("access.proxy", CONFIG_ACCESS_PROXY), | 246 | CONFIG_KEY("access.proxy", CONFIG_ACCESS_PROXY), |
| 246 | #endif | 247 | #endif |
| 248 | #ifdef WANT_RESTRICT_FULLSCRAPE | ||
| 249 | CONFIG_KEY("access.fullscrape", CONFIG_ACCESS_FULLSCRAPE), | ||
| 250 | #endif | ||
| 247 | CONFIG_KEY("tracker.redirect_url", CONFIG_TRACKER_REDIRECT_URL), | 251 | CONFIG_KEY("tracker.redirect_url", CONFIG_TRACKER_REDIRECT_URL), |
| 248 | #ifdef WANT_SYNC_LIVE | 252 | #ifdef WANT_SYNC_LIVE |
| 249 | CONFIG_KEY("livesync.cluster.node_ip", CONFIG_LIVESYNC_CLUSTER_NODE_IP), | 253 | CONFIG_KEY("livesync.cluster.node_ip", CONFIG_LIVESYNC_CLUSTER_NODE_IP), |
| @@ -376,6 +380,13 @@ static int parse_configfile(char *config_filename) { | |||
| 376 | accesslist_bless_net(&tmpnet, OT_PERMISSION_MAY_PROXY); | 380 | accesslist_bless_net(&tmpnet, OT_PERMISSION_MAY_PROXY); |
| 377 | break; | 381 | break; |
| 378 | #endif | 382 | #endif |
| 383 | #ifdef WANT_RESTRICT_FULLSCRAPE | ||
| 384 | case CONFIG_ACCESS_FULLSCRAPE: | ||
| 385 | if (!scan_ip6_net(p, &tmpnet)) | ||
| 386 | goto parse_error; | ||
| 387 | accesslist_bless_net(&tmpnet, OT_PERMISSION_MAY_FULLSCRAPE); | ||
| 388 | break; | ||
| 389 | #endif | ||
| 379 | case CONFIG_TRACKER_REDIRECT_URL: | 390 | case CONFIG_TRACKER_REDIRECT_URL: |
| 380 | set_config_option(&g_redirecturl, p); | 391 | set_config_option(&g_redirecturl, p); |
| 381 | break; | 392 | break; |
diff --git a/src/ot_http.c b/src/ot_http.c index 533a876..d2dad67 100644 --- a/src/ot_http.c +++ b/src/ot_http.c | |||
| @@ -402,6 +402,11 @@ static ssize_t http_handle_fullscrape(const int64_t sock, struct ot_workstruct * | |||
| 402 | struct http_data *cookie = fdstate_cookie(sock); | 402 | struct http_data *cookie = fdstate_cookie(sock); |
| 403 | int format = 0; | 403 | int format = 0; |
| 404 | 404 | ||
| 405 | #ifdef WANT_RESTRICT_FULLSCRAPE | ||
| 406 | if (!accesslist_is_blessed(cookie->ip, OT_PERMISSION_MAY_FULLSCRAPE)) | ||
| 407 | HTTPERROR_403_IP; | ||
| 408 | #endif | ||
| 409 | |||
| 405 | #ifdef WANT_MODEST_FULLSCRAPES | 410 | #ifdef WANT_MODEST_FULLSCRAPES |
| 406 | { | 411 | { |
| 407 | ot_scrape_log this_peer, *new_peer; | 412 | ot_scrape_log this_peer, *new_peer; |
