Skip to content

Commit 2ffe548

Browse files
committed
Improve documentation, typos
1 parent 9931db0 commit 2ffe548

File tree

3 files changed

+33
-32
lines changed

3 files changed

+33
-32
lines changed

config/sshproxy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# "2006-01-02T15:04:05.999999999Z07:00").
2929
# The subdirectories will be created if needed.
3030
# For example: "/var/lib/sshproxy/dumps/{user}/{time}-{sid}.dump"
31-
# It can also be "etcd", in order to store stats into etcd
31+
# It can also be "etcd", in order to store stats into etcd.
3232
# It can also be a network address where to send dumps if specified as
3333
# 'TCP:host:port' (the TCP is case sensitive), e.g. 'TCP:collector:5555'.
3434
#dump: ""

doc/sshproxy.yaml.txt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ The subdirectories will be created if needed with the user as owner. So the
6565
user needs to have the right to write in this directory. For example:
6666
'/var/spool/sshproxy/\{user}/\{time}-\{sid}.dump'
6767

68+
It can also be "etcd", in order to store stats into etcd.
69+
6870
It can also be a network address where to send dumps if specified as
6971
'TCP:host:port' (the TCP is case sensitive), e.g. 'TCP:collector:5555'.
7072

@@ -99,20 +101,10 @@ It can also be a network address where to send dumps if specified as
99101

100102
Commands can be translated between what is received by sshproxy and what is
101103
executed by the ssh forked by sshproxy. *translate_commands* is an associative
102-
array which keys are strings containing the exact user command. The value is
103-
an associative array containing:
104-
105-
An associative array *ssh* specifies the SSH options:
106-
107-
*exe*::
108-
path or command to use for the SSH client ('ssh' by default).
109-
110-
*args*::
111-
a list of arguments for the SSH client. Its default value is: '["-q",
112-
"-Y"]'.
113-
114-
*disable_dump*::
115-
false by default. If true, no dumps will be done for this command.
104+
array whose keys are strings containing the exact user command. *ssh_args*
105+
contains an optional list of options that will be passed to ssh. *command* is
106+
a mandatory string, the actual executed command. *disable_dump* is false by
107+
default. If true, no dumps will be done for this command.
116108

117109
For example, we can have the following:
118110

@@ -128,6 +120,15 @@ For example, we can have the following:
128120
command: "sftp"
129121
disable_dump: true
130122

123+
An associative array *ssh* specifies the SSH options:
124+
125+
*exe*::
126+
path or command to use for the SSH client ('ssh' by default).
127+
128+
*args*::
129+
a list of arguments for the SSH client. Its default value is: '["-q",
130+
"-Y"]'.
131+
131132
etcd configuration is provided in an associative array *etcd* whose keys are:
132133

133134
*endpoints*::

