Skip to content

Conversation

@Koncpa
Copy link
Collaborator

@Koncpa Koncpa commented Nov 12, 2025

Summary by Sourcery

Add support for the push attestation agent in test helpers, refactor tests for generic agent service invocation, and introduce new functional tests covering unreachable registrar/verifier and push-attestation scenarios

New Features:

  • Add push attestation agent management functions and logging to the test helper library
  • Introduce new functional test suite for handling unreachable verifier/registrar scenario
  • Add new functional test suite for push-attestation-on-localhost workflow

Enhancements:

  • Refactor existing tests to parameterize agent service (Agent vs PushAgent) via AGENT_SERVICE and TENANT_ARGS
  • Extend systemd drop-in unit file generation to include keylime_push_model_agent
  • Improve log file touching and cleanup quoting in test helpers

Tests:

  • Update measured-boot-swtpm-sanity tests to support push-model mode
  • Add push_model_agent invocation and flag handling to install and emulator configuration tests

@sourcery-ai
Copy link

sourcery-ai bot commented Nov 12, 2025

Reviewer's Guide

This pull request extends the test framework to support a new push-attestation agent and adds a functional test for the verifier/registrar unreachable scenario by enhancing the shared test helpers library, updating existing test scripts, adding systemd drop-in configurations for the new service, and introducing two new functional test suites.

File-Level Changes

Change Details Files
Extend test-helpers for push-attestation service support
  • Map push_model_agent name for logging
  • Add limeStartPushAgent, limeStopPushAgent, limePushAgentLogfile helpers
  • Include push agent logs in common log submission
  • Correct quoting and use true> for log file resets
Library/test-helpers/lib.sh
Parameterize existing measured-boot-swtpm-sanity tests for push model
  • Introduce TENANT_ARGS based on AGENT_SERVICE
  • Append TENANT_ARGS to keylime_tenant invocations
  • Configure verifier mode push when AGENT_SERVICE is PushAgent
  • Replace limeStartAgent/StopAgent calls with dynamic limeStart${AGENT_SERVICE}
functional/measured-boot-swtpm-sanity/test.sh
Add systemd drop-in units for keylime_push_model_agent
  • Create drop-in directory for push_model_agent
  • Add RUST_LOG trace configuration
  • Add TPM_BINARY_MEASUREMENTS and coverage settings
setup/install_upstream_rust_keylime/test.sh
Unify TCTI drop-in updates for both agent services
  • Loop over keylime_agent and keylime_push_model_agent service.d dirs
  • Apply identical 10-tcti.conf to both
setup/configure_tpm_emulator/test.sh
Introduce new functional test suites
  • Add verifier_registrar_unreachable test and FMF
  • Add push-attestation-on-localhost test and FMF
functional/verifier_registrar_unreachable/test.sh
functional/verifier_registrar_unreachable/main.fmf
functional/push-attestation-on-localhost/test.sh
functional/push-attestation-on-localhost/main.fmf

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Quote all variable expansions in lib.sh (e.g. ${__INTERNAL_limeTPMDetails}) to avoid word-splitting or globbing issues when paths contain spaces.
  • The systemd drop-in creation for keylime_agent and keylime_push_model_agent is almost identical—consider looping or extracting a helper function to reduce duplication.
  • The new push-attestation and unreachable-registrar test scripts share a lot of setup logic; think about moving common phases into test-helpers to simplify and DRY up the tests.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Quote all variable expansions in lib.sh (e.g. ${__INTERNAL_limeTPMDetails}) to avoid word-splitting or globbing issues when paths contain spaces.
- The systemd drop-in creation for keylime_agent and keylime_push_model_agent is almost identical—consider looping or extracting a helper function to reduce duplication.
- The new push-attestation and unreachable-registrar test scripts share a lot of setup logic; think about moving common phases into test-helpers to simplify and DRY up the tests.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Koncpa Koncpa force-pushed the pk_server_temp_unreachable branch from 975b3c1 to d24e0a2 Compare November 12, 2025 16:35
rlAssertGrep "ERROR - Agent $AGENT_ID does not exist on Registrar" $rlRun_LOG -E
rlRun "limeCreateTestPolicy"
#check agent status in logs
rlAssertGrep "Error.*Connection refused" $(limeAgentLogfile)

Check warning

Code scanning / shellcheck

SC2046 Warning test

Quote this to prevent word splitting.

rlPhaseStartTest "Stop verifier and check adding keylime agent"
rlRun -s "keylime_tenant -v 127.0.0.1 -t 127.0.0.1 -u $AGENT_ID --runtime-policy policy.json -c add ${TENANT_ARGS}" 1
rlAssertGrep "Failed to establish a new connection.*Connection refused" $rlRun_LOG -E

Check warning

Code scanning / shellcheck

SC2086 Warning test

Double quote to prevent globbing and word splitting.
rlRun -s "keylime_tenant -v 127.0.0.1 -t 127.0.0.1 -u $AGENT_ID --runtime-policy policy.json -c add ${TENANT_ARGS}" 1
rlAssertGrep "Failed to establish a new connection.*Connection refused" $rlRun_LOG -E
rlRun "limeWaitForAgentStatus $AGENT_ID 'Connection Refused'" 1
rlAssertGrep "GET invoked from" $(limeAgentLogfile)

Check warning

Code scanning / shellcheck

SC2046 Warning test

Quote this to prevent word splitting.
@Koncpa Koncpa force-pushed the pk_server_temp_unreachable branch from d24e0a2 to aec78a5 Compare November 18, 2025 12:38
@Koncpa Koncpa force-pushed the pk_server_temp_unreachable branch 2 times, most recently from 8fb2ca2 to ee371a1 Compare November 19, 2025 10:42
@Koncpa Koncpa changed the title Add verifier registrar unreachable test scenario [DO NOT MERGE] Add verifier registrar unreachable test scenario Nov 20, 2025
@Koncpa Koncpa force-pushed the pk_server_temp_unreachable branch 2 times, most recently from 88eba4e to a9aa2b0 Compare November 20, 2025 12:57
@Koncpa
Copy link
Collaborator Author

Koncpa commented Nov 20, 2025

Reported possible bug: keylime/keylime#1819

Test scenario check how is agent behaved when
verifier and registrar are unreachable
during initial registration or attestation.
@Koncpa Koncpa force-pushed the pk_server_temp_unreachable branch from a9aa2b0 to 7145c22 Compare November 21, 2025 12:12
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.

2 participants