Skip to content

Slurm workload attestor - #7160

Merged
amartinezfayo merged 14 commits into
spiffe:mainfrom
kfox1111:slurm
Aug 13, 2026
Merged

amartinezfayo merged 14 commits into
spiffe:mainfrom
kfox1111:slurm

Conversation

@kfox1111

Copy link
Copy Markdown
Contributor

Pull Request check list

  • Commit conforms to CONTRIBUTING.md?
  • Proper tests/regressions included?
  • Documentation updated?

Affected functionality
NA

Description of change
Adds a new slurm workload attestor

Which issue this PR fixes
#7153

kfox1111 added 2 commits July 23, 2026 06:45
Signed-off-by: Kevin Fox <[email protected]>
Signed-off-by: Kevin Fox <[email protected]>

Copilot AI left a comment

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.

Pull request overview

Adds a new built-in SPIRE Agent WorkloadAttestor plugin for Slurm (cgroup v2), plus an end-to-end integration suite that spins up a single-node Slurm environment and validates X.509-SVID issuance for a Slurm batch job.

Changes:

  • Added slurm workload attestor plugin (POSIX implementation + Windows stub) and wired it into the agent catalog.
  • Added unit tests for Slurm cgroup parsing and a new slurm-x509 integration suite that exercises real Slurm job attestation via cgroup v2.
  • Updated CI runner OS for the main integration job matrix to Ubuntu 24.04 to support host systemd/cgroup v2 behavior needed by the Slurm suite.

Reviewed changes

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/integration/suites/slurm-x509/teardown Cleans up suite resources and dumps diagnostics on failure
test/integration/suites/slurm-x509/README.md Documents suite topology and host/containers setup rationale
test/integration/suites/slurm-x509/docker-compose.yaml Runs server/agent containers with host PID+cgroup sharing for attestation
test/integration/suites/slurm-x509/conf/slurm/slurm.conf Minimal Slurm config enabling cgroup-based proctrack/task plugins
test/integration/suites/slurm-x509/conf/slurm/cgroup.conf Configures Slurm to use cgroup/v2 plugin without constraints
test/integration/suites/slurm-x509/conf/server/server.conf Suite-local SPIRE server config
test/integration/suites/slurm-x509/conf/job/fetch-svid.sh Slurm job payload that repeatedly fetches an X.509-SVID until issued
test/integration/suites/slurm-x509/conf/agent/agent.conf Suite-local SPIRE agent config enabling the slurm attestor
test/integration/suites/slurm-x509/06-verify-fetch Verifies Slurm job obtained expected SPIFFE ID and output artifacts
test/integration/suites/slurm-x509/05-create-entry Creates a registration entry using slurm selectors and waits for sync
test/integration/suites/slurm-x509/04-submit-job Submits the Slurm job and waits until it is running
test/integration/suites/slurm-x509/03-start-agent Starts agent container and verifies successful node attestation
test/integration/suites/slurm-x509/02-bootstrap-agent Fetches bundle to bootstrap the agent
test/integration/suites/slurm-x509/01-start-server Starts server container
test/integration/suites/slurm-x509/00-setup Installs/configures Slurm+munge on host and prepares shared dirs/binaries
pkg/agent/plugin/workloadattestor/slurm/slurm.go Declares plugin name and BuiltIn registration entrypoint
pkg/agent/plugin/workloadattestor/slurm/slurm_windows.go Windows stub returning Unimplemented for Slurm attestation
pkg/agent/plugin/workloadattestor/slurm/slurm_posix.go POSIX Slurm cgroup parsing and selector emission
pkg/agent/plugin/workloadattestor/slurm/slurm_posix_test.go Unit tests for Slurm cgroup parsing and selector output
pkg/agent/catalog/workloadattestor.go Registers the new built-in slurm workload attestor
doc/plugin_agent_workloadattestor_slurm.md Adds plugin documentation and selector reference
.github/workflows/release_build.yaml Updates integration job runner OS to Ubuntu 24.04/24.04-arm
.github/workflows/pr_build.yaml Updates integration job runner OS to Ubuntu 24.04/24.04-arm

kfox1111 added 3 commits July 23, 2026 09:02
Signed-off-by: Kevin Fox <[email protected]>
Signed-off-by: Kevin Fox <[email protected]>
Signed-off-by: Kevin Fox <[email protected]>
@kfox1111 kfox1111 mentioned this pull request Jul 23, 2026
@@ -0,0 +1,43 @@
#!/bin/bash
#SBATCH --job-name=spire-fetch

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is it not possible to get this job name as a selector in some way? I imagine this would be a bit more useful than the IDs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

