summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorAndrew Cady <d@cryptonomic.net>2021-10-22 15:22:37 -0400
committerAndrew Cady <d@cryptonomic.net>2021-10-23 11:17:15 -0400
commita19dce5c18f6d6370b58aa3b9dd26550a589fc8c (patch)
treeb8625d617d8ad85e0715b36400411f53d9ad1a75 /Makefile
Minimal Git/SSH Rhizome
Requires Sudo access to configure OpenSSH. It would be possible to run OpenSSH on a non-default port and not require root access. That is not implemented.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile24
1 files changed, 24 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..bd63693
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,24 @@
1ifeq ($(shell id -u),0)
2SUDO =
3else
4SUDO = sudo
5endif
6
7ROOT_INSTALL = $(SUDO) install
8
9USER != echo "$${SUDO_USER:-$$(id -un)}"
10
11SSH_CONFIG_DIR = /etc/ssh
12SSHD_CONFIG_DIR = $(SSH_CONFIG_DIR)/sshd_config.d
13SSH_LIB_DIR = /usr/lib/ssh
14USER_SSH_CONFIG_DIR = ~$(USER)/.ssh
15
16.PHONY: install
17install:
18 install -t $(USER_SSH_CONFIG_DIR) AnonymousAccessCommand
19 $(ROOT_INSTALL) -d "$(SSH_CONFIG_DIR)" "$(SSHD_CONFIG_DIR)" "$(SSH_LIB_DIR)" || true
20 $(ROOT_INSTALL) -m0644 -t "$(SSHD_CONFIG_DIR)" anonymous-access.conf || true
21 $(ROOT_INSTALL) -t "$(SSH_LIB_DIR)" AuthorizedKeysCommand || true
22 [ -e "$(SSH_LIB_DIR)"/AuthorizedKeysCommand ] || $(SUDO) ln -s -t /etc/ssh "$(SSH_LIB_DIR)"/AuthorizedKeysCommand
23
24include tests.makefile