From 5f183d3582a0225d4ba9b1290c5f3d84da31b61b Mon Sep 17 00:00:00 2001 From: Alex Vanin Date: Thu, 27 Jul 2023 19:41:23 +0300 Subject: [PATCH] [#18] Support custom wallets Signed-off-by: Alex Vanin --- Makefile | 13 +++++++++++-- README.md | 19 +++++++++++++++++++ docker-compose.yml | 1 + wallets/wallet1.json | 1 + wallets/wallet2.json | 1 + wallets/wallet3.json | 1 + 6 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 wallets/wallet1.json create mode 100644 wallets/wallet2.json create mode 100644 wallets/wallet3.json diff --git a/Makefile b/Makefile index 2a5c0b0..53ef6de 100644 --- a/Makefile +++ b/Makefile @@ -69,8 +69,17 @@ s3cred: --peer localhost:8080 \ --gate-public-key $(S3_GATE_PUBLIC_KEY) \ --container-placement-policy "REP 1" \ - --bearer-rules $(S3_BEARER_RULES) - + --bearer-rules $(S3_BEARER_RULES) + +# Generate S3 credentials based on imported wallets +s3cred-custom: + @docker exec aio /usr/bin/frostfs-s3-authmate issue-secret \ + --wallet /wallets/$(wallet) \ + --peer localhost:8080 \ + --gate-public-key $(S3_GATE_PUBLIC_KEY) \ + --container-placement-policy "REP 1" \ + --bearer-rules $(S3_BEARER_RULES) + # Tick new epoch in side chain tick.epoch: @docker exec aio /usr/bin/frostfs-adm --config /config/frostfs-adm.yml morph force-new-epoch diff --git a/README.md b/README.md index 6cca50a..16bb883 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,25 @@ $ aws s3api --endpoint http://localhost:8084 list-objects --bucket koty } ``` +### S3 credentials from custom wallets + +Credentials made by `make s3cred` command are based on the private key from +`s3-gw/user-wallet.json` file. If you need to create credential for different +users, use wallets from `wallets` dir. + +```sh +$ make s3cred-custom wallet=wallet2.json +{ + "access_key_id": "jHhL5B33o16R4jQsb8wm9A3RRdS6KrTB5N4bja9Jys904W7xXFNKqem2ACvTRWRYJsZMCUikYFSokN7pPJziWyDi", + "secret_access_key": "21bb64fafa32c82417fd8b97ac56cc8a085998a3852632d52fe7042453daa440", + "owner_private_key": "10f6f9d7a47bb0bf68363ad8a99fe69f1493f8b6e1665b3e4e83feb2d5c7ee39", + "wallet_public_key": "03e38759973a6bb722baabc2dd84036a39f0b2f53d32fec45a4dacde8a50fe4b70", + "container_id": "jHhL5B33o16R4jQsb8wm9A3RRdS6KrTB5N4bja9Jys9" +} +``` + +To get credentials from custom wallet, place it in `wallets` dir before start. +Make sure that wallet account has empty password. ## frostfs-cli interface diff --git a/docker-compose.yml b/docker-compose.yml index 1efaa25..b803fd0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -17,6 +17,7 @@ services: timeout: 2s volumes: - data:/data + - ./wallets:/wallets ports: - "8081:8081" # HTTP Gateway - "30333:30333" # RPC diff --git a/wallets/wallet1.json b/wallets/wallet1.json new file mode 100644 index 0000000..a67ecfd --- /dev/null +++ b/wallets/wallet1.json @@ -0,0 +1 @@ +{"version":"1.0","accounts":[{"address":"NhCHDEtGgSph1v6PmjFC1gtzJWNKtNSadk","key":"6PYQVTyo4PHBvegpRzSCNijGw6Zj2qN4wLVxTj5CM8nvsoYxkzBHqPzjzq","label":"wallet1","contract":{"script":"DCEDsJuqv/P2EHx+msuHIab8VhjUW1AkejFNguVIcCzOjNVBVuezJw==","parameters":[{"name":"parameter0","type":"Signature"}],"deployed":false},"lock":false,"isDefault":false}],"scrypt":{"n":16384,"r":8,"p":8},"extra":{"Tokens":null}} \ No newline at end of file diff --git a/wallets/wallet2.json b/wallets/wallet2.json new file mode 100644 index 0000000..f14e64b --- /dev/null +++ b/wallets/wallet2.json @@ -0,0 +1 @@ +{"version":"1.0","accounts":[{"address":"NivQRezLwGP8xFPr87DD5XaYGUKK3BMsTa","key":"6PYWJrGbrRmY9eTagWhNaucN2PfuPmi1G3QStUwNX8uAtCjTs6UYj1V1J9","label":"wallet2","contract":{"script":"DCED44dZlzprtyK6q8LdhANqOfCy9T0y/sRaTazeilD+S3BBVuezJw==","parameters":[{"name":"parameter0","type":"Signature"}],"deployed":false},"lock":false,"isDefault":false}],"scrypt":{"n":16384,"r":8,"p":8},"extra":{"Tokens":null}} \ No newline at end of file diff --git a/wallets/wallet3.json b/wallets/wallet3.json new file mode 100644 index 0000000..43d8d66 --- /dev/null +++ b/wallets/wallet3.json @@ -0,0 +1 @@ +{"version":"1.0","accounts":[{"address":"NR8qvrREk1eCeQJce9zBaDyPE3PHGZfT6t","key":"6PYWLJ3VAUcE8xLPnCbMp561b411u6qWoErdkx3hJugFZXrSckH9wTKRhe","label":"wallet3","contract":{"script":"DCECPwTRyxo1hHzMtjFAr5qmm8+WMm6X1qnlLX2lRkoSY+1BVuezJw==","parameters":[{"name":"parameter0","type":"Signature"}],"deployed":false},"lock":false,"isDefault":false}],"scrypt":{"n":16384,"r":8,"p":8},"extra":{"Tokens":null}} \ No newline at end of file