Skip to content

Commit b93d5e5

Browse files
committed
Add CyberArk Conjur Secrets Manager support
1 parent bf2e8ad commit b93d5e5

28 files changed

+2651
-10
lines changed

.teller.example.yml

+15
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,18 @@ providers:
8585
# SAVE_TIME:
8686
# # need to supply the relevant version (versions/1)
8787
# path: redis/config/savetime
88+
89+
# cyberark_conjur:
90+
# # configures client from environment:
91+
# # CONJUR_AUTHN_LOGIN
92+
# # CONJUR_AUTHN_API_KEY
93+
# # also, configures client from file:
94+
# # FILENAME: ~/.conjurrc
95+
# # appliance_url: https://conjur.cyberark.com
96+
# # account: cyberarkdemo
97+
# # cert_file: /root/conjur-cyberarkdemo.pem
98+
# env:
99+
# DB_USERNAME:
100+
# path: secrets/database/username
101+
# DB_PASSWORD:
102+
# path: secrets/database/passwords

.teller.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ opts:
2222
providers:
2323
# Configure via environment:
2424
# CONSUL_HTTP_ADDR
25-
dotenv:
25+
cyberark_conjur:
2626
env:
27-
FOO:
28-
path: ~/my-dot-env.env
27+
GH_USERNAME:
28+
path: github/username
2929

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,47 @@ vercel:
755755
path: my-app-dev
756756
```
757757

758+
759+
## CyberArk Conjur
760+
761+
### Authentication
762+
763+
Requires a username and API key populated in your environment:
764+
* `CONJUR_AUTHN_LOGIN`
765+
* `CONJUR_AUTHN_API_KEY`
766+
767+
Requires a .conjurrc file in your User's home directory:
768+
```yaml
769+
---
770+
account: cyberarkdemo
771+
plugins: []
772+
appliance_url: https://dap.joegarcia.dev
773+
cert_file: ""
774+
```
775+
* `account` is the organization account created during initial deployment
776+
* `plugins` will be blank
777+
* `appliance_url` should be the Base URI for the Conjur service
778+
* `cert_file` should be the public key certificate if running in self-signed mode
779+
780+
### Features
781+
782+
* Sync - `no`
783+
* Mapping - `no`
784+
* Modes - `read`
785+
* Key format
786+
* `env` - the secret variable path in Conjur Secrets Manager
787+
788+
### Example Config
789+
790+
```yaml
791+
cyberark_conjur:
792+
env:
793+
DB_USERNAME:
794+
path: /secrets/prod/pgsql/username
795+
DB_PASSWORD:
796+
path: /secrets/prod/pgsql/password
797+
```
798+
758799
# Semantics
759800

760801
## Addressing

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/aws/aws-sdk-go-v2/config v1.1.1
1919
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.1.1
2020
github.com/aws/aws-sdk-go-v2/service/ssm v1.1.1
21-
github.com/cyberark/conjur-api-go v0.7.1 // indirect
21+
github.com/cyberark/conjur-api-go v0.7.1
2222
github.com/dghubble/sling v1.3.0
2323
github.com/fatih/color v1.10.0
2424
github.com/golang/mock v1.4.4

pkg/providers.go

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func (p *BuiltinProviders) ProviderHumanToMachine() map[string]string {
2828
"Vercel": "vercel",
2929
"Azure Key Vault": "azure_keyvault",
3030
"Doppler": "doppler",
31+
"CyberArk Conjur": "cyberark_conjur",
3132
}
3233
}
3334

@@ -55,6 +56,8 @@ func (p *BuiltinProviders) GetProvider(name string) (core.Provider, error) {
5556
return providers.NewAzureKeyVault()
5657
case "doppler":
5758
return providers.NewDoppler()
59+
case "cyberark_conjur":
60+
return providers.NewConjurClient()
5861
default:
5962
return nil, fmt.Errorf("provider '%s' does not exist", name)
6063
}

pkg/providers/cyberark_conjur.go

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package providers
22

33
import (
4-
"context"
54
"fmt"
65
"os"
76

@@ -11,7 +10,7 @@ import (
1110
)
1211

1312
type ConjurClient interface {
14-
RetrieveSecret(ctx context.Context, variableId string) (string, error)
13+
RetrieveSecret(variableId string) ([]byte, error)
1514
}
1615

1716
type CyberArkConjur struct {
@@ -57,15 +56,15 @@ func (c *CyberArkConjur) Get(p core.KeyPath) (*core.EnvEntry, error) {
5756
if err != nil {
5857
return nil, err
5958
}
60-
if secret == "" {
59+
if secret == nil {
6160
ent := p.Missing()
6261
return &ent, nil
6362
}
6463

65-
ent := p.Found(secret)
64+
ent := p.Found(string(secret))
6665
return &ent, nil
6766
}
6867

69-
func (c *CyberArkConjur) getSecret(kp core.KeyPath) (string, error) {
70-
return c.client.RetrieveSecret(context.TODO(), kp.Path)
68+
func (c *CyberArkConjur) getSecret(kp core.KeyPath) ([]byte, error) {
69+
return c.client.RetrieveSecret(kp.Path)
7170
}

vendor/github.com/bgentry/go-netrc/LICENSE

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)