https://slurm.schedmd.com/rest_api.html#slurmV0045GetJob seems to have some more details about the job, the name, some group name, and maybe others.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the job name is a slurm user specifiable field for the user to help keep track of their own jobs. It will be insecure when used alone as a selector. So not super useful to spire setups I think.

I was trying to keep things simple. slurm-rest is not a commonly deployed component, and there is no standard way for a node to auth to it.

The easiest extension point would be to add a slurm prolog script on the compute nodes that pushes any of the metadata that slurm pushes to the hook:

Prolog gives you a decent set: SLURM_JOB_ID, SLURM_JOB_UID/GID/USER, SLURM_JOB_NODELIST, SLURM_JOB_PARTITION, SLURM_JOB_QOS, SLURM_JOB_ACCOUNT, SLURM_JOB_START_TIME, SLURM_JOB_WORK_DIR, SLURM_JOB_STDOUT/STDERR, SLURM_JOB_CONSTRAINTS, SLURM_JOB_GPUS, SLURM_JOB_SLUID, SLURMD_NODENAME, SLURM_CLUSTER_NAME

then get that data to the spire-agent plugin somehow. like dump it to json files. job name was left out I think as its a user field, so not for hooks.

Of those though, I think the only really useful ones are SLURM_CLUSTER_NAME and SLURM_JOB_ACCOUNT. USER info is attestable via the unix attestor already.
I'm not convinced any of those are worth making workload selectors for though. Just my 2c.

So, none of this helps with eliminating the need of of plumbing that makes the registration entries dynamically per job in spire. The most useful thing would be if you could do it per slurm account, but HPC systems often run into lots of scaling issues due to their size. Blanket adding x509 entries on nodes where the jobs are not registered to will make the scaling issue much worse. So an account selector, being the most useful other selector, doesnt really help much. Its super useful as a template item for the spiffe_id though.

So my suggestion would be, lets merge the functionality as is. Its simple and doesn't require extra scripts or advanced configuration of slurm on the compute nodes to get it to work. As we get more users of it, maybe some will think the extra functionality is worth the effort, and we can enhance it then. Or, after I try and use it for a while, maybe I'll change my mind and need it too. But, this current level of functionality feels like a good starting point to me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the information. So how would the SPIFFE IDs for these entries look like? Something like spiffe://<trust domain>/sluid/<sluid>job/<id>? Also, how would the nodes where the job runs be identified?

@kfox1111 kfox1111 Jul 25, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm planning on using spiffe://<trust domain>/<clustername>/<slurm account>

As previously mentioned, a spire-controller-manager like process that runs on the control plane node and collects job information from the slurm controller and pushes in the registration entries to spire. Hence the SSC request for another repo for that code.

As a taste though, this generates the list of running jobs and the node sets the job is running on:

squeue --json | jq -r '.jobs[] | select(IN(.job_state[]; "RUNNING")) | .job_id as $id | .account as $account | .job_resources | select(IN(.select_type[]; "CORE")) | "($account) ($id) (.nodes.list)"'

Example output:

project1 819721 t28
project1 819752 t[24,27,35-36]
project2 819846 t[53,101],ta18
project3 819912 t77
project1 820052 t86

@github-actions github-actions Bot assigned kfox1111 and unassigned amartinezfayo Jul 24, 2026

@amartinezfayo amartinezfayo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @kfox1111 for this contribution!

@@ -0,0 +1,40 @@
# Agent plugin: WorkloadAttestor "slurm"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would be good to also have this new plugin in the plugin table in the SPIRE Agent documentation and the full agent reference config.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Updated.

| `slurm:sluid` | Slurm SLUID of the job; the default job identifier (e.g. `slurm:sluid:s5K1KKYAYG5D00`). |
| `slurm:step` | Job step: a number or `batch`/`extern`/`interactive` (e.g. `slurm:step:batch`). |

