Add ip filtering
authorJacob Casper <dev@jacobcasper.com>
Sat, 18 Apr 2020 04:29:01 +0000 (23:29 -0500)
committerJacob Casper <dev@jacobcasper.com>
Sat, 18 Apr 2020 04:29:01 +0000 (23:29 -0500)
sockgit-listen@.service

index 1674d50..869e37f 100644 (file)
@@ -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