test/centos-image/sshproxy_test.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ var simpleConnectTests = []struct {
224224

225225
func TestSimpleConnect(t *testing.T) {
226226
for _, tt := range simpleConnectTests {
227-
ctx, cancel := context.WithTimeout(context.Background(), 5 * time.Second)
227+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
228228
defer cancel()
229229
args, cmd := prepareCommand(tt.user+"gateway1", tt.port, "hostname")
230230
_, stdout, stderr, err := runCommand(ctx, "ssh", args, nil, nil)
@@ -250,7 +250,7 @@ var environmentTests = []struct {
250250

251251
func TestEnvironment(t *testing.T) {
252252
for _, tt := range environmentTests {
253-
ctx, cancel := context.WithTimeout(context.Background(), 5 * time.Second)
253+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
254254
defer cancel()
255255
args, cmd := prepareCommand(tt.user+"gateway1", tt.port, "echo $XMODIFIERS")
256256
_, stdout, stderr, err := runCommand(ctx, "ssh", args, nil, nil)
@@ -265,7 +265,7 @@ func TestEnvironment(t *testing.T) {
265265

266266
func TestReturnCode(t *testing.T) {
267267
for _, exitCode := range []int{0, 3} {
268-
ctx, cancel := context.WithTimeout(context.Background(), 5 * time.Second)
268+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
269269
defer cancel()
270270
args, cmd := prepareCommand("gateway1", 2023, fmt.Sprintf("exit %d", exitCode))
271271
rc, _, _, _ := runCommand(ctx, "ssh", args, nil, nil)
@@ -276,7 +276,7 @@ func TestReturnCode(t *testing.T) {
276276
}
277277

278278
func TestMainSSHDied(t *testing.T) {
279-
ctx, cancel := context.WithTimeout(context.Background(), 120 * time.Second)
279+
ctx, cancel := context.WithTimeout(context.Background(), 120*time.Second)
280280
defer cancel()
281281
args, _ := prepareCommand("gateway1", 2023, "sleep 60")
282282
ch := make(chan *os.Process, 1)
@@ -295,7 +295,7 @@ func TestEtcdConnections(t *testing.T) {
295295
// remove old connections stored in etcd
296296
time.Sleep(4 * time.Second)
297297

298-
ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
298+
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
299299
defer cancel()
300300
args, _ := prepareCommand("gateway1", 2023, "sleep 20")
301301
ch := make(chan *os.Process)
@@ -349,7 +349,7 @@ func TestStickyConnections(t *testing.T) {
349349
disableHost("server1")
350350
checkHostState(t, "server1", "disabled")
351351

352-
ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
352+
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
353353
defer cancel()
354354
args, _ := prepareCommand("gateway1", 2022, "sleep 20")
355355
ch := make(chan *os.Process)
@@ -381,7 +381,7 @@ func TestNotLongStickyConnections(t *testing.T) {
381381
disableHost("server1")
382382
checkHostState(t, "server1", "disabled")
383383

384-
ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
384+
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
385385
defer cancel()
386386
args, _ := prepareCommand("gateway1", 2022, "hostname")
387387
_, _, _, err := runCommand(ctx, "ssh", args, nil, nil)
@@ -412,7 +412,7 @@ func TestLongStickyConnections(t *testing.T) {
412412
disableHost("server1")
413413
checkHostState(t, "server1", "disabled")
414414

415-
ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
415+
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
416416
defer cancel()
417417
args, _ := prepareCommand("gateway1", 2022, "hostname")
418418
_, _, _, err := runCommand(ctx, "ssh", args, nil, nil)
@@ -440,7 +440,7 @@ func TestBalancedConnections(t *testing.T) {
440440
// remove old connections stored in etcd
441441
time.Sleep(4 * time.Second)
442442

443-
ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
443+
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
444444
defer cancel()
445445
args, _ := prepareCommand("gateway1", 2022, "sleep 20")
446446
ch := make(chan *os.Process)
@@ -468,7 +468,7 @@ func TestBalancedConnections(t *testing.T) {
468468
}
469469

470470
func checkHostCheck(t *testing.T, host string, check time.Time) time.Time {
471-
ctx, cancel := context.WithTimeout(context.Background(), 5 * time.Second)
471+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
472472
defer cancel()
473473
args, _ := prepareCommand("gateway1", 2023, "hostname")
474474
want := time.Now()
@@ -482,7 +482,7 @@ func checkHostCheck(t *testing.T, host string, check time.Time) time.Time {
482482
found = true
483483
lastCheck = h.Ts
484484
if check.IsZero() {
485-
if lastCheck.Sub(want) > 1 * time.Second {
485+
if lastCheck.Sub(want) > 1*time.Second {
486486
t.Errorf("%s %s check at %s, want near %s", jsonStr, host, lastCheck, want)
487487
}
488488
} else {
@@ -534,7 +534,7 @@ func checkHostState(t *testing.T, host, state string) {
534534

535535
func TestEnableDisableHost(t *testing.T) {
536536
args, cmdStr := prepareCommand("gateway1", 2022, "hostname")
537-
ctx, cancel := context.WithTimeout(context.Background(), 60 * time.Second)
537+
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
538538
defer cancel()
539539

540540
_, stdout, _, err := runCommand(ctx, "ssh", args, nil, nil)
@@ -611,7 +611,7 @@ func TestEtcdUsers(t *testing.T) {
611611
// remove old connections stored in etcd
612612
time.Sleep(4 * time.Second)
613613

614-
ctx, cancel := context.WithTimeout(context.Background(), 60 * time.Second)
614+
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
615615
defer cancel()
616616

617617
ch := make(chan *os.Process)
@@ -654,7 +654,7 @@ func TestEtcdGroups(t *testing.T) {
654654
// remove old connections stored in etcd
655655
time.Sleep(4 * time.Second)
656656

657-
ctx, cancel := context.WithTimeout(context.Background(), 60 * time.Second)
657+
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
658658
defer cancel()
659659

660660
ch := make(chan *os.Process)
@@ -734,7 +734,7 @@ func TestSFTP(t *testing.T) {
734734
downloadFile := fmt.Sprintf("/tmp/passwd.%d", i)
735735
prepareSFTPBatchCommands(batchFile, downloadFile)
736736

737-
ctx, cancel := context.WithTimeout(context.Background(), 20 * time.Second)
737+
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
738738
defer cancel()
739739
ch := make(chan *os.Process, 1)
740740
go func() {
@@ -765,7 +765,7 @@ func TestOnlySFTP(t *testing.T) {
765765
downloadFile := "/tmp/passwd.onlySFTP"
766766
prepareSFTPBatchCommands(batchFile, downloadFile)
767767

768-
ctx, cancel := context.WithTimeout(context.Background(), 25 * time.Second)
768+
ctx, cancel := context.WithTimeout(context.Background(), 25*time.Second)
769769
defer cancel()
770770
ch := make(chan *os.Process, 1)
771771
go func() {
@@ -819,7 +819,7 @@ func TestSCP(t *testing.T) {
819819
defer removeLineSSHProxyConf(line)
820820
}
821821
for _, tt := range scpTests {
822-
ctx, cancel := context.WithTimeout(context.Background(), 5 * time.Second)
822+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
823823
defer cancel()
824824
_, _, _, err := runCommand(ctx, "scp", []string{"-P", strconv.Itoa(tt.port), tt.source, tt.dest}, nil, nil)
825825
if err != nil {

0 commit comments

Comments
 (0)