Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
78faa66
added tokensmith basic config file; update env file
travisbcotton Apr 2, 2026
9521654
added tokensmith bootstrap token script
travisbcotton Apr 7, 2026
639f1dc
removed old services; added new ones
travisbcotton Apr 7, 2026
df2ed75
updating some container files
travisbcotton Apr 7, 2026
c1020f3
renamed .service files to .container
travisbcotton Apr 14, 2026
6f3eb1c
actually remove the .service files
travisbcotton Apr 14, 2026
2c05c17
update boot-service description
travisbcotton Apr 14, 2026
4988684
remove hydra dependency
travisbcotton Apr 14, 2026
f16b084
update SMD env vars
travisbcotton Apr 14, 2026
b5591a4
update where tokesmith config file is mounted from
travisbcotton Apr 14, 2026
794f992
updated spec file to include tokensmith bootstrap script
travisbcotton Apr 14, 2026
29d3177
update spec again and renamed script to remove .sh ending
travisbcotton Apr 14, 2026
d45e3a0
update spec to hopefully fix rpm not building
travisbcotton Apr 14, 2026
0a4adaf
update spec yet again to add tokensmith_bootstrap_token to the config…
travisbcotton Apr 14, 2026
91b1c46
update ExecStartPre to use renamed tokensmith bootstrap script
travisbcotton Apr 14, 2026
d030f20
added boostrap secret to metadata-service
travisbcotton Apr 14, 2026
00eb5cd
updated openchami.target with new services; removed old ones
travisbcotton Apr 14, 2026
39d4005
updated tokensmith_bootstrap_token script to match updated tokensmith…
travisbcotton Apr 15, 2026
3b7d272
use v0.4.0 for tokensmith
travisbcotton Apr 15, 2026
a0d59ee
update tokensmith container
travisbcotton Apr 15, 2026
1789faa
update bootstrap_token to read the container env for token directory
travisbcotton Apr 16, 2026
3813f90
make boot-service require tokensmith
travisbcotton Apr 16, 2026
2fbbbb8
add persistent volume for tokensmith data
travisbcotton Apr 16, 2026
e13035e
updated tokensmith Exec, boot-service exec, some dependencies
travisbcotton Apr 16, 2026
4745776
remove opaal stuff from bootstrap_openchami.sh
travisbcotton Apr 16, 2026
2eb8996
update tokensmith container to mount the correct config file path
travisbcotton Apr 16, 2026
88c10b0
update tokensmith container to mount the correct config file path for…
travisbcotton Apr 16, 2026
13e4e48
ok now set the correct path for mounting inside the tokensmith contai…
travisbcotton Apr 16, 2026
b905e51
try to fix volume mount BS
travisbcotton Apr 16, 2026
289849f
use correct path for tokensmith bootstrap script in boot-service and …
travisbcotton Apr 16, 2026
6a7e1a4
use pr-7 for metadata
travisbcotton Apr 16, 2026
408e67a
update haproxy config
travisbcotton Apr 16, 2026
242773b
haproxy.cfg needs a newline at the end of the file? removed commented…
travisbcotton Apr 16, 2026
920d1d5
work on making bootstrap token scrit better
travisbcotton Apr 20, 2026
7c54ae3
minor updates to container files
travisbcotton Apr 20, 2026
b21c9f9
update haproxy.cfg
travisbcotton Apr 20, 2026
d9d2e7f
update openchami.target
travisbcotton Apr 20, 2026
6f4ce02
updated haproxy.cfg, removed more references to opaal
travisbcotton Apr 20, 2026
8f937f3
update some quadlet dependencies
travisbcotton Apr 20, 2026
d01b948
change target service from hsm to smd
travisbcotton May 14, 2026
22776a1
update boot-service container to use v0.1.5
travisbcotton May 14, 2026
03eeec3
remove hydra stuff from bootstrap+openchami.sh
travisbcotton May 14, 2026
d784192
remove cloud-init vars, revisit when metadata-service is in a better …
travisbcotton May 14, 2026
a763e13
set metadata-service to use port 8080 in haproxy since it's the default
travisbcotton May 14, 2026
0c8e315
remove the tokensmith flag for now, use pr-8 for the image
travisbcotton May 14, 2026
4b7c780
rename cloud-init-data volume to metadata-data, set metadata-service.…
travisbcotton May 14, 2026
9633ca9
fix volume name for metadata
travisbcotton May 14, 2026
3022616
bump tokensmith version and update Exec in container file
travisbcotton May 14, 2026
9309ecf
added SMD_URL=http://smd:27779 back since metadata-service seems to u…
travisbcotton May 14, 2026
16ef006
bump smd container version to v2.20.0
travisbcotton May 14, 2026
6ec4562
removed opaal refernce from openchami-certificate-update
travisbcotton May 14, 2026
eda3d55
added comment about OIDC provider in openchami.env file
travisbcotton May 14, 2026
93f4bf3
added usage to tokensmith_bootstrap_token, will print when missing cl…
travisbcotton May 14, 2026
6767e88
set metadata-service container image version to v0.1.0
travisbcotton May 14, 2026
b663e65
update coredhcp.yaml to match CoreSMD rules in v0.6.*
synackd May 14, 2026
36956de
bump coresmd to v0.6.1
synackd May 14, 2026
30ff0b5
use xname for bmc hostname pattern
synackd May 14, 2026
2e239c6
bump smd to v2.20.3
synackd May 14, 2026
f4e572e
remove unused secrets
synackd May 14, 2026
4bbf325
remove extra newline in coredhcp.yaml
synackd May 14, 2026
95ef228
bump coresmd to v0.6.3
synackd May 28, 2026
6442d3e
bump boot-service to v0.1.6 for client debug messages
synackd Jun 1, 2026
9a99f8c
bump metadata-service to v0.1.1
synackd Jun 3, 2026
76177ff
add --tokensmith-url back to metadata-service
synackd Jun 11, 2026
4f94aef
gen_access_token: use tokensmith user-token
synackd Jun 11, 2026
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
26 changes: 15 additions & 11 deletions openchami.spec
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,29 @@ mkdir -p %{buildroot}/etc/openchami/configs \
%{buildroot}/etc/containers/systemd \
%{buildroot}/etc/systemd/system \
%{buildroot}/usr/bin \
%{buildroot}/usr/sbin \
%{buildroot}/etc/profile.d \
%{buildroot}/usr/libexec/openchami

