summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2023-05-27 22:34:55 -0400
committerAndrew Cady <d@jerkface.net>2023-05-27 22:35:09 -0400
commitf6a5dafe904909bbee1b2da0d3a7786fd8952871 (patch)
treeebaffcc2043844dc1d04cc174bb45498f7276d47
parente6f31e56797cf45b13c0d98499d647125521feeb (diff)
add sshd config files
these contain a hard-coded username at the moment
-rw-r--r--Makefile2
-rw-r--r--src/fossil-user.conf4
-rwxr-xr-xsrc/user-d.AnonymousForceCommand2
-rwxr-xr-xsrc/user-d.AuthorizedKeysCommand7
4 files changed, 15 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 12b9329..e9b3bf9 100644
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,8 @@ bindir = /usr/local/bin
42 42
43default: install start follow 43default: install start follow
44install: 44install:
45 install -t /etc/ssh/ -- src/user-d.AnonymousForceCommand src/user-d.AuthorizedKeysCommand
46 install -m644 -t /etc/ssh/sshd_config.d -- src/fossil-user.conf
45 install -m644 -t $(unitdir) -- $(unit_files) 47 install -m644 -t $(unitdir) -- $(unit_files)
46 install -t $(bindir) -- $(executables) 48 install -t $(bindir) -- $(executables)
47 systemctl daemon-reload 49 systemctl daemon-reload
diff --git a/src/fossil-user.conf b/src/fossil-user.conf
new file mode 100644
index 0000000..f4296fd
--- /dev/null
+++ b/src/fossil-user.conf
@@ -0,0 +1,4 @@
1Match User d
2ExposeAuthInfo=yes
3AuthorizedKeysCommandUser=root
4AuthorizedKeysCommand=/etc/ssh/user-d.AuthorizedKeysCommand "%t %k" "%f"
diff --git a/src/user-d.AnonymousForceCommand b/src/user-d.AnonymousForceCommand
new file mode 100755
index 0000000..a8a09f3
--- /dev/null
+++ b/src/user-d.AnonymousForceCommand
@@ -0,0 +1,2 @@
1#!/bin/bash
2socat stdio /run/fossil-user.S
diff --git a/src/user-d.AuthorizedKeysCommand b/src/user-d.AuthorizedKeysCommand
new file mode 100755
index 0000000..6bf0ec9
--- /dev/null
+++ b/src/user-d.AuthorizedKeysCommand
@@ -0,0 +1,7 @@
1#!/bin/sh
2cmd=/etc/ssh/user-d.AnonymousForceCommand
3[ -x "$cmd" ] || exit
4
5key=$1
6shift
7printf 'restrict,pty,command="%s" %s\n' "$cmd $*" "$key"