pshima / consul-snapshot

consul-snapshot is a backup and restore utility for Consul (https://www.consul.io). This is slightly different than some other utilities out there as this runs as a daemon for backups and ships them to S3. Also has integrated monitoring and backup health checks.
Apache License 2.0
116 stars 35 forks source link

Support for custom CA #30

Open DrMagPie opened 5 years ago

DrMagPie commented 5 years ago

Hello, in my limited testing of this tool I have faced issue with our custom CA certificates. which are configured using these env vars https://www.consul.io/docs/commands/index.html#consul_cacert

I have glanced into your code and looks like there is no support for it. Am I missing something? Is it planned to add support for CONSUL_CACERT, CONSUL_CLIENT_CERT, CONSUL_CLIENT_KEY parameters? Or might be you could suggest how to use your tool without these certs?

$ ./consul-snapshot backup
[INFO] v0.2.3: Starting Consul Snapshot
2019/08/20 08:59:56 [DEBUG] Backup starting on interval: 5s
2019/08/20 09:00:01 [INFO] Starting Backup At: 1566291601 
2019/08/20 09:00:01 [INFO] Listing keys from consul
2019/08/20 09:00:01 [ERR] Unable to list keys: Get https://localhost:8500/v1/kv//?consistent=&recurse=: x509: certificate signed by unknown authority 

$ export CONSUL_HTTP_SSL_VERIFY=false
$ ./consul-snapshot backup
[INFO] v0.2.3: Starting Consul Snapshot 
2019/08/20 09:01:36 [DEBUG] Backup starting on interval: 5s
2019/08/20 09:01:41 [INFO] Starting Backup At: 1566291701 
2019/08/20 09:01:41 [INFO] Listing keys from consul
2019/08/20 09:01:41 [ERR] Unable to list keys: Get https://localhost:8500/v1/kv//?consistent=&recurse=: remote error: tls: bad certificate