From 421788a86f2ecef84c98eebc74a1f8a8fe2001e9 Mon Sep 17 00:00:00 2001 From: Jacob Casper Date: Fri, 17 Apr 2020 23:29:01 -0500 Subject: [PATCH] Add ip filtering --- sockgit-listen@.service | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sockgit-listen@.service b/sockgit-listen@.service index 1674d50..869e37f 100644 --- a/sockgit-listen@.service +++ b/sockgit-listen@.service @@ -8,7 +8,7 @@ Type=oneshot User=git Group=git WorkingDirectory=/srv/git -ExecStart=/bin/bash -c 'while read REPO; do /usr/bin/git init --bare --shared $REPO.git && cd $REPO.git && /usr/bin/git remote add public $USER@$PUBLIC:$PATH/$REPO.git; done;' +ExecStart=/bin/bash -c '[ $REMOTE_ADDR == $WHITELIST_IP ] && while read REPO; do /usr/bin/git init --bare --shared $REPO.git && cd $REPO.git && /usr/bin/git remote add public $USER@$PUBLIC:$PATH/$REPO.git; done;' StandardInput=socket StandardOutput=syslog StandardError=syslog @@ -16,6 +16,7 @@ Environment="USER=git" Environment="PUBLIC=add your url" Environment="PATH=/srv/git" Environment="GIT_TEMPLATE_DIR=/usr/share/sockgit/templates" +Environment="WHITELIST_IP=your ip" [Install] WantedBy=multi-user.target -- 2.20.1