diff --git a/Makefile b/Makefile index 06fc92a..dc4d72b 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ test: build-native $(GORUN) utils/ci.go test --integration travis: build-native - $(GORUN) utils/ci.go test -coverage $$TEST_PACKAGES --integration + $(GORUN) utils/ci.go test -coverage $$TEST_PACKAGES --integration -v # ------------------------------------- # release_pattern=current diff --git a/godbledger/cmd/config.go b/godbledger/cmd/config.go index da83813..11aae72 100644 --- a/godbledger/cmd/config.go +++ b/godbledger/cmd/config.go @@ -17,9 +17,9 @@ var log = logrus.WithField("prefix", "Config") type LedgerConfig struct { Host string // Host defines the address that the RPC will be opened on. Combined with RPC Port RPCPort string // RPCPort defines the port that the server will listen for transactions on - CACert string // CACertFlag defines a flag for the server's Certificate Authority certificate. - Cert string // CertFlag defines a flag for the server's TLS certificate. - Key string // KeyFlag defines a flag for the server's TLS key. + CACert string // CACertFlag defines a flag for the server's Certificate Authority certificate (Public Key of Authority that signs clients Public Keys). + Cert string // CertFlag defines a flag for the server's TLS certificate (Servers Public Key to broadcast). + Key string // KeyFlag defines a flag for the server's TLS key (Servers Private Key). DataDirectory string // DataDirectory defines the host systems folder directory holding the database and config files LogVerbosity string // LogVerbosity defines the logging level {debug, info, warn, error, fatal, panic} ConfigFile string // Location of the TOML config file, including directory path diff --git a/tests/certs/ca-cert.pem b/tests/certs/ca-cert.pem new file mode 100644 index 0000000..0ac5cc3 --- /dev/null +++ b/tests/certs/ca-cert.pem @@ -0,0 +1,36 @@ +-----BEGIN CERTIFICATE----- +MIIGNzCCBB+gAwIBAgIUfrvl32eGR2WkXww2GY4MGhN6dgUwDQYJKoZIhvcNAQEL +BQAwgaoxCzAJBgNVBAYTAkFVMREwDwYDVQQIDAhWaWN0b3JpYTESMBAGA1UEBwwJ +TWVsYm91cm5lMRgwFgYDVQQKDA9EYXJjeSBGaW5hbmNpYWwxEzARBgNVBAsMCkdv +REJMZWRnZXIxHTAbBgNVBAMMFCouZGFyY3lmaW5hbmNpYWwuY29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zOOESRKatnswIDAQABo1MwUTAdBgNVHQ4EFgQUXimxUCIFd8EFDtY32Pcq ++WQWUqgwHwYDVR0jBBgwFoAUXimxUCIFd8EFDtY32Pcq+WQWUqgwDwYDVR0TAQH/ +BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEALHYak4kn0IlMAAWsp1SiqImx9TzS +UiGzeV4WCS23ofJboKTtqdIAPHnlo4sOULP9iWMSzGVwxB4tDn/AO/bDKa6Faj6i +r75BnR5gFRvSi9/3AuphAC1NYU19JNevJNU+4S1nVkSht+YHM2L0ioysc5pMrlL7 +kj+9lDyvW5u0CeiAogrzEOvEDD4u6JH+oHtWI2grqWzLozjRpm9hhLAuTRCqmtfH +BAfu9+d0h27V4KJpwQMIdSQe9lbQ+l7VkyFEPt1yC7yEyz+S5Ep9S2O4cWjYCr69 +HvWZ9Mg3nviQAUa1q/PJL7ymKMlv3PcZID/FSgLg/MjU/J/nx8KMSaJb44Z9ZXHk +c1HfI9nv5vbyPrPSsmXX0hdJpkByl/CR0MK8kAlqGXIBO7Z8Y0WfJMPO6DB+i7A3 +mRcQqDF4/cim2sgNJYxfxCpyBSUarsvqIii+I3f8bZiNrls6pkqi1Vv/phUuDdgu +KmwtOMrg+gbG8uhGC+XRSATxfdQFsrgceGV/y5Y8HsVl5skjW9ky3A0EZsSFyWn9 +++3InkBkqWaGtfAheHk4jVd77yPoRP5iC/Att12CHec5VHRnBlG09zEI+jdgaDfV +0ZOz1nDbheGzn09AaUhl3Mc9rPFs3LhpH/2NTImvBxPGSSryVVAFsNCIimyvSsw7 +JqpRDKIbaL/BJpg= +-----END CERTIFICATE----- diff --git a/tests/certs/ca-cert.srl b/tests/certs/ca-cert.srl new file mode 100644 index 0000000..3b65df4 --- /dev/null +++ b/tests/certs/ca-cert.srl @@ -0,0 +1 @@ +4A706BC42E0D6EF165503659AF53895286D91463 diff --git a/tests/certs/ca-key.pem b/tests/certs/ca-key.pem new file mode 100644 index 0000000..9a8c8f5 --- /dev/null +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nh6RDpG9OQ6stmUcdlnkDd7vzDUjksyi8tPWfYfT+qKsAkgbTasmP5xtSK +5uVqWlF9Mqt5rOXH2CPPE35NjpJN3H4U +-----END PRIVATE KEY----- diff --git a/tests/certs/client-cert.pem b/tests/certs/client-cert.pem new file mode 100644 index 0000000..aa116a1 --- /dev/null +++ b/tests/certs/client-cert.pem @@ -0,0 +1,34 @@ +-----BEGIN CERTIFICATE----- +MIIF5DCCA8ygAwIBAgIUSnBrxC4NbvFlUDZZr1OJUobZFGMwDQYJKoZIhvcNAQEL +BQAwgaoxCzAJBgNVBAYTAkFVMREwDwYDVQQIDAhWaWN0b3JpYTESMBAGA1UEBwwJ +TWVsYm91cm5lMRgwFgYDVQQKDA9EYXJjeSBGaW5hbmNpYWwxEzARBgNVBAsMCkdv +REJMZWRnZXIxHTAbBgNVBAMMFCouZGFyY3lmaW5hbmNpYWwuY29tMSYwJAYJKoZI +hvcNAQkBFhdzZWFuQGRhcmN5ZmluYW5jaWFsLmNvbTAeFw0yMTAxMDEwODExMTZa +Fw0zMDEyMzAwODExMTZaMIGXMQswCQYDVQQGEwJBVTERMA8GA1UECAwIVmljdG9y +aWExEjAQBgNVBAcMCU1lbGJvdXJuZTESMBAGA1UECgwJUEMgQ2xpZW50MREwDwYD +VQQLDAhDb21wdXRlcjEXMBUGA1UEAwwOKi5wY2NsaWVudC5jb20xITAfBgkqhkiG +9w0BCQEWEnBjY2xpZW50QGdtYWlsLmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBAJoVSGWjmvurCbfxOEQ3D7Q2imIL47eihXvyqafroeDnCzGF4MoK +ib7yMoVmAruEnHPUpdVICBmQlK0K3qK3jYQWfiFzARcRDOFJgt5Rt9FsWyI62k2l +1g21lKg6GVqyMOzJwDmLp0WhghacAxWJq2s/Ie1tjSMd6yvrPJ3ZjhAj7Yedp7VM +bzqY/QB3d9U8ksrlceput58dbqye/gfpyDMuxm3JKTQFreQvC/654C8NsBJKWux1 +X3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GczQW3c4rpYENt/Q94QqDIrk5vBRUKZbp/Ll0KBs +pPzLe/YO40PHnO2WJ9g2hfiRjYjoLj+mvKr+QqheYdH6in3pQ2WV0wYOwIJ6w9rh +xS7ui42KINgLAstGF3mca/TCBwm8oi1P +-----END CERTIFICATE----- diff --git a/tests/certs/client-ext.cnf b/tests/certs/client-ext.cnf new file mode 100644 index 0000000..f7bc951 --- /dev/null +++ b/tests/certs/client-ext.cnf @@ -0,0 +1 @@ +subjectAltName = IP:127.0.0.1 diff --git a/tests/certs/client-key.pem b/tests/certs/client-key.pem new file mode 100644 index 0000000..374def5 --- /dev/null +++ b/tests/certs/client-key.pem @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCaFUhlo5r7qwm3 +8ThENw+0NopiC+O3ooV78qmn66Hg5wsxheDKCom+8jKFZgK7hJxz1KXVSAgZkJSt +Ct6it42EFn4hcwEXEQzhSYLeUbfRbFsiOtpNpdYNtZSoOhlasjDsycA5i6dFoYIW +nAMViatrPyHtbY0jHesr6zyd2Y4QI+2Hnae1TG86mP0Ad3fVPJLK5XHqbrefHW6s +nv4H6cgzLsZtySk0Ba3kLwv+ueAvDbASSlrsdV91j2/CZfoKEhXzC2pZhxL0/HfX +WwoCfgkX+QK6tQo2Gyo6ZvQNEL4sr6HsZldDTK+Sdwwe8a3mzYP+mM4PTpbtwuxx +KEjNTHe9kpmWat0Jt6qsyNZgScmQf9M70wpMzqD4sK0Oj8COsR3kWouJ/gybP4kk +9okSLf/z7WX9N6AGHd5S8+Ecs0x9VgrcJLwkzAlfbyg/VZYYhUxQA4il3cTJExOL +gRqnEMOn9CYwOUMu84SyPUODS4N/bzZ0ZnGDaFT372q3LC4REgPZh9hIdoEiOm0n +gMFyPd4dB7G5gqGhZzmJHXYXtSioQ3K1x74/Lo2rR7Wu/R2uHz01+XKvaib+PU4v +O6OxfJuPUfRGgxbNiuqdOawImI2E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b6JN+2ibKg4HqGMF1 +j+ECggEAJMCA6WpPxD62OhB0kcm9rzT56UmA4SVapqwbzVGX0CX3Ftcu6deLWeyd +VtixRRo9lNIRZX++L2THPKuzXFKjPIMLlE24NIRIz2STbpL3YxWWdmxFfI9qjG7Y +Y3IGcIo2jyG6IOfM7A9ehLzNx3ZlVDB7t1UcynHHTx/n93hk7/2ERCRMWZFooL+1 +ZTsQXdwMPmKJ8LXshlZXTHOI4Uqg8VLeu9Q1vDZCxaTzJav31YDmaZJbrwgtszKa +W+fp8NUlnZOJOIg+JDVWUYsdzSLvhf+mUTJts4GXM4vHddPduWn7Il/pSxZ5OSdQ +qxz23KiRx1nWJOFiiAwFccZlR4jA9A== +-----END PRIVATE KEY----- diff --git a/tests/certs/client-req.pem b/tests/certs/client-req.pem new file mode 100644 index 0000000..e4b6a20 --- /dev/null +++ b/tests/certs/client-req.pem @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIE3TCCAsUCAQAwgZcxCzAJBgNVBAYTAkFVMREwDwYDVQQIDAhWaWN0b3JpYTES +MBAGA1UEBwwJTWVsYm91cm5lMRIwEAYDVQQKDAlQQyBDbGllbnQxETAPBgNVBAsM +CENvbXB1dGVyMRcwFQYDVQQDDA4qLnBjY2xpZW50LmNvbTEhMB8GCSqGSIb3DQEJ +ARYScGNjbGllbnRAZ21haWwuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC +CgKCAgEAmhVIZaOa+6sJt/E4RDcPtDaKYgvjt6KFe/Kpp+uh4OcLMYXgygqJvvIy +hWYCu4Scc9Sl1UgIGZCUrQreoreNhBZ+IXMBFxEM4UmC3lG30WxbIjraTaXWDbWU +qDoZWrIw7MnAOYunRaGCFpwDFYmraz8h7W2NIx3rK+s8ndmOECPth52ntUxvOpj9 +AHd31TySyuVx6m63nx1urJ7+B+nIMy7GbckpNAWt5C8L/rngLw2wEkpa7HVfdY9v +wmX6ChIV8wtqWYcS9Px311sKAn4JF/kCur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7o5Fsd7xsXPuqxrt2+vGWJ4L+VT4rPMxSoIJCXLCUv0CfSQPCF9nCkyW1so+1Y +4Q== +-----END CERTIFICATE REQUEST----- diff --git a/tests/certs/server-cert.pem b/tests/certs/server-cert.pem new file mode 100644 index 0000000..1c27449 --- /dev/null +++ b/tests/certs/server-cert.pem @@ -0,0 +1,34 @@ +-----BEGIN CERTIFICATE----- +MIIF5DCCA8ygAwIBAgIUSnBrxC4NbvFlUDZZr1OJUobZFGIwDQYJKoZIhvcNAQEL +BQAwgaoxCzAJBgNVBAYTAkFVMREwDwYDVQQIDAhWaWN0b3JpYTESMBAGA1UEBwwJ +TWVsYm91cm5lMRgwFgYDVQQKDA9EYXJjeSBGaW5hbmNpYWwxEzARBgNVBAsMCkdv +REJMZWRnZXIxHTAbBgNVBAMMFCouZGFyY3lmaW5hbmNpYWwuY29tMSYwJAYJKoZI +hvcNAQkBFhdzZWFuQGRhcmN5ZmluYW5jaWFsLmNvbTAeFw0yMTAxMDEwODExMTZa +Fw0zMDEyMzAwODExMTZaMIGXMQswCQYDVQQGEwJBVTERMA8GA1UECAwIVmljdG9y +aWExEjAQBgNVBAcMCU1lbGJvdXJuZTESMBAGA1UECgwJUEMgU2VydmVyMREwDwYD +VQQLDAhDb21wdXRlcjEXMBUGA1UEAwwOKi5wY3NlcnZlci5jb20xITAfBgkqhkiG +9w0BCQEWEnBjc2VydmVyQGdtYWlsLmNvbTCCAiIwDQYJKoZIhvcNAQEBBQADggIP +ADCCAgoCggIBALBtKsxezGFWW3zqbUJaw1rVUjNpET4HoLV3NoDNbj9u+VDrOViF +J4Wzsav/sB186r7x7hj+eo95Rdsgx6DWUJRF35plys3x3IKB0SP6kTqXoUzEMaJw +3erb5CyNEM9+IyJQRtVRO2pYl+6PSK8GBDxGavlnExjWzGknENDCNJnzRgh6ff86 +dRGSOd0v5ZSuy+g9XDvRZpEwSGpCO8DbkqssJ+4pGkhb1CRkoMlG93EKM83nokaL +5+YEDmeL2o/MuZ69XQG18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sUjxfpfAMkAj9vALKwToHGObLMKp+2Mllj0WjR1ZripenBa1+4Dtral8 +PKqIKFM6ukpsa9Hzi7i9zrbPOqW1UZ7C +-----END CERTIFICATE----- diff --git a/tests/certs/server-ext.cnf b/tests/certs/server-ext.cnf new file mode 100644 index 0000000..f7bc951 --- /dev/null +++ b/tests/certs/server-ext.cnf @@ -0,0 +1 @@ +subjectAltName = IP:127.0.0.1 diff --git a/tests/certs/server-key.pem b/tests/certs/server-key.pem new file mode 100644 index 0000000..6ba002b --- /dev/null +++ b/tests/certs/server-key.pem @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCwbSrMXsxhVlt8 +6m1CWsNa1VIzaRE+B6C1dzaAzW4/bvlQ6zlYhSeFs7Gr/7AdfOq+8e4Y/nqPeUXb +IMeg1lCURd+aZcrN8dyCgdEj+pE6l6FMxDGicN3q2+QsjRDPfiMiUEbVUTtqWJfu +j0ivBgQ8Rmr5ZxMY1sxpJxDQwjSZ80YIen3/OnURkjndL+WUrsvoPVw70WaRMEhq +QjvA25KrLCfuKRpIW9QkZKDJRvdxCjPN56JGi+fmBA5ni9qPzLmevV0BtfDJEQ5q +uyBYCVZXkFFiFpGQJoHxQZQ/gbnmtbP6j8EU8vmr8LCYTJl7pqcRhpskalAc6fRx +UP8u7EgrfpUUSL1+UM90jRAsbP8/LNmtQ9MT+KiBzz3G70TIQVcYYSIo3tDhIJV2 +cyG7ayTAncQUG7b+OANr4ueP87PJph87H6z73zk0Y1Wg1kMVOG23g2tnGSXBRRnn +YGwQuIVL2BE7uEYEWCP0Y7+xb3vU62BCqRPnSfVcUkak8DlRAYyOnDG4Jr/xZr1R +VFJVJ4sDnR6zw6ggUA3O4/hq3kaFLFFaqi2/qjrBmc/veEeVNcnoKY6mzxf/Pfjp +rBlJ+//WtxZX/bteicFhSxFrAJ64EfKUZKj6HBbKxjLj2ts79VsWmHLMZDMCGw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 +qQKCAQEAmROXHp38l23cEupEa/VIoF6861iBXUPjf/zX1S/ze1LNEE39wsKUaDmE +mIHQmuOAxoHZJvHn7u7pPKCqlhal3+5G8Wa3Jn5ycXcxx/k0dcCS9ND/lYWRVEew +Zxu3mdXut+JsmBob9mVu/kxVld4kxZexQn1abG4OmXZ3X6CzgJcuDfckwxHLgtu3 +n2tIj/6BqQE70zfuI3CW4fSU3dDK98zuSDbtWFFp/vaITPCm6YvmjGi9as1R+Oqq +BdGUsrTTLLW+WU0xHIAiToQf946wvzVkF6pfJQ+cTmvsDcsVIqFW2UCzrrJs9sfL +MyFzlgENCslSOhBh4CCsrSjtJzQvhA== +-----END PRIVATE KEY----- diff --git a/tests/certs/server-req.pem b/tests/certs/server-req.pem new file mode 100644 index 0000000..1617695 --- /dev/null +++ b/tests/certs/server-req.pem @@ -0,0 +1,29 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIE3TCCAsUCAQAwgZcxCzAJBgNVBAYTAkFVMREwDwYDVQQIDAhWaWN0b3JpYTES +MBAGA1UEBwwJTWVsYm91cm5lMRIwEAYDVQQKDAlQQyBTZXJ2ZXIxETAPBgNVBAsM +CENvbXB1dGVyMRcwFQYDVQQDDA4qLnBjc2VydmVyLmNvbTEhMB8GCSqGSIb3DQEJ +ARYScGNzZXJ2ZXJAZ21haWwuY29tMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIIC +CgKCAgEAsG0qzF7MYVZbfOptQlrDWtVSM2kRPgegtXc2gM1uP275UOs5WIUnhbOx +q/+wHXzqvvHuGP56j3lF2yDHoNZQlEXfmmXKzfHcgoHRI/qROpehTMQxonDd6tvk +LI0Qz34jIlBG1VE7aliX7o9IrwYEPEZq+WcTGNbMaScQ0MI0mfNGCHp9/zp1EZI5 +3S/llK7L6D1cO9FmkTBIakI7wNuSqywn7ikaSFvUJGSgyUb3cQozzeeiRovn5gQO +Z4vaj8y5nr1dAbXwyREOarsgWAlWV5BRYhaRkCaB8UGUP4G55rWz+o/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8gCsPzIaiaddHiJB/S7jT8b191 +cg== +-----END CERTIFICATE REQUEST----- diff --git a/tests/components/godbledger_node.go b/tests/components/godbledger_node.go index 3376fcd..dda24ae 100644 --- a/tests/components/godbledger_node.go +++ b/tests/components/godbledger_node.go @@ -12,11 +12,10 @@ import ( "github.com/darcys22/godbledger/godbledger/cmd" "github.com/darcys22/godbledger/tests/helpers" - e2e "github.com/darcys22/godbledger/tests/params" ) -func StartGoDBLedger(t *testing.T, config *cmd.LedgerConfig, index int) int { - logfileName := fmt.Sprintf("%s-%d", e2e.LogFileName, index) +func StartGoDBLedger(t *testing.T, config *cmd.LedgerConfig, logfilename string, index int) int { + logfileName := fmt.Sprintf("%s-%d", logfilename, index) stdOutFile, err := helpers.DeleteAndCreateFile("", logfileName) if err != nil { @@ -33,6 +32,14 @@ func StartGoDBLedger(t *testing.T, config *cmd.LedgerConfig, index int) int { fmt.Sprintf("--database-location=%s-%d", config.DatabaseLocation, index), } + if config.Key != "" { + args = append(args, + fmt.Sprintf("--ca-cert=%s", config.CACert), + fmt.Sprintf("--tls-cert=%s", config.Cert), + fmt.Sprintf("--tls-key=%s", config.Key), + ) + } + cmd := exec.Command("../build/bin/native/godbledger", args...) t.Logf("Starting GoDBLedger with flags: %s", strings.Join(args[:], " ")) if err := cmd.Start(); err != nil { diff --git a/tests/endtoend_test.go b/tests/endtoend_test.go index 832c783..6f70958 100644 --- a/tests/endtoend_test.go +++ b/tests/endtoend_test.go @@ -52,7 +52,7 @@ func TestEndToEnd_MinimalConfig(t *testing.T) { processIDs := []int{} logFiles := []*os.File{} for i := 0; i < len(evaluators); i++ { - goDBLedgerPID := components.StartGoDBLedger(t, cfg, i) + goDBLedgerPID := components.StartGoDBLedger(t, cfg, e2e.LogFileName, i) processIDs = append(processIDs, goDBLedgerPID) time.Sleep(time.Duration(1) * time.Second) logfileName := fmt.Sprintf("%s-%d", e2e.LogFileName, i) diff --git a/tests/secure_connection_test.go b/tests/secure_connection_test.go new file mode 100644 index 0000000..2905ec9 --- /dev/null +++ b/tests/secure_connection_test.go @@ -0,0 +1,133 @@ +// secure connection test establishes a connection using mutual tls, and sending test transaction to verify + +// +build integration + +package tests + +import ( + "context" + "crypto/tls" + "crypto/x509" + "flag" + "fmt" + "io/ioutil" + "os" + "strconv" + "testing" + "time" + + "github.com/darcys22/godbledger/proto/transaction" + + "github.com/darcys22/godbledger/godbledger/cmd" + "github.com/darcys22/godbledger/tests/components" + + "github.com/darcys22/godbledger/tests/helpers" + + "github.com/urfave/cli/v2" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" +) + +func TestSecureConnection(t *testing.T) { + // Create a config from the defaults which would usually be created by the CLI library + set := flag.NewFlagSet("test", 0) + set.String("config", "", "doc") + ctx := cli.NewContext(nil, set, nil) + err, cfg := cmd.MakeConfig(ctx) + if err != nil { + t.Fatalf("New Config Failed: %v", err) + } + + // Set the Database type to a SQLite3 in memory database + cfg.DatabaseType = "memorydb" + + // Set the RPC port to random higher port to not clash with other tests + cfg.RPCPort = "55051" + + // The Certificates and Private Keys necessary for both the server and the client has previously been generated using utils/gen.sh these have been saved in the certs directory in this test folder. + + // Add the servers credential filenames to the configuration + cfg.CACert = "certs/ca-cert.pem" + cfg.Cert = "certs/server-cert.pem" + cfg.Key = "certs/server-key.pem" + + // Also add the clients credentials to variables for later usage + clientCertFilename := "certs/client-cert.pem" + clientKeyFilename := "certs/client-key.pem" + + processIDs := []int{} + logFiles := []*os.File{} + goDBLedgerPID := components.StartGoDBLedger(t, cfg, "secure-connection.log", 0) + processIDs = append(processIDs, goDBLedgerPID) + time.Sleep(time.Duration(1) * time.Second) + logfileName := fmt.Sprintf("%s-%d", "secure-connection.log", 0) + logFile, err := os.Open(logfileName) + if err != nil { + t.Fatal(err) + } + logFiles = append(logFiles, logFile) + + t.Run("Server Started", func(t *testing.T) { + if err := helpers.WaitForTextInFile(logFile, "Starting GoDBLedger Server"); err != nil { + t.Fatalf("failed to find GoDBLedger start in logfile: %s, this means the server did not start: %v", logfileName, err) + } + }) + + //Failing early in case chain doesn't start. + if t.Failed() { + return + } + defer helpers.KillProcesses(t, processIDs) + defer helpers.DeleteLogFiles(t, logFiles) + + t.Logf("Starting GoDBLedger") + port, _ := strconv.Atoi(cfg.RPCPort) + + opts := []grpc.DialOption{} + + // Load certificate of the CA who signed server's certificate + pemServerCA, err := ioutil.ReadFile(cfg.CACert) + if err != nil { + t.Fatalf("Failed reading CA certificate: %v", err) + } + + certPool := x509.NewCertPool() + if !certPool.AppendCertsFromPEM(pemServerCA) { + t.Fatal("failed to add CA's certificate to pool") + } + + // Load client's certificate and private key + clientCert, err := tls.LoadX509KeyPair(clientCertFilename, clientKeyFilename) + if err != nil { + t.Fatalf("Failed reading Client certificate and key: %v", err) + } + + // Create the credentials and return it + config := &tls.Config{ + Certificates: []tls.Certificate{clientCert}, + RootCAs: certPool, + } + + tlsCredentials := credentials.NewTLS(config) + opts = append(opts, grpc.WithTransportCredentials(tlsCredentials)) + + conn, err := grpc.Dial(fmt.Sprintf("%s:%d", cfg.Host, port), opts...) + if err != nil { + t.Fatalf("Failed to dial: %v", err) + } + defer func() { + if err := conn.Close(); err != nil { + t.Log(err) + } + }() + + client := transaction.NewTransactorClient(conn) + req := &transaction.VersionRequest{ + Message: "Test", + } + _, err = client.NodeVersion(context.Background(), req) + if err != nil { + t.Fatalf("Node Version request failed: %v", err) + } + +} diff --git a/utils/gen.sh b/utils/gen.sh index 6df8718..ad777ce 100755 --- a/utils/gen.sh +++ b/utils/gen.sh @@ -4,7 +4,7 @@ export IP="127.0.0.1" rm *.pem # 1. Generate CA's private key and self-signed certificate -openssl req -x509 -newkey rsa:4096 -days 365 -nodes -keyout ca-key.pem -out ca-cert.pem -subj "/C=AU/ST=Victoria/L=Melbourne/O=Darcy Financial/OU=GoDBLedger/CN=*.darcyfinancial.com/emailAddress=sean@darcyfinancial.com" +openssl req -x509 -newkey rsa:4096 -days 3650 -nodes -keyout ca-key.pem -out ca-cert.pem -subj "/C=AU/ST=Victoria/L=Melbourne/O=Darcy Financial/OU=GoDBLedger/CN=*.darcyfinancial.com/emailAddress=sean@darcyfinancial.com" echo "CA's self-signed certificate" openssl x509 -in ca-cert.pem -noout -text @@ -14,7 +14,7 @@ openssl req -newkey rsa:4096 -nodes -keyout server-key.pem -out server-req.pem - # 3. Use CA's private key to sign web server's CSR and get back the signed certificate echo subjectAltName = IP:${IP} > server-ext.cnf -openssl x509 -req -in server-req.pem -days 60 -CA ca-cert.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem -extfile server-ext.cnf +openssl x509 -req -in server-req.pem -days 3650 -CA ca-cert.pem -CAkey ca-key.pem -CAcreateserial -out server-cert.pem -extfile server-ext.cnf echo "Server's signed certificate" openssl x509 -in server-cert.pem -noout -text @@ -24,6 +24,6 @@ openssl req -newkey rsa:4096 -nodes -keyout client-key.pem -out client-req.pem - # 5. Use CA's private key to sign client's CSR and get back the signed certificate echo subjectAltName = IP:${IP} > client-ext.cnf -openssl x509 -req -in client-req.pem -days 60 -CA ca-cert.pem -CAkey ca-key.pem -CAcreateserial -out client-cert.pem -extfile client-ext.cnf +openssl x509 -req -in client-req.pem -days 3650 -CA ca-cert.pem -CAkey ca-key.pem -CAcreateserial -out client-cert.pem -extfile client-ext.cnf echo "Client's signed certificate" openssl x509 -in client-cert.pem -noout -text