Beispiel #1
0
def get_default_check_name(id: str, command_name: str) -> str:
    default_names = {
        'apt': 'APT',
        'breeze': 'Breeze',
        'ciphers': 'Ciphers',
        'clamd': 'Clamd',
        'deny_tls_version': 'Deny TLS version',
        'dhcp': 'DHCP',
        'dig': 'DIG',
        'disk': 'Disk',
        'disk_smb': 'Disk SMB',
        'dnssec_expiry': 'DNSSEC expire',
        'docker_login': '******',
        'domain_address_ipv4': 'DNS A',
        'domain_address_ipv6': 'DNS AAAA',
        'dummy': 'Dummy',
        'existing_users': 'Existing users',
        'file_age': 'File age',
        'flexlm': 'Flexlm',
        'ftp': 'FTP',
        'group_members': 'Group members',
        'hpjd': 'HP JD',
        'http': 'Http',
        'icmp': 'ICMP',
        'ide_smart': 'SMART',
        'ifstatus': 'Interface status',
        'imap': 'IMAP',
        'ircd': 'IRCD',
        'jabber': 'Jabber',
        'ldap': 'LDAP',
        'ldaps': 'LDAPS',
        'load': 'Load',
        'log': 'Log',
        'mailq': 'Mail queue',
        'mrt_gtraf': 'MRT gtraf',
        'mysql': 'MySQL',
        'mysql_query': 'MySQL query',
        'nntp': 'NNTP',
        'nntps': 'NNTPS',
        'nt': 'NT',
        'ntp_peer': 'NTP peer',
        'ntp_time': 'NTP time',
        'open_ports': 'Open ports',
        'path_exist': 'Path exist',
        'pgsql': 'PostgreSQL',
        'ping': 'Ping',
        'ping4': 'Ping (ipv4)',
        'ping6': 'Ping (ipv6)',
        'pop': 'POP',
        'procs': 'Processes',
        'proxy_requests': 'Open proxy (ProxyRequests)',
        'radius': 'RADIUS',
        'reboot_required': 'Reboot required',
        'rpc': 'RPC',
        'running_proc_amavisd': 'Amavisd running',
        'running_proc_apache': 'Apache running',
        'running_proc_bind': 'Bind running',
        'running_proc_clamd': 'Clamd running',
        'running_proc_containerd': 'Containerd running',
        'running_proc_cron': 'Cron running',
        'running_proc_docker': 'Docker running',
        'running_proc_dovecot': 'Dovecot running',
        'running_proc_freshclam': 'Freshclam running',
        'running_proc_httpd': 'Httpd running',
        'running_proc_mysql': 'MySQL running',
        'running_proc_nginx': 'NGINX running',
        'running_proc_opendkim': 'Open DKIM running',
        'running_proc_php_fpm': 'PHP FPM running',
        'running_proc_postfix': 'Postfix running',
        'running_proc_postgres': 'PostgreSQL running',
        'running_proc_postgrey': 'Postgrey running',
        'running_proc_rsyslogd': 'Rsyslogd running',
        'running_proc_sshd': 'SSHD running',
        'running_proc_tomcat': 'Apache Tomcat running',
        'sensors': 'Sensors',
        'simap': 'IMAPS',
        'smtp': 'SMTP',
        'snmp': 'SNMP',
        'spop': 'POPS',
        'ssh': 'SSH',
        'sshd_security': 'SSHD security',
        'ssmtp': 'SMTPS',
        'synology_status': 'Synology Status',
        'sudoers_group_members': 'Sudoers group members',
        'swap': 'SWAP',
        'tcp': 'TCP',
        'udp': 'UDP',
        'ufw_status': 'UFW Status',
        'ups': 'UPS',
        'uptime': 'Uptime',
        'users': 'Users',
        'wave': 'Wave',
        'web_access_allow_tls1_0': 'Allow insecure TLS 1.0',
        'web_access_allow_tls1_1': 'Allow insecure TLS 1.1',
        'web_access_allow_tls1_2': 'Allow secure TLS 1.2',
        'web_access_allow_tls1_3': 'Allow secure TLS 1.3',
        'web_access_certificate': 'Certificate check',
        'web_access_default': 'Default web access',
        'web_access_deny_gitdir': 'Deny .git',
        'web_access_deny_gitignore': 'Deny .gitignore',
        'web_access_deny_license': 'Deny License',
        'web_access_deny_readme': 'Deny readme',
        'web_access_deny_tls1_0': 'Deny insecure TLS 1.0',
        'web_access_deny_tls1_1': 'Deny insecure TLS 1.1',
        'web_access_deny_tls1_2': 'Deny secure TLS 1.2',
        'web_access_deny_tls1_3': 'Deny secure TLS 1.3',
        'web_access_deny_wp_admin': 'deny /wp-admin',
        'web_access_deny_wp_includes': 'deny /wp-includes',
        'web_access_deny_wp_content': 'deny /wp-content',
        'web_access_deny_wp_login': '******',
        'web_access_deny_wp_cron': 'deny /wp-cron.php',
        'web_access_deny_wp_load': 'deny /wp-load.php',
        'web_access_deny_wp_mail': 'deny /wp-mail.php',
        'web_access_deny_wp_signup': 'deny /wp-signup.php',
        'web_access_deny_wp_trackback': 'deny /wp-trackback.php',
        'web_access_deny_wp_xmlrpc': 'deny /xmlrpc.php',
        'web_access_deny_wp_config': 'deny /wp-config.php',
        'web_access_deny_wp_config_sample': 'deny /wp-config-sample.php',
        'web_access_deny_wp_blog_header': 'deny /wp-blog-header.php',
        'web_access_deny_wp_activate': 'deny /wp-activate.php',
        'web_access_deny_wp_links_opml': 'deny /wp-links-opml.php',
        'web_access_http_redirect': 'Http to https redirect',
        'web_access_missing_http_redirect': 'No http redirect check for',
        'wheel_group_members': 'Sudoers (wheel) group members',
        'yum': 'YUM',
    }

    id = ValueMapper.replace_command_prefixes(id)
    command_name = ValueMapper.replace_command_prefixes(command_name)

    for name in default_names:
        if id.startswith(name + '_'):
            return default_names[name]

    return default_names.get(
        id, default_names.get(command_name, command_name.replace('_', ' ')))
