Skip to content

[DONOTMERGE, DONOTREVIEW]: Implement Push Model attestation #1041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 12 commits into from

Conversation

sarroutbi
Copy link
Contributor

No description provided.

sarroutbi and others added 12 commits July 4, 2025 15:47
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Signed-off-by: Sergio Arroutbi <sarroutb@redhat.com>
Drop unnecessary options:
- DEFAULT_MEASUREDBOOT_ML_PATH
- DEFAULT_UEFI_LOGS_BINARY_PATH

Drop unnecessary lazy initialization of constants.

Organize the default values in base.rs depending on its usage (shared,
push-model only, or pull-model only)

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Remove KeylimeConfig structure, making AgentConfig the only
configuration structure.  The KeylimeConfig structure was just a wrapper
around AgentConfig.

This also moves the loading of configuration files to the file_config.rs
file.

A test for overriding options using environment variables is added as a
integration test. This is necessary to make it to run in a separate
process and not affect other tests.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
The keylime-macros crate provide helper macros.

The define_config_view procedural macro allows annotating a structure
with the attribute #[define_view_trait(for_struct = "SomeStructure")].

The annotated structure serves as a template to create a Trait which
provides a view of the referred structure, restricting the accessible
fields through getter methods. The created Trait is named as the
annotated name followed by "Trait".

For types that are Copy primitives (e.g. u16, u32, etc.), the getter
method will return a copy of the value. For other types, the getter
method will return a reference to the value, unless it is annotated with
the #[copy] attribute. Only types that implement the Copy trait can be
annotated with the #[copy] attribute.

The annoted structure fields can also be annotated with the attribute
`#[transform(using = custom_transform_fn, error = CustomError)]`.
The annotated fields getters are generated using the provided transform
function which may return an error of the given type.

For example:

```rust
struct KeylimeConfig {
    node_id: String,
    port: u16,
    api_versions: String,
    info: CustomCopyType,
}

\#[define_view_trait(for_struct = KeylimeConfig)]
struct KeylimeView {
    node_id: String,
    port: u16,
    #[transform(using = parse_string_list, error = ParsingError)]
    api_versions: Vec<String>,
    #[copy]
    info: CustomCopyType,
}
```

Expands into:

```rust
pub trait KeylimeViewTrait {
    fn node_id(&self) -> &str;
    fn port(&self) -> u16;
    fn api_versions(&self) -> Result<Vec<String>, ParsingError>;
    fn info(&self) -> CustomCopyType;
}

impl KeylimeViewTrait for KeylimeConfig {
    fn node_id(&self) -> &str { &self.node_id }
    fn port(&self) -> u16 { self.port }
    fn api_versions(&self) -> Result<Vec<String>, ParsingError> {
        parse_string_list(&self.api_versions)
    }
    fn info(&self) -> CustomCopyType { self.info }
}
```

Assisted-by: Gemini 2.5 Pro
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Use the procedural macro 'define_view_trait' to create a view limited by
a trait for the AgentConfig instead of creating a new structure.

This removes the PushModelConfig structure. The AgentConfig should be
used directly instead, which has the PushModelConfigTrait implemented
using the procedural macro.

Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
@sarroutbi sarroutbi closed this Jul 7, 2025
@sarroutbi sarroutbi deleted the 202507071739-fix-conflicts branch July 7, 2025 15:40
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