Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions scripts/tokensmith_bootstrap_token.sh
Copy link
Copy Markdown
Contributor

@davidallendj davidallendj Apr 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script needs to be copied and permissions changed in the openchami.spec file. I'm not sure exactly where it goes but I'm guessing here.

cp scripts/tokensmith_bootstrap_token.sh          %{buildroot}/usr/bin
# ...
chmod +x %{buildroot}/usr/bin/tokensmith_bootstrap_token.sh

*Edit: It looks like the tokensmith_bootstrap_token.sh script should be placed in /usr/local/sbin/ judging by the ExecStartPre path in the boot-service.service file.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

CLIENT="${1}"
SERVICE="smd"

TOKENSMITH_BOOTSTRAP_TOKEN=$(podman exec -e SERVICE=$SERVICE -e CLIENT=$CLIENT tokensmith /bin/sh -c "\
/usr/local/bin/tokensmith mint-bootstrap-token \
--key-file /tmp/tokensmith/keys/private.pem \
--service-id ${CLIENT}-client \
--target-service ${SERVICE}
")
SECRET_NAME="${CLIENT}-bootstrap-token"
printf '%s' "$TOKENSMITH_BOOTSTRAP_TOKEN" | podman secret rm ${SECRET_NAME} 2>/dev/null || true
printf '%s' "$TOKENSMITH_BOOTSTRAP_TOKEN" | podman secret create ${SECRET_NAME} -
25 changes: 9 additions & 16 deletions systemd/configs/openchami.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,6 @@ URLS_LOGOUT=https://${SYSTEM_URL}/logout
# Environemnt Variables
POSTGRES_USER=ochami

# Environemnt Variables
BSS_USESQL=true
BSS_INSECURE=true
BSS_DEBUG=true
BSS_DBHOST=postgres
BSS_DBPORT=5432
BSS_DBNAME=bssdb
BSS_DBUSER=bss-user
BSS_JWKS_URL=http://opaal:3333/keys
BSS_OAUTH2_ADMIN_BASE_URL=http://opaal:3333
BSS_OAUTH2_PUBLIC_BASE_URL=http://opaal:3333
BSS_IPXE_SERVER=${SYSTEM_URL}
BSS_CHAIN_PROTO=https

# Environemnt Variables
SMD_DBHOST=postgres
SMD_DBPORT=5432
Expand All @@ -36,6 +22,15 @@ SMD_DBUSER=smd-user
SMD_DBOPTS=sslmode=disable
SMD_JWKS_URL=http://opaal:3333/keys
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what changes have been made to SMD with the tokensmith integration, but this would probably need to be changed or removed.


# Environemnt Variables
TOKENSMITH_ISSUER=https://tokensmith.openchami.dev
TOKENSMITH_CLUSTER_ID=demo-cluster
TOKENSMITH_OPENCHAMI_ID=demo-openchami
TOKENSMITH_CONFIG=/tokensmith/config.json
TOKENSMITH_KEY_DIR=/tmp/tokensmith/keys
TOKENSMITH_OIDC_PROVIDER=http://hydra:4444
TOKENSMITH_PORT=8080

# Environemnt Variables
STEPPATH=/home/step
DOCKER_STEPCA_INIT_NAME=OpenCHAMI
Expand All @@ -53,6 +48,4 @@ ANSIBLE_HOST_KEY_CHECKING=False
# Environemnt Variables for cloud-init
LISTEN=:27777
SMD_URL=http://smd:27779
OPAAL_URL=http://opaal:3333
JWKS_URL=http://opaal:3333/keys
IMPERSONATION=true
19 changes: 19 additions & 0 deletions systemd/configs/tokensmith.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"groupScopes": {
"admin": [
"admin",
"write",
"read"
],
"operator": [
"write",
"read"
],
"user": [
"read"
],
"viewer": [
"read"
]
}
}
30 changes: 30 additions & 0 deletions systemd/containers/boot-service.service
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a quick note glancing at this: The files in systemd/containers/ are named *.container instead of *.service. It looks like that also applies to metadata-service.service too.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[Unit]
Description=The bss container
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bss container -> The boot-service container

PartOf=openchami.target

# Ensure SMD has started already
Wants=smd.service tokensmith.service
After=smd.service tokensmith.service

[Container]
ContainerName=boot-service
HostName=boot-service
Image=boot-service:test

# Environment Variables
EnvironmentFile=/etc/openchami/configs/openchami.env

# Secrets
Secret=boot-service-bootstrap-token,type=env,target=TOKENSMITH_BOOTSTRAP_TOKEN

# Networks for the Container to use
Network=openchami-internal.network

# Proxy settings
PodmanArgs=--http-proxy=false

Exec=serve --enable-auth --tokensmith_url=http://tokensmith:8080 --hsm-url=http://smd:27779 --tokensmith-target-service smd

[Service]
ExecStartPre=/usr/local/sbin/tokensmith_bootstrap_token.sh boot-service
Restart=always
28 changes: 0 additions & 28 deletions systemd/containers/bss-init.container

This file was deleted.

36 changes: 0 additions & 36 deletions systemd/containers/bss.container

This file was deleted.

24 changes: 0 additions & 24 deletions systemd/containers/cloud-init-server.container

This file was deleted.

4 changes: 2 additions & 2 deletions systemd/containers/coresmd-coredhcp.container
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=The CoreSMD CoreDHCP container
Wants=haproxy.service
After=haproxy.service
Wants=tokensmith.service smd.service
After=tokensmith.service smd.service
PartOf=openchami.target

[Container]
Expand Down
4 changes: 2 additions & 2 deletions systemd/containers/haproxy.container
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Unit]
Description=The haproxy container
Wants=bss.service cloud-init-server.service smd.service acme-deploy.service
After=openchami-external-network.service opaal.service smd.service bss.service acme-deploy.service cloud-init-server.service
Wants=boot-service.service metadata-service.service smd.service acme-deploy.service
After=openchami-external-network.service smd.service boot-service.service acme-deploy.service metadata-service.service
Requires=openchami-external-network.service acme-deploy.service
PartOf=openchami.target

Expand Down
26 changes: 0 additions & 26 deletions systemd/containers/hydra-gen-jwks.container

This file was deleted.

32 changes: 0 additions & 32 deletions systemd/containers/hydra-migrate.container

This file was deleted.

40 changes: 0 additions & 40 deletions systemd/containers/hydra.container

This file was deleted.

27 changes: 27 additions & 0 deletions systemd/containers/metadata-service.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[Unit]
Description=The metadata-service container
Wants=smd.service
After=smd.service tokensmith.service
PartOf=openchami.target

[Container]
ContainerName=metadata-service
HostName=metadata-service
Image=metadata-service:test

Secret=metadata-service-bootstrap-token,type=env,target=TOKENSMITH_BOOTSTRAP_TOKEN

# Environment Variables
EnvironmentFile=/etc/openchami/configs/openchami.env

Exec=serve --tokensmith-url=http://tokensmith:8080

# Networks for the Container to use
Network=openchami-internal.network

# Proxy settings
PodmanArgs=--http-proxy=false

[Service]
ExecStartPre=/usr/local/sbin/tokensmith_bootstrap_token.sh metadata-service
Restart=always
26 changes: 0 additions & 26 deletions systemd/containers/opaal-idp.container

This file was deleted.

Loading
Loading