[#84] Port targets for issuing credentials
All checks were successful
DCO action / DCO (pull_request) Successful in 46s
All checks were successful
DCO action / DCO (pull_request) Successful in 46s
Signed-off-by: Nikita Zinkevich <n.zinkevich@yadro.com>
This commit is contained in:
parent
d0c32731f2
commit
fc39619f6b
5 changed files with 61 additions and 0 deletions
1
Makefile
1
Makefile
|
@ -60,6 +60,7 @@ get: $(foreach SVC, $(GET_SVCS), get.$(SVC))
|
|||
.PHONY: up
|
||||
up: up/basic
|
||||
@$(foreach SVC, $(START_SVCS), $(shell docker-compose -f services/$(SVC)/docker-compose.yml up -d))
|
||||
./vendor/frostfs-adm morph proxy-add-account --config frostfs-adm.yml --account NYpbUf3vVDfaL1UyiUxwEfR6dtrZSBztis || die "Couldn't set s3-gw wallet as proxy wallet"
|
||||
@echo "Full FrostFS Developer Environment is ready"
|
||||
|
||||
# Build up FrostFS
|
||||
|
|
|
@ -13,10 +13,12 @@ services:
|
|||
ipv4_address: ${IPV4_PREFIX}.82
|
||||
volumes:
|
||||
- ./wallet.json:/wallet.json
|
||||
- ./user_wallet.json:/user_wallet.json
|
||||
- ./tls.key:/tls.key
|
||||
- ./tls.crt:/tls.crt
|
||||
- ./../../vendor/hosts:/etc/hosts
|
||||
- ./cfg:/etc/frostfs/s3
|
||||
- ./issue-creds.sh:/usr/bin/issue-creds.sh
|
||||
stop_signal: SIGTERM
|
||||
stop_grace_period: 15s
|
||||
env_file: [ ".env", ".s3.env", ".int_test.env" ]
|
||||
|
@ -34,6 +36,7 @@ services:
|
|||
- S3_GW_PEERS_2_WEIGHT=0.2
|
||||
- S3_GW_PEERS_3_ADDRESS=s04.${LOCAL_DOMAIN}:8080
|
||||
- S3_GW_PEERS_3_WEIGHT=0.2
|
||||
- AUTHMATE_WALLET_CONTRACT_PASSPHRASE=s3
|
||||
|
||||
networks:
|
||||
s3_gate_int:
|
||||
|
|
39
services/s3_gate/issue-creds.sh
Executable file
39
services/s3_gate/issue-creds.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
initUser() {
|
||||
/bin/frostfs-s3-authmate register-user \
|
||||
--wallet $WALLET_PATH \
|
||||
--rpc-endpoint http://morph-chain.frostfs.devenv:30333 \
|
||||
--username $USERNAME \
|
||||
--contract-wallet /wallet.json 1> /dev/null && touch $WALLET_CACHE/$USERNAME
|
||||
}
|
||||
|
||||
issueAWS() {
|
||||
/bin/frostfs-s3-authmate issue-secret \
|
||||
--wallet $WALLET_PATH \
|
||||
--peer s01.frostfs.devenv:8080 \
|
||||
--gate-public-key $S3_GATE_PUBLIC_KEY \
|
||||
--container-placement-policy "REP 1"
|
||||
}
|
||||
|
||||
WALLET_PATH=/$2
|
||||
if [[ -z "$2" ]]; then
|
||||
WALLET_PATH=/user_wallet.json
|
||||
fi
|
||||
|
||||
S3_GATE_PUBLIC_KEY=$3
|
||||
if [[ -z "$3" ]]; then
|
||||
S3_GATE_PUBLIC_KEY=0204507e99f918e343046c382dfdb4564c616bc9ad6b2fe26b08f4b2b666c58ce9
|
||||
fi
|
||||
|
||||
WALLET_CACHE=/data/wallets
|
||||
mkdir -p $WALLET_CACHE
|
||||
|
||||
USERNAME=$(echo $WALLET_PATH | md5sum | cut -d' ' -f1)
|
||||
if [ ! -e $WALLET_CACHE/$USERNAME ]; then
|
||||
initUser
|
||||
fi
|
||||
|
||||
if [ $1 == "s3" ]; then
|
||||
issueAWS
|
||||
fi
|
17
services/s3_gate/prepare.mk
Normal file
17
services/s3_gate/prepare.mk
Normal file
|
@ -0,0 +1,17 @@
|
|||
.PHONY: s3cred s3cred-custom cred cred-custom
|
||||
|
||||
# Generate S3 credentials
|
||||
s3cred:
|
||||
@docker exec -it s3_gate /usr/bin/issue-creds.sh s3
|
||||
|
||||
# Generate S3 credentials based on imported wallets
|
||||
s3cred-custom:
|
||||
@docker exec -it s3_gate /usr/bin/issue-creds.sh s3 $(wallet)
|
||||
|
||||
# Register user-wallet.json in FrostFS ID contract
|
||||
cred:
|
||||
@docker exec -it s3_gate /usr/bin/issue-creds.sh native $(gate_public_key)
|
||||
|
||||
# Register custom wallet in FrostFS ID contract
|
||||
cred-custom:
|
||||
@docker exec -it s3_gate /usr/bin/issue-creds.sh native $(wallet) $(gate_public_key)
|
1
services/s3_gate/user_wallet.json
Normal file
1
services/s3_gate/user_wallet.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":"1.0","accounts":[{"address":"NQjbiXuAoZHCifBJ9H1TQ7SPQA3EzdA1Mr","key":"6PYVwvn4kpcHD2VedzwcKcFgGYooeiBrWaJdXg1WEag3fzNWMwPKnKDKV4","label":"nikita","contract":{"script":"DCEDzN6yW9sasGL4sGpyAq9I47Ly2b2JjRz0WSqLoW1sIU9BVuezJw==","parameters":[{"name":"parameter0","type":"Signature"}],"deployed":false},"lock":false,"isDefault":false}],"scrypt":{"n":16384,"r":8,"p":8},"extra":{"Tokens":null}}
|
Loading…
Reference in a new issue