Skip to content

Commit 3d25fc3

Browse files
committed
Add support for openbao_transit_mount_path field in server
1 parent ca83955 commit 3d25fc3

File tree

5 files changed

+23
-9
lines changed

5 files changed

+23
-9
lines changed

server/parsec/cli/run.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,23 @@ def handle_parse_result(
214214
envvar="PARSEC_OPENBAO_SECRET_MOUNT_PATH",
215215
metavar="MOUNT_PATH",
216216
show_envvar=True,
217-
help="""Configure the mount path of the KV2 secret module used for storage
217+
default="secret",
218+
help="""Configure the mount path of the OpenBao KV2 secret module used for storage
218219
219220
(see: https://openbao.org/api-docs/secret/kv/kv-v2/)
220221
""",
221222
)
223+
@click.option(
224+
"--openbao-transit-mount-path",
225+
envvar="PARSEC_OPENBAO_TRANSIT_MOUNT_PATH",
226+
metavar="MOUNT_PATH",
227+
show_envvar=True,
228+
default="transit",
229+
help="""Configure the mount path of the OpenBao transit module
230+
231+
(see: https://openbao.org/api-docs/secret/transit/)
232+
""",
233+
)
222234
@click.option(
223235
"--openbao-auth-pro-connect",
224236
envvar="PARSEC_OPENBAO_AUTH_PRO_CONNECT_MOUNT_PATH",
@@ -525,7 +537,8 @@ def run_cmd(
525537
administration_token: str,
526538
account_config: AccountConfig,
527539
openbao_server_url: str | None,
528-
openbao_secret_mount_path: str | None,
540+
openbao_secret_mount_path: str,
541+
openbao_transit_mount_path: str,
529542
openbao_auth_pro_connect: str | None,
530543
openbao_auth_hexagone: str | None,
531544
spontaneous_organization_bootstrap: bool,
@@ -592,11 +605,6 @@ def run_cmd(
592605
if openbao_server_url is None:
593606
openbao_config = None
594607
else:
595-
if openbao_secret_mount_path is None:
596-
raise ValueError(
597-
"--openbao-secret-mount-path is required when --openbao-server-url is provided"
598-
)
599-
600608
auths = []
601609
if openbao_auth_hexagone is not None:
602610
auths.append(
@@ -621,6 +629,7 @@ def run_cmd(
621629
openbao_config = OpenBaoConfig(
622630
server_url=openbao_server_url,
623631
secret_mount_path=openbao_secret_mount_path,
632+
transit_mount_path=openbao_transit_mount_path,
624633
auths=auths,
625634
)
626635

server/parsec/cli/testbed.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,7 @@ async def testbed_backend_factory(
986986
openbao_config=OpenBaoConfig(
987987
server_url=server_addr.to_http_url("/testbed/mock/openbao"),
988988
secret_mount_path="secret",
989+
transit_mount_path="transit",
989990
auths=[
990991
OpenBaoAuthConfig(
991992
id=OpenBaoAuthType.HEXAGONE,

server/parsec/components/events.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,7 @@ async def api_server_config(
525525
secret=anonymous_server_cmds.latest.server_config.OpenBaoSecretConfigKV2(
526526
mount_path=self._config.openbao_config.secret_mount_path
527527
),
528+
transit_mount_path=self._config.openbao_config.transit_mount_path,
528529
auths=[
529530
anonymous_server_cmds.latest.server_config.OpenBaoAuthConfig(
530531
id=auth.id.str,

server/parsec/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ class OpenBaoAuthConfig:
248248
class OpenBaoConfig:
249249
server_url: str
250250
secret_mount_path: str
251+
transit_mount_path: str
251252
auths: list[OpenBaoAuthConfig]
252253

253254

server/tests/api_v5/anonymous_server/test_server_config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ async def test_anonymous_server_server_config_ok(
2626
backend.config.account_config = AccountConfig.ENABLED_WITH_VAULT
2727
backend.config.openbao_config = OpenBaoConfig(
2828
server_url="https://openbao.parsec.invalid",
29-
secret_mount_path="secrets",
29+
secret_mount_path="secret",
30+
transit_mount_path="transit",
3031
auths=[
3132
OpenBaoAuthConfig(
3233
id=OpenBaoAuthType.HEXAGONE,
@@ -46,8 +47,9 @@ async def test_anonymous_server_server_config_ok(
4647
openbao=anonymous_server_cmds.latest.server_config.OpenBaoConfigEnabled(
4748
server_url="https://openbao.parsec.invalid",
4849
secret=anonymous_server_cmds.latest.server_config.OpenBaoSecretConfigKV2(
49-
"secrets"
50+
"secret"
5051
),
52+
transit_mount_path="transit",
5153
auths=[
5254
anonymous_server_cmds.latest.server_config.OpenBaoAuthConfig(
5355
id="HEXAGONE", mount_path="auth/hexagone"

0 commit comments

Comments
 (0)