summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--conf/config.proto1
-rwxr-xr-xgit-interface/git-serve.py5
-rw-r--r--web/html/index.php8
3 files changed, 10 insertions, 4 deletions
diff --git a/conf/config.proto b/conf/config.proto
index e5da57ad..628dac3f 100644
--- a/conf/config.proto
+++ b/conf/config.proto
@@ -29,6 +29,7 @@ pkgbuild_uri = https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=%s
log_uri = https://aur.archlinux.org/cgit/aur.git/log/?h=%s
snapshot_uri = https://aur.archlinux.org/cgit/aur.git/snapshot/%s.tar.gz
enable-maintenance = 1
+maintenance-exceptions = 127.0.0.1
[auth]
valid-keytypes = ssh-rsa ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519
diff --git a/git-interface/git-serve.py b/git-interface/git-serve.py
index 21b130c6..a6dee138 100755
--- a/git-interface/git-serve.py
+++ b/git-interface/git-serve.py
@@ -22,6 +22,7 @@ git_shell_cmd = config.get('serve', 'git-shell-cmd')
ssh_cmdline = config.get('serve', 'ssh-cmdline')
enable_maintenance = config.getboolean('options', 'enable-maintenance')
+maintenance_exc = config.get('options', 'maintenance-exceptions').split()
def pkgbase_exists(pkgbase):
db = mysql.connector.connect(host=aur_db_host, user=aur_db_user,
@@ -113,7 +114,9 @@ cmdargv = shlex.split(cmd)
action = cmdargv[0]
if enable_maintenance:
- die("The AUR is down due to maintenance. We will be back soon.")
+ remote_addr = os.environ["SSH_CLIENT"].split(" ")[0]
+ if not remote_addr in maintenance_exc:
+ die("The AUR is down due to maintenance. We will be back soon.")
if action == 'git-upload-pack' or action == 'git-receive-pack':
if len(cmdargv) < 2:
diff --git a/web/html/index.php b/web/html/index.php
index 27f81c84..27d897c7 100644
--- a/web/html/index.php
+++ b/web/html/index.php
@@ -8,9 +8,11 @@ $path = $_SERVER['PATH_INFO'];
$tokens = explode('/', $path);
if (config_get_bool('options', 'enable-maintenance') && (empty($tokens[1]) || ($tokens[1] != "css" && $tokens[1] != "images"))) {
- header("HTTP/1.0 503 Service Unavailable");
- include "./503.php";
- return;
+ if (!in_array($_SERVER['REMOTE_ADDR'], explode(" ", config_get('options', 'maintenance-exceptions')))) {
+ header("HTTP/1.0 503 Service Unavailable");
+ include "./503.php";
+ return;
+ }
}
if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {