forked from TrueCloudLab/frostfs-testcases
[#246] Get pubkey
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
This commit is contained in:
parent
a5764da57b
commit
da9b723498
4 changed files with 23 additions and 11 deletions
|
@ -10,7 +10,7 @@ from enum import Enum, auto
|
||||||
import base58
|
import base58
|
||||||
from cli_helpers import _cmd_run
|
from cli_helpers import _cmd_run
|
||||||
from common import ASSETS_DIR, NEOFS_ENDPOINT, WALLET_CONFIG
|
from common import ASSETS_DIR, NEOFS_ENDPOINT, WALLET_CONFIG
|
||||||
from neo3 import wallet
|
from data_formatters import pub_key_hex
|
||||||
from robot.api import logger
|
from robot.api import logger
|
||||||
from robot.api.deco import keyword
|
from robot.api.deco import keyword
|
||||||
|
|
||||||
|
@ -174,12 +174,8 @@ def eacl_rules(access: str, verbs: list, user: str):
|
||||||
(list): a list of eACL rules
|
(list): a list of eACL rules
|
||||||
"""
|
"""
|
||||||
if user not in ('others', 'user'):
|
if user not in ('others', 'user'):
|
||||||
wallet_content = ''
|
pubkey = pub_key_hex(user)
|
||||||
with open(user) as out:
|
user = f"pubkey:{pubkey}"
|
||||||
wallet_content = json.load(out)
|
|
||||||
wallet_from_json = wallet.Wallet.from_json(wallet_content, password="")
|
|
||||||
pub_key_64 = str(wallet_from_json.accounts[0].public_key)
|
|
||||||
user = f"pubkey:{pub_key_64}"
|
|
||||||
|
|
||||||
rules = []
|
rules = []
|
||||||
for verb in verbs:
|
for verb in verbs:
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
import json
|
||||||
|
from neo3 import wallet
|
||||||
|
|
||||||
|
|
||||||
def dict_to_attrs(attrs: dict) -> str:
|
def dict_to_attrs(attrs: dict) -> str:
|
||||||
"""
|
"""
|
||||||
|
@ -11,3 +14,13 @@ def dict_to_attrs(attrs: dict) -> str:
|
||||||
(str): string in "a=b,c=d" format.
|
(str): string in "a=b,c=d" format.
|
||||||
"""
|
"""
|
||||||
return ",".join(f"{key}={value}" for key, value in attrs.items())
|
return ",".join(f"{key}={value}" for key, value in attrs.items())
|
||||||
|
|
||||||
|
|
||||||
|
def pub_key_hex(wallet_path: str, wallet_password=""):
|
||||||
|
wallet_content = ''
|
||||||
|
with open(wallet_path) as out:
|
||||||
|
wallet_content = json.load(out)
|
||||||
|
wallet_from_json = wallet.Wallet.from_json(wallet_content, password=wallet_password)
|
||||||
|
pub_key_64 = str(wallet_from_json.accounts[0].public_key)
|
||||||
|
|
||||||
|
return pub_key_64
|
||||||
|
|
|
@ -6,13 +6,14 @@ import uuid
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
|
||||||
import boto3
|
import boto3
|
||||||
|
from data_formatters import pub_key_hex
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
import urllib3
|
import urllib3
|
||||||
from robot.api import logger
|
from robot.api import logger
|
||||||
from robot.api.deco import keyword
|
from robot.api.deco import keyword
|
||||||
|
|
||||||
from cli_helpers import _run_with_passwd, log_command_execution
|
from cli_helpers import _run_with_passwd, log_command_execution
|
||||||
from common import GATE_PUB_KEY, NEOFS_ENDPOINT, S3_GATE
|
from common import NEOFS_ENDPOINT, S3_GATE, S3_GATE_WALLET_PATH, S3_GATE_WALLET_PASS
|
||||||
|
|
||||||
##########################################################
|
##########################################################
|
||||||
# Disabling warnings on self-signed certificate which the
|
# Disabling warnings on self-signed certificate which the
|
||||||
|
@ -33,12 +34,13 @@ class VersioningStatus(Enum):
|
||||||
|
|
||||||
|
|
||||||
@keyword('Init S3 Credentials')
|
@keyword('Init S3 Credentials')
|
||||||
def init_s3_credentials(wallet, s3_bearer_rules_file: str = None):
|
def init_s3_credentials(wallet_path, s3_bearer_rules_file: str = None):
|
||||||
bucket = str(uuid.uuid4())
|
bucket = str(uuid.uuid4())
|
||||||
s3_bearer_rules = s3_bearer_rules_file or 'robot/resources/files/s3_bearer_rules.json'
|
s3_bearer_rules = s3_bearer_rules_file or 'robot/resources/files/s3_bearer_rules.json'
|
||||||
|
gate_pub_key = pub_key_hex(S3_GATE_WALLET_PATH, S3_GATE_WALLET_PASS)
|
||||||
cmd = (
|
cmd = (
|
||||||
f'{NEOFS_EXEC} --debug --with-log --timeout {CREDENTIALS_CREATE_TIMEOUT} '
|
f'{NEOFS_EXEC} --debug --with-log --timeout {CREDENTIALS_CREATE_TIMEOUT} '
|
||||||
f'issue-secret --wallet {wallet} --gate-public-key={GATE_PUB_KEY} '
|
f'issue-secret --wallet {wallet_path} --gate-public-key={gate_pub_key} '
|
||||||
f'--peer {NEOFS_ENDPOINT} --container-friendly-name {bucket} '
|
f'--peer {NEOFS_ENDPOINT} --container-friendly-name {bucket} '
|
||||||
f'--bearer-rules {s3_bearer_rules}'
|
f'--bearer-rules {s3_bearer_rules}'
|
||||||
)
|
)
|
||||||
|
|
|
@ -31,7 +31,6 @@ NEOFS_CONTRACT = os.getenv("NEOFS_IR_CONTRACTS_NEOFS")
|
||||||
ASSETS_DIR = os.getenv("ASSETS_DIR", "TemporaryDir/")
|
ASSETS_DIR = os.getenv("ASSETS_DIR", "TemporaryDir/")
|
||||||
|
|
||||||
MORPH_MAGIC = os.getenv("MORPH_MAGIC")
|
MORPH_MAGIC = os.getenv("MORPH_MAGIC")
|
||||||
GATE_PUB_KEY = '0313b1ac3a8076e155a7e797b24f0b650cccad5941ea59d7cfd51a024a8b2a06bf'
|
|
||||||
|
|
||||||
STORAGE_NODE_1 = os.getenv('DATA_NODE_1', 's01.neofs.devenv:8080')
|
STORAGE_NODE_1 = os.getenv('DATA_NODE_1', 's01.neofs.devenv:8080')
|
||||||
STORAGE_NODE_2 = os.getenv('DATA_NODE_2', 's02.neofs.devenv:8080')
|
STORAGE_NODE_2 = os.getenv('DATA_NODE_2', 's02.neofs.devenv:8080')
|
||||||
|
@ -69,6 +68,8 @@ IR_WALLET_PATH = f"{DEVENV_SERVICES_PATH}/ir/wallet01.json"
|
||||||
IR_WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/one_wallet_password.yml"
|
IR_WALLET_CONFIG = f"{os.getcwd()}/neofs_cli_configs/one_wallet_password.yml"
|
||||||
IR_WALLET_PASS = 'one'
|
IR_WALLET_PASS = 'one'
|
||||||
STORAGE_WALLET_PATH = f"{DEVENV_SERVICES_PATH}/storage/wallet01.json"
|
STORAGE_WALLET_PATH = f"{DEVENV_SERVICES_PATH}/storage/wallet01.json"
|
||||||
|
S3_GATE_WALLET_PATH = f"{DEVENV_SERVICES_PATH}/s3_gate/wallet.json"
|
||||||
|
S3_GATE_WALLET_PASS = 's3'
|
||||||
|
|
||||||
CONTROL_NODE_USER = os.getenv('CONTROL_NODE_USER', 'root')
|
CONTROL_NODE_USER = os.getenv('CONTROL_NODE_USER', 'root')
|
||||||
CONTROL_NODE_PWD = os.getenv('CONTROL_NODE_PWD')
|
CONTROL_NODE_PWD = os.getenv('CONTROL_NODE_PWD')
|
||||||
|
|
Loading…
Reference in a new issue