summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-11-05 14:57:13 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-11-05 14:57:13 +0100
commit14f1f19dab3f41b5bcaeb40f63964c57eb1e25f2 (patch)
tree0bc8c1973d6d58bc8e14676cca108d50254aa6e1
parent6b4703f21deb0f140dbbeca682823f2b644a4e78 (diff)
Step 2 of the WANT_RESTRICT_FULLSCRAPE feature (fixing a bug along the way)
-rw-r--r--man5/opentracker.conf.53
-rw-r--r--src/ot_config.c2
-rw-r--r--src/ot_http.c7
-rw-r--r--src/ot_stats.c3
4 files changed, 14 insertions, 1 deletions
diff --git a/man5/opentracker.conf.5 b/man5/opentracker.conf.5
index 2250fe5..db79d4b 100644
--- a/man5/opentracker.conf.5
+++ b/man5/opentracker.conf.5
@@ -78,6 +78,9 @@ Specifies the path to the stats location. You can configure opentracker to appea
78.It access.proxy Ar ip_address_or_network 78.It access.proxy Ar ip_address_or_network
79Specifies the IP address or network of the reverse proxies. Opentracker will take the X-Forwarded-For address instead of the source IP address. Can be added more than once. 79Specifies the IP address or network of the reverse proxies. Opentracker will take the X-Forwarded-For address instead of the source IP address. Can be added more than once.
80.Pp 80.Pp
81.It access.fullscrape Ar ip_address_or_network
82Specifies the IP address or network in CIDR notation allowed to fetch fullscrapes from opentracker, in case they're restricted.
83.Pp
81.It livesync.cluster.listen Ar ip_address:port 84.It livesync.cluster.listen Ar ip_address:port
82Specifies the IP address and port opentracker will listen on for incoming live 85Specifies the IP address and port opentracker will listen on for incoming live
83sync packets to keep a cluster of opentrackers synchronized. Every member of a 86sync packets to keep a cluster of opentrackers synchronized. Every member of a
diff --git a/src/ot_config.c b/src/ot_config.c
index dfaef0d..9c5e8f0 100644
--- a/src/ot_config.c
+++ b/src/ot_config.c
@@ -276,7 +276,7 @@ static int parse_configfile(char *config_filename) {
276 FILE *config_file_handle; 276 FILE *config_file_handle;
277 char inbuf[512]; 277 char inbuf[512];
278 ot_ip6 tmpip; 278 ot_ip6 tmpip;
279#if defined(WANT_RESTRICT_STATS) || defined(WANT_IP_FROM_PROXY) || defined(WANT_SYNC_LIVE) 279#if defined(WANT_RESTRICT_STATS) || defined(WANT_RESTRICT_FULLSCRAPE) || defined(WANT_IP_FROM_PROXY) || defined(WANT_SYNC_LIVE)
280 ot_net tmpnet; 280 ot_net tmpnet;
281#endif 281#endif
282 int bound = 0; 282 int bound = 0;
diff --git a/src/ot_http.c b/src/ot_http.c
index d2dad67..cc11366 100644
--- a/src/ot_http.c
+++ b/src/ot_http.c
@@ -342,6 +342,10 @@ static ssize_t http_handle_stats(const int64_t sock, struct ot_workstruct *ws, c
342 } 342 }
343 343
344 if (mode == TASK_STATS_TPB) { 344 if (mode == TASK_STATS_TPB) {
345#ifdef WANT_RESTRICT_FULLSCRAPE
346 if (!accesslist_is_blessed(cookie->ip, OT_PERMISSION_MAY_FULLSCRAPE))
347 HTTPERROR_403_IP;
348#endif
345#ifdef WANT_COMPRESSION_GZIP 349#ifdef WANT_COMPRESSION_GZIP
346 ws->request[ws->request_size - 1] = 0; 350 ws->request[ws->request_size - 1] = 0;
347#ifndef WANT_COMPRESSION_GZIP_ALWAYS 351#ifndef WANT_COMPRESSION_GZIP_ALWAYS
@@ -402,6 +406,9 @@ static ssize_t http_handle_fullscrape(const int64_t sock, struct ot_workstruct *
402 struct http_data *cookie = fdstate_cookie(sock); 406 struct http_data *cookie = fdstate_cookie(sock);
403 int format = 0; 407 int format = 0;
404 408
409 if (!cookie)
410 HTTPERROR_500;
411
405#ifdef WANT_RESTRICT_FULLSCRAPE 412#ifdef WANT_RESTRICT_FULLSCRAPE
406 if (!accesslist_is_blessed(cookie->ip, OT_PERMISSION_MAY_FULLSCRAPE)) 413 if (!accesslist_is_blessed(cookie->ip, OT_PERMISSION_MAY_FULLSCRAPE))
407 HTTPERROR_403_IP; 414 HTTPERROR_403_IP;
diff --git a/src/ot_stats.c b/src/ot_stats.c
index 7b5b1b9..d395275 100644
--- a/src/ot_stats.c
+++ b/src/ot_stats.c
@@ -588,6 +588,9 @@ static const char *const build_features[] = {
588#ifdef WANT_RESTRICT_STATS 588#ifdef WANT_RESTRICT_STATS
589 "WANT_RESTRICT_STATS", 589 "WANT_RESTRICT_STATS",
590#endif 590#endif
591#ifdef WANT_RESTRICT_FULLSCRAPE
592 "WANT_RESTRICT_FULLSCRAPE",
593#endif
591#ifdef WANT_LOG_NUMWANT 594#ifdef WANT_LOG_NUMWANT
592 "WANT_LOG_NUMWANT", 595 "WANT_LOG_NUMWANT",
593#endif 596#endif