Combine TLS cert and key options in single one
This commit is contained in:
parent
b35f6e7b3c
commit
85e6538f2f
4
README
4
README
@ -56,8 +56,8 @@ Just execute goircd daemon. It has following optional arguments:
|
|||||||
* -statedir: directory where all channels states will be saved and
|
* -statedir: directory where all channels states will be saved and
|
||||||
loaded during startup. If omitted, then states will be
|
loaded during startup. If omitted, then states will be
|
||||||
lost after daemon termination
|
lost after daemon termination
|
||||||
* -tlsbind/-tlskey/-tlscert: enable TLS, specify address to listen on,
|
* -tlsbind/-pem: enable TLS, specify address to listen on and path
|
||||||
certificate and key files
|
to PEM file with certificate and private key
|
||||||
* -passwords: enable client authentication and specify path to
|
* -passwords: enable client authentication and specify path to
|
||||||
passwords file
|
passwords file
|
||||||
* -verbose: increase log messages verbosity
|
* -verbose: increase log messages verbosity
|
||||||
|
@ -41,8 +41,7 @@ var (
|
|||||||
passwords = flag.String("passwords", "", "Optional path to passwords file")
|
passwords = flag.String("passwords", "", "Optional path to passwords file")
|
||||||
|
|
||||||
tlsBind = flag.String("tlsbind", "", "TLS address to bind to")
|
tlsBind = flag.String("tlsbind", "", "TLS address to bind to")
|
||||||
tlsKey = flag.String("tlskey", "", "TLS keyfile")
|
tlsPEM = flag.String("tlspem", "", "Path to TLS certificat+key PEM file")
|
||||||
tlsCert = flag.String("tlscert", "", "TLS certificate")
|
|
||||||
|
|
||||||
verbose = flag.Bool("v", false, "Enable verbose logging.")
|
verbose = flag.Bool("v", false, "Enable verbose logging.")
|
||||||
)
|
)
|
||||||
@ -138,9 +137,9 @@ func Run() {
|
|||||||
go listenerLoop(listener, events)
|
go listenerLoop(listener, events)
|
||||||
}
|
}
|
||||||
if *tlsBind != "" {
|
if *tlsBind != "" {
|
||||||
cert, err := tls.LoadX509KeyPair(*tlsCert, *tlsKey)
|
cert, err := tls.LoadX509KeyPair(*tlsPEM, *tlsPEM)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Could not load TLS keys from %s and %s: %s", *tlsCert, *tlsKey, err)
|
log.Fatalf("Could not load TLS keys from %s: %s", *tlsPEM, err)
|
||||||
}
|
}
|
||||||
config := tls.Config{Certificates: []tls.Certificate{cert}}
|
config := tls.Config{Certificates: []tls.Certificate{cert}}
|
||||||
listenerTLS, err := tls.Listen("tcp", *tlsBind, &config)
|
listenerTLS, err := tls.Listen("tcp", *tlsBind, &config)
|
||||||
|
Loading…
Reference in New Issue
Block a user