From 21997e6f749684206d014cec077d8a1005bf745e Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sat, 7 Dec 2024 21:24:06 +0900 Subject: [PATCH] added the version subcommand added subjectAltNames to the embedded cert file --- Makefile | 17 +++--- client.go | 2 +- cmd/config.go | 144 ++++++++++++++++++++++++++++++++++++++++++++++++- cmd/main.go | 146 ++++---------------------------------------------- cmd/tls.crt | 55 +++++++++---------- cmd/tls.key | 100 +++++++++++++++++----------------- hodu.go | 2 +- server.go | 2 +- 8 files changed, 243 insertions(+), 225 deletions(-) diff --git a/Makefile b/Makefile index f07cd51..f36c4fa 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +NAME=hodu +VERSION=1.0.0 + SRCS=\ client.go \ client-ctl.go \ @@ -20,14 +23,14 @@ CMD_SRCS=\ cmd/config.go \ cmd/main.go \ -all: hodu +all: $(NAME) -hodu: $(SRCS) $(CMD_DATA) $(CMD_SRCS) - CGO_ENABLED=0 go build -x -o $@ $(CMD_SRCS) +$(NAME): $(SRCS) $(CMD_DATA) $(CMD_SRCS) + CGO_ENABLED=0 go build -x -ldflags "-X 'main.HODU_NAME=$(NAME)' -X 'main.HODU_VERSION=$(VERSION)'" -o $@ $(CMD_SRCS) clean: go clean -x -i - rm -f hodu + rm -f $(NAME) hodu.pb.go: hodu.proto protoc --go_out=. --go_opt=paths=source_relative \ @@ -40,9 +43,9 @@ hodu_grpc.pb.go: hodu.proto hodu.proto cmd/tls.crt: - openssl req -x509 -newkey rsa:4096 -keyout cmd/tls.key -out cmd/tls.crt -sha256 -days 36500 -nodes -subj "/CN=hodu" + openssl req -x509 -newkey rsa:4096 -keyout cmd/tls.key -out cmd/tls.crt -sha256 -days 36500 -nodes -subj "/CN=$(NAME)" --addext "subjectAltName=DNS:$(NAME),IP:10.0.0.1,IP:::1" cmd/tls.key: - openssl req -x509 -newkey rsa:4096 -keyout cmd/tls.key -out cmd/tls.crt -sha256 -days 36500 -nodes -subj "/CN=hodu" + openssl req -x509 -newkey rsa:4096 -keyout cmd/tls.key -out cmd/tls.crt -sha256 -days 36500 -nodes -subj "/CN=$(NAME)" --addext "subjectAltName=DNS:$(NAME),IP:10.0.0.1,IP:::1" -.PHONY: clean +.PHONY: clean certfiles diff --git a/client.go b/client.go index 26ae3d5..6637831 100644 --- a/client.go +++ b/client.go @@ -731,7 +731,7 @@ start_over: // seed exchange is for furture expansion of the protocol // there is nothing to do much about it for now. - c_seed.Version = HODU_VERSION + c_seed.Version = HODU_RPC_VERSION c_seed.Flags = 0 s_seed, err = cts.hdc.GetSeed(cts.cli.ctx, &c_seed) if err != nil { diff --git a/cmd/config.go b/cmd/config.go index bd75165..2ca47ba 100644 --- a/cmd/config.go +++ b/cmd/config.go @@ -1,7 +1,11 @@ package main +import "crypto/tls" +import "crypto/x509" import "errors" +import "fmt" import "io" +import "io/ioutil" import "os" import "gopkg.in/yaml.v3" @@ -56,7 +60,7 @@ type ClientConfig struct { } -func LoadServerConfig(cfgfile string) (*ServerConfig, error) { +func load_server_config(cfgfile string) (*ServerConfig, error) { var cfg ServerConfig var f *os.File var yd *yaml.Decoder @@ -77,7 +81,7 @@ func LoadServerConfig(cfgfile string) (*ServerConfig, error) { return &cfg, nil } -func LoadClientConfig(cfgfile string) (*ClientConfig, error) { +func load_client_config(cfgfile string) (*ClientConfig, error) { var cfg ClientConfig var f *os.File var yd *yaml.Decoder @@ -97,3 +101,139 @@ func LoadClientConfig(cfgfile string) (*ClientConfig, error) { return &cfg, nil } + + +func tls_string_to_client_auth_type(str string) tls.ClientAuthType { + switch str { + case tls.NoClientCert.String(): + return tls.NoClientCert + case tls.RequestClientCert.String(): + return tls.RequestClientCert + case tls.RequireAnyClientCert.String(): + return tls.RequireAnyClientCert + case tls.VerifyClientCertIfGiven.String(): + return tls.VerifyClientCertIfGiven + case tls.RequireAndVerifyClientCert.String(): + return tls.RequireAndVerifyClientCert + default: + return tls.NoClientCert + } +} + +// -------------------------------------------------------------------- + +func make_tls_server_config(cfg *ServerTLSConfig) (*tls.Config, error) { + var tlscfg *tls.Config + + if cfg.Enabled { + var cert tls.Certificate + var cert_pool *x509.CertPool + var err error + + if cfg.CertText != "" && cfg.KeyText != "" { + cert, err = tls.X509KeyPair([]byte(cfg.CertText), []byte(cfg.KeyText)) + } else if cfg.CertFile != "" && cfg.KeyFile != "" { + cert, err = tls.LoadX509KeyPair(cfg.CertFile, cfg.KeyFile) + } else { + // use the embedded certificate + cert, err = tls.X509KeyPair(hodu_tls_cert_text, hodul_tls_key_text) + } + if err != nil { + return nil, fmt.Errorf("failed to load key pair - %s", err) + } + + if cfg.ClientCACertText != "" || cfg.ClientCACertFile != ""{ + var ok bool + + cert_pool = x509.NewCertPool() + + if cfg.ClientCACertText != "" { + ok = cert_pool.AppendCertsFromPEM([]byte(cfg.ClientCACertText)) + if !ok { + return nil, fmt.Errorf("failed to append certificate to pool") + } + } else if cfg.ClientCACertFile != "" { + var text []byte + text, err = ioutil.ReadFile(cfg.ClientCACertFile) + if err != nil { + return nil, fmt.Errorf("failed to load ca certficate file %s - %s", cfg.ClientCACertFile, err.Error()) + } + ok = cert_pool.AppendCertsFromPEM(text) + if !ok { + return nil, fmt.Errorf("failed to append certificate to pool") + } + } + } + + tlscfg = &tls.Config{ + Certificates: []tls.Certificate{cert}, + // If multiple certificates are configured, we may have to implement GetCertificate + // GetCertificate: func (chi *tls.ClientHelloInfo) (*Certificate, error) { return cert, nil } + ClientAuth: tls_string_to_client_auth_type(cfg.ClientAuthType), + ClientCAs: cert_pool, // trusted CA certs for client certificate verification + } + } + + return tlscfg, nil +} + +// -------------------------------------------------------------------- + +func make_tls_client_config(cfg *ClientTLSConfig) (*tls.Config, error) { + var tlscfg *tls.Config + + if cfg.Enabled { + var cert tls.Certificate + var cert_pool *x509.CertPool + var ok bool + var err error + + if cfg.CertText != "" && cfg.KeyText != "" { + cert, err = tls.X509KeyPair([]byte(cfg.CertText), []byte(cfg.KeyText)) + } else if cfg.CertFile != "" && cfg.KeyFile != "" { + cert, err = tls.LoadX509KeyPair(cfg.CertFile, cfg.KeyFile) + } else { + // use the embedded certificate + cert, err = tls.X509KeyPair(hodu_tls_cert_text, hodul_tls_key_text) + } + if err != nil { + return nil, fmt.Errorf("failed to load key pair - %s", err) + } + + cert_pool = x509.NewCertPool() + + if cfg.ServerCACertText != "" { + ok = cert_pool.AppendCertsFromPEM([]byte(cfg.ServerCACertText)) + if !ok { + return nil, fmt.Errorf("failed to append certificate to pool") + } + } else if cfg.ServerCACertFile != "" { + var text []byte + text, err = ioutil.ReadFile(cfg.ServerCACertFile) + if err != nil { + return nil, fmt.Errorf("failed to load ca certficate file %s - %s", cfg.ServerCACertFile, err.Error()) + } + ok = cert_pool.AppendCertsFromPEM(text) + if !ok { + return nil, fmt.Errorf("failed to append certificate to pool") + } + } else { + // trust the embedded certificate if not explicitly specified + ok = cert_pool.AppendCertsFromPEM(hodu_tls_cert_text) + if !ok { + return nil, fmt.Errorf("failed to append certificate to pool") + } + } + + if cfg.ServerName == "" { cfg.ServerName = HODU_NAME } + tlscfg = &tls.Config{ + //Certificates: []tls.Certificate{cert}, + GetClientCertificate: func(cri *tls.CertificateRequestInfo) (*tls.Certificate, error) { return &cert, nil }, + RootCAs: cert_pool, + InsecureSkipVerify: cfg.InsecureSkipVerify, + ServerName: cfg.ServerName, + } + } + + return tlscfg, nil +} diff --git a/cmd/main.go b/cmd/main.go index bff1aec..54c98f3 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -2,13 +2,11 @@ package main import "context" import "crypto/tls" -import "crypto/x509" import _ "embed" import "flag" import "fmt" import "hodu" import "io" -import "io/ioutil" import "os" import "os/signal" import "path/filepath" @@ -18,6 +16,11 @@ import "sync" import "syscall" import "time" + +// Don't change these items to 'const' as they can be overridden with a linker option +var HODU_NAME string = "hodu" +var HODU_VERSION string = "0.0.0" + //go:embed tls.crt var hodu_tls_cert_text []byte //go:embed tls.key @@ -136,138 +139,6 @@ func (sh *signal_handler) WriteLog(id string, level hodu.LogLevel, fmt string, a sh.svc.WriteLog(id, level, fmt, args...) } -func tls_string_to_client_auth_type(str string) tls.ClientAuthType { - switch str { - case tls.NoClientCert.String(): - return tls.NoClientCert - case tls.RequestClientCert.String(): - return tls.RequestClientCert - case tls.RequireAnyClientCert.String(): - return tls.RequireAnyClientCert - case tls.VerifyClientCertIfGiven.String(): - return tls.VerifyClientCertIfGiven - case tls.RequireAndVerifyClientCert.String(): - return tls.RequireAndVerifyClientCert - default: - return tls.NoClientCert - } -} - -// -------------------------------------------------------------------- - -func make_tls_server_config(cfg *ServerTLSConfig) (*tls.Config, error) { - var tlscfg *tls.Config - - if cfg.Enabled { - var cert tls.Certificate - var cert_pool *x509.CertPool - var err error - - if cfg.CertText != "" && cfg.KeyText != "" { - cert, err = tls.X509KeyPair([]byte(cfg.CertText), []byte(cfg.KeyText)) - } else if cfg.CertFile != "" && cfg.KeyFile != "" { - cert, err = tls.LoadX509KeyPair(cfg.CertFile, cfg.KeyFile) - } else { - // use the embedded certificate - cert, err = tls.X509KeyPair(hodu_tls_cert_text, hodul_tls_key_text) - } - if err != nil { - return nil, fmt.Errorf("failed to load key pair - %s", err) - } - - if cfg.ClientCACertText != "" || cfg.ClientCACertFile != ""{ - var ok bool - - cert_pool = x509.NewCertPool() - - if cfg.ClientCACertText != "" { - ok = cert_pool.AppendCertsFromPEM([]byte(cfg.ClientCACertText)) - if !ok { - return nil, fmt.Errorf("failed to append certificate to pool") - } - } else if cfg.ClientCACertFile != "" { - var text []byte - text, err = ioutil.ReadFile(cfg.ClientCACertFile) - if err != nil { - return nil, fmt.Errorf("failed to load ca certficate file %s - %s", cfg.ClientCACertFile, err.Error()) - } - ok = cert_pool.AppendCertsFromPEM(text) - if !ok { - return nil, fmt.Errorf("failed to append certificate to pool") - } - } - } - - tlscfg = &tls.Config{ - Certificates: []tls.Certificate{cert}, - // If multiple certificates are configured, we may have to implement GetCertificate - // GetCertificate: func (chi *tls.ClientHelloInfo) (*Certificate, error) { return cert, nil } - ClientAuth: tls_string_to_client_auth_type(cfg.ClientAuthType), - ClientCAs: cert_pool, // trusted CA certs for client certificate verification - } - } - - return tlscfg, nil -} - -// -------------------------------------------------------------------- - -func make_tls_client_config(cfg *ClientTLSConfig) (*tls.Config, error) { - var tlscfg *tls.Config - - if cfg.Enabled { - var cert tls.Certificate - var cert_pool *x509.CertPool - var err error - - - if cfg.CertText != "" && cfg.KeyText != "" { - cert, err = tls.X509KeyPair([]byte(cfg.CertText), []byte(cfg.KeyText)) - } else if cfg.CertFile != "" && cfg.KeyFile != "" { - cert, err = tls.LoadX509KeyPair(cfg.CertFile, cfg.KeyFile) - } else { - // use the embedded certificate - cert, err = tls.X509KeyPair(hodu_tls_cert_text, hodul_tls_key_text) - } - if err != nil { - return nil, fmt.Errorf("failed to load key pair - %s", err) - } - - if cfg.ServerCACertText != "" || cfg.ServerCACertFile != ""{ - var ok bool - - cert_pool = x509.NewCertPool() - - if cfg.ServerCACertText != "" { - ok = cert_pool.AppendCertsFromPEM([]byte(cfg.ServerCACertText)) - if !ok { - return nil, fmt.Errorf("failed to append certificate to pool") - } - } else if cfg.ServerCACertFile != "" { - var text []byte - text, err = ioutil.ReadFile(cfg.ServerCACertFile) - if err != nil { - return nil, fmt.Errorf("failed to load ca certficate file %s - %s", cfg.ServerCACertFile, err.Error()) - } - ok = cert_pool.AppendCertsFromPEM(text) - if !ok { - return nil, fmt.Errorf("failed to append certificate to pool") - } - } - } - - tlscfg = &tls.Config{ - //Certificates: []tls.Certificate{cert}, - GetClientCertificate: func(cri *tls.CertificateRequestInfo) (*tls.Certificate, error) { return &cert, nil }, - RootCAs: cert_pool, - InsecureSkipVerify: cfg.InsecureSkipVerify, - ServerName: cfg.ServerName, - } - } - - return tlscfg, nil -} - // -------------------------------------------------------------------- func server_main(ctl_addrs []string, svcaddrs []string, cfg *ServerConfig) error { @@ -385,7 +256,7 @@ func main() { } if (cfgfile != "") { - cfg, err = LoadServerConfig(cfgfile) + cfg, err = load_server_config(cfgfile) if err != nil { fmt.Printf ("ERROR: failed to load configuration file %s - %s\n", cfgfile, err.Error()) goto oops @@ -431,7 +302,7 @@ func main() { } if (cfgfile != "") { - cfg, err = LoadClientConfig(cfgfile) + cfg, err = load_client_config(cfgfile) if err != nil { fmt.Printf ("ERROR: failed to load configuration file %s - %s\n", cfgfile, err.Error()) goto oops @@ -443,6 +314,8 @@ func main() { fmt.Fprintf(os.Stderr, "ERROR: client error - %s\n", err.Error()) goto oops } + } else if strings.EqualFold(os.Args[1], "version") { + fmt.Printf("%s %s\n", HODU_NAME, HODU_VERSION) } else { goto wrong_usage } @@ -452,6 +325,7 @@ func main() { wrong_usage: fmt.Fprintf(os.Stderr, "USAGE: %s server --rpc-on=addr:port --ctl-on=addr:port\n", os.Args[0]) fmt.Fprintf(os.Stderr, " %s client --rpc-server=addr:port --ctl-on=addr:port [peer-addr:peer-port ...]\n", os.Args[0]) + fmt.Fprintf(os.Stderr, " %s version\n", os.Args[0]) os.Exit(1) oops: diff --git a/cmd/tls.crt b/cmd/tls.crt index d6c6ccc..114634b 100644 --- a/cmd/tls.crt +++ b/cmd/tls.crt @@ -1,29 +1,30 @@ -----BEGIN CERTIFICATE----- -MIIFATCCAumgAwIBAgIUYf8nD4uZJgKt00E1vhq2Kmbc3S8wDQYJKoZIhvcNAQEL -BQAwDzENMAsGA1UEAwwEaG9kdTAgFw0yNDEyMDcwMzQwMzFaGA8yMTI0MTExMzAz -NDAzMVowDzENMAsGA1UEAwwEaG9kdTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCC -AgoCggIBAI8fLL9mkZH38Hu0zftteEKbDU7fsWLhUBg+vvPthIkEFowpWWrp6Pf7 -l2fu6jfAh8NzxFCafhrCMNqtN6dvCJQ8chB4E9fT2hWtbkZE+YnbQo7zundXelza -CxnTE9f1r+LJ9CfymuA+2hz5RG+gU+k+JT2d0GpwSiCuUt2NnfGUOWfFdNTAxsbX -pffCdjeyjlbrjkZKpNpWudmE0XcAJH/CGq0Y3SCjuU4tDKJ6aJ0oz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BoAjt8 +/bggXGa/oIdYqJNtusrILOy9Yz97uNH8AMNlwHudpXnahOsij7z9AgMBAAGjfDB6 +MB0GA1UdDgQWBBQMtXgimCHgFkL/uzfevQKQA8Ns7zAfBgNVHSMEGDAWgBQMtXgi +mCHgFkL/uzfevQKQA8Ns7zAPBgNVHRMBAf8EBTADAQH/MCcGA1UdEQQgMB6CBGhv +ZHWHBAoAAAGHEAAAAAAAAAAAAAAAAAAAAAEwDQYJKoZIhvcNAQELBQADggIBAKf/ +g5BK+opuXs1r/WbHj6wZOYs/Yrto2MHuuQkKyywLtWx7KWcsKITPPNv2JNWvor6J +aiOsOdU2iH/DNus3Ja8Ezs8Y5StN5irTHAAOR13ilGFnuAkQiTfY2+zpYZ5mLCZn +X6YP0SCaSLlRqNda2nFeCoPNQI1zCrtbOsHeY7z0QJL/ZccaJdGt3j7/qGdzRqSP +F8ZXWtPthYgnwdP11Px+iM/eT/ECQmq1CANb38/BUgvGRLo3mYQQm5SwLJVnNzbm +IheWdaHE0PC6SBGkcNKL1UtiH8aHU3Flk8D6qriogmeRRb0MLIktQXu+oYPsZiVy +eFCGUBnPPUFxzaeB8Cw0FjWxgpBj/Ga75BkHj3W9t/9XKBKKPCwV/vJ52uP0BY7H +cnr8fwvGdzwRABTCseQe/smELfiepvtoEy6+cMLTG+0smMsmntJ6CVicqS2hW5gB +ebA3aHvHZXoHdI0F3HzQtbzFoR27cI97GTWFWM2Cikccd26c5b9Bq7P+o1I/vCXV +40KBxGMCzGeDqyb2Z7f5RjNgGZlMB6pnzHAMapimrvdx5Z6pPLfQWJnkhY18YFzH +7T82ebDFbGwDBkf77gbE7sWhZUq3pZmlW5umhUhnaQHYTGSh7mZeDdnm79ihdbu/ +HGOsIDnLdHlVsu8y/jqapPCnsw7dIcKr2Qz4EY4W -----END CERTIFICATE----- diff --git a/cmd/tls.key b/cmd/tls.key index ad02408..0ea797c 100644 --- a/cmd/tls.key +++ b/cmd/tls.key @@ -1,52 +1,52 @@ -----BEGIN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UIK+FZTd7 -----END PRIVATE KEY----- diff --git a/hodu.go b/hodu.go index c884e73..97b2bdb 100644 --- a/hodu.go +++ b/hodu.go @@ -2,7 +2,7 @@ package hodu import "sync" -const HODU_VERSION uint32 = 0x010000 +const HODU_RPC_VERSION uint32 = 0x010000 type LogLevel int diff --git a/server.go b/server.go index 1da9a18..b9061ca 100644 --- a/server.go +++ b/server.go @@ -651,7 +651,7 @@ func (s *Server) GetSeed(ctx context.Context, c_seed *Seed) (*Seed, error) { // seed exchange is for furture expansion of the protocol // there is nothing to do much about it for now. - s_seed.Version = HODU_VERSION + s_seed.Version = HODU_RPC_VERSION s_seed.Flags = 0 // we create no ServerConn structure associated with the connection