summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile12
-rwxr-xr-xgit-hooks/post-receive4
2 files changed, 13 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 9d03294..bc103f1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,20 @@
+# The git user home, from where repos are served
PREFIX=/srv/git
+# The git user
USER=git
+# The git-shell path
GIT_SHELL=/usr/bin/git-shell
+# The hacking.git clone
HACKERS=$(PWD)
# Create the user
user:
- useradd -d $(PREFIX) -m -r -s $(GIT_SHELL) -U $(USER)
+ useradd --home $(PREFIX) \
+ --shell $(GIT_SHELL) \
+ --create-home \
+ --system \
+ --user-group \
+ $(USER)
# Create the hackers.git bare repo and clone as .ssh
# Then create needed symlinks and add hooks to hackers.git
@@ -13,6 +22,7 @@ install:
cd $(PREFIX); \
git clone --bare $(HACKERS) hackers.git && \
git clone hackers.git .ssh && \
+ chmod 700 $(PREFIX) && \
chmod 700 .ssh && \
chmod 600 .ssh/authorized_keys && \
ln -s $(PREFIX)/.ssh/git-hooks/* hackers.git/hooks/ && \
diff --git a/git-hooks/post-receive b/git-hooks/post-receive
index 6164d81..b78c54d 100755
--- a/git-hooks/post-receive
+++ b/git-hooks/post-receive
@@ -5,7 +5,7 @@
# cp .ssh/git-hooks/post-receive hackers.git/hooks/
# fail on any error
-set -E
+set -e
# the ssh dir
ssh_dir=${HOME}/.ssh
@@ -15,7 +15,7 @@ git --git-dir ${ssh_dir}/.git \
--work-tree ${ssh_dir} \
pull origin master
-# secure the files
+# secure the files (sshd will refuse connections otherwise)
chmod 600 ${ssh_dir}/authorized_keys
chmod 700 ${ssh_dir}