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
-k="": pem file of private keys (read from SSH_PRIVATE_KEYS by default)
12
+
-h="": host ip to listen on
12
13
-p="22": port to listen on
13
14
-s=false: run exec handler via SHELL
14
15
```
16
+
17
+
15
18
#### auth-handler $user $key
16
19
17
20
*`$user` argument is the name of the user being used to attempt the connection
@@ -21,12 +24,47 @@ auth-handler is the path to an executable that's used for authenticating incomin
21
24
22
25
Although auth-handler is required, you can still achieve no-auth open access by providing `/usr/bin/true` as auth-handler.
23
26
27
+
24
28
#### exec-handler $command...
25
29
26
30
*`$command...` arguments is the command line that was specified to run by the SSH client
27
31
28
32
exec-handler is the path to an executable that's used to execute the command provided by the client. The meaning of that is quite flexible. All of the stdout and stderr is returned to the client, including the exit status. If the client provides stdin, that's passed to the exec-handler. Any environment variables provided by the auth-handler output will be available to exec-handler, as well as `$USER` and `$SSH_ORIGINAL_COMMAND` environment variables.
29
33
34
+
35
+
## Examples
36
+
37
+
**These examples bypass all authentication and allow remote execution, *do not* run this in production.**
38
+
39
+
Echo server (with accept-all auth):
40
+
41
+
```
42
+
server$ execd $(which true) $(which echo)
43
+
client$ ssh $SERVER "hello world"
44
+
hello world
45
+
```
46
+
47
+
Echo host's environment to clients (with accept-all auth):
48
+
49
+
```
50
+
server$ execd -e $(which true) $(env)
51
+
client$ ssh $SERVER
52
+
USER=root
53
+
HOME=/root
54
+
LANG=en_US.UTF-8
55
+
...
56
+
```
57
+
58
+
Bash server (with accept-all auth):
59
+
60
+
```
61
+
server$ execd $(which true) $(which bash)
62
+
client$ ssh $SERVER
63
+
bash-4.3$ echo "this is a bash instance running on the server"
64
+
this is a bash instance running on the server
65
+
```
66
+
67
+
30
68
## Credit / History
31
69
32
70
It started with [gitreceive](https://github.com/progrium/gitreceive), which was then used in [Dokku](https://github.com/progrium/dokku). Then I made a more generalized version of gitreceive, more similar to execd, called [sshcommand](https://github.com/progrium/sshcommand), which eventually replaced gitreceive in Dokku. When I started work on Flynn, the first projects included [gitreceived](https://github.com/flynn/gitreceived) (a standalone daemon version of gitreceive). This was refined by the Flynn community, namely Jonathan Rudenberg.
@@ -39,4 +77,4 @@ This project was made possible thanks to [DigitalOcean](http://digitalocean.com)
0 commit comments