mirror of
https://github.com/pomerium/pomerium.git
synced 2025-04-29 02:16:28 +02:00
* refactor backend, implement encrypted store * refactor in-memory store * wip * wip * wip * add syncer test * fix redis expiry * fix linting issues * fix test by skipping non-config records * fix backoff import * fix init issues * fix query * wait for initial sync before starting directory sync * add type to SyncLatest * add more log messages, fix deadlock in in-memory store, always return server version from SyncLatest * update sync types and tests * add redis tests * skip macos in github actions * add comments to proto * split getBackend into separate methods * handle errors in initVersion * return different error for not found vs other errors in get * use exponential backoff for redis transaction retry * rename raw to result * use context instead of close channel * store type urls as constants in databroker * use timestampb instead of ptypes * fix group merging not waiting * change locked names * update GetAll to return latest record version * add method to grpcutil to get the type url for a protobuf type
59 lines
1.3 KiB
Go
59 lines
1.3 KiB
Go
// Package main implements the pomerium-cli.
|
|
package main
|
|
|
|
import (
|
|
"crypto/tls"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/pomerium/pomerium/pkg/cryptutil"
|
|
)
|
|
|
|
var rootCmd = &cobra.Command{
|
|
Use: "pomerium-cli",
|
|
}
|
|
|
|
func main() {
|
|
err := rootCmd.Execute()
|
|
if err != nil {
|
|
fatalf("%s", err.Error())
|
|
}
|
|
}
|
|
|
|
func fatalf(msg string, args ...interface{}) {
|
|
fmt.Fprintf(os.Stderr, msg+"\n", args...)
|
|
os.Exit(1)
|
|
}
|
|
|
|
var tlsOptions struct {
|
|
disableTLSVerification bool
|
|
alternateCAPath string
|
|
caCert string
|
|
}
|
|
|
|
func addTLSFlags(cmd *cobra.Command) {
|
|
flags := cmd.Flags()
|
|
flags.BoolVar(&tlsOptions.disableTLSVerification, "disable-tls-verification", false,
|
|
"disables TLS verification")
|
|
flags.StringVar(&tlsOptions.alternateCAPath, "alternate-ca-path", "",
|
|
"path to CA certificate to use for HTTP requests")
|
|
flags.StringVar(&tlsOptions.caCert, "ca-cert", "",
|
|
"base64-encoded CA TLS certificate to use for HTTP requests")
|
|
}
|
|
|
|
func getTLSConfig() *tls.Config {
|
|
cfg := new(tls.Config)
|
|
if tlsOptions.disableTLSVerification {
|
|
cfg.InsecureSkipVerify = true
|
|
}
|
|
if tlsOptions.caCert != "" {
|
|
var err error
|
|
cfg.RootCAs, err = cryptutil.GetCertPool(tlsOptions.caCert, tlsOptions.alternateCAPath)
|
|
if err != nil {
|
|
fatalf("%s", err)
|
|
}
|
|
}
|
|
return cfg
|
|
}
|