Skip to content

Commit cb2c32b

Browse files
committed
renaming and refactoring
1 parent ff5bda9 commit cb2c32b

File tree

13 files changed

+323
-305
lines changed

13 files changed

+323
-305
lines changed

LICENSE

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
Copyright (C) 2014 Jeff Lindsay
2-
Copyright (c) 2013-2014 Prime Directive, Inc. All rights reserved.
1+
The MIT License (MIT)
32

4-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3+
Copyright (c) 2015 Glider Labs
54

6-
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
711

8-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
914

10-
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11-
12-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
NAME=execd
2-
OWNER=progrium
1+
NAME=sshfront
2+
OWNER=gliderlabs
33
ARCH=$(shell uname -m)
4-
VERSION=0.1.0
4+
VERSION=0.2.0
55

66
build:
77
mkdir -p build/Linux && GOOS=linux CGO_ENABLED=0 go build -a \
8+
-ldflags "-X main.Version $(VERSION)" \
89
-installsuffix cgo \
910
-o build/Linux/$(NAME)
1011
mkdir -p build/Darwin && GOOS=darwin CGO_ENABLED=0 go build -a \
12+
-ldflags "-X main.Version $(VERSION)" \
1113
-installsuffix cgo \
1214
-o build/Darwin/$(NAME)
1315

@@ -16,7 +18,7 @@ deps:
1618
go get || true
1719

1820
example: build
19-
./execd -h localhost -p 2022 -k example/host_pk.pem example/authcheck example/helloworld
21+
./build/Darwin/sshfront -d -p 2222 -k ~/.ssh/id_rsa example/helloworld
2022

2123

2224
release:

README.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
# execd
1+
# sshfront
22

3-
A very lightweight SSH server frontend written in Go. The backend auth and execution logic is handled by commands you specify, letting you customize its behavior via your own scripts/executables.
3+
A lightweight SSH server frontend written in Go. Authentication and connections
4+
are controlled with command handlers / shell scripts.
45

5-
## Using execd
6+
## Using sshfront
67
```
7-
Usage: ./execd [options] <auth-handler> <exec-handler>
8+
Usage: ./sshfront [options] <handler>
89
910
-d=false: debug mode displays handler output
1011
-e=false: pass environment to handlers
1112
-k="": pem file of private keys (read from SSH_PRIVATE_KEYS by default)
1213
-h="": host ip to listen on
1314
-p="22": port to listen on
14-
-s=false: run exec handler via SHELL
1515
```
1616

1717

@@ -39,15 +39,15 @@ exec-handler is the path to an executable that's used to execute the command pro
3939
Echo server (with accept-all auth):
4040

4141
```
42-
server$ execd $(which true) $(which echo)
42+
server$ sshfront $(which true) $(which echo)
4343
client$ ssh $SERVER "hello world"
4444
hello world
4545
```
4646

4747
Echo host's environment to clients (with accept-all auth):
4848

4949
```
50-
server$ execd -e $(which true) $(env)
50+
server$ sshfront -e $(which true) $(env)
5151
client$ ssh $SERVER
5252
USER=root
5353
HOME=/root
@@ -58,19 +58,13 @@ LANG=en_US.UTF-8
5858
Bash server (with accept-all auth):
5959

6060
```
61-
server$ execd $(which true) $(which bash)
61+
server$ sshfront $(which true) $(which bash)
6262
client$ ssh $SERVER
6363
bash-4.3$ echo "this is a bash instance running on the server"
6464
this is a bash instance running on the server
6565
```
6666

6767

68-
## Credit / History
69-
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.
71-
72-
Eventually I came to realize gitreceived could be generalized / simplified further in a way that could be used *with* the original gitreceive, *and* replace sshcommand, *and* be used in Dokku, *and* potentially replace gitreceived in Flynn. This project takes learnings from all those projects, though mostly gitreceived.
73-
7468
## Sponsors
7569

7670
This project was made possible thanks to [DigitalOcean](http://digitalocean.com).

circle.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ dependencies:
55
- make deps
66
- make build
77
post:
8-
- tar -czvf $CIRCLE_ARTIFACTS/execd-linux.tgz -C build/Linux execd
9-
- tar -czvf $CIRCLE_ARTIFACTS/execd-darwin.tgz -C build/Darwin execd
8+
- tar -czvf $CIRCLE_ARTIFACTS/sshfront-linux.tgz -C build/Linux sshfront
9+
- tar -czvf $CIRCLE_ARTIFACTS/sshfront-darwin.tgz -C build/Darwin sshfront
1010
- tar -czvf $CIRCLE_ARTIFACTS/go-workspace.tgz -C ~/.go_workspace .
1111

1212
test:

example/authcheck

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,2 @@
11
#!/bin/bash
2-
3-
USER="$1"
4-
KEY="$2"
5-
6-
generate_fingerprint() {
7-
awk '{print $2}' | base64 -d | md5sum | awk '{print $1}' | sed -e 's/../:&/2g'
8-
}
9-
10-
echo "USER=$USER"
11-
echo "FINGERPRINT=$(echo "$KEY" | generate_fingerprint)"
12-
13-
grep "$KEY" "/home/$USER/.ssh/authorized_keys" > /dev/null 2>&1
2+
grep "$2" "/home/$1/.ssh/authorized_keys" > /dev/null 2>&1

example/helloworld

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash
2-
echo "Hello world"
3-
read hello
4-
echo "OK: $hello"
2+
echo "Hello world: $@"
3+
env
4+
if [[ -t 1 ]]; then
5+
exec bash
6+
fi

example/host_pk.pem

Lines changed: 0 additions & 12 deletions
This file was deleted.

example/id_dsa

Lines changed: 0 additions & 12 deletions
This file was deleted.

example/id_dsa.pub

Lines changed: 0 additions & 1 deletion
This file was deleted.

execd.go

Lines changed: 0 additions & 201 deletions
This file was deleted.

0 commit comments

Comments
 (0)