cp -r systemd/configs/* %{buildroot}/etc/openchami/configs/
cp -r systemd/containers/* %{buildroot}/etc/containers/systemd/
cp -r systemd/volumes/* %{buildroot}/etc/containers/systemd/
cp -r systemd/networks/* %{buildroot}/etc/containers/systemd/
cp -r systemd/targets/* %{buildroot}/etc/systemd/system/
cp -r systemd/system/* %{buildroot}/etc/systemd/system/
cp scripts/bootstrap_openchami.sh %{buildroot}/usr/libexec/openchami/
cp scripts/openchami-certificate-update %{buildroot}/usr/bin/
cp scripts/openchami_profile.sh %{buildroot}/etc/profile.d/openchami.sh
cp scripts/multi-psql-db.sh %{buildroot}/etc/openchami/pg-init/multi-psql-db.sh
cp scripts/ohpc-nodes.sh %{buildroot}/usr/libexec/openchami/
cp -r systemd/configs/* %{buildroot}/etc/openchami/configs/
cp -r systemd/containers/* %{buildroot}/etc/containers/systemd/
cp -r systemd/volumes/* %{buildroot}/etc/containers/systemd/
cp -r systemd/networks/* %{buildroot}/etc/containers/systemd/
cp -r systemd/targets/* %{buildroot}/etc/systemd/system/
cp -r systemd/system/* %{buildroot}/etc/systemd/system/
cp scripts/bootstrap_openchami.sh %{buildroot}/usr/libexec/openchami/
cp scripts/openchami-certificate-update %{buildroot}/usr/bin/
cp scripts/openchami_profile.sh %{buildroot}/etc/profile.d/openchami.sh
cp scripts/multi-psql-db.sh %{buildroot}/etc/openchami/pg-init/multi-psql-db.sh
cp scripts/ohpc-nodes.sh %{buildroot}/usr/libexec/openchami/
cp scripts/tokensmith_bootstrap_token %{buildroot}/usr/sbin/

chmod +x %{buildroot}/usr/libexec/openchami/bootstrap_openchami.sh
chmod +x %{buildroot}/usr/libexec/openchami/ohpc-nodes.sh
chmod +x %{buildroot}/usr/libexec/openchami/bootstrap_openchami.sh
chmod +x %{buildroot}/usr/bin/openchami-certificate-update
chmod +x %{buildroot}/usr/libexec/openchami/ohpc-nodes.sh
chmod 0700 %{buildroot}/usr/sbin/tokensmith_bootstrap_token

chmod 600 %{buildroot}/etc/openchami/configs/openchami.env
chmod 644 %{buildroot}/etc/openchami/configs/*
Expand All @@ -70,6 +73,7 @@ chmod 644 %{buildroot}/etc/openchami/configs/*
/etc/profile.d/openchami.sh
/etc/openchami/pg-init/multi-psql-db.sh
/usr/bin/openchami-certificate-update
/usr/sbin/tokensmith_bootstrap_token

%pre
if [ -f /etc/containers/systemd/coresmd.container ]; then
Expand Down
20 changes: 2 additions & 18 deletions scripts/bootstrap_openchami.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ acme_correction() {
sed -i "s/^ContainerName=.*/ContainerName=${system_fqdn}/" /etc/containers/systemd/acme-register.container
sed -i "s/^HostName=.*/HostName=${system_fqdn}/" /etc/containers/systemd/acme-register.container
sed -i "s|-d .* \\\\|-d ${system_fqdn} \\\\|" /etc/containers/systemd/acme-register.container
sed -i "s|--add-host='demo\.openchami\.cluster:[0-9\.]*'|--add-host='${system_fqdn}:${primary_ip}'|" /etc/containers/systemd/opaal.container
Comment thread
travisbcotton marked this conversation as resolved.
}

