Skip to content
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

Keylime Agent will crash on hostname usage #794

Closed
marcostork opened this issue May 23, 2024 · 6 comments · Fixed by #797
Closed

Keylime Agent will crash on hostname usage #794

marcostork opened this issue May 23, 2024 · 6 comments · Fixed by #797

Comments

@marcostork
Copy link

Environment

Rust Keylime Agent: v0.2.5
Rust: v1.78.0

Description

The Keylime Agent will crash with the following message if Keylime Registrar is set with a hostname instead of an IP address on the agent configuration file.

Error: IpParserError(ParseError { input: "keylime-registrar", source: Error { variant: ParsingError { positives: [ip], negatives: [] }, location: Pos(0), line_col: Pos((1, 1)), path: None, line: "keylime-registrar", continued_line: None } })

@maugustosilva
Copy link

This (inability to refer to registrars with hostnames) basically breaks the attestation-operator, which relies on Kubernetes/OpenShift name resolution to allow communication between agents and registrars on pods:

oc logs hhkl-keylime-agent-zqwvv -n keylime
Defaulted container "keylime-agent" out of: keylime-agent, keylime-agent-init (init)
 INFO  keylime_agent::config > Using hashed EK as UUID
Error: IpParserError(ParseError { input: "hhkl-keylime-registrar.keylime.svc.cluster.local", source: Error { variant: ParsingError { positives: [ip], negatives: [] }, location: Pos(0), line_col: Pos((1, 1)), path: None, line: "hhkl-keylime-registrar.keylime.svc.cluster.local", continued_line: None } })

@ansasaki
Copy link
Contributor

Thank you for reporting!

This is a duplicate of #454

@maugustosilva
Copy link

Just to be clear, the problem does not seem to be cause by setting the uuid on /etc/keylime/agent.conf. It seems to be cause by registrar_ip to a hostname instead of an IP. @marcostork please confirm that, in you test, switching from localhost to 127.0.0.1 results in the agent actually running.

@maugustosilva
Copy link

Just for more context, this used to work on the attestation-operator, but not anymore...

oc get pods -n keylime
NAME                                      READY   STATUS             RESTARTS        AGE
hhkl-keylime-agent-96jgd                  0/1     CrashLoopBackOff   6 (2m58s ago)   8m57s
hhkl-keylime-agent-m44rc                  0/1     CrashLoopBackOff   6 (3m14s ago)   8m57s
hhkl-keylime-registrar-5b9f6c5d7c-gqngr   1/1     Running            0               8m57s
hhkl-keylime-tenant-6d5f7d8dd4-jptpm      1/1     Running            0               8m57s
hhkl-keylime-verifier-0                   1/1     Running            0               8m57s
[[email protected] keylime-attestation-operator ]$ oc logs hhkl-keylime-agent-96jgd -n keylime
Defaulted container "keylime-agent" out of: keylime-agent, keylime-agent-init (init)
 INFO  keylime_agent::config > Using hashed EK as UUID
Error: IpParserError(ParseError { input: "hhkl-keylime-registrar.keylime.svc.cluster.local", source: Error { variant: ParsingError { positives: [ip], negatives: [] }, location: Pos(0), line_col: Pos((1, 1)), path: None, line: "hhkl-keylime-registrar.keylime.svc.cluster.local", continued_line: None } })
KEYLIME_AGENT_PORT=9002
KEYLIME_AGENT_UUID=hash_ek
KEYLIME_AGENT_ENABLE_IAK_IDEVID=false
KEYLIME_AGENT_REGISTRAR_IP=hhkl-keylime-registrar.keylime.svc.cluster.local
KEYLIME_AGENT_REGISTRAR_PORT=8890
KEYLIME_AGENT_IP=0.0.0.0
KEYLIME_AGENT_ENABLE_AGENT_MTLS=true
KEYLIME_AGENT_CONTACT_PORT=9002

@ansasaki
Copy link
Contributor

Ah, ok, I see... This is most probably due to the changes introduced to support IPv6 addresses in #765.
I'll see how hard would be to restore the functionality.

@marcostork
Copy link
Author

As @maugustosilva has pinpointed, the crash occurs when you change the registrar's IP address to a hostname in the agent.conf file. The environment worked perfectly before the change (from IP address to hostname) and resumed working after reverting to an IP address.

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 a pull request may close this issue.

3 participants