-
Notifications
You must be signed in to change notification settings - Fork 12
OpenSSH audit: range tests. #288
OpenSSH audit: range tests. #288
Conversation
a661d24
to
e53e2c6
Compare
agent/security_helper.py
Outdated
self._safe = safe | ||
self.is_safe = {self.COMPARE.MATCH: self.match, | ||
self.COMPARE.RANGE: self.range}[compare] | ||
self._safe_value = (safe if compare == self.COMPARE.MATCH else str(self._safe[1])) |
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.
Redundant parentheses
'openssh-agent-forwarding': | ||
('OpenSSH: Disable agent forwarding', 'AllowAgentForwarding'), | ||
'openssh-protocol': | ||
('\tOpenSSH: Force protocol version 2', 'Protocol'), |
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.
What's the purpose of this '\t' here?
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.
To align the output in the console. Otherwise it's hard to read.
agent/security_helper.py
Outdated
def __init__(self, default, safe, compare=COMPARE.MATCH): | ||
self.default = default | ||
self._safe = safe | ||
self.is_safe = {self.COMPARE.MATCH: self.match, |
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.
Pls comment
agent/security_helper.py
Outdated
@@ -362,7 +395,7 @@ def patch_sshd_config(patch_param): | |||
logger.exception('sshd or service executable not found') | |||
return | |||
|
|||
safe_value_string = '\n# Added by wott-agent on {}\n{} {}\n'.format(time.ctime(), patch_param, safe_value) | |||
safe_value_string = '\n# Added by wott-agent on {}\n{} {}\n'.format(time.ctime(), patch_param, param_info.safe_value) |
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.
Too long line
agent/security_helper.py
Outdated
if not replaced and not safe and default_value != safe_value: | ||
logger.info('{}: replacing default "{}" with "{}"'.format(patch_param, default_value, safe_value)) | ||
if not replaced and not safe and not param_info.is_safe(param_info.default): | ||
logger.info('{}: replacing default "{}" with "{}"'.format(patch_param, param_info.default, param_info.safe_value)) |
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.
Too long line
19b8a45
to
08cc181
Compare
08cc181
to
392caf3
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.
Pls be consistent in logger strings formatting. I.e. always use %s
392caf3
to
e5b3e0e
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
I'm doing this to silence Codacy warnings. It says i should always use %-formatting for logging. It is a valid point, though |
#277