# Check and create secrets with random passwords if needed
Expand All @@ -55,32 +54,17 @@ acme_correction() {
postgres_password=$(generate_random_password)
create_secret_if_not_exists "postgres_password" "$postgres_password"

# BSS Postgres Password
bss_postgres_password=$(generate_random_password)
create_secret_if_not_exists "bss_postgres_password" "$bss_postgres_password"

# SMD Postgres Password
smd_postgres_password=$(generate_random_password)
create_secret_if_not_exists "smd_postgres_password" "$smd_postgres_password"

# Hydra Postgres Password
hydra_postgres_password=$(generate_random_password)
create_secret_if_not_exists "hydra_postgres_password" "$hydra_postgres_password"

# Hydra System Secret
hydra_system_secret=$(generate_random_password)
create_secret_if_not_exists "hydra_system_secret" "$hydra_system_secret"

# HYDRA_DSN
HYDRA_DSN="postgres://hydra-user:$(podman secret inspect hydra_postgres_password --showsecret | jq -r '.[0].SecretData')@postgres:5432/hydradb?sslmode=disable&max_conns=20&max_idle_conns=4"
create_secret_if_not_exists "hydra_dsn" "$HYDRA_DSN"

# POSTGRES_MULTIPLE_DATABASES
POSTGRES_MULTIPLE_DATABASES="hmsds:smd-user:$(podman secret inspect smd_postgres_password --showsecret | jq -r '.[0].SecretData'),bssdb:bss-user:$(podman secret inspect bss_postgres_password --showsecret | jq -r '.[0].SecretData'),hydradb:hydra-user:$(podman secret inspect hydra_postgres_password --showsecret | jq -r '.[0].SecretData')"
POSTGRES_MULTIPLE_DATABASES="hmsds:smd-user:$(podman secret inspect smd_postgres_password --showsecret | jq -r '.[0].SecretData')"
create_secret_if_not_exists "postgres_multiple_databases" "$POSTGRES_MULTIPLE_DATABASES"

# openchami.env Configuration
generate_environment_file

# Correct the ACME files
acme_correction
acme_correction
1 change: 0 additions & 1 deletion scripts/openchami-certificate-update
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ update_dns() {
sed -i "s/^ContainerName=.*/ContainerName=${system_fqdn}/" /etc/containers/systemd/acme-register.container
sed -i "s/^HostName=.*/HostName=${system_fqdn}/" /etc/containers/systemd/acme-register.container
sed -i "s|-d .* \\\\|-d ${system_fqdn} \\\\|" /etc/containers/systemd/acme-register.container
sed -i "s|--add-host='.*|--add-host='${system_fqdn}:${primary_ip}'|" /etc/containers/systemd/opaal.container

# Reload systemD after .container changes
systemctl daemon-reload
Expand Down
38 changes: 12 additions & 26 deletions scripts/openchami_profile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,18 @@ container_curl() {
${CONTAINER_CMD:-docker} run -it --rm "${CURL_CONTAINER}:${CURL_TAG}" -s $url
}

create_client_credentials() {
${CONTAINER_CMD:-docker} exec hydra hydra create client \
--endpoint http://hydra:4445/ \
--format json \
--grant-type client_credentials \
--scope openid \
--scope smd.read
}

retrieve_access_token() {
local CLIENT_ID=$1
local CLIENT_SECRET=$2

${CONTAINER_CMD:-docker} run --http-proxy=false --rm --network openchami-jwt-internal "${CURL_CONTAINER}:${CURL_TAG}" curl -s -u "$CLIENT_ID:$CLIENT_SECRET" \
-d grant_type=client_credentials \
-d scope=openid+smd.read \
http://hydra:4444/oauth2/token
}

gen_access_token() {
local CLIENT_CREDENTIALS
CLIENT_CREDENTIALS=$(create_client_credentials)
local CLIENT_ID=`echo $CLIENT_CREDENTIALS | jq -r '.client_id'`
local CLIENT_SECRET=`echo $CLIENT_CREDENTIALS | jq -r '.client_secret'`
local ACCESS_TOKEN=$(retrieve_access_token $CLIENT_ID $CLIENT_SECRET | jq -r .access_token)
echo $ACCESS_TOKEN
${CONTAINER_CMD:-docker} exec tokensmith \
/bin/sh \
-c \
"/usr/local/bin/tokensmith \
user-token \
create \
--audience smd \
--key-file /tokensmith/data/keys/private.pem \
--subject 'admin@example.com' \
--scopes 'admin' \
--enable-local-user-mint"
}


Expand Down Expand Up @@ -107,4 +93,4 @@ create_podman_secret() {
fi

echo -n $secret | ${CONTAINER_CMD:-docker} secret create $name -
}
}
31 changes: 31 additions & 0 deletions scripts/tokensmith_bootstrap_token
Comment thread
davidallendj marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
usage() {
echo "usage: $0 CLIENT"
echo
echo 'CLIENT: name of client service to generate token for'
}

CLIENT="${1}"
Comment thread
travisbcotton marked this conversation as resolved.
SERVICE="smd"

if [[ -z "$CLIENT" ]]
then
echo "Empty client"
usage >&2
exit 1
fi
Comment thread
travisbcotton marked this conversation as resolved.

echo "Generating bootstrap token for service client ${CLIENT}"
TOKENSMITH_BOOTSTRAP_TOKEN=$(podman exec -e SERVICE=$SERVICE -e CLIENT=$CLIENT tokensmith /bin/sh -c "\
/usr/local/bin/tokensmith bootstrap-token create \
--bootstrap-store \${TOKENSMITH_RFC8693_BOOTSTRAP_STORE} \
--subject \${CLIENT} \
--audience \${SERVICE} \
--scopes "read" \
--output-format json | jq -r '.bootstrap_token'
")

SECRET_NAME="${CLIENT}-bootstrap-token"
echo "Creating secret ${CLIENT}-bootstrap-token"
printf '%s' "$TOKENSMITH_BOOTSTRAP_TOKEN" | podman secret rm -i ${SECRET_NAME} 2>/dev/null || true
printf '%s' "$TOKENSMITH_BOOTSTRAP_TOKEN" | podman secret create ${SECRET_NAME} -
105 changes: 91 additions & 14 deletions systemd/configs/coredhcp.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,95 @@
# Based on https://github.com/coredhcp/coredhcp/blob/master/cmds/coredhcp/config.yml.example
# See there for more extensive CoreDHCP configuration documentation.

server4:
# You can configure the specific interfaces that you want OpenCHAMI to listen on by
# uncommenting the lines below and setting the interface
# listen:
# - "%virbr-openchami"
# Optionally define how CoreDHCP binds to an interface or address. If unset,
# the server will bind to all interfaces (0.0.0.0).
#
#listen:
# - "%virbr-openchami"
plugins:
# You are able to set the IP address of the system in server_id as the place to look for a DHCP server
# DNS is able to be set to whatever you want but it is much easier if you keep it set to the server IP
# Router is also able to be set to whatever you network router address is
# - server_id: 172.16.0.254
# - dns: 172.16.0.254
# - router: 172.16.0.254
# Set DHCP Server Identifier to help resolve situations when there are
# multiple DHCP servers on a network.
#- server_id: 172.16.0.254

# Advertise list of DNS resolvers to use for hosts on network.
#- dns: 172.16.0.254

# REQUIRED: Advertise address of default router on network.
#- router: 172.16.0.254

# Advertise network mask of assigned IPs on network.
- netmask: 255.255.255.0
# The lines below define where the system should assign ip addresses for systems that do not have
# mac addresses stored in SMD
# - coresmd: https://demo.openchami.cluster:8443 http://172.16.0.254:8081 /root_ca/root_ca.crt 30s 1h false
# - bootloop: /tmp/coredhcp.db default 5m 172.16.0.200 172.16.0.250

#
# OpenCHAMI CONFIGURATION
#

# Assign IP addresses to devices known to OpenCHAMI based on MAC address.
#- coresmd: |
# /* Base URI for contacting SMD */
# svc_base_uri=https://demo.openchami.cluster:8443
#
# /* Base URI for contacting boot-service for boot scripts */
# ipxe_base_uri=http://172.16.0.254:8081
#
# /*
# * Path to root CA certificate in container to use for TLS
# * verification for communication with SMD
# */
# ca_cert=/root_ca/root_ca.crt
#
# /* Refresh interval for CoreSMD's component cache */
# cache_valid=30s
#
# /* Duration DHCP leases should be valid */
# lease_time=1h
#
# /* Toggle TFTP single-port mode */
# single_port=false
#
# /*
# * RICH RULES
# *
# * These are used to set DHCP options based on certain selectors.
# * See: https://github.com/OpenCHAMI/coresmd/blob/main/examples/coredhcp/rules.md
# */
#
# /* Domain to append to set hostnames (able to be overridden)
# domain=openchami.cluster
#
# /*
# * Log level for rules.
# *
# * none: do not log
# * info: log rule matches
# * debug: log rule matches and non-matches
# */
# rule_log=info
#
# /* Set hostname based on type (node or BMC, respectively) */
# rule=type:Node,hostname:n{02d}
# rule=type:NodeBMC,hostname:{id}

# Optional catch-all for extra devices. This plugin is meant to assign
# temporary IPs via a very short lease to devices not tracked in SMD, e.g.
# for BMCs to be discoverable via Redfish so they _can_ be added to SMD.
# Non-BMC devices are served an iPXE script that instructs them to reboot
# (by default, this is customizable, hence the name 'bootloop') so that
# they will constantly try to get a new lease. The idea is that once they
# are added to SMD, CoreSMD above will catch it.
#- bootloop: |
# /* Where to store leases (sqlite)
# lease_file=/tmp/coredhcp.db
#
# /* iPXE script to use ('default' reboots)
# script_path=default
#
# /* Duration of short-lived lease */
# lease_time=5m
#
# /* Beginning IP of assignable IPv4 addresses */
# ipv4_start=172.16.0.200
#
# /* Ending IP of assignable IPv4 addresses */
# ipv4_end=172.16.0.250
58 changes: 20 additions & 38 deletions systemd/configs/haproxy.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,50 +23,32 @@ frontend openchami
bind :443 ssl crt /etc/haproxy/certs/ strict-sni
option forwardfor

acl PATH_smd path_beg -i /hsm/v2
acl PATH_smd path_beg -i /hsm/v2
acl PATH_configurator path_beg -i /configurator /generate
acl PATH_boot-service path_beg -i /boot-service/
acl PATH_metadata-service path_beg -i /metadata-service/
acl PATH_tokensmith path_beg -i /tokensmith/

acl PATH_bss path_beg -i /boot/v1
acl PATH_bss path_beg -i /apis/bss/

acl PATH_opaal path_beg -i /token
acl PATH_opaal path_beg -i /login
acl PATH_opaal path_beg -i /oidc/callback

acl PATH_opaal-idp path_beg -i /.well-known/openid-configuration
acl PATH_opaal-idp path_beg -i /.well-known/jwks.json
acl PATH_opaal-idp path_beg -i /browser/login
acl PATH_opaal-idp path_beg -i /api/login
acl PATH_opaal-idp path_beg -i /oauth2/authorize
acl PATH_opaal-idp path_beg -i /oauth2/token

acl PATH_cloud-init path_beg -i /cloud-init

acl PATH_configurator path_beg -i /generate
acl PATH_configurator path_beg -i /configurator

use_backend opaal if PATH_opaal
use_backend opaal-idp if PATH_opaal-idp
use_backend smd if PATH_smd
use_backend bss if PATH_bss
use_backend cloud-init if PATH_cloud-init
use_backend configurator if PATH_configurator

backend opaal
server opaal opaal:3333

backend opaal-idp
server opaal-idp opaal-idp:3332
use_backend boot-service if PATH_boot-service
use_backend metadata-service if PATH_metadata-service
use_backend tokensmith if PATH_tokensmith

backend smd
server smd smd:27779

backend bss
server bss bss:27778
http-request replace-path ^/apis/bss/(.*) /\1

backend cloud-init
server cloud-init-server cloud-init-server:27777
http-request replace-path ^/cloud-init(/.*) \1

backend configurator
server configurator configurator:3334 init-addr none

backend boot-service
http-request set-path %[path,regsub(^/boot-service/,/)]
server boot-service boot-service:8081

backend metadata-service
http-request set-path %[path,regsub(^/metadata-service/,/)]
server metadata-service metadata-service:8080

backend tokensmith
http-request set-path %[path,regsub(^/tokensmith/,/)]
server tokensmith tokensmith:8080
Loading
Loading