# Whether it's OK to use an IP address from a known local/private range
LOCAL_OK = no
+# Whether a remote peer can access the statistics page
+REMOTE_STATS = yes
+
# Unload the packages cache after an interval of inactivity this long.
# The packages cache uses a lot of memory, and only takes a few seconds
# to reload when a new request arrives.
else:
log.msg('Hash could not be found in database: %r' % hash)
- # Only local requests (apt) get past this point
- if request.remoteAddr.host != "127.0.0.1":
- log.msg('Blocked illegal access to %s from %s' % (request.uri, request.remoteAddr))
- return None, ()
-
- # Block access to index .diff files (for now)
- if 'Packages.diff' in segments or 'Sources.diff' in segments:
- return None, ()
-
if len(name) > 1:
# It's a request from apt
+
+ # Only local requests (apt) get past this point
+ if request.remoteAddr.host != "127.0.0.1":
+ log.msg('Blocked illegal access to %s from %s' % (request.uri, request.remoteAddr))
+ return None, ()
+
+ # Block access to index .diff files (for now)
+ if 'Packages.diff' in segments or 'Sources.diff' in segments or name == 'favicon.ico':
+ return None, ()
+
return FileDownloader(self.directory.path, self.manager), segments[0:]
else:
# Will render the statistics page
+
+ # Only local requests for stats are allowed
+ if not config.getboolean('DEFAULT', 'REMOTE_STATS') and request.remoteAddr.host != "127.0.0.1":
+ log.msg('Blocked illegal access to %s from %s' % (request.uri, request.remoteAddr))
+ return None, ()
+
return self, ()
log.msg('Got a malformed request for "%s" from %s' % (request.uri, request.remoteAddr))
# Whether it's OK to use an IP address from a known local/private range
'LOCAL_OK': 'no',
+ # Whether a remote peer can access the statistics page
+ 'REMOTE_STATS': 'yes',
+
# Unload the packages cache after an interval of inactivity this long.
# The packages cache uses a lot of memory, and only takes a few seconds
# to reload when a new request arrives.
(Default is false)</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>REMOTE_STATS = <replaceable>boolean</replaceable></option></term>
+ <listitem>
+ <para>Whether a remote peer can access the statistics page.
+ (Default is True)</para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term><option>UNLOAD_PACKAGES_CACHE = <replaceable>time</replaceable></option></term>
<listitem>
# Whether it's OK to use an IP addres from a known local/private range
LOCAL_OK = yes
+# Whether a remote peer can access the statistics page
+REMOTE_STATS = yes
+
# Unload the packages cache after an interval of inactivity this long.
# The packages cache uses a lot of memory, and only takes a few seconds
# to reload when a new request arrives.