convert of login items keeps original env names in fields; env now also exposes the login triple so sourced consumers can map to legacy names. Ticket: https://projects.knownelement.com/issues/832
This commit is contained in:
@@ -251,6 +251,15 @@ func cmdEnv(name string) error {
|
||||
v := strings.ReplaceAll(f.Value, "'", "'\\''")
|
||||
fmt.Printf("export %s='%s'\n", f.Name, v)
|
||||
}
|
||||
if len(pc.URIs) > 0 {
|
||||
fmt.Printf("export URI='%s'\n", pc.URIs[0])
|
||||
}
|
||||
if pc.Login.Username != "" {
|
||||
fmt.Printf("export USERNAME='%s'\n", pc.Login.Username)
|
||||
}
|
||||
if pc.Login.Password != "" {
|
||||
fmt.Printf("export PASSWORD='%s'\n", pc.Login.Password)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -537,3 +546,5 @@ func cmdConvert(name string) error {
|
||||
fmt.Printf("converted: %s (user=%v pass=%v uris=%d fields=%d)\n", name, username != "", password != "", len(uris), len(rest))
|
||||
return nil
|
||||
}
|
||||
|
||||
func urisOf(pc *PlainCipher) []string { return pc.URIs }
|
||||
|
||||
@@ -91,6 +91,7 @@ type PlainCipher struct {
|
||||
Password string `json:"password"`
|
||||
} `json:"login"`
|
||||
FolderID string `json:"folderId"`
|
||||
URIs []string `json:"uris"`
|
||||
}
|
||||
|
||||
// DecryptCipher converts a raw sync cipher into PlainCipher.
|
||||
@@ -132,6 +133,18 @@ func DecryptCipher(userKey []byte, raw []byte) (*PlainCipher, error) {
|
||||
if cr.Login.Password != nil {
|
||||
pc.Login.Password, _ = decStr(userKey, ck, cr.Login.Password)
|
||||
}
|
||||
for _, u := range cr.Login.URIs {
|
||||
var um map[string]any
|
||||
um, _ = u.(map[string]any)
|
||||
if um != nil {
|
||||
if us, ok := um["uri"].(string); ok {
|
||||
v, err := decStr(userKey, ck, &us)
|
||||
if err == nil {
|
||||
pc.URIs = append(pc.URIs, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return pc, nil
|
||||
}
|
||||
|
||||
+2
-2
@@ -10,13 +10,13 @@
|
||||
name: knel-secretsmanager
|
||||
services:
|
||||
smcli:
|
||||
image: git.knownelement.com/knel/knel-secretsmanager-cli@sha256:a0482ad7ebbfed58e0662fa99fc1ac9416d2542058db7df02907a9fe7f9e21e7
|
||||
image: git.knownelement.com/knel/knel-secretsmanager-cli@sha256:554de767afbf80ca2db772edda350200b741c211495dda3fde96c6496a7a13cc
|
||||
container_name: ukrrs-secretsmgr-cli
|
||||
restart: unless-stopped
|
||||
entrypoint: ["sleep", "infinity"]
|
||||
init: true
|
||||
env_file:
|
||||
- path: /home/reachableceo/.creds/smcli.env
|
||||
- path: ./smcli.env
|
||||
required: false
|
||||
environment:
|
||||
SM_STATE_DIR: /data/state
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
SM_SERVER=https://pwvault.turnsys.com
|
||||
SM_EMAIL=coo@turnsys.com
|
||||
SM_STATE_DIR=/data/state
|
||||
Reference in New Issue
Block a user