Skip to content

Commit

Permalink
small nits
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke committed Oct 7, 2023
1 parent e10d9b8 commit b9ada6c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
6 changes: 4 additions & 2 deletions internal/openvpn/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ func (c *Client) processClient(client connection.Client) error {
}

func (c *Client) clientConnect(client connection.Client) error {
var err error

logger := c.logger.With(
slog.Uint64("cid", client.Cid),
slog.Uint64("kid", client.Kid),
Expand All @@ -51,7 +53,7 @@ func (c *Client) clientConnect(client connection.Client) error {
}

session := state.New(ClientIdentifier, client.IPAddr, client.CommonName)
if err := session.Encode(c.conf.HTTP.Secret); err != nil {
if err = session.Encode(c.conf.HTTP.Secret); err != nil {
return fmt.Errorf("error encoding state: %w", err)
}

Expand All @@ -62,7 +64,7 @@ func (c *Client) clientConnect(client connection.Client) error {

logger.Info("start pending auth")

_, err := c.SendCommandf(`client-pending-auth %d %d "WEB_AUTH::%s" %.0f`, client.Cid, client.Kid, startURL, c.conf.OpenVpn.AuthPendingTimeout.Seconds())
_, err = c.SendCommandf(`client-pending-auth %d %d "WEB_AUTH::%s" %.0f`, client.Cid, client.Kid, startURL, c.conf.OpenVpn.AuthPendingTimeout.Seconds())
if err != nil {
logger.Warn(err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion internal/openvpn/connection/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewClient(message string) (Client, error) { //nolint:cyclop
} else if strings.HasPrefix(line, ">CLIENT:ENV,") {
envKey, envValue := parseClientEnv(line)
if envKey == "" || envValue == "" {
break
continue
}

switch envKey {
Expand Down
12 changes: 6 additions & 6 deletions tests/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
- "0.0.0.0:1194:1194/udp"
- "8080:8080/tcp"
- "8081:8081/tcp"
- "9000:9000/tcp"
- "9001:9001/tcp"
volumes:
- ./:/tests/:ro
- ./data:/etc/openvpn
Expand Down Expand Up @@ -71,15 +71,15 @@ services:
fast-io
user nobody
group nogroup
auth-gen-token 240 120
#auth-gen-token 240 120
management 0.0.0.0 8081 /etc/openvpn/password.txt
#management-hold
#management-client-auth
management-hold
management-client-auth
plugin /plugin/openvpn-auth-oauth2.so /plugin/config.yaml
#plugin /plugin/openvpn-auth-oauth2.so /plugin/config.yaml
reneg-sec 60
reneg-sec 30
auth-user-pass-optional
EOF
Expand Down

0 comments on commit b9ada6c

Please sign in to comment.