Exactly one of `slurm:job_id` or `slurm:sluid` is produced for a given workload, depending

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this framing may only hold for Slurm 26.05 and later. Before 26.05 the cgroup/v2 layout always used job_ directories (that is what the suite's Slurm 23.11 produces), and SLUID naming + the CgroupJobIdPaths option were introduced in 26.05 (https://slurm.schedmd.com/cgroup.conf.html). I'm not sure what's the best way to handle this, would it make sense to qualify this by version so operators on older Slurm don't go looking for a knob that doesn't exist?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I took a stab at it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for updating this. I think the job_id row now conflicts with itself though. CgroupJobIdPaths only exists on 26.05 and later, where setting it to yes emits numeric job ids, while before 26.05 numeric ids are emitted unconditionally, so the row shouldn't say the selector only applies to versions older than 26.05. Maybe something like "Numeric Slurm job id. Emitted on Slurm older than 26.05, or on 26.05 and later when CgroupJobIdPaths=yes". There's also a small typo in the sluid row (verison).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh. yeah.

I just took another stab at it. How does this look?


## Platform support

This plugin is only supported on Unix systems and requires that Slurm is configured to use

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It could be worth documenting the deployment requirement here as well. When the agent runs in a container it needs to share the host PID and cgroup namespaces (as the suite's compose file does), since (I think?) otherwise /proc//cgroup won't show the host-rooted /system.slice path and Slurm workloads would attest with no selectors.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

sudo rm -rf /tmp/slurm-spire-sockets /tmp/slurm-spire-jobs
sudo install -d -m 0777 /tmp/slurm-spire-sockets /tmp/slurm-spire-jobs

# --- Install and configure a single-node Slurm cluster on the host ---------

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should guard this step against a machine that already runs Slurm?
It overwrites /etc/slurm/slurm.conf, installs a binary into /usr/local/bin, and restarts munge/slurmctld/slurmd, and the teardown stops those daemons and cancels all jobs, which could be destructive on a developer host with a real Slurm install. Failing early when slurmd or munge is already active (or unless running in CI) would keep that from happening by accident, what do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I was assuming no one would run the integration tests on their own boxes... Maybe this was a wrong assumption?

Should we do something like look for the GITHUB ACTIONS env vars and just deny the test if they are not in the environment?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Checking for GITHUB_ACTIONS and refusing to run otherwise sounds reasonable to me. I'll just note that this would diverge from how the other suites handle host dependencies, which is to run everything in containers. Since the regex requires the slurmstepd scope to live under the real host /system.slice, I think containerizing Slurm isn't really an option here, so gating on the CI environment seems like a fair trade-off. Maybe we could also accept an explicit opt-in (for example SLURM_SUITE_ALLOW_HOST_CHANGES=1) so the suite can still be run deliberately outside CI for debugging, say in a disposable VM.
It would be good to update the test suite README with these details.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmm, I was assuming no one would run the integration tests on their own boxes... Maybe this was a wrong assumption?

Our posture has been that the integration tests can be run on dev machines without needing CI infrastructure. make integration runs all the suites by default and supports running individual ones with SUITES.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok. Maybe I tweak the job to skip the job but pass then?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok. I took a stab at fixing this too.

Signed-off-by: Kevin Fox <[email protected]>
Signed-off-by: Kevin Fox <[email protected]>
Comment thread conf/agent/agent_full.conf Outdated
}
}

# WorkloadAttestor "slurm": A workload attestor which allows selectors based

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: the WorkloadAttestor entries here are in alphabetical order, so this one would go between k8s and systemd. The other Unix-only attestors also include a "Supported on Unix only." line in their description, which would be worth adding here too.

| `slurm:sluid` | Slurm SLUID of the job; the default job identifier (e.g. `slurm:sluid:s5K1KKYAYG5D00`). |
| `slurm:step` | Job step: a number or `batch`/`extern`/`interactive` (e.g. `slurm:step:batch`). |

Exactly one of `slurm:job_id` or `slurm:sluid` is produced for a given workload, depending

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for updating this. I think the job_id row now conflicts with itself though. CgroupJobIdPaths only exists on 26.05 and later, where setting it to yes emits numeric job ids, while before 26.05 numeric ids are emitted unconditionally, so the row shouldn't say the selector only applies to versions older than 26.05. Maybe something like "Numeric Slurm job id. Emitted on Slurm older than 26.05, or on 26.05 and later when CgroupJobIdPaths=yes". There's also a small typo in the sluid row (verison).

Signed-off-by: Kevin Fox <[email protected]>

@amartinezfayo amartinezfayo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @kfox1111! 🚀

@amartinezfayo amartinezfayo added this to the 1.15.3 milestone Aug 13, 2026
@github-actions github-actions Bot assigned amartinezfayo and unassigned kfox1111 Aug 13, 2026
@amartinezfayo
amartinezfayo added this pull request to the merge queue Aug 13, 2026
Merged via the queue into spiffe:main with commit 517c2a8 Aug 13, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants