Skip to content

Commit 9931db0

Browse files
committed
Bugfix: check host syntax for actions "enable", "disable" and "forget"
1 parent 4938612 commit 9931db0

24 files changed

+57
-30
lines changed

.cirrus.yml

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ task:
22
env:
33
GOPROXY: https://proxy.golang.org
44
matrix:
5-
VERSION: 1.14
65
VERSION: 1.15
76
VERSION: 1.16
87

@@ -11,6 +10,29 @@ task:
1110

1211
name: test-$VERSION
1312

13+
test_script:
14+
- apt-get update
15+
- apt-get install -y asciidoc docbook-utils docbook-xml libxml2-utils xsltproc
16+
- GOPATH=/tmp/go
17+
- PATH="$PATH:$GOPATH/bin"
18+
- mkdir -p $GOPATH/src/github.com/cea-hpc
19+
- mv /tmp/cirrus-ci-build $GOPATH/src/github.com/cea-hpc/sshproxy
20+
- cd $GOPATH/src/github.com/cea-hpc/sshproxy
21+
- make
22+
- make get-old-deps check
23+
24+
task:
25+
env:
26+
GOPROXY: https://proxy.golang.org
27+
matrix:
28+
VERSION: 1.17
29+
VERSION: 1.18
30+
31+
container:
32+
image: golang:$VERSION
33+
34+
name: test-$VERSION
35+
1436
test_script:
1537
- apt-get update
1638
- apt-get install -y asciidoc docbook-utils docbook-xml libxml2-utils xsltproc

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ fmt:
7979
$(GO) fmt $(PKGS)
8080
$(GO) fmt $(TEST)
8181

82+
get-old-deps:
83+
$(GO) get -u honnef.co/go/tools/cmd/[email protected]
84+
8285
get-deps:
83-
$(GO) get -u golang.org/x/lint/golint honnef.co/go/tools/cmd/staticcheck
86+
$(GO) get -u honnef.co/go/tools/cmd/staticcheck
8487

8588
check:
86-
golint $(PKGS)
87-
golint $(TEST)
8889
$(GO) vet ./...
8990
$(GO) vet $(TEST)
9091
staticcheck ./...
@@ -97,4 +98,4 @@ test:
9798
clean:
9899
rm -f $(EXE) $(MANDOC) doc/*.xml sshproxy_*.tar.gz
99100

100-
.PHONY: all exe doc install install-doc-man install-binaries fmt get-deps check clean test
101+
.PHONY: all exe doc install install-doc-man install-binaries package fmt get-old-deps get-deps check test clean

README.asciidoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ and +sshproxy-replay+ in +/usr/bin+.
5858
Configuration
5959
-------------
6060

61-
There are commented configuration files in the +config+ directory.
61+
There is a commented configuration file in the +config+ directory.
6262

6363
Configure +/etc/sshproxy/sshproxy.yaml+ to suit your needs.
6464

@@ -69,7 +69,7 @@ Modify the SSH daemon configuration +/etc/ssh/sshd_config+ by adding:
6969
Copying
7070
-------
7171
72-
Copyright (C) 2015-2021 CEA/DAM/DIF
72+
Copyright (C) 2015-2022 CEA/DAM/DIF
7373
7474
sshproxy is distributed under the CeCILL-B, a French transposition of the BSD
7575
license. See the included files +Licence_CeCILL-B_V1-en.txt+ (English version)

cmd/sshproxy-dumpd/sshproxy-dumpd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2021 CEA/DAM/DIF
1+
// Copyright 2015-2022 CEA/DAM/DIF
22
// Author: Arnaud Guignard <[email protected]>
33
// Contributor: Cyril Servant <[email protected]>
44
//

cmd/sshproxy-replay/sshproxy-replay.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2021 CEA/DAM/DIF
1+
// Copyright 2015-2022 CEA/DAM/DIF
22
// Author: Arnaud Guignard <[email protected]>
33
// Contributor: Cyril Servant <[email protected]>
44
//

cmd/sshproxy/commands.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2021 CEA/DAM/DIF
1+
// Copyright 2015-2022 CEA/DAM/DIF
22
// Author: Arnaud Guignard <[email protected]>
33
// Contributor: Cyril Servant <[email protected]>
44
//

cmd/sshproxy/recorder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2021 CEA/DAM/DIF
1+
// Copyright 2015-2022 CEA/DAM/DIF
22
// Author: Arnaud Guignard <[email protected]>
33
// Contributor: Cyril Servant <[email protected]>
44
//

cmd/sshproxy/sshproxy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2021 CEA/DAM/DIF
1+
// Copyright 2015-2022 CEA/DAM/DIF
22
// Author: Arnaud Guignard <[email protected]>
33
// Contributor: Cyril Servant <[email protected]>
44
//

cmd/sshproxyctl/sshproxyctl.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2015-2021 CEA/DAM/DIF
1+
// Copyright 2015-2022 CEA/DAM/DIF
22
// Author: Arnaud Guignard <[email protected]>
33
// Contributor: Cyril Servant <[email protected]>
44
//
@@ -16,6 +16,7 @@ import (
1616
"flag"
1717
"fmt"
1818
"log"
19+
"net"
1920
"os"
2021
"sort"
2122
"strconv"
@@ -550,7 +551,7 @@ The options are:
550551
}
551552

552553
func getHostPortFromCommandLine(args []string) (string, string, error) {
553-
host, port := "", "22"
554+
host, port := "", defaultHostPort
554555
switch len(args) {
555556
case 2:
556557
host, port = args[0], args[1]
@@ -564,6 +565,9 @@ func getHostPortFromCommandLine(args []string) (string, string, error) {
564565
} else if iport < 0 || iport > 65535 {
565566
return "", "", fmt.Errorf("port must be in the 0-65535 range")
566567
}
568+
if _, _, err := net.SplitHostPort(host + ":" + port); err != nil {
569+
return "", "", fmt.Errorf("%s", err)
570+
}
567571
return host, port, nil
568572
}
569573

config/sshproxy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
# command asked by the user. If command_must_match is set to true, then the
137137
# connection is closed if the original command is not the same as the
138138
# force_command. command_must_match defaults to false. etcd_keyttl defauts to
139-
# 0. If a value is set (in seconds), the chosen backen will be remembered for
139+
# 0. If a value is set (in seconds), the chosen backend will be remembered for
140140
# this amount of time. Environment variables can be set if needed. The '{user}'
141141
# pattern will be replaced with the user login.
142142
#routes:

0 commit comments

Comments
 (0)