-
Notifications
You must be signed in to change notification settings - Fork 28
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
Implement simple CA range checking #77
base: master
Are you sure you want to change the base?
Conversation
@frasertweedale can you take a look? |
8ed261d
to
6e849a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rcritten the general approach seems fine, as is most of the code. But there are some mistakes and omissions (I do not blame you for this, it is confusing!) If you agree, I can take over the ticket for the next sprint and make the necessary fixes and additions? It is good for me to get more familiar with Health Check.
src/ipahealthcheck/dogtag/range.py
Outdated
yield Result(self, constants.CRITICAL, | ||
key='nextRange', | ||
dn='ou=certificateRepository,ou=ca,o=ipaca', | ||
msg='multiple {key} values in {dn}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to also handle the len(entries) == 0
case, so perhaps the error message should mention the number of entries (and that only one entry was expected).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The no entries case is handled on line 67. The message for multiple can be improved, I'll push an update.
msg='multiple {key} values in {dn}') | ||
return | ||
else: | ||
nextrange = int(entries[0].single_value.get('nextRange', 0)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certificate repository (and KRA keyRepository) uses hex encoding. Even though they may look decimal-ish :)
attrlist = ['beginRange', 'endRange', 'host'] | ||
try: | ||
entries = self.conn.get_entries( | ||
DN('ou=requests,ou=ranges,o=ipaca'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So here we are comparing request ranges against the certificateRepository nextRange
. We need to output and compare range entries and nextRange
values separate for each of:
- CA certificateRepository
- CA requests
- CA replicas
- KRA keyRepository
- KRA requests
- KRA replicas
It's a pain, I know. I suppose the best way is a superclass with all the logic, and a subclass for each managed range that just plugs in a few parameters (what are the CS.cfg params, repository object DN, range object base DN, whether the numbers are decimal or hex).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, I didn't get that part from the docs.
keys = [('dbs.beginSerialNumber', True), | ||
('dbs.endSerialNumber', True), | ||
('dbs.nextBeginSerialNumber', False), | ||
('dbs.nextEndSerialNumber', False)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And yeah, same comment here, this looks fine for serials, but we need to do similar thing for all the other managed ranges.
Sure, you can take it over. I'll push the one minor update for the multiple keys message. |
Checking the CS.cfg ranges requires visibility for the whole cluster so only report those values. We can check that the data stored in LDAP doesn't overlap and that the nextRange value is defined. freeipa#76
I pushed a fix for multiple ranges and added a test case for it. |
Checking the CS.cfg ranges requires visibility for the whole
cluster so only report those values.
We can check that the data stored in LDAP doesn't overlap and
that the nextRange value is defined.
#76