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

allow FIPS enabled systems to register successfully with puppet #236

Merged
merged 1 commit into from
Jan 18, 2018

Conversation

sideangleside
Copy link
Member

Fixes #235

bootstrap.py Outdated
if fipsStatus == "1":
return True
else:
return False
Copy link
Member

Choose a reason for hiding this comment

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

Any reason not to do this?

return fipsStatus == "1"

Copy link
Member Author

Choose a reason for hiding this comment

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

It seemed more pythonic to return True/False in lieu of a value. But I can be convinced otherwise.

Copy link
Member

Choose a reason for hiding this comment

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

return fipsStatus == "1" will return (True/False) just fine and is imho the pythonicst way to do it.

Copy link
Member

Choose a reason for hiding this comment

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

And, for those interested, it's the Ruby way also (though I'm struggling to find a link to back myself up).

README.md Outdated

## FIPS support

On systems with FIPS enabled (where `/proc/sys/crypto/fips_enabled` == `1`), algorithms such as MD5 are disallowed.
Copy link
Member

Choose a reason for hiding this comment

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

I think this should be '/proc/sys/crypto/fips_enabled == 1' (but using backticks, of course)

README.md Outdated
On systems with FIPS enabled (where `/proc/sys/crypto/fips_enabled` == `1`), algorithms such as MD5 are disallowed.
Bootstrap will configure `digest_algorithm = sha256` in puppet.conf to allow successful puppet runs.
However, the signing algorithm **must** match on the Puppet Master. It is expected that the Puppet Masters are configured with
the **same** algorithm.
Copy link
Member

Choose a reason for hiding this comment

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

stray linebreak

bootstrap.py Outdated
"""
Checks to see if the system is FIPS enabled.
"""
fipsfile = open("/proc/sys/crypto/fips_enabled", "r")
Copy link
Member

Choose a reason for hiding this comment

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

imho this should be fips_file

bootstrap.py Outdated
Checks to see if the system is FIPS enabled.
"""
fipsfile = open("/proc/sys/crypto/fips_enabled", "r")
fipsStatus = fipsfile.read(1)
Copy link
Member

Choose a reason for hiding this comment

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

and this fips_status, we're in snake_land here ;)

@sideangleside
Copy link
Member Author

sideangleside commented Jan 18, 2018

I've incorporated all of the above feedback into 97e1930

bootstrap.py Outdated
"""
fips_file = open("/proc/sys/crypto/fips_enabled", "r")
fips_status = fips_file.read(1)
if fips_status == "1":
Copy link
Member

Choose a reason for hiding this comment

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

nah, just always return it.

Copy link
Member Author

Choose a reason for hiding this comment

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

ah. got it now.

"""
Checks to see if the system is FIPS enabled.
"""
fips_file = open("/proc/sys/crypto/fips_enabled", "r")
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should handle systems where this file does not exist. (like a CentOS container running on Debian).

Copy link
Member Author

Choose a reason for hiding this comment

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

Why wouldn't it exist? (though if we are going to pretend bootstrap works on non-RHEL, we'll need a whole nother 5 pull requests)

Copy link
Member

Choose a reason for hiding this comment

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

I think an EL/Fedora container running on non-EL/Fedora is the only way this could happen.

Copy link
Member Author

Choose a reason for hiding this comment

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

but the FIPS attribute is set at the kernel level. I suspect /proc/sys/crypto/fips_enabled exists on a Debian system. (Though I don't have one in front of me to confirm)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, it's dependent on the docker host. Every single OS image (centos, rhel, debian, alpine) has that file when I run docker on Fedora, but none of the images has it when I run on non-EL/Fedora, such as on OS X, for instance. To clarify, running a RHEL container does not even have that file if the container is running on an OS that doesn't have that file.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, exactly. It's a kernel thing, so a container running on a non-EL/Fedora kernel will not have this.

It's not like I like registering containers anyways...

Copy link
Member

@akofink akofink left a comment

Choose a reason for hiding this comment

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

LGTM after the one fips_status == "1" change is updated

@evgeni evgeni merged commit 3f3d316 into Katello:master Jan 18, 2018
evgeni added a commit to evgeni/katello-client-bootstrap that referenced this pull request Jan 23, 2018
* make bootstrap.py compatible with Puppet 4 (Katello#230)
* add ansible example playbook (Katello#197)
* remove SAMs CA consumer RPM in remove_obsolete_packages() (Katello#234)
* allow FIPS enabled systems to register successfully with puppet (Katello#236)
* allow configuring timeout for API calls and subscription-manager (Katello#237)
* implement switching proxy / caps without destroying the host in Foreman (Katello#227)
@evgeni evgeni mentioned this pull request Jan 23, 2018
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.

3 participants