Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ COPY --chown=app:app --from=compile-stage /app/static /static
# copy the data folder with the correct permissions for the volume mount
COPY --chown=app:app --from=compile-stage /app/data /data
VOLUME /data
COPY --chown=app:app --from=compile-stage /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
ENTRYPOINT ["/beacon"]
18 changes: 17 additions & 1 deletion auth/heimdall/heimdall.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ package heimdall
import (
"bufio"
"context"
"crypto/tls"
"crypto/x509"
"encoding/json"
"errors"
"io"
"log"
"net/http"
"os"
"slices"
"time"

Expand Down Expand Up @@ -43,8 +46,21 @@ var (
)

func New(dir directory.Directory[resource.Resource[resource.Content]]) *HeimdallAuth {
pool := x509.NewCertPool()
certFile, err := os.ReadFile(config.CaCertificatesFilePath)
if err != nil {
panic("Could not open " + config.CaCertificatesFilePath + ": " + err.Error())
}
ok := pool.AppendCertsFromPEM(certFile)
if !ok {
panic("Certificates were not parsed correctly from: " + config.CaCertificatesFilePath)
}
auth := HeimdallAuth{
client: http.DefaultClient,
client: &http.Client{
Transport: &http.Transport{
TLSClientConfig: &tls.Config{RootCAs: pool},
},
},
}
go func() {
for {
Expand Down
5 changes: 3 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ var (
LegacyDatabasePassword string = GetString("DB_PASSWORD", "postgres")
LegacyDatabaseName string = GetString("DB_NAME", "LHP")
DatabaseQueryInterval time.Duration = GetDuration("DB_QUERY_PERIOD", 1*time.Second)
// jwt (unfinished test)
JWTPrivateKey []byte = []byte(GetString("JWT_PRIVATE_KEY", "")) // generates a new random key if empty

// TLS certificates (for https client)
CaCertificatesFilePath string = GetString("CA_CERTIFICATES_FILE_PATH", "/etc/ssl/certs/ca-certificates.crt")

// logging
VerboseLogging bool = GetBool("VERBOSE_LOGGING", false)
Expand Down
Loading