Skip to content

Commit

Permalink
Docs: Added all new checks to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
blackandred committed Oct 27, 2019
1 parent 754e08b commit dee38a7
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 55 deletions.
16 changes: 16 additions & 0 deletions docs/source/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,19 @@ Parameters:

- container
- mysql_root_password

.. include:: ../../infracheck/checks/ssh-fingerprint
:start-after: <sphinx>
:end-before: </sphinx>

.. include:: ../../infracheck/checks/ssh-files-checksum
:start-after: <sphinx>
:end-before: </sphinx>

.. include:: ../../infracheck/checks/ssh-command
:start-after: <sphinx>
:end-before: </sphinx>

.. include:: ../../infracheck/checks/reminder
:start-after: <sphinx>
:end-before: </sphinx>
18 changes: 10 additions & 8 deletions infracheck/checks/reminder
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
#!/usr/bin/env python3

"""
reminder
--------
<sphinx>
reminder
--------
Reminds about the recurring date. Example: To extend validity of your hosting account
Reminds about the recurring date. Example: To extend validity of your hosting account
Parameters:
Parameters:
- REF_DATE (example: 2019-05-01 for a 1th of May 2019)
- EACH (values: week; month; year, default: year)
- ALERT_DAYS_BEFORE (default: 5, the health check will be red when there will be 5 days before)
- NOW (development only, current date to mock/imitate for testing)
- ref_date (example: 2019-05-01 for a 1th of May 2019)
- each (values: week; month; year, default: year)
- alert_days_before (default: 5, the health check will be red when there will be 5 days before)
- now (development only, current date to mock/imitate for testing)
</sphinx>
"""

import os
Expand Down
42 changes: 22 additions & 20 deletions infracheck/checks/ssh-command
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
#!/usr/bin/env python3

"""
ssh-command
-----------
Calls remote process using SSH and expects: exit code, keywords in the output
Parameters:
- USER (default: root)
- HOST
- PORT (default: 22)
- PRIVATE_KEY
- PASSWORD
- SSH_BIN (default: ssh)
- SSHPASS_BIN (default: sshpass)
- SSH_OPTS
- COMMAND (default: uname -a)
- TIMEOUT: (default: 15, unit: seconds)
- EXPECTED_KEYWORDS (Keywords expected to be in stdout/stderr. Separated by ";")
- UNEXPECTED_KEYWORDS (Keywords not expected to be present in stdout/stderr. Separated by ";")
- EXPECTED_EXIT_CODE (default: 0)
<sphinx>
ssh-command
-----------
Calls remote process using SSH and expects: exit code, keywords in the output
Parameters:
- user (default: root)
- host
- port (default: 22)
- private_key
- password
- ssh_bin (default: ssh)
- sshpass_bin (default: sshpass)
- ssh_opts
- command (default: uname -a)
- timeout: (default: 15, unit: seconds)
- expected_keywords (Keywords expected to be in stdout/stderr. Separated by ";")
- unexpected_keywords (Keywords not expected to be present in stdout/stderr. Separated by ";")
- expected_exit_code (default: 0)
</sphinx>
"""


Expand Down
40 changes: 21 additions & 19 deletions infracheck/checks/ssh-files-checksum
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
#!/usr/bin/env python3

"""
ssh-files-checksum
------------------
Calls remote process using SSH and expects: the listed files and checksums will be matching
Parameters:
- USER (default: root)
- HOST
- PORT (default: 22)
- PRIVATE_KEY
- PASSWORD
- SSH_BIN (default: ssh)
- SSHPASS_BIN (default: sshpass)
- SSH_OPTS
- COMMAND (default: uname -a)
- TIMEOUT: (default: 15, unit: seconds)
- METHOD (default: sha256sum)
- EXPECTS (json dict, example: {"/usr/bin/bahub": "d6e85b50756a08e24c1d46f07b68e288c9e7e565fd662a15baca214f576c34be"})
<sphinx>
ssh-files-checksum
------------------
Calls remote process using SSH and expects: the listed files and checksums will be matching
Parameters:
- user (default: root)
- host
- port (default: 22)
- private_key
- password
- ssh_bin (default: ssh)
- sshpass_bin (default: sshpass)
- ssh_opts
- command (default: uname -a)
- timeout: (default: 15, unit: seconds)
- method (default: sha256sum)
- expects (json dict, example: {"/usr/bin/bahub": "d6e85b50756a08e24c1d46f07b68e288c9e7e565fd662a15baca214f576c34be"})
</sphinx>
"""


Expand Down
20 changes: 12 additions & 8 deletions infracheck/checks/ssh-fingerprint
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#!/usr/bin/env python3

"""
ssh-fingerprint
---------------
<sphinx>
Verifies if remote host fingerprint matches. Helps detecting man-in-the-middle and server takeover attacks.
ssh-fingerprint
---------------
Parameters:
Verifies if remote host fingerprint matches. Helps detecting man-in-the-middle and server takeover attacks.
- EXPECTED_FINGERPRINT (example: zsp.net.pl ssh-rsa SOMESOMESOMESOMESOMEKEYHERE)
- METHOD (default: rsa)
- HOST (example: zsp.net.pl)
- PORT (example: 22)
Parameters:
- expected_fingerprint (example: zsp.net.pl ssh-rsa SOMESOMESOMESOMESOMEKEYHERE)
- method (default: rsa)
- host (example: zsp.net.pl)
- port (example: 22)
</sphinx>
"""

import subprocess
Expand Down

0 comments on commit dee38a7

Please sign in to comment.