You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-32Lines changed: 45 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,67 +7,80 @@ A lightweight SSH server frontend where authentication and connections
7
7
are controlled with command handlers / shell scripts.
8
8
9
9
## Using sshfront
10
-
```
11
-
Usage: ./sshfront [options] <handler>
12
10
13
-
-a="": authentication hook. empty=allow all
14
-
-d=false: debug mode
15
-
-e=false: pass environment to handler
16
-
-h="0.0.0.0": ip to listen on
17
-
-k="~/.ssh/id_rsa": private host key path
18
-
-p="22": port to listen on
19
-
```
11
+
12
+
Usage: ./sshfront [options] <handler>
13
+
14
+
-a="": authentication hook. empty=allow all
15
+
-d=false: debug mode
16
+
-e=false: pass environment to handler
17
+
-h="0.0.0.0": ip to listen on
18
+
-k="~/.ssh/id_rsa": private host key path
19
+
-p="22": port to listen on
20
20
21
21
22
22
#### handler $command...
23
23
24
-
*`$command...` command line arguments specified to run by the SSH client
24
+
`$command...` command line arguments specified to run by the SSH client
25
25
26
-
The handler is a command that's used to handle all SSH connections. Output, stderr, and the exit code is returned to the client. If the client provides stdin, that's passed to the handler.
26
+
The handler is a command that's used to handle all SSH connections.
27
+
Output, stderr, and the exit code is returned to the client.
28
+
If the client provides stdin, that's passed to the handler.
27
29
28
-
If the authentication hook was specified, any output is parsed as environment variables and added to the handler environment. `$USER` is always the SSH user used to connect and `$SSH_ORIGINAL_COMMAND` is the command specified from the client if not interactive.
30
+
If the authentication hook was specified, any output is parsed as environment variables and added to the handler environment.
31
+
`$USER` is always the SSH user used to connect and `$SSH_ORIGINAL_COMMAND` is the command specified from the client if not interactive.
29
32
30
33
#### auth-hook $user $key
31
34
32
35
*`$user` argument is the name of the user being used to attempt the connection
33
36
*`$key` argument is the public key data being provided for authentication
34
37
35
-
The auth hook is a command used for authenticating incoming SSH connections. If it returns with exit status 0, the connection will be allowed, otherwise it will be denied. The output of auth hook must be empty, or key-value pairs in the form `KEY=value` separated by newlines, which will be added to the environment of connection handler.
38
+
The auth hook is a command used for authenticating incoming SSH connections.
39
+
If it returns with exit status 0, the connection will be allowed, otherwise it will be denied.
40
+
The output of auth hook must be empty, or key-value pairs in the form `KEY=value` separated by newlines, which will be added to the environment of connection handler.
36
41
37
42
The auth hook is optional, but if not specified then all connections are allowed.
38
43
It is a good idea to always specify an auth hook.
39
44
45
+
46
+
See example/authcheck auth hook that checks that the pub key is authorized. Usage:
47
+
48
+
sshfront -a example/authcheck
49
+
50
+
40
51
## Examples
41
52
42
53
**Many of these bypass authentication and may allow remote execution, *do not* run this in production.**
43
54
44
55
Echo server:
45
56
46
-
```
47
-
server$ sshfront $(which echo)
48
-
client$ ssh $SERVER "hello world"
49
-
hello world
50
-
```
57
+
server$ sshfront $(which echo)
58
+
client$ ssh $SERVER "hello world"
59
+
hello world
51
60
52
61
Echo host's environment to clients:
53
62
54
-
```
55
-
server$ sshfront -e $(env)
56
-
client$ ssh $SERVER
57
-
USER=root
58
-
HOME=/root
59
-
LANG=en_US.UTF-8
60
-
...
61
-
```
63
+
server$ sshfront -e $(env)
64
+
client$ ssh $SERVER
65
+
USER=root
66
+
HOME=/root
67
+
LANG=en_US.UTF-8
68
+
...
62
69
63
70
Bash server:
64
71
65
-
```
66
-
server$ sshfront $(which bash)
67
-
client$ ssh $SERVER
68
-
bash-4.3$ echo "this is a bash instance running on the server"
69
-
this is a bash instance running on the server
70
-
```
72
+
server$ sshfront $(which bash)
73
+
client$ ssh $SERVER
74
+
bash-4.3$ echo "this is a bash instance running on the server"
0 commit comments