question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refactor arg and configparser use of IP's and Ports.

See original GitHub issue

This issue first started off as a report on the following issue (created by yours truly not properly testing his patch)

If you run keylime tenant without the -tp arg, it fails:

keylime_tenant -t 127.0.0.1 -v 127.0.0.1  -f excludes.txt --whitelist ~/whitelist.txt --exclude excludes.txt -c add 
Using config file /etc/keylime.conf
2019-12-22 08:38:30.658 - keylime.tenant - WARNING - CAUTION: using default password for private key, please set private_key_pw to a strong password
2019-12-22 08:38:30.658 - keylime.tenant - INFO - Setting up client TLS in /var/lib/keylime/cv_ca
2019-12-22 08:38:30.665 - keylime.tenant - WARNING - Using default UUID D432FBB3-D2F1-4A97-9EF7-75BD81C00000
2019-12-22 08:38:30.665 - keylime.tenant - INFO - TPM PCR Mask from policy is 0x408000
2019-12-22 08:38:30.665 - keylime.tenant - INFO - TPM PCR Mask from policy is 0x808000
2019-12-22 08:38:30.752 - keylime.ima - WARNING - No boot_aggregate value found in whitelist, adding an empty oneTraceback (most recent call last):
  File "/usr/local/bin/keylime_tenant", line 11, in <module>
    load_entry_point('keylime==1.2', 'console_scripts', 'keylime_tenant')()
  File "/usr/local/lib/python3.7/site-packages/keylime-1.2-py3.7.egg/keylime/tenant.py", line 812, in main
    mytenant.do_cv()
  File "/usr/local/lib/python3.7/site-packages/keylime-1.2-py3.7.egg/keylime/tenant.py", line 492, in do_cv
    keylime_logging.log_http_response(lo
Traceback (most recent call last):
  File "/usr/local/bin/keylime_tenant", line 11, in <module>
    load_entry_point('keylime==1.2', 'console_scripts', 'keylime_tenant')()
  File "/usr/local/lib/python3.7/site-packages/keylime-1.2-py3.7.egg/keylime/tenant.py", line 812, in main
    mytenant.do_cv()
  File "/usr/local/lib/python3.7/site-packages/keylime-1.2-py3.7.egg/keylime/tenant.py", line 492, in do_cv

We need a validation check to make sure its captured when the -tp arg is not used and it falls back to the configparser set value.

Now for the main issue

I think we need to better layout and define ip’s and ports, the whole lot are grouped in together at the top of the file, with no real outline on what is for connecting to a service and what is for a service to bind to. I will create another issue for this.

I have observed a few incorrect behaviours as well, for example for the -c delete command. This calls do_cvdelete which then http posts a DELETE to the verfifier, however it does not pass on the target IP. Instead it takes the IP from the config. Yet if you run the tenant command without a target IP ( -t), it fails. So its basically defining an arg as mandatory, yet not even using it.

keylime_tenant -v 127.0.0.1  -f excludes.txt --whitelist ~/whitelist.txt --exclude excludes.txt -c delete
Using config file /etc/keylime.conf
2019-12-22 09:07:36.581 - keylime.tenant - WARNING - CAUTION: using default password for private key, please set private_key_pw to a strong password
2019-12-22 09:07:36.582 - keylime.tenant - INFO - Setting up client TLS in /var/lib/keylime/cv_ca
Traceback (most recent call last):
  File "/usr/local/bin/keylime_tenant", line 11, in <module>
    load_entry_point('keylime==1.2', 'console_scripts', 'keylime_tenant')()
  File "/usr/local/lib/python3.7/site-packages/keylime-1.2-py3.7.egg/keylime/tenant.py", line 786, in main
    raise UserError("-t/--targethost is required for command %s"%args.command)
keylime.tenant.UserError: -t/--targethost is required for command delete

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
rajdroidcommented, Jan 4, 2020

@lukehinds Yeah, let’s fix it. I also observed this during my testing. Please assign it to me, I’ll take a look.

0reactions
github-actions[bot]commented, Jan 13, 2021

🎉 This issue has been resolved in version 4.0.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pythons Module Configparser - Javatpoint
Python's in-built ConfigParser library is part of the base module. The library provides a console parser for easy file configuration consisting of pairs...
Read more >
configparser — Configuration file parser — Python 3.11.1 ...
This module provides the ConfigParser class which implements a basic configuration language which provides a structure similar to what's found in Microsoft ...
Read more >
ConfigParser – Work with configuration files - PyMOTW
Use the ConfigParser module to manage user-editable configuration files for an application. The configuration files are organized into sections, and each ...
Read more >
Python Examples of configparser.ParsingError
This page shows Python examples of configparser.ParsingError.
Read more >
Gunicorn Documentation - Read the Docs
The log config dictionary to use, using the standard Python logging module's dictionary configuration format. This option takes precedence over the logconfig ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found