-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcliserver_config.json
98 lines (98 loc) · 3.71 KB
/
cliserver_config.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
{
"routes": {
"/register": {
"method": "POST",
"params": ["public-key", "id"],
"variables": {
"id-hash": "echo -n {id} | openssl dgst -binary -sha256 | base64 | tr '/+' '_-' | tr -d '=\n'"
},
"commands": [
{
"condition": "-d /pass/{id-hash}",
"command": "test -d /dev/null",
"expected_return_code": 0
},
{
"command": "base64 -d",
"stdin": "public-key",
"pipe_to_stdin": true
},
{
"command": "gpg --import",
"expected_return_code": 0
},
{
"command": "mkdir -p /pass/{id-hash}"
}
]
},
"/save-password": {
"method": "POST",
"params": ["id", "password", "name", "email", "encrypted"],
"variables": {
"id-hash": "echo -n {id} | openssl dgst -binary -sha256 | base64 | tr '/+' '_-' | tr -d '=\n'",
"name-hash": "echo -n {name} | openssl dgst -binary -sha256 | base64 | tr '/+' '_-' | tr -d '=\n'"
},
"commands": [
{
"condition": "{encrypted} = false",
"command": "gpg --trust-model always --batch --yes -a -e -o /pass/{id-hash}/{name-hash}.gpg -r {email}",
"stdin": "password"
},
{
"condition": "{encrypted} = true",
"command":"echo -n {password} > /pass/{id-hash}/{name-hash}.gpg"
},
{
"command": "git -C /pass add . && git -C /pass commit -m 'added {name-hash} for {id-hash}' > /dev/null"
}
]
},
"/get-password": {
"method": "GET",
"params": ["id", "name"],
"variables": {
"id-hash": "echo -n {id} | openssl dgst -binary -sha256 | base64 | tr '/+' '_-' | tr -d '=\n'",
"name-hash": "echo -n {name} | openssl dgst -binary -sha256 | base64 | tr '/+' '_-' | tr -d '=\n'"
},
"commands": [
{
"command": "cat /pass/{id-hash}/{name-hash}.gpg"
}
]
},
"/save-password-list": {
"method": "POST",
"params": ["id", "password-list", "email", "encrypted"],
"variables": {
"id-hash": "echo -n {id} | openssl dgst -binary -sha256 | base64 | tr '/+' '_-' | tr -d '=\n'"
},
"commands": [
{
"condition": "{encrypted} = false",
"command": "gpg --trust-model always --batch --yes -a -e -o /pass/{id-hash}/items.gpg -r {email}",
"stdin": "password-list"
},
{
"condition": "{encrypted} = true",
"command": "echo -n {password-list} > /pass/{id-hash}/items.gpg"
},
{
"command": "git -C /pass add . && git -C /pass commit -m 'updated password-list for {id-hash}' > /dev/null"
}
]
},
"/get-password-list": {
"method": "GET",
"params": ["id"],
"variables": {
"id-hash": "echo -n {id} | openssl dgst -binary -sha256 | base64 | tr '/+' '_-' | tr -d '=\n'"
},
"commands": [
{
"command":"cat /pass/{id-hash}/items.gpg"
}
]
}
}
}