Python: module hardening

hardening (version 0.2.2) | index hardening.py

`This tools run scripts and display the result in a Web Interface.
This file implement the hardening audit of the WebScripts installation and
configuration.`

Modules
`` |  |
ctypes json | os ntpath | pip platform | stat sys

Classes
`` |  | builtins.object Audit Report Rule enum.Enum(builtins.object) SEVERITY
class Audit(builtins.object)
`` | `This function implement hardening checks.`
| Methods defined here: audit_active_auth(server: ~Server) -> hardening.Rule `This function check authentication is enabled.` audit_admin_account(server: ~Server) -> collections.abc.Iterator `This function check the admin password.` audit_blacklist(server: ~Server) -> hardening.Rule `This function check the blacklist configuration.` audit_config_files(server: ~Server) -> hardening.Rule `This function check the configurations files.` audit_debug(server: ~Server) -> hardening.Rule `This function check the debug configuration.` audit_export_configuration(server: ~Server) -> collections.abc.Iterator `This function check the export configuration file.` audit_force_auth(server: ~Server) -> hardening.Rule `This function check authentication is forced.` audit_in_venv(server: ~Server) -> hardening.Rule `This function check the virtualenv.` audit_interface(server: ~Server) -> hardening.Rule `This function check the network interface.` audit_limit_exclude_auth(server: ~Server) -> hardening.Rule `This function check exclusions for authentication.` audit_log_level(server: ~Server) -> hardening.Rule `This function check the log level.` audit_security(server: ~Server) -> hardening.Rule `This function check the security configuration.` audit_smtp_password(server: ~Server) -> hardening.Rule `This function check the SMTP password protection.` audit_system_user(server: ~Server) -> hardening.Rule `This function check the user.` audit_venv_modules(server: ~Server) -> hardening.Rule `This function check the virtualenv modules.` audits_file_owner(server: ~Server) -> collections.abc.Iterator `This function check the files owner.` audits_file_rights(server: ~Server) -> collections.abc.Iterator `This function check the files rights.` audits_launcher(server: ~Server) -> collections.abc.Iterator `This function check the configuration of the script launcher.` audits_module_path(server: ~Server) -> hardening.Rule `This function check the modules paths.` audits_scripts_content_type(server: ~Server) -> collections.abc.Iterator `This function check the configuration of the script content type.` audits_scripts_directory(server: ~Server) -> collections.abc.Iterator `This function check owner and permissions on bin directory.` audits_scripts_logs(server: ~Server) -> collections.abc.Iterator `This function check the configuration of the script log.` audits_scripts_path(server: ~Server) -> collections.abc.Iterator `This function check the configuration of the script path.` audits_scripts_stderr_content_type(server: ~Server) -> collections.abc.Iterator `This function check the configuration of the script stderr content type.` audits_timeout(server: ~Server) -> collections.abc.Iterator `This function check scripts timeout.` check_for_updates(configuration: ~ServerConfiguration, logs: ~Logs, send_mail: collections.abc.Callable) -> None `This function runs in a thread indefinitely, it checks the version and the latest published version of WebScripts every hour. If the version and the latest published version are different, this function sends an email notification.` get_owner(filename: str) -> str `This function return the owner of a file.` get_permissions(filename: str) -> str `This function return the file permissions.` log_rule(rule: hardening.Rule, logs: ~Logs) -> None `This function log rule.` run(server: ~Server, logs: ~Logs) -> List[hardening.Rule] `This function run audit and checks.` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes defined here: is_windows = True
class Report(builtins.object)
`` | `Report(rules: List[hardening.Rule], server: ~Server, logs: ~Logs) This class implement the report object.`
| Methods defined here: __init__(self, rules: List[hardening.Rule], server: ~Server, logs: ~Logs) `Initialize self. See help(type(self)) for accurate signature.` as_html(self) -> str `This function return a HTML string of audit results.` as_json(self) -> str `This function returns a JSON string of audit results.` as_text(self) -> str `This function return a HTML string of audit results.` get_pourcent(self) -> None `This function calcul pourcent.` notification(self) -> None `This function send an email notification to administrator with the audit report.` Static methods defined here: get_HTML_table(headers: str, rules: List[hardening.Rule]) -> str `This function returns a HTML table with rule attributes as columns.` get_text_table(headers: str, rules: List[hardening.Rule], joiner: str = ' ') -> str `This function return a text table with rule attributes as columns.` truncate_string(string: str, length: int = 13, end: str = '...', separator: str = ',') -> str `This function truncate a string.` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class Rule(builtins.object)
`` | `Rule(subject: str, id_: int, is_OK: bool, level: int, severity: str, category: str, reason: str) -&gt; None This class implement a rule for hardening.`
| Methods defined here: __eq__(self, other) __init__(self, subject: str, id_: int, is_OK: bool, level: int, severity: str, category: str, reason: str) -> None __repr__(self) Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes defined here: __annotations__ = {'category': <class 'str'>, 'id_': <class 'int'>, 'is_OK': <class 'bool'>, 'level': <class 'int'>, 'reason': <class 'str'>, 'severity': <class 'str'>, 'subject': <class 'str'>} __dataclass_fields__ = {'category': Field(name='category',type=<class 'str'>,default...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'id_': Field(name='id_',type=<class 'int'>,default=<dat...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'is_OK': Field(name='is_OK',type=<class 'bool'>,default=<...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'level': Field(name='level',type=<class 'int'>,default=<d...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'reason': Field(name='reason',type=<class 'str'>,default=<...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'severity': Field(name='severity',type=<class 'str'>,default...rue,metadata=mappingproxy({}),_field_type=_FIELD), 'subject': Field(name='subject',type=<class 'str'>,default=...rue,metadata=mappingproxy({}),_field_type=_FIELD)} __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False) __hash__ = None
class SEVERITY(enum.Enum)
`` | `SEVERITY(value, names=None, *, module=None, qualname=None, type=None, start=1) Severity level of the rules.`
| Method resolution order: SEVERITY enum.Enum builtins.object Data and other attributes defined here: CRITICAL = <SEVERITY.CRITICAL: 'CRITICAL'> HIGH = <SEVERITY.HIGH: 'HIGH'> INFORMATION = <SEVERITY.INFORMATION: 'INFORMATION'> LOW = <SEVERITY.LOW: 'LOW'> MEDIUM = <SEVERITY.MEDIUM: 'MEDIUM'> Data descriptors inherited from enum.Enum: name `The name of the Enum member.` value `The value of the Enum member.` Readonly properties inherited from enum.EnumMeta: __members__ `Returns a mapping of member name->value. This mapping lists all enum members, including aliases. Note that this is a read-only view of the internal mapping.`

Functions
`` |  | main(server: ~Server, logs: ~Logs, send_mail: collections.abc.Callable) -> hardening.Report `Main function to execute this file.`

Data
`` |  | __all__ = ['Report', 'Rule', 'Audit', 'SEVERITY', 'main'] __author_email__ = 'mauricelambert434@gmail.com' __copyright__ = '\nWebScripts Copyright (C) 2021 Maurice Lambert...ome to redistribute it\nunder certain conditions.\n' __description__ = 'This tools run scripts and display the result in...of the WebScripts installation and\nconfiguration.' __license__ = 'GPL-3.0 License' __maintainer__ = 'Maurice Lambert' __maintainer_email__ = 'mauricelambert434@gmail.com' __url__ = 'https://github.com/mauricelambert/WebScripts'

Author
`` |  | Maurice Lambert