Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow the password of immugw auditor to be base64 encoded in th… #296

Merged
merged 1 commit into from
Jun 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ detached = false
servername = "localhost"
pkey = "/etc/immudb/mtls/4_client/private/localhost.key.pem"
certificate = "/etc/immudb/mtls/4_client/certs/localhost.cert.pem"
clientcas = "/etc/immudb/mtls/2_intermediate/certs/ca-chain.cert.pem"`)
clientcas = "/etc/immudb/mtls/2_intermediate/certs/ca-chain.cert.pem"
audit = false
# valid suffixes: "s", "m", "h", examples: 10s, 5m 1h
audit-interval = "5m"
audit-username = "immugwauditor"
# password can be plaintext or base64
audit-password = ""`)
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,10 @@ detached = false
servername = "localhost"
pkey = "%programdata%\\Immugw\\config\\mtls\\4_client\\private\\localhost.key.pem"
certificate = "%programdata%\\Immugw\\config\\mtls\\4_client\\certs\\localhost.cert.pem"
clientcas = "%programdata%\\Immugw\\config\\mtls\\2_intermediate\\certs\\ca-chain.cert.pem"`)
clientcas = "%programdata%\\Immugw\\config\\mtls\\2_intermediate\\certs\\ca-chain.cert.pem"
audit = false
# valid suffixes: "s", "m", "h", examples: 10s, 5m 1h
audit-interval = "5m"
audit-username = "immugwauditor"
# password can be plaintext or base64
audit-password = ""`)
4 changes: 3 additions & 1 deletion configs/immugw.toml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ pkey = "./tools/mtls/4_client/private/localhost.key.pem"
certificate = "./tools/mtls/4_client/certs/localhost.cert.pem"
clientcas = "./tools/mtls/2_intermediate/certs/ca-chain.cert.pem"
audit = false
audit-interval = "5m" # suffixes: "s", "m", "h", examples: 10s, 5m 1h
# valid suffixes: "s", "m", "h", examples: 10s, 5m 1h
audit-interval = "5m"
audit-username = "immugwauditor"
# password can be plaintext or base64
audit-password = ""
11 changes: 10 additions & 1 deletion pkg/client/auditor/auditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package auditor

import (
"context"
"encoding/base64"
"io"
"os"
"regexp"
Expand Down Expand Up @@ -57,10 +58,18 @@ func DefaultAuditor(
serverAddress string,
dialOptions *[]grpc.DialOption,
username string,
password string,
passwordBase64 string,
history cache.HistoryCache,
updateMetrics func(string, string, bool, bool, bool, *schema.Root, *schema.Root),
logoutput io.Writer) (Auditor, error) {

password := strings.TrimSpace(passwordBase64)
if password != "" {
passwordBytes, err := base64.StdEncoding.DecodeString(passwordBase64)
if err == nil {
password = string(passwordBytes)
}
}
if logoutput == nil {
logoutput = os.Stderr
}
Expand Down