Skip to content

Commit 6fa1f97

Browse files
oliwermjuraga
authored andcommitted
MEDIUM: storage: add support for crt-list files
For now, only support crt-lists as simple files, not directories. They are stored in the same directory as SSL certificates, and must have a .txt file extension.
1 parent 913824d commit 6fa1f97

19 files changed

Lines changed: 1235 additions & 104 deletions

client_native.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ type haProxyClient struct {
3939
runtime runtime.Runtime
4040
mapStorage storage.Storage
4141
sslCertStorage storage.Storage
42+
crtListStorage storage.Storage
4243
generalStorage storage.Storage
4344
spoe spoe.Spoe
4445
configurationMu sync.RWMutex
@@ -89,6 +90,13 @@ func (c *haProxyClient) SSLCertStorage() (storage.Storage, error) {
8990
return c.sslCertStorage, nil
9091
}
9192

93+
func (c *haProxyClient) CrtListStorage() (storage.Storage, error) {
94+
if c.crtListStorage == nil {
95+
return nil, fmt.Errorf("crt-list storage: %w", ErrOptionNotAvailable)
96+
}
97+
return c.crtListStorage, nil
98+
}
99+
92100
func (c *haProxyClient) GeneralStorage() (storage.Storage, error) {
93101
if c.generalStorage == nil {
94102
return nil, fmt.Errorf("general files storage: %w", ErrOptionNotAvailable)

interface.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type HAProxyClient interface {
1717
ReplaceRuntime(runtimeClient runtime.Runtime)
1818
MapStorage() (storage.Storage, error)
1919
SSLCertStorage() (storage.Storage, error)
20+
CrtListStorage() (storage.Storage, error)
2021
GeneralStorage() (storage.Storage, error)
2122
Spoe() (spoe.Spoe, error)
2223
}
@@ -37,6 +38,7 @@ func New(ctx context.Context, opt ...options.Option) (HAProxyClient, error) { //
3738
runtime: o.Runtime,
3839
mapStorage: o.MapStorage,
3940
sslCertStorage: o.SSLCertStorage,
41+
crtListStorage: o.CrtListStorage,
4042
generalStorage: o.GeneralStorage,
4143
spoe: o.Spoe,
4244
}

models/ssl_crt_list.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/ssl_crt_list_file.go

Lines changed: 76 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/ssl_crt_list_file_compare.go

Lines changed: 71 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

models/ssl_crt_list_file_compare_test.go

Lines changed: 190 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)