fix(remnawave): парсить keypairs[] из x25519 generate v3
ansible-core-net / deploy (push) Failing after 1m27s
ansible-core-net / deploy (push) Failing after 1m27s
API отдаёт массив пар, а не одиночные privateKey/publicKey. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8872b8765e
commit
a4a0655888
1 file changed
+6
-3
@@ -117,11 +117,14 @@ pub=""
|
|||||||
|
|
||||||
if [ -z "${profile_uuid}" ]; then
|
if [ -z "${profile_uuid}" ]; then
|
||||||
key_resp=$(api GET /system/tools/x25519/generate 2>/dev/null || echo '{}')
|
key_resp=$(api GET /system/tools/x25519/generate 2>/dev/null || echo '{}')
|
||||||
|
# v3: {response:{keypairs:[{publicKey,privateKey},...]}}
|
||||||
priv=$(printf '%s' "${key_resp}" | jq -r '
|
priv=$(printf '%s' "${key_resp}" | jq -r '
|
||||||
.response.privateKey // .response.privKey // .privateKey // .privKey // empty')
|
.response.keypairs[0].privateKey
|
||||||
|
// .response.privateKey // .response.privKey // .privateKey // .privKey // empty')
|
||||||
pub=$(printf '%s' "${key_resp}" | jq -r '
|
pub=$(printf '%s' "${key_resp}" | jq -r '
|
||||||
.response.publicKey // .response.pubKey // .publicKey // .pubKey // empty')
|
.response.keypairs[0].publicKey
|
||||||
if [ -z "${priv}" ]; then
|
// .response.publicKey // .response.pubKey // .publicKey // .pubKey // empty')
|
||||||
|
if [ -z "${priv}" ] || [ -z "${pub}" ]; then
|
||||||
echo "Не удалось сгенерировать X25519 ключи Reality" >&2
|
echo "Не удалось сгенерировать X25519 ключи Reality" >&2
|
||||||
printf '%s\n' "${key_resp}" >&2
|
printf '%s\n' "${key_resp}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in new issue
Block a user