File tree 4 files changed +28
-4
lines changed
4 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -2,15 +2,15 @@ NAME=sshfront
2
2
OWNER =gliderlabs
3
3
ARCH =$(shell uname -m)
4
4
RMFLAG =--rm
5
- VERSION =0.2.0
5
+ VERSION =0.2.1
6
6
7
7
build :
8
8
mkdir -p build/Linux && GOOS=linux CGO_ENABLED=0 go build -a \
9
- -ldflags " -X main.Version $( VERSION) " \
9
+ -ldflags " -X main.Version= $( VERSION) " \
10
10
-installsuffix cgo \
11
11
-o build/Linux/$(NAME )
12
12
mkdir -p build/Darwin && GOOS=darwin CGO_ENABLED=0 go build -a \
13
- -ldflags " -X main.Version $( VERSION) " \
13
+ -ldflags " -X main.Version= $( VERSION) " \
14
14
-installsuffix cgo \
15
15
-o build/Darwin/$(NAME )
16
16
Original file line number Diff line number Diff line change 1
1
# sshfront
2
2
3
+ [ ![ CircleCI] ( https://img.shields.io/circleci/project/gliderlabs/sshfront/release.svg )] ( https://circleci.com/gh/gliderlabs/sshfront )
4
+ [ ![ IRC Channel] ( https://img.shields.io/badge/irc-%23gliderlabs-blue.svg )] ( https://kiwiirc.com/client/irc.freenode.net/#gliderlabs )
5
+
3
6
A lightweight SSH server frontend where authentication and connections
4
7
are controlled with command handlers / shell scripts.
5
8
@@ -74,3 +77,4 @@ This project was made possible thanks to [Deis](http://deis.io) and [DigitalOcea
74
77
## License
75
78
76
79
MIT
80
+ <img src =" https://ga-beacon.appspot.com/UA-58928488-2/sshfront/readme?pixel " />
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ echo " Stdin:"
3
+ cat
Original file line number Diff line number Diff line change @@ -163,10 +163,16 @@ func (h *sshHandler) Exit(err error) error {
163
163
return err
164
164
}
165
165
166
+ type EnvVar struct {
167
+ Name , Value string
168
+ }
169
+
166
170
func (h * sshHandler ) Request (req * ssh.Request ) {
167
171
switch req .Type {
168
172
case "exec" :
169
173
h .handleExec (req )
174
+ case "env" :
175
+ h .handleEnv (req )
170
176
case "pty-req" :
171
177
h .handlePty (req )
172
178
case "window-change" :
@@ -178,6 +184,14 @@ func (h *sshHandler) Request(req *ssh.Request) {
178
184
}
179
185
}
180
186
187
+ func (h * sshHandler ) handleEnv (req * ssh.Request ) {
188
+ var pair EnvVar
189
+ ssh .Unmarshal (req .Payload , & pair )
190
+ envvar := fmt .Sprintf ("%s=%s" , pair .Name , pair .Value )
191
+ h .Env = append (h .Env , envvar )
192
+ req .Reply (true , nil )
193
+ }
194
+
181
195
func (h * sshHandler ) handleExec (req * ssh.Request ) {
182
196
h .Lock ()
183
197
defer h .Unlock ()
@@ -207,7 +221,10 @@ func (h *sshHandler) handleExec(req *ssh.Request) {
207
221
h .channel .Close ()
208
222
return
209
223
}
210
- go io .Copy (stdinPipe , h .channel )
224
+ go func () {
225
+ defer stdinPipe .Close ()
226
+ io .Copy (stdinPipe , h .channel )
227
+ }()
211
228
212
229
if req .WantReply {
213
230
req .Reply (true , nil )
You can’t perform that action at this time.
0 commit comments