feat: secrets of clients now need to be hashed, added command to create hash

This commit is contained in:
2025-04-25 21:35:52 +02:00
parent a77e96be6e
commit 81dcd9c7cc
5 changed files with 58 additions and 9 deletions

View File

@@ -24,6 +24,11 @@ func (m *mockProvider) UpdateRecord(ctx context.Context, host, ip string) error
}
func newTestConfig(provider string) *config.Config {
// Pre-generate hash for "s3cr3t" (replace with actual hash generation if needed)
// Example hash generated with bcrypt.GenerateFromPassword([]byte("s3cr3t"), bcrypt.DefaultCost)
// In a real test setup, you might generate this once or use a helper.
testSecretHash := "$2a$10$abcdefghijklmnopqrstuv" // Placeholder hash
return &config.Config{
Server: config.ServerConfig{
BindAddress: ":0",
@@ -35,9 +40,9 @@ func newTestConfig(provider string) *config.Config {
},
Clients: map[string]config.ClientConfig{
"client1": {
Secret: "s3cr3t",
Exact: []string{"a.example.com"},
Wildcard: []string{"example.net"},
SecretHash: testSecretHash,
Exact: []string{"a.example.com"},
Wildcard: []string{"example.net"},
},
},
}