Beispiel #2
0
def get_default_group_name(id: str) -> str:
    default_names = {
        'amavisd': 'Amavisd',
        'antivirus': 'Antivirus',
        'apache': 'Apache',
        'apt': 'APT',
        'bind': 'Bind',
        'breeze': 'Breeze',
        'certificate_check': 'X.509 certificate',
        'ciphers': 'Ciphers',
        'clamd': 'Clamd',
        'containerd': 'Containerd',
        'cron': 'Cron',
        'database': 'Database',
        'deny_insecure_TLSv1_0_webserver': 'Deny insecure TLS 1.0 webserver',
        'deny_insecure_TLSv1_0_unchecked': 'Deny insecure TLS 1.0 unchecked',
        'deny_insecure_TLSv1_1_webserver': 'Deny insecure TLS 1.1 webserver',
        'deny_insecure_TLSv1_1_unchecked': 'Deny insecure TLS 1.1 unchecked',
        'deny_secure_TLSv1_2_webserver': 'Deny secure TLS 1.2 wevserver',
        'deny_secure_TLSv1_3_webserver': 'Deny secure TLS 1.3 wevserver',
        'dhcp': 'DHCP',
        'dig': 'dig',
        'disk': 'Disk',
        'dns': 'DNS',
        'dnssec': 'DNSSEC',
        'docker': 'Docker',
        'dovecot': 'Dovecot',
        'dummy': 'Dummy',
        'existing_user': '******',
        'file_age': 'File age',
        'firewall': 'Firewall',
        'flexlm': 'Flexlm',
        'freshclam': 'Freshclam',
        'ftp': 'FTP',
        'group_members': 'Group members',
        'hpjd': 'HP JD',
        'http_redirect': 'Http to https redirect',
        'http_redirect_unchecked': 'Http to https redirect unchecked',
        'icmp': 'ICMP',
        'ifstatus': 'Interface status',
        'imap': 'IMAP',
        'insecure_webserver': 'Insecure webserver',
        'insecure_TLSv1_0_Webserver': 'Insecure TLS v1.0 webserver',
        'insecure_TLSv1_1_Webserver': 'Insecure TLS v1.1 webserver',
        'ircd': 'IRCD',
        'jabber': 'Jabber',
        'ldap': 'LDAP',
        'load': 'Load',
        'log': 'Log',
        'mail': 'Mail',
        'mailq': 'Mail queue',
        'missing_http_redirect_check': 'Missing http to https redirect check',
        'mrt_gtraf': 'MRT graf',
        'mysql': 'MySQL',
        'network': 'Network',
        'nginx': 'NGINX',
        'nmap': 'Nmap',
        'nntp': 'NNTP',
        'no_certificate_check': 'No X.509 Certificate check',
        'ntp': 'NTP',
        'ns_client': 'NS Client',
        'opendkim': 'Open DKIM',
        'open_ports': 'Open ports',
        'path_exists': 'Path exists',
        'php_fpm': 'PHP FPM',
        'postfix': 'Postfix',
        'postgres': 'PostgreSQL',
        'postgrey': 'Postgrey',
        'ping': 'Ping',
        'pop': 'POP',
        'procs': 'Procs',
        'radius': 'RADIUS',
        'reboot': 'Reboot',
        'rpc': 'RPC',
        'rsyslogd': 'Rsyslogd',
        'secure_webserver': 'Secure Webserver',
        'secure_TLSv1_2_unchecked': 'Secure TLS 1.2 unchecked',
        'secure_TLSv1_3_unchecked': 'Secure TLS 1.3 unchecked',
        'secure_TLSv1_2_webserver': 'Secure TLS 1.2 Webserver',
        'secure_TLSv1_3_webserver': 'Secure TLS 1.3 Webserver',
        'security': 'Security',
        'sensors': 'Sensors',
        'smart': 'SMART',
        'smtp': 'SMTP',
        'snmp': 'SNMP',
        'sshd': 'SSHD',
        'sshd_security': 'SSHD security',
        'sudoers': 'Sudoers',
        'swap': 'SWAP',
        'synology_status': 'Synology Status',
        'system_health': 'System health',
        'tcp': 'TCP',
        'tls_1_0_check': 'TLS v1.0 Check',
        'tls_1_1_check': 'TLS v1.1 Check',
        'tls_1_2_check': 'TLS v1.2 Check',
        'tls_1_3_check': 'TLS v1.3 Check',
        'tls': 'TLS',
        'tomcat': 'Apache Tomcat',
        'udp': 'UDP',
        'ufw': 'UFW',
        'ups': 'UPS',
        'updates': 'Updates',
        'uptime': 'Uptime',
        'user': '******',
        'yum': 'YUM',
        'wave': 'Wave',
        'webserver': 'Webserver',
        'wordpress': 'Wordpress',
    }

    id = ValueMapper.replace_command_prefixes(id)

    return default_names.get(id, id.replace('_', ' '))
    def get_property_default_config(self: T) -> str:

        return ValueMapper.get_property_default_config(
            self, self.__class_name,
            ValueMapper.replace_command_prefixes(self.__command_name),
            'command')