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

Fixes #18987 - Check ueber certs on each proxy sync #6728

Merged
merged 1 commit into from May 2, 2017

Conversation

johnpmitsch
Copy link
Contributor

@johnpmitsch johnpmitsch commented Apr 4, 2017

When the CA changes for any reason (like a hostname change), we need to regenerate the ueber certs for organizations. This will automatically verify the ueber cert against the ca cert on each proxy sync.

To-do

  • Fix test ssl errors

@mention-bot
Copy link

@johnpmitsch, thanks for your PR! By analyzing the history of the files in this pull request, we identified @bbuckingham, @jlsherrill and @iNecas to be potential reviewers.

@johnpmitsch
Copy link
Contributor Author

@jlsherrill is this testable? Would we be able to get a cert and CA that could be verified in a test env?

@jlsherrill
Copy link
Member

We likely could write a test that includes some certs with say a 30 year expiration for this test (most likely any ca and ueber cert from some sample install would suffice along with some stubs).


def test_verify_ueber_cert
Setting.stubs(:[]).with(:ssl_ca_file).returns("/home/vagrant/foreman/test/services/cert/helpers/ca.crt")
cert_valid = Cert::Certs.verify_ueber_cert(@org)

Choose a reason for hiding this comment

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

Trailing whitespace detected.


def test_verify_ueber_cert
Setting.stubs(:[]).with(:ssl_ca_file).returns("/home/vagrant/foreman/test/services/cert/helpers/ca.crt")
cert_valid = Cert::Certs.verify_ueber_cert(@org)

Choose a reason for hiding this comment

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

Trailing whitespace detected.

@theforeman-bot
Copy link

There were the following issues with the commit message:

  • 4f29933d90aaef669eb4ca0c86df8c6e091aec6a must be in the format fixes #redmine_number - brief description

If you don't have a ticket number, please create an issue in Redmine.

More guidelines are available in Coding Standards or on the Foreman wiki.


This message was auto-generated by Foreman's prprocessor

end

def test_verify_ueber_cert
Setting.stubs(:[]).with(:ssl_ca_file).returns(File.join("#{Rails.root}", "/test/services/cert/helpers/ca.crt"))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jlsherrill @stbenjam I keep getting this error on a test run:

Katello::CertsTest#test_verify_ueber_cert:
OpenSSL::X509::StoreError: system lib
    /home/vagrant/katello/app/services/cert/certs.rb:22:in `add_file'
    /home/vagrant/katello/app/services/cert/certs.rb:22:in `verify_ueber_cert'
    /home/vagrant/katello/test/services/cert/certs_test.rb:20:in `test_verify_ueber_cert'

any ideas why that is? I've even tried the hardcoded full path

Copy link
Member

Choose a reason for hiding this comment

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

Because Rails.root refers to the foreman dir, not the katello dir. You want Katello::Engine.root

Also the assert won't work, you'd want to use:

@org.expects(:regenerate_ueber_cert).never

instead of the assert()

Copy link
Member

Choose a reason for hiding this comment

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

I'd also like to see a 'bad' case. you might use the included redhat ca cert (ca/redhat-uep.pem) to test a bad caes

@theforeman-bot
Copy link

There were the following issues with the commit message:

  • 71bad28408afd9cd793bab58a052257e3d2f8557 must be in the format fixes #redmine_number - brief description

If you don't have a ticket number, please create an issue in Redmine.

More guidelines are available in Coding Standards or on the Foreman wiki.


This message was auto-generated by Foreman's prprocessor

@johnpmitsch johnpmitsch changed the title Fixes #18987 - Check ueber certs on each proxy sync [WIP] Fixes #18987 - Check ueber certs on each proxy sync Apr 17, 2017
@johnpmitsch johnpmitsch changed the title [WIP] Fixes #18987 - Check ueber certs on each proxy sync Fixes #18987 - Check ueber certs on each proxy sync Apr 21, 2017
@johnpmitsch
Copy link
Contributor Author

@jlsherrill thanks for the suggestions, updated!

@johnpmitsch
Copy link
Contributor Author

[test]

1 similar comment
@johnpmitsch
Copy link
Contributor Author

[test]

@jlsherrill
Copy link
Member

APJ

@johnpmitsch johnpmitsch merged commit a054193 into Katello:master May 2, 2017
@johnpmitsch johnpmitsch deleted the verify_ueber_certs branch May 2, 2017 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants