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

Tests for certificates with SAN #73

Closed
wants to merge 3 commits into from

Conversation

apophys
Copy link
Contributor

@apophys apophys commented Sep 12, 2016

Commits include several new test cases for CA ACLs and cert request for CSRs containing subject alternative name extension.

Also included minor fixes in used tracker and couple of new context managers used in the test cases.

@martbab martbab self-assigned this Sep 20, 2016
Copy link
Contributor

@martbab martbab left a comment

Choose a reason for hiding this comment

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

LGTM except of some nitpicks. Tests pass.

We should probably consider some additional test cases like these:

1.) CA ACL contains host1, host2, and service1. Only host1 can manage service1. Host2 requests certificate for service1 using existing CSR and fails since it does not manage service1 (CA ACLs pass but can_write check does not).

2.) positive test case: same as above but host2 can now manage service1. Host2 should be granted CSR for service1 (both CA ACLs and can_write check pass).

I hope I got the cases right and they are valid.

@@ -709,8 +711,12 @@ def change_principal(user, password, client=None, path=None,

try:
with private_ccache(ccache_name):
kinit_password(user, password, ccache_name,
canonicalize=canonicalize, enterprise=enterprise)
if keytab:
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather be explicit here and user if keytab is not None:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is here a typo or word missing? I do not understand. If one specifies keytab I would assume the tester knows what he's doing.

I can document the context manager though.

try:
cmd = [paths.IPA_GETKEYTAB, '-p', principal, '-k', keytab_filename]

if options:
Copy link
Contributor

Choose a reason for hiding this comment

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

The same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

keytab_filename is a file that will be created by ipa-getkeytab command, what is there to check?

"""Sign certificate request witn an invalid SAN entry

Using the environment prepared by the base class, ask to sign
a certificate request for a service managet by one host only.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick overload: typo in 'managet'



@pytest.mark.tier1
class TestSignServiceCertWithoudSANServiceInACL(CAACLEnforcementOnCertBase):
Copy link
Contributor

Choose a reason for hiding this comment

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

typo in class name

* two host entries
* santest-host-1
* santest-host-2
* one service entry
Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't there two service entries? (santest_service_host_1 and santest_service_host_2)

This test case doesn't have the service hosted on a host in SAN
in the CA ACL. The assumption is that the issuance will fail.

Using the environment of the base class, modify the service to be managed
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy-paste error here?

@apophys apophys force-pushed the cert-request-not-allowed-SAN branch 2 times, most recently from be2d6e9 to 74f5f45 Compare September 27, 2016 14:53
@martbab
Copy link
Contributor

martbab commented Sep 29, 2016

NACK: you probably forgot to add service fixtures as params to the added test cases: https://paste.fedoraproject.org/437721/51355181/

In addition please write sensible commit message to commit f43833d and probably squash the last commit into 2d75883

I have also noticed that you linked the commits to a ticket in a already closed milestone. Per our process guidelines you need to open a new ticket and go through a new triage, sorry.

@apophys
Copy link
Contributor Author

apophys commented Sep 29, 2016

I have fixed typos and implemented the proposed test cases. I have also provided docstring to the change_principal context manager.

@martbab martbab added the ack Pull Request approved, can be merged label Oct 4, 2016
@martbab martbab added the pushed Pull Request has already been pushed label Oct 4, 2016
@martbab martbab closed this Oct 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
2 participants