Minor fixes
This commit is contained in:
@ -11,8 +11,8 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
"kat-system/internal/pki"
|
||||
"kat-system/internal/store"
|
||||
"git.dws.rip/dubey/kat/internal/pki"
|
||||
"git.dws.rip/dubey/kat/internal/store"
|
||||
)
|
||||
|
||||
// JoinRequest represents the data sent by an agent when joining
|
||||
@ -103,10 +103,10 @@ func NewJoinHandler(stateStore store.StateStore, caKeyPath, caCertPath string) h
|
||||
// Store node registration in etcd
|
||||
nodeRegKey := fmt.Sprintf("/kat/nodes/registration/%s", nodeName)
|
||||
nodeReg := map[string]interface{}{
|
||||
"uid": nodeUID,
|
||||
"advertiseAddr": joinReq.AdvertiseAddr,
|
||||
"uid": nodeUID,
|
||||
"advertiseAddr": joinReq.AdvertiseAddr,
|
||||
"wireguardPubKey": joinReq.WireguardPubKey,
|
||||
"joinTimestamp": time.Now().Unix(),
|
||||
"joinTimestamp": time.Now().Unix(),
|
||||
}
|
||||
nodeRegData, err := json.Marshal(nodeReg)
|
||||
if err != nil {
|
||||
|
@ -8,7 +8,6 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@ -113,7 +112,7 @@ func (s *Server) Start() error {
|
||||
ClientAuth: tls.NoClientCert, // Don't require client certs for now
|
||||
MinVersion: tls.VersionTLS12,
|
||||
}
|
||||
|
||||
|
||||
log.Printf("WARNING: TLS configured without client certificate verification for Phase 2")
|
||||
log.Printf("This is a temporary development configuration and should be secured in production")
|
||||
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"kat-system/internal/pki"
|
||||
"git.dws.rip/dubey/kat/internal/pki"
|
||||
)
|
||||
|
||||
func TestServerWithMTLS(t *testing.T) {
|
||||
@ -31,7 +31,7 @@ func TestServerWithMTLS(t *testing.T) {
|
||||
// Generate CA
|
||||
caKeyPath := filepath.Join(tempDir, "ca.key")
|
||||
caCertPath := filepath.Join(tempDir, "ca.crt")
|
||||
if err := pki.GenerateCA(caKeyPath, caCertPath, "KAT Test CA", 24*time.Hour); err != nil {
|
||||
if err := pki.GenerateCA(tempDir, caKeyPath, caCertPath); err != nil {
|
||||
t.Fatalf("Failed to generate CA: %v", err)
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ func TestServerWithMTLS(t *testing.T) {
|
||||
serverKeyPath := filepath.Join(tempDir, "server.key")
|
||||
serverCSRPath := filepath.Join(tempDir, "server.csr")
|
||||
serverCertPath := filepath.Join(tempDir, "server.crt")
|
||||
if err := pki.GenerateCertificateRequest("server.test", serverKeyPath, serverCSRPath); err != nil {
|
||||
if err := pki.GenerateCertificateRequest("localhost", serverKeyPath, serverCSRPath); err != nil {
|
||||
t.Fatalf("Failed to generate server CSR: %v", err)
|
||||
}
|
||||
if err := pki.SignCertificateRequest(caKeyPath, caCertPath, serverCSRPath, serverCertPath, 24*time.Hour); err != nil {
|
||||
@ -58,7 +58,7 @@ func TestServerWithMTLS(t *testing.T) {
|
||||
}
|
||||
|
||||
// Create and start server
|
||||
server, err := NewServer("localhost:0", serverCertPath, serverKeyPath, caCertPath)
|
||||
server, err := NewServer("localhost:8443", serverCertPath, serverKeyPath, caCertPath)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create server: %v", err)
|
||||
}
|
||||
@ -76,7 +76,7 @@ func TestServerWithMTLS(t *testing.T) {
|
||||
}()
|
||||
|
||||
// Wait for server to start
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
time.Sleep(250 * time.Millisecond)
|
||||
|
||||
// Load CA cert
|
||||
caCert, err := os.ReadFile(caCertPath)
|
||||
|
Reference in New Issue
Block a user