This repository has been archived by the owner on Apr 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add list of certs to add to the http.client used
Signed-off-by: Alexander Trost <galexrt@googlemail.com>
- Loading branch information
Showing
16 changed files
with
125 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
- [ ] Rework caching logic to be non-blocking. -> Either a "cluster is detected and stats is available" or there is no stats of the cluster. | ||
- [ ] Clearly communicate to the user if the data is "live" or not. Adding auto refresh. | ||
- [ ] Look into "basic IF condition"-AI for the data-control-center -> Recommendation system | ||
- [ ] "Reliability"-score on steroids -> Always give a why. | ||
- [ ] Ideas: "It is recommended to ..." | ||
- [ ] Set a custom OSD scrubbing schedule. | ||
- [ ] Set K8S resources requests/limits for the Ceph components. | ||
- [ ] At least replicated.size 3 or higher for production. | ||
- [ ] Other important config aspects to check for? | ||
- [ ] Fix SSL CA custom cert issue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package httpclient | ||
|
||
import ( | ||
"crypto/tls" | ||
"crypto/x509" | ||
"fmt" | ||
"log" | ||
"net/http" | ||
"os" | ||
|
||
"github.com/koor-tech/data-control-center/pkg/config" | ||
"go.uber.org/fx" | ||
"go.uber.org/zap" | ||
) | ||
|
||
var Module = fx.Module("http_client", | ||
fx.Provide(New), | ||
) | ||
|
||
func New(logger *zap.Logger, cfg *config.Config) (*http.Client, error) { | ||
// Get the SystemCertPool, continue with an empty pool on error | ||
rootCAs, _ := x509.SystemCertPool() | ||
if rootCAs == nil { | ||
rootCAs = x509.NewCertPool() | ||
} | ||
|
||
for _, certFile := range cfg.Certs.CACerts { | ||
// Read cert file | ||
certs, err := os.ReadFile(certFile) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to append %q to RootCAs: %w", certFile, err) | ||
} | ||
|
||
// Append cert to the system pool | ||
if ok := rootCAs.AppendCertsFromPEM(certs); !ok { | ||
log.Println("No certs appended, using system certs only") | ||
} | ||
} | ||
|
||
// Trust the augmented cert pool in our client | ||
config := &tls.Config{ | ||
InsecureSkipVerify: cfg.Certs.InsecureSkipVerify, | ||
RootCAs: rootCAs, | ||
} | ||
|
||
tr := &http.Transport{TLSClientConfig: config} | ||
client := &http.Client{Transport: tr} | ||
|
||
return client, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters