Full Code of hardenedlinux/harbian-audit for AI

master 7fe31792867c cached
352 files
1.9 MB
537.0k tokens
11 symbols
1 requests
Download .txt
Showing preview only (2,042K chars total). Download the full file or copy to clipboard to get everything.
Repository: hardenedlinux/harbian-audit
Branch: master
Commit: 7fe31792867c
Files: 352
Total size: 1.9 MB

Directory structure:
gitextract_sowemua5/

├── .gitignore
├── LICENSE
├── README-CN.md
├── README.md
├── bin/
│   ├── harbianaudit.sh
│   ├── hardening/
│   │   ├── 1.1_install_updates.sh
│   │   ├── 1.2_enable_verify_sign_packages_from_repository.sh
│   │   ├── 1.3_enable_verify_sign_of_local_packages.sh
│   │   ├── 1.4_set_no_allow_insecure_repository_by_apt.sh
│   │   ├── 1.5.11_ensure_core_file_size_configured.sh
│   │   ├── 1.5.12_ensure_systemd_coredump_processsizemax.sh
│   │   ├── 1.5.13_ensure_systemd_coredump_storage.sh
│   │   ├── 1.5.1_ensure_fs_protected_hardlinks.sh
│   │   ├── 1.5.2_ensure_fs_protected_symlinks.sh
│   │   ├── 1.5.3_ensure_kernel_yama_ptrace_scope.sh
│   │   ├── 1.5.4_ensure_fs_suid_dumpable.sh
│   │   ├── 1.5.5_ensure_kernel_dmesg_restrict.sh
│   │   ├── 1.5.7_ensure_automatic_error_reporting_configured.sh
│   │   ├── 1.5.8_ensure_kernel_kptr_restrict.sh
│   │   ├── 1.5.9_ensure_kernel_randomize_va_space.sh
│   │   ├── 10.1.10_set_maxlogins_for_all_accounts.sh
│   │   ├── 10.1.11_ensure_no_shosts_cfg_on_system.sh
│   │   ├── 10.1.1_set_password_exp_days.sh
│   │   ├── 10.1.2_set_password_min_days_change.sh
│   │   ├── 10.1.3_set_password_exp_warning_days.sh
│   │   ├── 10.1.4_set_password_encrypt_method.sh
│   │   ├── 10.1.5_set_password_lock_inactive_user.sh
│   │   ├── 10.1.6_remove_nopasswd_sudoers.sh
│   │   ├── 10.1.7_remove_noauthenticate_sudoers.sh
│   │   ├── 10.1.8_set_fail_delay_seconds.sh
│   │   ├── 10.1.9_set_create_home_bool.sh
│   │   ├── 10.2_disable_system_accounts.sh
│   │   ├── 10.3_default_root_group.sh
│   │   ├── 10.4_default_umask.sh
│   │   ├── 10.5_set_timeout_tty.sh
│   │   ├── 11.1_warning_banners.sh
│   │   ├── 11.2_remove_os_info_warning_banners.sh
│   │   ├── 12.10_find_suid_files.sh
│   │   ├── 12.11_find_sgid_files.sh
│   │   ├── 12.12_etc_group_backup_permissions.sh
│   │   ├── 12.13_etc_gshadow_backup_permissions.sh
│   │   ├── 12.1_etc_passwd_permissions.sh
│   │   ├── 12.2_etc_shadow_permissions.sh
│   │   ├── 12.3_etc_group_permissions.sh
│   │   ├── 12.4_etc_gshadow_permissions.sh
│   │   ├── 12.5_etc_passwd_backup_permissions.sh
│   │   ├── 12.6_etc_shadow_backup_permissions.sh
│   │   ├── 12.7_find_world_writable_file.sh
│   │   ├── 12.8_find_unowned_files.sh
│   │   ├── 12.9_find_ungrouped_files.sh
│   │   ├── 13.10_find_user_rhosts_files.sh
│   │   ├── 13.11_find_passwd_group_inconsistencies.sh
│   │   ├── 13.12_users_valid_homedir.sh
│   │   ├── 13.13_check_user_homedir_ownership.sh
│   │   ├── 13.14_check_duplicate_uid.sh
│   │   ├── 13.15_check_duplicate_gid.sh
│   │   ├── 13.16_check_duplicate_username.sh
│   │   ├── 13.17_check_duplicate_groupname.sh
│   │   ├── 13.18_find_user_netrc_files.sh
│   │   ├── 13.19_find_user_forward_files.sh
│   │   ├── 13.1_remove_empty_password_field.sh
│   │   ├── 13.20_shadow_group_empty.sh
│   │   ├── 13.2_remove_legacy_passwd_entries.sh
│   │   ├── 13.3_remove_legacy_shadow_entries.sh
│   │   ├── 13.4_remove_legacy_group_entries.sh
│   │   ├── 13.5_find_0_uid_non_root_account.sh
│   │   ├── 13.6_sanitize_root_path.sh
│   │   ├── 13.7_check_user_dir_perm.sh
│   │   ├── 13.8_check_user_dot_file_perm.sh
│   │   ├── 13.9_set_perm_on_user_netrc.sh
│   │   ├── 14.1_security_related_NAT_slipstreaming.sh
│   │   ├── 14.2_check_abuse_777_permissions.sh
│   │   ├── 2.10_home_nodev.sh
│   │   ├── 2.11_removable_device_nodev.sh
│   │   ├── 2.12_removable_device_noexec.sh
│   │   ├── 2.13_removable_device_nosuid.sh
│   │   ├── 2.14_run_shm_nodev.sh
│   │   ├── 2.15_run_shm_nosuid.sh
│   │   ├── 2.16_run_shm_noexec.sh
│   │   ├── 2.17_sticky_bit_world_writable_folder.sh
│   │   ├── 2.18_disable_cramfs.sh
│   │   ├── 2.19_disable_freevxfs.sh
│   │   ├── 2.1_tmp_partition.sh
│   │   ├── 2.20_disable_jffs2.sh
│   │   ├── 2.21_disable_hfs.sh
│   │   ├── 2.22_disable_hfsplus.sh
│   │   ├── 2.23_disable_squashfs.sh
│   │   ├── 2.24_disable_udf.sh
│   │   ├── 2.25_disable_automounting.sh
│   │   ├── 2.26_home_nosuid.sh
│   │   ├── 2.27_nfs_nosuid.sh
│   │   ├── 2.28_nfs_noexec.sh
│   │   ├── 2.29_nfs_RPCSEC_GSS.sh
│   │   ├── 2.2_tmp_nodev.sh
│   │   ├── 2.3_tmp_nosuid.sh
│   │   ├── 2.4_tmp_noexec.sh
│   │   ├── 2.5_var_partition.sh
│   │   ├── 2.6.1_var_tmp_partition.sh
│   │   ├── 2.6.2_var_tmp_nodev.sh
│   │   ├── 2.6.3_var_tmp_nosuid.sh
│   │   ├── 2.6.4_var_tmp_noexec.sh
│   │   ├── 2.7_var_log_partition.sh
│   │   ├── 2.8_var_log_audit_partition.sh
│   │   ├── 2.9_home_partition.sh
│   │   ├── 3.1_bootloader_ownership.sh
│   │   ├── 3.2_bootloader_permissions.sh
│   │   ├── 3.3_bootloader_password.sh
│   │   ├── 3.4_root_password.sh
│   │   ├── 4.1.1_ensure_ufw_installed.sh
│   │   ├── 4.1.2_ensure_ufw_service_configured.sh
│   │   ├── 4.1_restrict_core_dumps.sh
│   │   ├── 4.2_enable_nx_support.sh
│   │   ├── 4.3_enable_randomized_vm_placement.sh
│   │   ├── 4.4_disable_prelink.sh
│   │   ├── 4.5_enable_apparmor.sh
│   │   ├── 4.6_enable_selinux.sh
│   │   ├── 4.7_enable_selinux_policy.sh
│   │   ├── 4.8_disable_usb_devices.sh
│   │   ├── 5.1.1_disable_nis.sh
│   │   ├── 5.1.2_disable_rsh.sh
│   │   ├── 5.1.3_disable_rsh_client.sh
│   │   ├── 5.1.4_disable_talk.sh
│   │   ├── 5.1.5_disable_talk_client.sh
│   │   ├── 5.1.6_disable_telnet_server.sh
│   │   ├── 5.1.7_disable_inetd.sh
│   │   ├── 5.2_install_screen.sh
│   │   ├── 5.3_enable_openssh_server.sh
│   │   ├── 5.4_disable_ctrl_alt_del_target.sh
│   │   ├── 5.5_ensure_installed_sudo.sh
│   │   ├── 6.10_disable_http_server.sh
│   │   ├── 6.11_disable_imap_pop.sh
│   │   ├── 6.12_disable_samba.sh
│   │   ├── 6.13_disable_http_proxy.sh
│   │   ├── 6.14_disable_snmp_server.sh
│   │   ├── 6.15_mta_localhost.sh
│   │   ├── 6.16_disable_rsync.sh
│   │   ├── 6.17_ensure_virul_scan_server_is_enabled.sh
│   │   ├── 6.18_ensure_virusscan_program_update_is_enabled.sh
│   │   ├── 6.19_configure_ntp.sh
│   │   ├── 6.1_disable_xwindow_system.sh
│   │   ├── 6.20_configure_chrony.sh
│   │   ├── 6.2_disable_avahi_server.sh
│   │   ├── 6.3_disable_print_server.sh
│   │   ├── 6.4_disable_dhcp.sh
│   │   ├── 6.5_ensure_time_sync_server_is_installed.sh
│   │   ├── 6.6_disable_ldap.sh
│   │   ├── 6.7_disable_nfs_rpc.sh
│   │   ├── 6.8_disable_dns_server.sh
│   │   ├── 6.9_disable_ftp.sh
│   │   ├── 7.1.1_disable_ip_forwarding.sh
│   │   ├── 7.1.2_disable_send_packet_redirects.sh
│   │   ├── 7.1.3_disable_interface_promisc_mode.sh
│   │   ├── 7.2.1_disable_source_routed_packets.sh
│   │   ├── 7.2.2_disable_icmp_redirect.sh
│   │   ├── 7.2.3_disable_secure_icmp_redirect.sh
│   │   ├── 7.2.4_log_martian_packets.sh
│   │   ├── 7.2.5_ignore_broadcast_requests.sh
│   │   ├── 7.2.6_enable_bad_error_message_protection.sh
│   │   ├── 7.2.7_enable_source_route_validation.sh
│   │   ├── 7.2.8_enable_tcp_syn_cookies.sh
│   │   ├── 7.3.1_disable_ipv6_router_advertisement.sh
│   │   ├── 7.3.2_disable_ipv6_redirect.sh
│   │   ├── 7.4.1_install_tcp_wrapper.sh
│   │   ├── 7.4.2_hosts_allow.sh
│   │   ├── 7.4.3_hosts_allow_permissions.sh
│   │   ├── 7.4.4_hosts_deny.sh
│   │   ├── 7.4.5_hosts_deny_permissions.sh
│   │   ├── 7.6_disable_wireless.sh
│   │   ├── 7.7.1_enable_firewall.sh
│   │   ├── 7.7.2_ensure_set_firewall_rules.sh
│   │   ├── 7.7.3_ensure_firewall_set_protect_dos_attacks.sh
│   │   ├── 7.7.4.1_ensure_default_deny_firewall_policy.sh
│   │   ├── 7.7.4.2_ensure_loopback_traffic_is_configured.sh
│   │   ├── 7.7.4.3_ensure_firewall_rules_exist_for_all_open_ports.sh
│   │   ├── 7.7.4.4_ensure_outbound_and_established_connections_are_configured.sh
│   │   ├── 7.7.5.1_ensure_default_deny_firewall_policy_for_v6.sh
│   │   ├── 7.7.5.2_ensure_loopback_traffic_is_configured_for_v6.sh
│   │   ├── 7.7.5.3_ensure_firewall_rules_exist_for_all_open_ports_for_v6.sh
│   │   ├── 7.7.5.4_ensure_outbound_and_established_connections_are_configured_for_v6.sh
│   │   ├── 8.0_enable_auditd_kernel.sh
│   │   ├── 8.1.1.1_audit_log_storage.sh
│   │   ├── 8.1.1.2_halt_when_audit_log_full.sh
│   │   ├── 8.1.1.3_keep_all_audit_logs.sh
│   │   ├── 8.1.1.4_set_failure_mode.sh
│   │   ├── 8.1.1.5_ensure_set_remote_server.sh
│   │   ├── 8.1.1.6_ensure_set_encrypt_for_audit_remote.sh
│   │   ├── 8.1.1.7_ensure_set_action_for_audit_storage_full.sh
│   │   ├── 8.1.1.8_ensure_set_action_for_net_fail.sh
│   │   ├── 8.1.1.9_set_space_left_audit.sh
│   │   ├── 8.1.10_record_dac_edit.sh
│   │   ├── 8.1.11_record_failed_access_file.sh
│   │   ├── 8.1.12_record_syscall_execve.sh
│   │   ├── 8.1.13_record_successful_mount.sh
│   │   ├── 8.1.14_record_file_deletions.sh
│   │   ├── 8.1.15_record_sudoers_edit.sh
│   │   ├── 8.1.16_record_sudo_usage.sh
│   │   ├── 8.1.17_record_kernel_modules.sh
│   │   ├── 8.1.18_record_Events_netfilter.sh
│   │   ├── 8.1.19_record_sshkeysign_usage.sh
│   │   ├── 8.1.20_record_open_by_handle_at_syscall.sh
│   │   ├── 8.1.21_record_Events_that_privileged_passwd_cmd_usage.sh
│   │   ├── 8.1.22_record_Events_that_privileged_priv_change_cmd_usage.sh
│   │   ├── 8.1.23_record_Events_that_privileged_postfix_cmd_usage.sh
│   │   ├── 8.1.24_record_crontab_cmd_usage.sh
│   │   ├── 8.1.25_record_pam_timestamp_check_cmd_usage.sh
│   │   ├── 8.1.26_record_pam_tally_cmd_usage.sh
│   │   ├── 8.1.27_record_Events_that_modify_conf_files.sh
│   │   ├── 8.1.28_record_acl_cmd_usage.sh
│   │   ├── 8.1.29_record_usermod_cmd_usage.sh
│   │   ├── 8.1.2_enable_auditd.sh
│   │   ├── 8.1.30_record_unix_update_cmd_usage.sh
│   │   ├── 8.1.31_record_file_transfer_related.sh
│   │   ├── 8.1.32_record_ufw_of_debian_like.sh
│   │   ├── 8.1.33_record_iptables_restore_exec.sh
│   │   ├── 8.1.34_record_privileged_commands.sh
│   │   ├── 8.1.35_freeze_auditd_conf.sh
│   │   ├── 8.1.3_audit_bootloader.sh
│   │   ├── 8.1.4_record_date_time_edit.sh
│   │   ├── 8.1.5_record_user_group_edit.sh
│   │   ├── 8.1.6_record_network_edit.sh
│   │   ├── 8.1.7_record_mac_edit.sh
│   │   ├── 8.1.8_record_login_logout.sh
│   │   ├── 8.1.9_record_session_init.sh
│   │   ├── 8.2.1_install_rsyslog.sh
│   │   ├── 8.2.2_enable_rsyslog.sh
│   │   ├── 8.2.3_set_logfile_perm_cfg_rsyslog.sh
│   │   ├── 8.2.4_rsyslog_remote_host.sh
│   │   ├── 8.3.1_install_syslog-ng.sh
│   │   ├── 8.3.2_enable_syslog-ng.sh
│   │   ├── 8.3.3_set_logfile_perm.sh
│   │   ├── 8.3.4_syslog-ng_remote_host.sh
│   │   ├── 8.4.1_install_aide.sh
│   │   ├── 8.4.2_aide_cron.sh
│   │   ├── 8.5_ensure_permissions_on_all_logfiles.sh
│   │   ├── 8.6_verify_integrity_packages.sh
│   │   ├── 8.7.1_journald_config_compress.sh
│   │   ├── 8.7.2_journald_config_storage.sh
│   │   ├── 9.1.1_enable_cron.sh
│   │   ├── 9.1.2_crontab_perm_ownership.sh
│   │   ├── 9.1.3_cron_hourly_perm_ownership.sh
│   │   ├── 9.1.4_cron_daily_perm_ownership.sh
│   │   ├── 9.1.5_cron_weekly_perm_ownership.sh
│   │   ├── 9.1.6_cron_monthly_perm_ownership.sh
│   │   ├── 9.1.7_cron_d_perm_ownership.sh
│   │   ├── 9.1.8_cron_users.sh
│   │   ├── 9.2.10_pam_maxclassrepeat_cracklib.sh
│   │   ├── 9.2.11_pam_deny_times_tally2.sh
│   │   ├── 9.2.12_pam_lockout_failed_tally2.sh
│   │   ├── 9.2.13_pam_even_deny_root_tally2.sh
│   │   ├── 9.2.14_pam_dictcheck_pwquality.sh
│   │   ├── 9.2.15_pam_printlastlog_to_showfailed_lastlog.sh
│   │   ├── 9.2.16_pam_limit_password_reuse.sh
│   │   ├── 9.2.17_pam_password_sha512_unix.sh
│   │   ├── 9.2.18_pam_auth_without_nullpwd_unix.sh
│   │   ├── 9.2.1_pam_retry_cracklib.sh
│   │   ├── 9.2.2_pam_minlen_cracklib.sh
│   │   ├── 9.2.3_pam_dcredit_cracklib.sh
│   │   ├── 9.2.4_pam_ucredit_cracklib.sh
│   │   ├── 9.2.5_pam_ocredit_cracklib.sh
│   │   ├── 9.2.6_pam_lcredit_cracklib.sh
│   │   ├── 9.2.7_pam_difok_cracklib.sh
│   │   ├── 9.2.8_pam_minclass_cracklib.sh
│   │   ├── 9.2.9_pam_maxrepeat_cracklib.sh
│   │   ├── 9.3.10_disable_sshd_setenv.sh
│   │   ├── 9.3.11_sshd_ciphers.sh
│   │   ├── 9.3.12_sshd_idle_timeout.sh
│   │   ├── 9.3.13_sshd_limit_access.sh
│   │   ├── 9.3.14_ssh_banner.sh
│   │   ├── 9.3.15_sshd_printlastlog.sh
│   │   ├── 9.3.16_sshd_IgnoreUserKnownHosts.sh
│   │   ├── 9.3.17_sshd_GSSAPIAuthentication.sh
│   │   ├── 9.3.18_sshd_KerberosAuthentication.sh
│   │   ├── 9.3.19_sshd_StrictModes.sh
│   │   ├── 9.3.1_sshd_protocol.sh
│   │   ├── 9.3.20_sshd_compression.sh
│   │   ├── 9.3.21_sshd_MACs.sh
│   │   ├── 9.3.22_ssh_check_pub_hostkey_permission.sh
│   │   ├── 9.3.23_ssh_check_priv_hostkey_permission.sh
│   │   ├── 9.3.24_sshd_kexalgorithms.sh
│   │   ├── 9.3.25_sshd_logingracetime.sh
│   │   ├── 9.3.2_sshd_loglevel.sh
│   │   ├── 9.3.3_sshd_conf_perm_ownership.sh
│   │   ├── 9.3.4_disable_x11_forwarding.sh
│   │   ├── 9.3.5_sshd_maxauthtries.sh
│   │   ├── 9.3.6_enable_sshd_ignorerhosts.sh
│   │   ├── 9.3.7_disable_sshd_hostbasedauthentication.sh
│   │   ├── 9.3.8_disable_root_login.sh
│   │   ├── 9.3.9_disable_sshd_permitemptypasswords.sh
│   │   └── 9.4_pam_restrict_su.sh
│   └── hardening.sh
├── docs/
│   ├── STIG-Benchmark/
│   │   ├── stig-Ubuntu_16-04_LTS.txt
│   │   └── stig-rhel-7-v1r4.txt
│   ├── complianced_image/
│   │   ├── AMI/
│   │   │   ├── how_to_creating_and_making_an_AMI_public.mkd
│   │   │   └── how_to_use_harbian_audit_complianced_Debian_9.mkd
│   │   └── QEMU/
│   │       ├── how_to_creating_and_making_a_QEMU_img_for_centos8.mkd
│   │       ├── how_to_creating_and_making_a_QEMU_img_for_debian9.mkd
│   │       ├── how_to_use_QEMU_image_of_harbian_audit_complianced_Debian_9.mkd
│   │       └── signature/
│   │           ├── debian9.9-harbian-0910.qcow2.sig
│   │           └── debian9.9-harbian-0910.qcow2.tar.gz.sig
│   ├── configurations/
│   │   ├── build-simple-cdd-cfg/
│   │   │   ├── Readme
│   │   │   ├── usr_share_simple-cdd_profiles_default.packages
│   │   │   └── usr_share_simple-cdd_profiles_default.preseed
│   │   ├── debian-config-4-build-deb/
│   │   │   ├── debian/
│   │   │   │   ├── Readme
│   │   │   │   ├── changelog
│   │   │   │   ├── compat
│   │   │   │   ├── control
│   │   │   │   ├── copyright
│   │   │   │   └── rules
│   │   │   └── how-to-build-deb-package.md
│   │   ├── etc.audit.auditd.conf
│   │   ├── etc.audit.rules.d.audit.rules_for_debian
│   │   ├── etc.iptables.rules.v4.sh
│   │   ├── etc.iptables.rules.v6.sh
│   │   ├── etc.login.defs
│   │   ├── etc.nftables.conf
│   │   ├── etc.ssh.sshd_config
│   │   ├── manual-operation-docs/
│   │   │   ├── how_to_config_grub2_password_protection.mkd
│   │   │   ├── how_to_deploy_audisp_remote_for_audit_log.mkd
│   │   │   ├── how_to_fix_SELinux_access_denied.mkd
│   │   │   ├── how_to_migrating_from_iptables_to_nftables_in_debian10.md
│   │   │   ├── how_to_persistent_iptables_rules_with_debian_9.mkd
│   │   │   └── how_to_persistent_nft_rules_with_debian_10.mkd
│   │   └── usr.share.netfilter-persistent.plugins.d.15-nft
│   ├── harbian_audit_Debian_9_Benchmark_v0.1.mkd
│   └── use-cases/
│       ├── apache2-usecase/
│       │   ├── Readme.mkd
│       │   └── etc.iptables.rules.v4.4http.sh
│       ├── hyperledger-cello-usecase/
│       │   ├── README.mkd
│       │   ├── master-ufw-rules.conf
│       │   └── worker-ufw-rules.conf
│       ├── nodejs-redis-mysql-usecase/
│       │   ├── README.md
│       │   └── helloworld/
│       │       ├── app.js
│       │       ├── config/
│       │       │   └── config.js
│       │       ├── package.json
│       │       └── services/
│       │           ├── LogService.js
│       │           ├── RedisService.js
│       │           └── SqlService.js
│       └── tls-transmission-usecase/
│           ├── nginx-mutual-ssl-proxy-http-service/
│           │   ├── Readme.mkd
│           │   ├── iptables_ufw-4-client.cfg
│           │   └── iptables_ufw-4-server.cfg
│           └── using-Nginx-as-SSL-tunnel-4TCP-UDP-service/
│               ├── Readme.mkd
│               ├── iptables_ufw-4-client.cfg
│               └── iptables_ufw-4-server.cfg
├── etc/
│   ├── conf.d/
│   │   ├── .gitignore
│   │   └── README
│   ├── default.cfg
│   └── hardening.cfg
├── lib/
│   ├── common.sh
│   ├── constants.sh
│   ├── main.sh
│   └── utils.sh
└── src/
    ├── skel
    └── skel.cfg

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
tmp/*


================================================
FILE: LICENSE
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.


================================================
FILE: README-CN.md
================================================
# harbian-audit审计与加固

## 简介 
本项目是面向 Debian GNU/Linux、CentOS 8 和 Ubuntu 发行版的安全审计与加固工具。当前主要测试环境为 Debian GNU/Linux 9/10/11/12/13、CentOS 8 以及 Ubuntu 22,其他版本尚未经过充分测试。本项目主要面向服务器场景,暂未针对桌面环境实现对应检查项。
本项目基于 [OVH-debian-cis](https://github.com/ovh/debian-cis) 框架,并结合 Debian GNU/Linux 9 的一些特性进行了优化。同时参考了安全合规基线 STIG([STIG Red_Hat_Enterprise_Linux_7_V2R5](redhat-STIG-DOCs/U_Red_Hat_Enterprise_Linux_7_V2R5_STIG.zip) 及 [STIG Ubuntu V1R2](https://dl.dod.cyber.mil/wp-content/uploads/stigs/zip/U_Canonical_Ubuntu_16-04_LTS_V1R2_STIG.zip))和 CIS([cisecurity.org](https://www.cisecurity.org/)),补充了安全检查项;另外也结合 HardenedLinux 社区在实际生产环境中的经验,实现了一些额外安全检查项的审计功能。项目不仅支持安全审计,也支持自动修复。

审计功能的使用示例: 
```console
# bash bin/hardening.sh --audit-all
[...]
hardening                 [INFO] Treating /home/test/harbian-audit/bin/hardening/13.15_check_duplicate_gid.sh
13.15_check_duplicate_gid [INFO] Working on 13.15_check_duplicate_gid
13.15_check_duplicate_gid [INFO] Checking Configuration
13.15_check_duplicate_gid [INFO] Performing audit
13.15_check_duplicate_gid [ OK ] No duplicate GIDs
13.15_check_duplicate_gid [ OK ] Check Passed

[...]
################### SUMMARY ###################
      Total Available Checks : 271
         Total Checks Run : 271
         Total Passed Checks : [ 226/271 ]
         Total Failed Checks : [  44/271 ]
   Enabled Checks Percentage : 100.00 %
       Conformity Percentage : 83.39 %
```
## 快速上手使用介绍

### 下载及初始化 
```console
$ git clone https://github.com/hardenedlinux/harbian-audit.git && cd harbian-audit
# cp etc/default.cfg /etc/default/cis-hardening
# sed -i "s#CIS_ROOT_DIR=.*#CIS_ROOT_DIR='$(pwd)'#" /etc/default/cis-hardening
# bin/hardening.sh --init
```
### 对所有安全检查项执行审计 
```
# bin/hardening.sh --audit-all
hardening                 [INFO] Treating /home/test/harbian-audit/bin/hardening/1.1_install_updates.sh
1.1_install_updates       [INFO] Working on 1.1_install_updates
1.1_install_updates       [INFO] Checking Configuration
1.1_install_updates       [INFO] Performing audit
1.1_install_updates       [INFO] Checking if apt needs an update
1.1_install_updates       [INFO] Fetching upgrades ...
1.1_install_updates       [ OK ] No upgrades available
1.1_install_updates       [ OK ] Check Passed
[...]
################### SUMMARY ###################
      Total Available Checks : 270
         Total Checks Run : 270
         Total Passed Checks : [ 226/270 ]
         Total Failed Checks : [  44/270 ]
   Enabled Checks Percentage : 100.00 %
       Conformity Percentage : 83.70 %
```
### 设置加固级别并执行自动修复  
```
# bin/hardening.sh --set-hardening-level 5  
# bin/hardening.sh --apply  
hardening                 [INFO] Treating /home/test/harbian-audit/bin/hardening/1.1_install_updates.sh
1.1_install_updates       [INFO] Working on 1.1_install_updates
1.1_install_updates       [INFO] Checking Configuration
1.1_install_updates       [INFO] Performing audit
1.1_install_updates       [INFO] Checking if apt needs an update
1.1_install_updates       [INFO] Fetching upgrades ...
1.1_install_updates       [ OK ] No upgrades available
1.1_install_updates       [INFO] Applying Hardening
1.1_install_updates       [ OK ] No Upgrades to apply
1.1_install_updates       [ OK ] Check Passed
[...]
```

## 用法简介 

### 需要预装的软件  
如果 Debian GNU/Linux 系统采用最小化安装方式,在使用本项目之前需要先安装以下软件:
```
# apt-get install -y bc net-tools pciutils 
```
如果系统是 RedHat/CentOS,在使用本项目前,需要安装以下软件包:
```
# yum install -y bc net-tools pciutils NetworkManager epel-release 
```

### 需要预先进行的配置 
在使用本项目前,必须为所有会用到的用户设置密码。否则在执行自动化加固后,相关用户可能无法登录系统。例如(用户:root 和 test):
```
 
# passwd 
# passwd test 
```

### 项目本身的配置 
审计与修复脚本位于 `bin/hardening` 目录中,每个脚本文件都对应一个位于 `/etc/conf.d/[script_name].cfg` 的配置文件。每个脚本都可以单独设置为 `enabled` 或 `disabled`,例如:
``disable_system_accounts``:

```
# Configuration for script of same name
status=disabled
# Put here your exceptions concerning admin accounts shells separated by spaces
EXCEPTIONS=""
```

`status` 参数有 3 个可选值: 
- `disabled` (do nothing): 执行时不运行该脚本 
- `audit` (RO): 仅执行审计检查 
- `enabled` (RW): 执行审计检查,并尝试自动修复

如需为每个脚本生成对应配置文件,并设置审计级别,可使用以下命令: 
1. 首次执行本项目时,可通过 `audit-all` 参数生成 `etc/conf.d/[script_name].cfg`:
```
# bash bin/hardening.sh --audit-all
```
2. 使用 `set-hardening-level` 参数,将对应级别的 `[script_name].cfg` 配置文件设为 `enabled` 状态:  
```
# bash bin/hardening.sh --set-hardening-level <level>
```
通用配置文件为 `etc/hardening.cfg`。该文件可用于控制日志级别和备份目录;备份目录用于在自动修复时保存原始配置文件。

### 审计及修复操作(执行加固后,必须完成“修复后必须进行的操作”章节中的内容)
执行审计或修复时,运行 `bin/hardening.sh`。该命令主要有两种执行模式:
- `--audit`: 对所有配置为 `enabled` 的脚本执行审计
- `--apply`: 对所有配置为 `enabled` 的脚本执行审计并尝试修复

另外,`--audit-all` 参数会强制执行所有审计脚本,包括配置为 `disabled` 的脚本;该操作不会修改系统(即不会执行修复)。
`--audit-all-enable-passed` 参数可用作快速初始化配置的快捷方式:它会以审计模式执行所有脚本,如果某个脚本审计通过,则自动将其对应配置文件设为 `enabled`。如果你已经自定义了配置文件,不建议使用此参数。

使用以下命令对系统进行加固/修复:
```
# bash bin/hardening.sh --apply 
```

## 修复后必须进行的操作(非常重要)
当 `set-hardening-level` 设为 5(最高等级)并执行 `--apply` 后,还需要完成以下操作:
1. 当 9.4 项(Restrict Access to the su Command)被修复后,如果仍然存在必须使用 `su` 的场景,例如通过 SSH 以普通用户登录后再切换到其他用户,可以使用以下命令临时解除限制:
```
# sed -i '/^[^#].*pam_wheel.so.*/s/^/# &/' /etc/pam.d/su 
```
该命令会临时注释掉包含 `pam_wheel.so` 的行。使用完 `su` 后,请恢复该行的注释状态。

2. 当 7.4.4 项(`7.4.4_hosts_deny.sh`)被修复后,系统将拒绝所有连接(例如 SSH 连接),因此需要在 `/etc/hosts.allow` 中配置允许访问此主机的来源,例如:
```
# echo "ALL: 192.168.1. 192.168.5." >> /etc/hosts.allow
```
该示例表示仅允许 `192.168.1.[1-255]` 和 `192.168.5.[1-255]` 两个网段访问此系统。请根据实际场景调整配置。 

3. 为普通用户授予 sudo 权限,例如(用户名为 `test`):
```
# sed -i "/^root/a\test    ALL=(ALL:ALL) ALL" /etc/sudoers 
```

4. 设置基础 iptables 防火墙规则  
请根据实际场景配置防火墙规则,可参考 HardenedLinux 社区整理的 Debian GNU/Linux 基础防火墙规则:
[etc.iptables.rules.v4.sh](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/etc.iptables.rules.v4.sh)

基于iptables的部署:
```
$ INTERFACENAME="your network interfacename(Example eth0)"
# bash docs/configurations/etc.iptables.rules.v4.sh $INTERFACENAME

# iptables-save > /etc/iptables/rules.v4 
# ip6tables-save > /etc/iptables/rules.v6 
```
基于 nft 的部署:
按以下命令修改 `nftables.conf`(将对外网卡名称替换为实际值,例如 `eth0`):
```
$ sed -i 's/^define int_if = ens33/define int_if = eth0/g' etc.nftables.conf 
# nft -f ./etc.nftables.conf 
```
5. 当所有安全基线项都修复完成后,可使用 `--final` 完成以下收尾工作:
   1. 使用 `passwd` 命令重新设置普通用户及 root 用户的密码,以满足 `pam_cracklib` 模块对密码强度的要求。
   2. 重新初始化 aide 工具的数据库。
```
# bin/hardening.sh --final
```

## 特别注意 

### 必须在第一次应用修复后处理的项  
8.1.35:此项一旦设置完成,将无法继续添加新的审计规则。

### 必须在所有项都修复完成后再处理的项  
8.4.1、8.4.2:这两项都与 aide 文件完整性检测有关,最好在所有修复完成后再执行,以便基于修复完成后的系统文件初始化完整性数据库。

### 一些检查项需要多次修复,且操作系统可能需要多次重启 
#### 需要执行两次修复的项  
8.1.1.2  
8.1.1.3  
8.1.12  
4.5  

## 扩展(如何添加检查项)

**获取源码**

```console
$ git clone https://github.com/hardenedlinux/harbian-audit.git
```

**添加一个自定义脚本**

```console
$ cp src/skel bin/hardening/99.99_custom_script.sh
$ chmod +x bin/hardening/99.99_custom_script.sh
$ cp src/skel.cfg etc/conf.d/99.99_custom_script.cfg
```
将对应配置文件设为 `enabled`,然后执行审计及加固测试:
```console
$ sed -i "s/status=.+/status=enabled/" etc/conf.d/99.99_custom_script.cfg
$ bash bin/hardening.sh --audit --only 99.99
$ bash bin/hardening.sh --apply --only 99.99
```

## 项目相关文档列表  

### Harbian-audit benchmark for Debian GNU/Linux 9 
This document is a description of the additions to the sections not included in the [CIS reference documentation](https://benchmarks.cisecurity.org/downloads/show-single/index.cfm?file=debian8.100). Includes STIG reference documentation and additional checks recommended by the HardenedLinux community. 

[CIS Debian GNU/Linux 8 Benchmark v1.0.0](https://benchmarks.cisecurity.org/downloads/show-single/index.cfm?file=debian8.100)  
[CIS Debian GNU/Linux 9 Benchmark v1.0.0](https://benchmarks.cisecurity.org/downloads/show-single/index.cfm?file=debian8.100)  
[harbian audit Debian Linux 9 Benchmark](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/harbian_audit_Debian_9_Benchmark_v0.1.mkd)  

### 手动修复操作文档列表  
[How to config grub2 password protection](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/manual-operation-docs/how_to_config_grub2_password_protection.mkd)  
[How to persistent iptables rules with debian 9](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/manual-operation-docs/how_to_persistent_iptables_rules_with_debian_9.mkd)  
[How to deploy audisp-remote for auditd log](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/manual-operation-docs/how_to_deploy_audisp_remote_for_audit_log.mkd)
[How to migrating from iptables to nftables in debian10](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/manual-operation-docs/how_to_migrating_from_iptables_to_nftables_in_debian10.md)  
[How to persistent nft rules with debian 10](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/manual-operation-docs/how_to_persistent_nft_rules_with_debian_10.mkd)
[How to fix SELinux access denied](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/manual-operation-docs/how_to_fix_SELinux_access_denied.mkd)

### 应用场景示例文档列表   
[Nodejs + redis + mysql demo](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/use-cases/nodejs-redis-mysql-usecase/README.md)  
[deploy-hyperledger-cello-on-debian-9](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/use-cases/hyperledger-cello-usecase/README.mkd)  
[nginx-mutual-ssl-proxy-http](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/use-cases/tls-transmission-usecase/nginx-mutual-ssl-proxy-http-service/Readme.mkd)  
[nginx-mutual-ssl-proxy-tcp-udp](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/use-cases/tls-transmission-usecase/using-Nginx-as-SSL-tunnel-4TCP-UDP-service/Readme.mkd)   

## harbian-audit 合规镜像  

### AMI(Amazon Machine Image) Public

#### 相关文档  
[how to creating and making an AMI public](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/complianced_image/AMI/how_to_creating_and_making_an_AMI_public.mkd)  
[how to use harbian-audit complianced for GNU/Linux Debian 9](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/complianced_image/AMI/how_to_use_harbian_audit_complianced_Debian_9.mkd)  

### QEMU Image    

#### 相关文档   
[How to creating and making a QEMU image of harbian-audit complianced Debian GNU/Linux 9](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/complianced_image/QEMU/how_to_creating_and_making_a_QEMU_img.mkd)  
[How to use QEMU image of harbian-audit complicanced Debian GNU/Linux 9](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/complianced_image/QEMU/how_to_use_QEMU_image_of_harbian_audit_complianced_Debian_9.mkd)   


## harbian-audit License   
GPL 3.0 

## OVH Disclaimer

This project is a set of tools. They are meant to help the system administrator
built a secure environment. While we use it at OVH to harden our PCI-DSS compliant
infrastructure, we can not guarantee that it will work for you. It will not
magically secure any random host.

Additionally, quoting the License:

> THIS SOFTWARE IS PROVIDED BY OVH SAS AND CONTRIBUTORS ``AS IS'' AND ANY
> EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> DISCLAIMED. IN NO EVENT SHALL OVH SAS AND CONTRIBUTORS BE LIABLE FOR ANY
> DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

## OVH License

3-Clause BSD


## 参考列表  

- **Center for Internet Security**: https://www.cisecurity.org/
- **STIG V1R4**: https://iasecontent.disa.mil/stigs/zip/U_Red_Hat_Enterprise_Linux_7_V1R4_STIG.zip 
- **Firewall Rules**: https://github.com/citypw/arsenal-4-sec-testing/blob/master/bt5_firewall/debian_fw



================================================
FILE: README.md
================================================
# harbian-audit Hardening

## Introduction 

Hardened Debian GNU/Linux and CentOS 8 distro auditing.  

The main test environment is in debian GNU/Linux 9/10/11/12/13 and CentOS 8 and ubuntu 22, and other versions are not fully tested. There are no implementations of desktop related items in this release.

The code framework is based on the [OVH-debian-cis](https://github.com/ovh/debian-cis) project, Modified some of the original implementations according to the features of Debian 9/10/11/12/13 and CentOS 8, added and implemented check items for [STIG Red_Hat_Enterprise_Linux_7_V2R5](https://github.com/hardenedlinux/STIG-OS-mirror/blob/master/redhat-STIG-DOCs/U_Red_Hat_Enterprise_Linux_7_V2R5_STIG.zip) [STIG Ubuntu V1R2](https://dl.dod.cyber.mil/wp-content/uploads/stigs/zip/U_Canonical_Ubuntu_16-04_LTS_V1R2_STIG.zip) and [cisecurity.org](https://www.cisecurity.org/) recommendations, and also added and implemented some check items by the HardenedLinux community. The audit and apply functions of the infrastructure are implemented, and the automatic fix function is implemented for the items that can be automatically fixed.


```console
# bash bin/hardening.sh --audit-all
[...]
hardening                 [INFO] Treating /home/test/harbian-audit/bin/hardening/13.15_check_duplicate_gid.sh
13.15_check_duplicate_gid [INFO] Working on 13.15_check_duplicate_gid
13.15_check_duplicate_gid [INFO] Checking Configuration
13.15_check_duplicate_gid [INFO] Performing audit
13.15_check_duplicate_gid [ OK ] No duplicate GIDs
13.15_check_duplicate_gid [ OK ] Check Passed

[...]
################### SUMMARY ###################
      Total Available Checks : 271
         Total Checks Run : 271
         Total Passed Checks : [ 226/271 ]
         Total Failed Checks : [  44/271 ]
   Enabled Checks Percentage : 100.00 %
       Conformity Percentage : 83.39 %
```

## Quickstart

```console
$ git clone https://github.com/hardenedlinux/harbian-audit.git && cd harbian-audit
# cp etc/default.cfg /etc/default/cis-hardening
# sed -i "s#CIS_ROOT_DIR=.*#CIS_ROOT_DIR='$(pwd)'#" /etc/default/cis-hardening
# bin/hardening.sh --init
# bin/hardening.sh --audit-all
hardening                 [INFO] Treating /home/test/harbian-audit/bin/hardening/1.1_install_updates.sh
1.1_install_updates       [INFO] Working on 1.1_install_updates
1.1_install_updates       [INFO] Checking Configuration
1.1_install_updates       [INFO] Performing audit
1.1_install_updates       [INFO] Checking if apt needs an update
1.1_install_updates       [INFO] Fetching upgrades ...
1.1_install_updates       [ OK ] No upgrades available
1.1_install_updates       [ OK ] Check Passed
[...]
################### SUMMARY ###################
      Total Available Checks : 284
         Total Checks Run : 284
         Total Passed Checks : [ 260/284 ]
         Total Failed Checks : [  24/284 ]
   Enabled Checks Percentage : 100.00 %
       Conformity Percentage : 91.55 %
# bin/hardening.sh --set-hardening-level 5
# bin/hardening.sh --apply 
hardening                 [INFO] Treating /home/test/harbian-audit/bin/hardening/1.1_install_updates.sh
1.1_install_updates       [INFO] Working on 1.1_install_updates
1.1_install_updates       [INFO] Checking Configuration
1.1_install_updates       [INFO] Performing audit
1.1_install_updates       [INFO] Checking if apt needs an update
1.1_install_updates       [INFO] Fetching upgrades ...
1.1_install_updates       [ OK ] No upgrades available
1.1_install_updates       [INFO] Applying Hardening
1.1_install_updates       [ OK ] No Upgrades to apply
1.1_install_updates       [ OK ] Check Passed
[...]
```

## Usage

### Pre-Install 

If use Network install from a minimal CD to installed Debian GNU/Linux, need install packages before use the hardening tool. 
```
# apt-get install -y bc net-tools pciutils network-manager 
```

Redhat/CentOS need install packages before use the hardening tool:
```
# yum install -y bc net-tools pciutils NetworkManager epel-release 
```

### Pre-Set 
You must set a password for all users before hardening. Otherwise, you will not be able to log in after the hardening is completed. Example(OS user: root and test): 
```
 
# passwd 
# passwd test 
```

### Configuration

Hardening scripts are in ``bin/hardening``. Each script has a corresponding
configuration file in ``etc/conf.d/[script_name].cfg``.

Each hardening script can be individually enabled from its configuration file.
For example, this is the default configuration file for ``disable_system_accounts``:

```
# Configuration for script of same name
status=disabled
# Put here your exceptions concerning admin accounts shells separated by spaces
EXCEPTIONS=""
```

``status`` parameter may take 3 values:
- ``disabled`` (do nothing): The script will not run.
- ``audit`` (RO): The script will check if any change *should* be applied.
- ``enabled`` (RW): The script will check if any change should be done and automatically apply what it can.

You can also set the configuration item to enable by modifying the level, following command: 
1) Generate etc/conf.d/[script_name].cfg by audit-all when first use 
```
# bash bin/hardening.sh --audit-all
```
2) Enable [script_name].cfg by set-hardening-level 
Use the command to set the hardening level to make the corresponding level audit entry take effect. 
```
# bash bin/hardening.sh --set-hardening-level <level>
```
Global configuration is in ``etc/hardening.cfg``. This file controls the log level
as well as the backup directory. Whenever a script is instructed to edit a file, it
will create a timestamped backup in this directory.

### Run aka "Harden your distro (After the hardened, you must perform the "After remediation" section)

To run the checks and apply the fixes, run ``bin/hardening.sh``.

This command has 2 main operation modes:    
- ``--audit``: Audit your system with all enabled and audit mode scripts    
- ``--apply``: Audit your system with all enabled and audit mode scripts and apply changes for enabled scripts    

Additionally, ``--audit-all`` can be used to force running all auditing scripts, including disabled ones. this will *not* change the system.  

``--audit-all-enable-passed`` can be used as a quick way to kickstart your configuration. It will run all scripts in audit mode. If a script passes, it will automatically be enabled for future runs. Do NOT use this option if you have already started to customize your configuration.

Use the command to harden your OS:
```
# bash bin/hardening.sh --apply 
```

### rsyslog config   
If rsyslog is used, and you want to print the harbian-audit log to a separate log file, the configuration is as follows:  
```
user.info			/var/log/harbian-audit.log
user.*				-/var/log/user.log
```
The log will be output to the file /var/log/harbian-audit.log.

If you apply docs/configurations/etc.iptables.rules.v4.sh to your firewall rules, and want to print the iptables log to a separate log file, insert the following lines to rsyslog.conf:  
```
:msg,contains,"FW-"                     -/var/log/firewalllog.log
&                                       stop
```

## After remediation (Very important)
When exec --apply and set-hardening-level are set to 5 (the highest level), you need to do the following:

1) When applying 9.4(Restrict Access to the su Command), you must use the root account to log in to the OS because ordinary users cannot perform subsequent operations. 
If you can only use ssh for remote login, you must use the su command when the normal user logs in. Then do the following:
```
# sed -i '/^[^#].*pam_wheel.so.*/s/^/# &/' /etc/pam.d/su 
```
Temporarily comment out the line containing pam_wheel.so. After you have finished using the su command, please uncomment the line.

2) When applying 7.4.4_hosts_deny.sh, the OS cannot be connected through the ssh service, so you need to set allow access host list on /etc/hosts.allow, example:
```
# echo "ALL: 192.168.1. 192.168.5." >> /etc/hosts.allow
```
This example only allows 192.168.1.[1-255] 192.168.5.[1-255] to access this system. Need to be configured according to your situation. 

3) Set capabilities for usual user, example(user name is test):
```
# sed -i "/^root/a\test    ALL=(ALL:ALL) ALL" /etc/sudoers 
```

4) Set basic firewall rules 
Set the corresponding firewall rules according to the applications used. HardenedLinux community for Debian GNU/Linux basic firewall rules: 

### Iptabels format rules:
[etc.iptables.rules.v4.sh](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/etc.iptables.rules.v4.sh)
First install the iptables-persistent package, then to do the following:
```
$ INTERFACENAME="your network interfacename(Example eth0)"
# bash docs/configurations/etc.iptables.rules.v4.sh $INTERFACENAME

# iptables-save > /etc/iptables/rules.v4 
# ip6tables-save > /etc/iptables/rules.v6 
```

### nft format rules:
[nftables.conf](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/etc.nftables.conf)
to do the following(your network interfacename(Example eth0)):
```
$ sed -i 's/^define int_if = ens33/define int_if = eth0/g' etc.nftables.conf 
# nft -f ./etc.nftables.conf 
```
5) When all repairs are completed. --final method will:
   1. Use passwd command to change the password of the regular and root user to apply the password complexity and robustness of the pam_cracklib module configuration.
   2. Aide reinitializes.
```
# bin/hardening.sh --final
```

## Special Note 
Some check items check a variety of situations and are interdependent, they must be applied (fix) multiple times, and the OS must be a reboot after each applies (fix). 

### Items that must be applied after the first application(reboot after is better)
8.1.35  Because this item is set, the audit rules will not be added. 

### Items that must be applied after all application is ok
8.4.1   
8.4.2   
These are all related to the aide. It is best to fix all the items after they have been fixed to fix the integrity of the database in the system. 

### Items that need to be fix twice  
4.5  

## Hacking

**Getting the source**

```console
$ git clone https://github.com/hardenedlinux/harbian-audit.git
```

**Adding a custom hardening script**

```console
$ cp src/skel bin/hardening/99.99_custom_script.sh
$ chmod +x bin/hardening/99.99_custom_script.sh
$ cp src/skel.cfg etc/conf.d/99.99_custom_script.cfg
```

Code your check explaining what it does then if you want to test

```console
$ sed -i "s/status=.+/status=enabled/" etc/conf.d/99.99_custom_script.cfg
$ bash bin/hardening.sh --audit --only 99.99
$ bash bin/hardening.sh --apply --only 99.99
```

## Document 

### Harbian-audit benchmark for Debian GNU/Linux 9 
This document is a description of the additions to the sections not included in the [CIS reference documentation](https://benchmarks.cisecurity.org/downloads/show-single/index.cfm?file=debian8.100). Includes STIG reference documentation and additional checks recommended by the HardenedLinux community. 

[CIS Debian GNU/Linux 8 Benchmark v1.0.0](https://benchmarks.cisecurity.org/downloads/show-single/index.cfm?file=debian8.100)  
[CIS Debian GNU/Linux 9 Benchmark v1.0.0](https://benchmarks.cisecurity.org/downloads/show-single/index.cfm?file=debian8.100)  
[harbian audit Debian Linux 9 Benchmark](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/harbian_audit_Debian_9_Benchmark_v0.1.mkd)  

### Manual Operation docs 
[How to config grub2 password protection](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/manual-operation-docs/how_to_config_grub2_password_protection.mkd)  
[How to persistent iptables rules with debian 9](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/manual-operation-docs/how_to_persistent_iptables_rules_with_debian_9.mkd)  
[How to deploy audisp-remote for auditd log](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/manual-operation-docs/how_to_deploy_audisp_remote_for_audit_log.mkd)  
[How to migrating from iptables to nftables in debian10](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/manual-operation-docs/how_to_migrating_from_iptables_to_nftables_in_debian10.md)  
[How to persistent nft rules with debian 10](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/manual-operation-docs/how_to_persistent_nft_rules_with_debian_10.mkd)  
[How to fix SELinux access denied](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/configurations/manual-operation-docs/how_to_fix_SELinux_access_denied.mkd)

### Use case docs  
[Nodejs + redis + mysql demo](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/use-cases/nodejs-redis-mysql-usecase/README.md)  
[deploy-hyperledger-cello-on-debian-9](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/use-cases/hyperledger-cello-usecase/README.mkd)  
[nginx-mutual-ssl-proxy-http](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/use-cases/tls-transmission-usecase/nginx-mutual-ssl-proxy-http-service/Readme.mkd)  
[nginx-mutual-ssl-proxy-tcp-udp](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/use-cases/tls-transmission-usecase/using-Nginx-as-SSL-tunnel-4TCP-UDP-service/Readme.mkd)   

## harbian-audit complianced image 

### AMI(Amazon Machine Image) Public

#### Docs  
[how to creating and making an AMI public](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/complianced_image/AMI/how_to_creating_and_making_an_AMI_public.mkd)  
[how to use harbian-audit complianced for GNU/Linux Debian 9](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/complianced_image/AMI/how_to_use_harbian_audit_complianced_Debian_9.mkd)  

### QEMU Image    

#### Docs   
[How to creating and making a QEMU image of harbian-audit complianced Debian GNU/Linux 9](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/complianced_image/QEMU/how_to_creating_and_making_a_QEMU_img.mkd)  
[How to use QEMU image of harbian-audit complicanced Debian GNU/Linux 9](https://github.com/hardenedlinux/harbian-audit/blob/master/docs/complianced_image/QEMU/how_to_use_QEMU_image_of_harbian_audit_complianced_Debian_9.mkd)   

## harbian-audit License   
GPL 3.0 

## OVH Disclaimer

This project is a set of tools. They are meant to help the system administrator
built a secure environment. While we use it at OVH to harden our PCI-DSS compliant
infrastructure, we can not guarantee that it will work for you. It will not
magically secure any random host.

Additionally, quoting the License:

> THIS SOFTWARE IS PROVIDED BY OVH SAS AND CONTRIBUTORS ``AS IS'' AND ANY
> EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
> WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> DISCLAIMED. IN NO EVENT SHALL OVH SAS AND CONTRIBUTORS BE LIABLE FOR ANY
> DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
> (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
> LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
> ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
> SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

## OVH License

3-Clause BSD

## Reference

- **Center for Internet Security**: [https://www.cisecurity.org](https://www.cisecurity.org)
- **STIG V1R4**: [https://iasecontent.disa.mil/stigs/zip/U_Red_Hat_Enterprise_Linux_7_V1R4_STIG.zip](https://iasecontent.disa.mil/stigs/zip/U_Red_Hat_Enterprise_Linux_7_V1R4_STIG.zip) 
- **Firewall Rules**: [https://github.com/citypw/arsenal-4-sec-testing/blob/master/bt5_firewall/debian_fw](https://github.com/citypw/arsenal-4-sec-testing/blob/master/bt5_firewall/debian_fw)


================================================
FILE: bin/harbianaudit.sh
================================================
#!/bin/bash
# For make deb package 
/opt/harbianaudit/bin/hardening.sh --init
/opt/harbianaudit/bin/hardening.sh --audit-all
/opt/harbianaudit/bin/hardening.sh --set-hardening-level 5
sed -i 's/^status=.*/status=disabled/' /opt/harbianaudit/etc/conf.d/7.4.4_hosts_deny.cfg
sed -i 's/^status=.*/status=disabled/' /opt/harbianaudit/etc/conf.d/8.1.35_freeze_auditd_conf.cfg
sed -i 's/^status=.*/status=disabled/' /opt/harbianaudit/etc/conf.d/8.4.1_install_aide.cfg
sed -i 's/^status=.*/status=disabled/' /opt/harbianaudit/etc/conf.d/8.4.2_aide_cron.cfg
sed -i 's/^status=.*/status=disabled/' /opt/harbianaudit/etc/conf.d/9.4_pam_restrict_su.cfg
/opt/harbianaudit/bin/hardening.sh --apply
sed -i 's/^status=.*/status=enabled/' /opt/harbianaudit/etc/conf.d/8.1.35_freeze_auditd_conf.cfg
sed -i 's/^status=.*/status=enabled/' /opt/harbianaudit/etc/conf.d/8.4.1_install_aide.cfg
sed -i 's/^status=.*/status=enabled/' /opt/harbianaudit/etc/conf.d/8.4.2_aide_cron.cfg
/opt/harbianaudit/bin/hardening.sh --apply --only 8.4.1
/opt/harbianaudit/bin/hardening.sh --apply --only 8.4.2
/opt/harbianaudit/bin/hardening.sh --apply --only 8.1.35


================================================
FILE: bin/hardening/1.1_install_updates.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux Debian 9/10/11/12/13 or CentOS 8 Hardening
# Modify by: Samson-W (samson@hardenedlinux.org)
#

#
# 1.1 Install Updates, Patches and Additional Security Software (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3


audit_debian ()
{
    info "Checking if apt needs an update"
    apt_update_if_needed 
    info "Fetching upgrades ..."
    apt_check_updates "CIS_APT"
    if [ $FNRET -gt 0 ]; then
        crit "$RESULT"
        FNRET=1
    else
        ok "No upgrades available"
        FNRET=0
    fi
}

audit_centos ()
{
	info "Checking if yum needs an update"
	info "Fetching upgrades ..."
	yum_check_updates
	if [ $FNRET -eq 100 ]; then
		crit "There are packages available for an update!"
	elif [ $FNRET -eq 0 ]; then
		ok "No upgrades available"
	else
		crit "Call yum_check_updates function error!"
	fi
}

# This function will be called if the script status is on enabled / audit mode
audit () 
{
	if [ $OS_RELEASE -eq 2 ]; then
		audit_centos
	else
		audit_debian
	fi
}

apply_debian ()
{
    if [ $FNRET -eq 1 ]; then 
        info "Applying Upgrades..."
        DEBIAN_FRONTEND='noninteractive' apt-get -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' upgrade -y
	else
		ok "No Upgrades to apply"
    fi
}

apply_centos ()
{
	if [ $FNRET -eq 100 ]; then 
		info "Applying Upgrades..."
		yum upgrade -y
	elif [ $FNRET -eq 0 ]; then 
		ok "No Upgrades to apply"
	else
		crit "Call yum_check_updates function error!"
    fi
}

# This function will be called if the script status is on enabled mode
apply () 
{
	if [ $OS_RELEASE -eq 2 ]; then
		apply_centos
	else
		apply_debian
	fi
}

# This function will check config parameters required
check_config() {
    # No parameters for this function
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/1.2_enable_verify_sign_packages_from_repository.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux Debian 9/10/11/12/13 or CentOS 8 Hardening
#

#
# 1.2 Enable Option for signature of packages from a repository (Scored)
# Author : Samson wen, Samson <sccxboy@gmail.com>
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2
OPTION='AllowUnauthenticated'
YUM_OPTION='gpgcheck'
YUM_CONF='/etc/yum.conf'

audit_debian ()
{
    if [ $(grep -v "^#" /etc/apt/ -Ir | grep -c "${OPTION}.*true") -gt 0 ]; then
        crit "The signature of packages option is disable "
        FNRET=1
    else
        ok "The signature of packages option is enable "
        FNRET=0
    fi
}

audit_centos ()
{
	if [ $(grep -c "^$YUM_OPTION" $YUM_CONF) -gt 0 ]; then
		if [ $(grep "^$YUM_OPTION" $YUM_CONF | awk -F"=" '{print $2}') -eq 1 ]; then
			ok "The signature of packages option is enable "
			FNRET=0
		else
			crit "The signature of packages option is disable "
			FNRET=1
		fi
	else
		crit "Option $YUM_OPTION is not set in $YUM_CONF!"
		FNRET=2
	fi
}

# This function will be called if the script status is on enabled / audit mode
audit () 
{
    if [ $OS_RELEASE -eq 2 ]; then
        audit_centos
    else
        audit_debian
    fi
}


apply_debian () {
    if [ $FNRET = 0 ]; then 
        ok "The signature of packages option is enable "
    else
        warn "Set to enabled signature of packages option"
        for CONFFILE in $(grep -i "${OPTION}" /etc/apt/ -Ir | grep -v "^#" | awk -F: '{print $1}')
        do
			backup_file ${CONFFILE}	
			sed -i "s/${OPTION}.*true.*/${OPTION} \"false\";/g" ${CONFFILE}
        done
    fi
}
apply_centos () {
	if [ $FNRET = 0 ]; then 
		ok "The signature of packages option is enable "
	elif [ $FNRET = 1 ]; then
		warn "Set to enabled signature of packages option"
		backup_file $YUM_CONF
		sed -i "s/$YUM_OPTION=.*/$YUM_OPTION=1/g" $YUM_CONF
		
	else 
		warn "Add $YUM_OPTION option to $YUM_CONF"
		backup_file $YUM_CONF
		add_end_of_file $YUM_CONF "$YUM_OPTION=1"
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
    if [ $OS_RELEASE -eq 2 ]; then
        apply_centos
    else
        apply_debian
    fi
}

# This function will check config parameters required
check_config() {
    # No parameters for this function
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/1.3_enable_verify_sign_of_local_packages.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux Debian 9/10/11/12/13 or CentOS 8 Hardening
#

#
# 1.3 Enable verify the signature of local packages (Scored)
# Dependence pkg: debsig-verify
# Author : Samson wen, Samson <sccxboy@gmail.com>
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2
OPTION='no-debsig'
CONFFILE='/etc/dpkg/dpkg.cfg'

YUM_OPTION='localpkg_gpgcheck'
YUM_CONFFILE='/etc/yum.conf'

audit_debian () {
    if [ $(grep -v "^#" ${CONFFILE} | grep -c ${OPTION}) -gt 0 ]; then
        crit "The signature of local packages option is disable "
        FNRET=1
    else
        ok "The signature of local packages option is enable "
        FNRET=0
    fi
}

audit_centos ()
{
    if [ $(grep -c "^$YUM_OPTION" $YUM_CONFFILE) -gt 0 ]; then
        if [ $(grep "^$YUM_OPTION" $YUM_CONFFILE | awk -F"=" '{print $2}') -eq 1 ]; then
            ok "The signature of packages option is enable "
            FNRET=0
        else
            crit "The signature of packages option is disable "
            FNRET=1
        fi
    else
        crit "Option $YUM_OPTION is not set in $YUM_CONFFILE!"
        FNRET=2
    fi
}

# This function will be called if the script status is on enabled / audit mode
audit()
{
    if [ $OS_RELEASE -eq 2 ]; then
        audit_centos
    else
        audit_debian
    fi
}

apply_debian () {
    if [ $FNRET = 0 ]; then 
        ok "The signature of local packages option is enable "
    else
        warn "Set to enabled signature of local packages option"
			backup_file $CONFFILE
            sed -i "s/^${OPTION}/#&/" ${CONFFILE}
    fi
}

apply_centos () {
    if [ $FNRET = 0 ]; then
        ok "The signature of packages option is enable "
    elif [ $FNRET = 1 ]; then
		backup_file $YUM_CONFFILE
        warn "Set to enabled signature of packages option"
        sed -i "s/$YUM_OPTION=.*/$YUM_OPTION=1/g" $YUM_CONFFILE
    else
		backup_file $YUM_CONFFILE
        warn "Add $YUM_OPTION option to $YUM_CONFFILE"
        add_end_of_file $YUM_CONFFILE "$YUM_OPTION=1"
    fi
}


# This function will be called if the script status is on enabled mode
apply () {
    if [ $OS_RELEASE -eq 2 ]; then
        apply_centos
    else
        apply_debian
    fi
}
# This function will check config parameters required
check_config() {
    # No parameters for this function
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/1.4_set_no_allow_insecure_repository_by_apt.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux Debian 9/10/11/12/13 or CentOS 8 Hardening
#

#
# 1.4 Set no allow insecure repository when by apt update (Scored)
# Author : Samson wen, Samson <sccxboy@gmail.com>
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2
OPTION='AllowInsecureRepositories'

YUM_OPTION='repo_gpgcheck'
YUM_CONFFILE='/etc/yum.conf'

audit_debian () {
    if [ $(grep -v "^#" /etc/apt/ -rI | grep -c "${OPTION}.*true") -gt 0 ]; then
        crit "The allow insecure repository when by apt update is enable"
        FNRET=1
    else
        ok "The allow insecure repository when by apt update is disable"
        FNRET=0
    fi
}

audit_centos ()
{
    if [ $(grep -c "^$YUM_OPTION" $YUM_CONFFILE) -gt 0 ]; then
		if [ $(grep "^$YUM_OPTION" $YUM_CONFFILE | awk -F"=" '{print $2}') -eq 1 ]; then
			ok "The allow insecure repository when by yum update is disable"
			FNRET=0
        else
            crit "The signature of repodata option is disable "
            FNRET=1
        fi
    else
        crit "Option $YUM_OPTION is not set in $YUM_CONFFILE!"
        FNRET=2
    fi
}

# This function will be called if the script status is on enabled / audit mode
audit () {
    if [ $OS_RELEASE -eq 2 ]; then
        audit_centos
    else
        audit_debian
    fi
}

apply_debian () {
    if [ $FNRET = 0 ]; then 
        ok "The allow insecure repository when by apt update is disable"
    else
        warn "Set no allow insecure repository when by apt update"
        for CONFFILE in $(grep -i "${OPTION}" /etc/apt/ -rI | grep -v "^#" | awk -F: '{print $1}')
        do
            sed -i "s/${OPTION}.*true.*/${OPTION} \"false\";/g" ${CONFFILE}
        done
    fi
}

apply_centos () {
	if [ $FNRET = 0 ]; then
		ok "The signature of repodata option is enable "
    elif [ $FNRET = 1 ]; then
        warn "Set to enabled signature of repodata option"
        sed -i "s/$YUM_OPTION=.*/$YUM_OPTION=1/g" $YUM_CONFFILE
    else
        warn "Add $YUM_OPTION option to $YUM_CONFFILE"
        add_end_of_file $YUM_CONFFILE "$YUM_OPTION=1"
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
    if [ $OS_RELEASE -eq 2 ]; then
        apply_centos
    else
        apply_debian
    fi
}
# This function will check config parameters required
check_config() {
    # No parameters for this function
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/1.5.11_ensure_core_file_size_configured.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 13
#

#
# 1.5.11 Ensure core file size is configured
#

set -e
set -u

HARDENING_LEVEL=2




audit () {
    is_debian_ge_13
    if [ $FNRET = 0 ]; then
        file_limit_check '* hard core 0'
    else
        ok "Rule is not applicable to OS versions prior to Debian 13."
        FNRET=0
    fi
}

apply () {
    # The main framework automatically calls audit() first to set FNRET based on the current system state.
    # Therefore, we just use the existing $FNRET instead of calling is_debian_ge_13 again which would clobber it.
    if [ $FNRET = 0 ]; then
        ok "Already compliant. Nothing to apply for 1.5.11 Ensure core file size is configured."
    elif [ $FNRET != 0 ]; then
        is_debian_ge_13
        local is_supported=$FNRET
        if [ $is_supported = 0 ]; then
            file_limit_apply '* hard core 0'
        else
            ok "Rule is not applicable to OS versions prior to Debian 13."
        fi
    fi
}

check_config() {
    :
}

if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
    echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
    echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory?"
    exit 128
fi


================================================
FILE: bin/hardening/1.5.12_ensure_systemd_coredump_processsizemax.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 13
#

#
# 1.5.12 Ensure systemd-coredump ProcessSizeMax is configured
#

set -e
set -u

HARDENING_LEVEL=2




audit () {
    is_debian_ge_13
    if [ $FNRET = 0 ]; then
        check_param_pair_by_str '/etc/systemd/coredump.conf' 'ProcessSizeMax' '0'
        if [ $FNRET = 0 ]; then
            ok "Parameter is correctly set"
        else
            crit "Parameter is missing or incorrect"
        fi

    else
        ok "Rule is not applicable to OS versions prior to Debian 13."
        FNRET=0
    fi
}

apply () {
    # The main framework automatically calls audit() first to set FNRET based on the current system state.
    # Therefore, we just use the existing $FNRET instead of calling is_debian_ge_13 again which would clobber it.
    if [ $FNRET = 0 ]; then
        ok "Already compliant. Nothing to apply for 1.5.12 Ensure systemd-coredump ProcessSizeMax is configured."
    elif [ $FNRET != 0 ]; then
        is_debian_ge_13
        local is_supported=$FNRET
        if [ $is_supported = 0 ]; then
            replace_in_file_custom '/etc/systemd/coredump.conf' '^#?ProcessSizeMax.*' 'ProcessSizeMax=0'
        else
            ok "Rule is not applicable to OS versions prior to Debian 13."
        fi
    fi
}

check_config() {
    :
}

if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
    echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
    echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory?"
    exit 128
fi


================================================
FILE: bin/hardening/1.5.13_ensure_systemd_coredump_storage.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 13
#

#
# 1.5.13 Ensure systemd-coredump Storage is configured
#

set -e
set -u

HARDENING_LEVEL=2




audit () {
    is_debian_ge_13
    if [ $FNRET = 0 ]; then
        check_param_pair_by_str '/etc/systemd/coredump.conf' 'Storage' 'none'
        if [ $FNRET = 0 ]; then
            ok "Parameter is correctly set"
        else
            crit "Parameter is missing or incorrect"
        fi

    else
        ok "Rule is not applicable to OS versions prior to Debian 13."
        FNRET=0
    fi
}

apply () {
    # The main framework automatically calls audit() first to set FNRET based on the current system state.
    # Therefore, we just use the existing $FNRET instead of calling is_debian_ge_13 again which would clobber it.
    if [ $FNRET = 0 ]; then
        ok "Already compliant. Nothing to apply for 1.5.13 Ensure systemd-coredump Storage is configured."
    elif [ $FNRET != 0 ]; then
        is_debian_ge_13
        local is_supported=$FNRET
        if [ $is_supported = 0 ]; then
            replace_in_file_custom '/etc/systemd/coredump.conf' '^#?Storage.*' 'Storage=none'
        else
            ok "Rule is not applicable to OS versions prior to Debian 13."
        fi
    fi
}

check_config() {
    :
}

if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
    echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
    echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory?"
    exit 128
fi


================================================
FILE: bin/hardening/1.5.1_ensure_fs_protected_hardlinks.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 13
#

#
# 1.5.1 Ensure fs.protected_hardlinks is configured
#

set -e
set -u

HARDENING_LEVEL=2




audit () {
    is_debian_ge_13
    if [ $FNRET = 0 ]; then
        sysctl_check 'fs.protected_hardlinks' '1'
    else
        ok "Rule is not applicable to OS versions prior to Debian 13."
        FNRET=0
    fi
}

apply () {
    # The main framework automatically calls audit() first to set FNRET based on the current system state.
    # Therefore, we just use the existing $FNRET instead of calling is_debian_ge_13 again which would clobber it.
    if [ $FNRET = 0 ]; then
        ok "Already compliant. Nothing to apply for 1.5.1 Ensure fs.protected_hardlinks is configured."
    elif [ $FNRET != 0 ]; then
        is_debian_ge_13
        local is_supported=$FNRET
        if [ $is_supported = 0 ]; then
            sysctl_apply 'fs.protected_hardlinks' '1'
        else
            ok "Rule is not applicable to OS versions prior to Debian 13."
        fi
    fi
}

check_config() {
    :
}

if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
    echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
    echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory?"
    exit 128
fi


================================================
FILE: bin/hardening/1.5.2_ensure_fs_protected_symlinks.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 13
#

#
# 1.5.2 Ensure fs.protected_symlinks is configured
#

set -e
set -u

HARDENING_LEVEL=2




audit () {
    is_debian_ge_13
    if [ $FNRET = 0 ]; then
        sysctl_check 'fs.protected_symlinks' '1'
    else
        ok "Rule is not applicable to OS versions prior to Debian 13."
        FNRET=0
    fi
}

apply () {
    # The main framework automatically calls audit() first to set FNRET based on the current system state.
    # Therefore, we just use the existing $FNRET instead of calling is_debian_ge_13 again which would clobber it.
    if [ $FNRET = 0 ]; then
        ok "Already compliant. Nothing to apply for 1.5.2 Ensure fs.protected_symlinks is configured."
    elif [ $FNRET != 0 ]; then
        is_debian_ge_13
        local is_supported=$FNRET
        if [ $is_supported = 0 ]; then
            sysctl_apply 'fs.protected_symlinks' '1'
        else
            ok "Rule is not applicable to OS versions prior to Debian 13."
        fi
    fi
}

check_config() {
    :
}

if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
    echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
    echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory?"
    exit 128
fi


================================================
FILE: bin/hardening/1.5.3_ensure_kernel_yama_ptrace_scope.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 13
#

#
# 1.5.3 Ensure kernel.yama.ptrace_scope is configured
#

set -e
set -u

HARDENING_LEVEL=2




audit () {
    is_debian_ge_13
    if [ $FNRET = 0 ]; then
        sysctl_check 'kernel.yama.ptrace_scope' '1'
    else
        ok "Rule is not applicable to OS versions prior to Debian 13."
        FNRET=0
    fi
}

apply () {
    # The main framework automatically calls audit() first to set FNRET based on the current system state.
    # Therefore, we just use the existing $FNRET instead of calling is_debian_ge_13 again which would clobber it.
    if [ $FNRET = 0 ]; then
        ok "Already compliant. Nothing to apply for 1.5.3 Ensure kernel.yama.ptrace_scope is configured."
    elif [ $FNRET != 0 ]; then
        is_debian_ge_13
        local is_supported=$FNRET
        if [ $is_supported = 0 ]; then
            sysctl_apply 'kernel.yama.ptrace_scope' '1'
        else
            ok "Rule is not applicable to OS versions prior to Debian 13."
        fi
    fi
}

check_config() {
    :
}

if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
    echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
    echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory?"
    exit 128
fi


================================================
FILE: bin/hardening/1.5.4_ensure_fs_suid_dumpable.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 13
#

#
# 1.5.4 Ensure fs.suid_dumpable is configured
#

set -e
set -u

HARDENING_LEVEL=2




audit () {
    is_debian_ge_13
    if [ $FNRET = 0 ]; then
        sysctl_check 'fs.suid_dumpable' '0'
    else
        ok "Rule is not applicable to OS versions prior to Debian 13."
        FNRET=0
    fi
}

apply () {
    # The main framework automatically calls audit() first to set FNRET based on the current system state.
    # Therefore, we just use the existing $FNRET instead of calling is_debian_ge_13 again which would clobber it.
    if [ $FNRET = 0 ]; then
        ok "Already compliant. Nothing to apply for 1.5.4 Ensure fs.suid_dumpable is configured."
    elif [ $FNRET != 0 ]; then
        is_debian_ge_13
        local is_supported=$FNRET
        if [ $is_supported = 0 ]; then
            sysctl_apply 'fs.suid_dumpable' '0'
        else
            ok "Rule is not applicable to OS versions prior to Debian 13."
        fi
    fi
}

check_config() {
    :
}

if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
    echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
    echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory?"
    exit 128
fi


================================================
FILE: bin/hardening/1.5.5_ensure_kernel_dmesg_restrict.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 13
#

#
# 1.5.5 Ensure kernel.dmesg_restrict is configured
#

set -e
set -u

HARDENING_LEVEL=2




audit () {
    is_debian_ge_13
    if [ $FNRET = 0 ]; then
        sysctl_check 'kernel.dmesg_restrict' '1'
    else
        ok "Rule is not applicable to OS versions prior to Debian 13."
        FNRET=0
    fi
}

apply () {
    # The main framework automatically calls audit() first to set FNRET based on the current system state.
    # Therefore, we just use the existing $FNRET instead of calling is_debian_ge_13 again which would clobber it.
    if [ $FNRET = 0 ]; then
        ok "Already compliant. Nothing to apply for 1.5.5 Ensure kernel.dmesg_restrict is configured."
    elif [ $FNRET != 0 ]; then
        is_debian_ge_13
        local is_supported=$FNRET
        if [ $is_supported = 0 ]; then
            sysctl_apply 'kernel.dmesg_restrict' '1'
        else
            ok "Rule is not applicable to OS versions prior to Debian 13."
        fi
    fi
}

check_config() {
    :
}

if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
    echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
    echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory?"
    exit 128
fi


================================================
FILE: bin/hardening/1.5.7_ensure_automatic_error_reporting_configured.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 13
#

#
# 1.5.7 Ensure Automatic Error Reporting is configured
#

set -e
set -u

HARDENING_LEVEL=2




audit () {
    is_debian_ge_13
    if [ $FNRET = 0 ]; then
        service_disable_check 'apport.service'
    else
        ok "Rule is not applicable to OS versions prior to Debian 13."
        FNRET=0
    fi
}

apply () {
    # The main framework automatically calls audit() first to set FNRET based on the current system state.
    # Therefore, we just use the existing $FNRET instead of calling is_debian_ge_13 again which would clobber it.
    if [ $FNRET = 0 ]; then
        ok "Already compliant. Nothing to apply for 1.5.7 Ensure Automatic Error Reporting is configured."
    elif [ $FNRET != 0 ]; then
        is_debian_ge_13
        local is_supported=$FNRET
        if [ $is_supported = 0 ]; then
            service_disable_apply 'apport.service'
        else
            ok "Rule is not applicable to OS versions prior to Debian 13."
        fi
    fi
}

check_config() {
    :
}

if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
    echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
    echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory?"
    exit 128
fi


================================================
FILE: bin/hardening/1.5.8_ensure_kernel_kptr_restrict.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 13
#

#
# 1.5.8 Ensure kernel.kptr_restrict is configured
#

set -e
set -u

HARDENING_LEVEL=2




audit () {
    is_debian_ge_13
    if [ $FNRET = 0 ]; then
        sysctl_check 'kernel.kptr_restrict' '1'
    else
        ok "Rule is not applicable to OS versions prior to Debian 13."
        FNRET=0
    fi
}

apply () {
    # The main framework automatically calls audit() first to set FNRET based on the current system state.
    # Therefore, we just use the existing $FNRET instead of calling is_debian_ge_13 again which would clobber it.
    if [ $FNRET = 0 ]; then
        ok "Already compliant. Nothing to apply for 1.5.8 Ensure kernel.kptr_restrict is configured."
    elif [ $FNRET != 0 ]; then
        is_debian_ge_13
        local is_supported=$FNRET
        if [ $is_supported = 0 ]; then
            sysctl_apply 'kernel.kptr_restrict' '1'
        else
            ok "Rule is not applicable to OS versions prior to Debian 13."
        fi
    fi
}

check_config() {
    :
}

if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
    echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
    echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory?"
    exit 128
fi


================================================
FILE: bin/hardening/1.5.9_ensure_kernel_randomize_va_space.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 13
#

#
# 1.5.9 Ensure kernel.randomize_va_space is configured
#

set -e
set -u

HARDENING_LEVEL=2




audit () {
    is_debian_ge_13
    if [ $FNRET = 0 ]; then
        sysctl_check 'kernel.randomize_va_space' '2'
    else
        ok "Rule is not applicable to OS versions prior to Debian 13."
        FNRET=0
    fi
}

apply () {
    # The main framework automatically calls audit() first to set FNRET based on the current system state.
    # Therefore, we just use the existing $FNRET instead of calling is_debian_ge_13 again which would clobber it.
    if [ $FNRET = 0 ]; then
        ok "Already compliant. Nothing to apply for 1.5.9 Ensure kernel.randomize_va_space is configured."
    elif [ $FNRET != 0 ]; then
        is_debian_ge_13
        local is_supported=$FNRET
        if [ $is_supported = 0 ]; then
            sysctl_apply 'kernel.randomize_va_space' '2'
        else
            ok "Rule is not applicable to OS versions prior to Debian 13."
        fi
    fi
}

check_config() {
    :
}

if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
    echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
    echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory?"
    exit 128
fi


================================================
FILE: bin/hardening/10.1.10_set_maxlogins_for_all_accounts.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux debian 7/8/9 or CentOS 8 Hardening
#

#
# 10.1.10 Set maxlogins for all accounts  (Scored)
# Author : Samson wen, Samson <sccxboy@gmail.com>
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2

PACKAGE='libpam-modules'
OPTIONS='maxsyslogins'
OPVALUE=10
FILE='/etc/security/limits.conf'

# This function will be called if the script status is on enabled / audit mode
audit () {
    is_pkg_installed $PACKAGE
    if [ $FNRET != 0 ]; then
        crit "$PACKAGE is not installed!"
        FNRET=1
    else
        ok "$PACKAGE is installed"
        does_file_exist $FILE
        if [ $FNRET != 0 ]; then                    
            crit "$FILE does not exist"
            FNRET=2
        else
            ok "$FILE does exist"
            COUNT=$(sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' $FILE | grep "${OPTIONS}" | wc -l)
            if [ $COUNT -gt 0 ]; then
                ok "$OPTIONS is set in $FILE."
                VALUE=$(sed -e '/^#/d' -e '/^[ \t][ \t]*#/d' -e 's/#.*$//' -e '/^$/d' $FILE | grep ".*[[:space:]].*${OPTIONS}[[:space:]].*${OPVALUE}" | wc -l)
                if [ $VALUE -eq 0 ]; then
                    crit "$OPTIONS value is incorrect in $FILE"
                    FNRET=4
                else
                    ok "$OPTIONS value is correct in $FILE"
                    FNRET=0
                fi
            else
                crit "$OPTIONS is not set in $FILE."
                FNRET=3
            fi
        fi

    fi
}

# This function will be called if the script status is on enabled mode
apply () {
    if [ $FNRET = 0 ]; then
		ok "$OPTIONS value is correct in $FILE"
    elif [ $FNRET = 1 ]; then
        warn "$PACKAGE is not installed, need install."
        install_package $PACKAGE
    elif [ $FNRET = 2 ]; then
        warn "$FILE is not exist, need manual check."
    elif [ $FNRET = 3 ]; then
        warn "$OPTIONS value not exist in $FILE, add it"
        add_end_of_file $FILE "* hard ${OPTIONS}  $OPVALUE"
    elif [ $FNRET = 4 ]; then
        warn "$OPTIONS value is incorrect in $FILE, reset it"
        replace_in_file $FILE "^[^#].*${OPTIONS}[[:space:]].*" "\* hard ${OPTIONS}  $OPVALUE"
    fi
}

# This function will check config parameters required
check_config() {
	if [ $OS_RELEASE -eq 2 ]; then
		PACKAGE='pam'
	else
		:
	fi
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.1.11_ensure_no_shosts_cfg_on_system.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 10.1.11 Ensure no shosts configure file on system (Scored)
# Author : Samson wen, Samson <sccxboy@gmail.com>
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

FILENAME='.shosts'
FILENAME1='shosts.equiv'

# This function will be called if the script status is on enabled / audit mode
audit () {
    COUNT=$(find / -xdev -name "${FILENAME}" | wc -l)
    COUNT1=$(find / -xdev -name "${FILENAME1}" | wc -l)
    if [ "$COUNT" -ne 0 -o "$COUNT1" -ne 0 ]; then
        crit "$FILENAME or $FILENAME1 file is exist on system."
        FNRET=1
    else
        ok "$FILENAME and $FILENAME1 file is not on system."
        FNRET=0
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
    if [ $FNRET = 0 ]; then
        ok "$FILENAME and $FILENAME1 file is not on system."
    elif [ $FNRET = 1 ]; then
        warn "$FILENAME or $FILENAME1 file is exist on the system, delete all like this name file on the system."
        find / -name "$FILENAME" -exec rm {} \;
        find / -name "$FILENAME1" -exec rm {} \;
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.1.1_set_password_exp_days.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening
#

#
# 10.1.1 Set Password Expiration Days (Scored)
# Modify by: Samson-W (sccxboy@gmail.com)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

OPTIONS='PASS_MAX_DAYS=60'
FILE='/etc/login.defs'
SHA_FILE='/etc/shadow'

# This function will be called if the script status is on enabled / audit mode
audit () {
	SSH_PARAM=$(echo $OPTIONS | cut -d= -f 1)
	SSH_VALUE=$(echo $OPTIONS | cut -d= -f 2)
	PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
	does_pattern_exist_in_file $FILE "$PATTERN"
	if [ $FNRET = 0 ]; then
		ok "$PATTERN is present in $FILE"
	else
	crit "$PATTERN is not present in $FILE"
	fi

	if [ $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$5 > "'$SSH_VALUE'" {print $1}' | wc -l) -gt 0 ]; then
		crit "Have least user's maximum password lifetime is greater than $SSH_VALUE day"
	else
		ok "All user's maximum password lifetime is equal or less than $SSH_VALUE day"
	fi
}

# This function will be called if the script status is on enabled mode
apply () {
	SSH_PARAM=$(echo $OPTIONS | cut -d= -f 1)
	SSH_VALUE=$(echo $OPTIONS | cut -d= -f 2)
	PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
	does_pattern_exist_in_file $FILE "$PATTERN"
	if [ $FNRET = 0 ]; then
		ok "$PATTERN is present in $FILE"
	else
		warn "$PATTERN is not present in $FILE, adding it"
		does_pattern_exist_in_file $FILE "^$SSH_PARAM"
		if [ $FNRET != 0 ]; then
			add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
		else
			info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
			replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
		fi
	fi
	if [ $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$5 > "'$SSH_VALUE'" {print $1}' | wc -l) -gt 0 ]; then
		warn "Have least user's maximum password lifetime is greater than $SSH_VALUE day, Fixing"
		for USERNAME in $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$5 > "'$SSH_VALUE'" {print $1}'); 
		do 
			chage --maxdays $SSH_VALUE $USERNAME
		done
	fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.1.2_set_password_min_days_change.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening
#

#
# 10.1.2 Set Password Change Minimum Number of Days (Scored)
# Modify by: Samson-W (sccxboy@gmail.com)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

OPTIONS='PASS_MIN_DAYS=1'
FILE='/etc/login.defs'
SHA_FILE='/etc/shadow'

# This function will be called if the script status is on enabled / audit mode
audit () {
	SSH_PARAM=$(echo $OPTIONS | cut -d= -f 1)
	SSH_VALUE=$(echo $OPTIONS | cut -d= -f 2)
	PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
	does_pattern_exist_in_file $FILE "$PATTERN"
	if [ $FNRET = 0 ]; then
		ok "$PATTERN is present in $FILE"
	else
		crit "$PATTERN is not present in $FILE"
	fi
		
	if [ $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$4 < "'$SSH_VALUE'" {print $1}' | wc -l) -gt 0 ]; then
		crit "Have least user's minimum password lifetime is not equal or less than $SSH_VALUE day"
	else
		ok "All user's minimum password lifetime is $SSH_VALUE day"
	fi
}

# This function will be called if the script status is on enabled mode
apply () {
	SSH_PARAM=$(echo $OPTIONS | cut -d= -f 1)
	SSH_VALUE=$(echo $OPTIONS | cut -d= -f 2)
	PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
	does_pattern_exist_in_file $FILE "$PATTERN"
	if [ $FNRET = 0 ]; then
		ok "$PATTERN is present in $FILE"
	else
		warn "$PATTERN is not present in $FILE, adding it"
		does_pattern_exist_in_file $FILE "^$SSH_PARAM"
		if [ $FNRET != 0 ]; then
			add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
		else
			info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
			replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
		fi
	fi
	if [ $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$4 < "'$SSH_VALUE'" {print $1}' | wc -l) -gt 0 ]; then
		warn "Have least user's minimum password lifetime is not equal or less than $SSH_VALUE day, Fixing"
		for USERNAME in $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$4 < "'$SSH_VALUE'" {print $1}');	
		do
			chage --mindays $SSH_VALUE $USERNAME
		done
	else
		ok "All user's minimum password lifetime is $SSH_VALUE day"
	fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.1.3_set_password_exp_warning_days.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening
#

#
# 10.1.3 Set Password Expiring Warning Days (Scored)
# Modify by: Samson-W (sccxboy@gmail.com)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

OPTIONS='PASS_WARN_AGE=7'
FILE='/etc/login.defs'
SHA_FILE='/etc/shadow'

# This function will be called if the script status is on enabled / audit mode
audit () {
		SSH_PARAM=$(echo $OPTIONS | cut -d= -f 1)
		SSH_VALUE=$(echo $OPTIONS | cut -d= -f 2)
		PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
		does_pattern_exist_in_file $FILE "$PATTERN"
		if [ $FNRET = 0 ]; then
			ok "$PATTERN is present in $FILE"
		else
			crit "$PATTERN is not present in $FILE"
		fi
		if [ $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$6 < "'$SSH_VALUE'" {print $1}' | wc -l) -gt 0 ]; then
			crit "Have least user's maximum password lifetime is greater than $SSH_VALUE day"
		else
			ok "All user's maximum password lifetime is equal or less than $SSH_VALUE day"
		fi
}

# This function will be called if the script status is on enabled mode
apply () {
	SSH_PARAM=$(echo $OPTIONS | cut -d= -f 1)
	SSH_VALUE=$(echo $OPTIONS | cut -d= -f 2)
	PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
	does_pattern_exist_in_file $FILE "$PATTERN"
	if [ $FNRET = 0 ]; then
		ok "$PATTERN is present in $FILE"
	else
		warn "$PATTERN is not present in $FILE, adding it"
		does_pattern_exist_in_file $FILE "^$SSH_PARAM"
		if [ $FNRET != 0 ]; then
			add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
		else
			info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
			replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
		fi
	fi
	if [ $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$6 < "'$SSH_VALUE'" {print $1}' | wc -l) -gt 0 ]; then
		warn "Have least user's maximum password lifetime is greater than $SSH_VALUE day, Fixing"
		for USERNAME in $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$6 < "'$SSH_VALUE'" {print $1}'); 
		do 
			chage --warndays $SSH_VALUE $USERNAME
		done
	fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.1.4_set_password_encrypt_method.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening
#

#
# 10.1.4 Set Password Expiration Days (Scored)
# Author : Samson wen, Samson <sccxboy@gmail.com>
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

OPTIONS='ENCRYPT_METHOD=SHA512'
FILE='/etc/login.defs'

# This function will be called if the script status is on enabled / audit mode
audit () {
	for SSH_OPTION in $OPTIONS; do
		SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
		SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
		PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
		does_pattern_exist_in_file $FILE "$PATTERN"
		if [ $FNRET = 0 ]; then
			ok "$PATTERN is present in $FILE"
		else
			crit "$PATTERN is not present in $FILE"
		fi
	done
}

# This function will be called if the script status is on enabled mode
apply () {
    for SSH_OPTION in $OPTIONS; do
            SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
            SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
            PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
            does_pattern_exist_in_file $FILE "$PATTERN"
            if [ $FNRET = 0 ]; then
                ok "$PATTERN is present in $FILE"
            else
                warn "$PATTERN is not present in $FILE, adding it"
                does_pattern_exist_in_file $FILE "^$SSH_PARAM"
                if [ $FNRET != 0 ]; then
                    add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
                else
                    info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
                    replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
                fi
            fi
    done
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.1.5_set_password_lock_inactive_user.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13  Hardening
#

#
# 10.1.5 Ensure inactive password lock is 30 days or less (Scored)
# Author: Samson-W (sccxboy@gmail.com)
# STIG for Ubuntu_16-04_LTS_STIG_V1R2_Manual: INACTIVE=35
# STIG for U_Red_Hat_Enterprise_Linux_7_V2R5: INACTIVE=0
# 
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

OPTIONS='INACTIVE=30'
OPTIONS_CENTOS='INACTIVE=0'
SHA_FILE='/etc/shadow'
DISABLE_V='-1'
FILE='/etc/default/useradd'

audit_debian () {
		SSH_PARAM=$(echo $OPTIONS | cut -d= -f 1)
		SSH_VALUE=$(echo $OPTIONS | cut -d= -f 2)
		INACTIVE_V=$(useradd -D | grep $SSH_PARAM | awk -F= '{print $2}')
		if [ $INACTIVE_V -eq $DISABLE_V ]; then
			crit "INACTIVE feature has disabled."
		elif [ $INACTIVE_V -gt $SSH_VALUE ]; then
			crit "INACTIVE value is greater than $SSH_VALUE day"
		else
			ok "All user's INACTIVE value is equal or less than $SSH_VALUE day"
		fi

		if [ $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '{print $7}' | wc -w) -eq 0 ]; then
			crit "Have least user's INACTIVE password lifetime is not set"
		else
			if [ $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$7 > "'$SSH_VALUE'" {print $1}' | wc -l) -gt 0 ]; then
				crit "Have least user's INACTIVE password lifetime is greater than $SSH_VALUE day"
			else
				ok "All user's INACTIVE password lifetime is equal or less than $SSH_VALUE day"
			fi
		fi
}

audit_centos () {
	SSH_PARAM=$(echo $OPTIONS | cut -d= -f 1)
	SSH_VALUE=$(echo $OPTIONS | cut -d= -f 2)
	INACTIVE_V=$(useradd -D | grep $SSH_PARAM | awk -F= '{print $2}')
	if [ $INACTIVE_V -eq $DISABLE_V ]; then
		crit "INACTIVE feature has disabled."
	elif [ $INACTIVE_V -eq $SSH_VALUE ]; then
		ok "All user's INACTIVE value has set $SSH_VALUE: disables the account as soon as the password has expired"
	else
		crit "All user's INACTIVE value is not set $SSH_VALUE: disables the account as soon as the password has expired"
	fi
}

# This function will be called if the script status is on enabled / audit mode
audit () {
    if [ $OS_RELEASE -eq 2 ]; then
		audit_centos
	else
		audit_debian
	fi
}

apply_debian () {
	SSH_PARAM=$(echo $OPTIONS | cut -d= -f 1)
	SSH_VALUE=$(echo $OPTIONS | cut -d= -f 2)
	PATTERN="^$SSH_PARAM=$SSH_VALUE"
	does_pattern_exist_in_file $FILE "$PATTERN"
	if [ $FNRET = 0 ]; then
		ok "$PATTERN is present in $FILE"
	else
		warn "$PATTERN is not present in $FILE, adding it"
		does_pattern_exist_in_file $FILE "^$SSH_PARAM"
		if [ $FNRET != 0 ]; then
			add_end_of_file $FILE "$SSH_PARAM=$SSH_VALUE"
		else
			info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
			replace_in_file $FILE "^$SSH_PARAM.*" "$SSH_PARAM=$SSH_VALUE"
		fi
	fi
	if [ $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '{print $7}' | wc -w) -eq 0 ]; then
		warn "Have least user's INACTIVE password lifetime is not set. Fixing"
		for USERNAME in $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '{print $1}'); 
		do 
			chage --inactive $SSH_VALUE $USERNAME			
		done
	else
		if [ $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$7 > "'$SSH_VALUE'" {print $1}' | wc -l) -gt 0 ]; then
			warn "Have least user's INACTIVE password lifetime is greater than $SSH_VALUE day. Fixing"
			for USERNAME in $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$7 > "'$SSH_VALUE'" {print $1}'); 
			do 
				chage --inactive $SSH_VALUE $USERNAME
			done
		else
			ok "All user's INACTIVE password lifetime is equal or less than $SSH_VALUE day"
		fi
	fi
}

apply_centos () {
	SSH_PARAM=$(echo $OPTIONS | cut -d= -f 1)
	SSH_VALUE=$(echo $OPTIONS | cut -d= -f 2)
	PATTERN="^$SSH_PARAM=$SSH_VALUE"
	does_pattern_exist_in_file $FILE "$PATTERN"
	if [ $FNRET = 0 ]; then
		ok "$PATTERN is present in $FILE"
	else
		warn "$PATTERN is not present in $FILE, adding it"
		does_pattern_exist_in_file $FILE "^$SSH_PARAM"
		if [ $FNRET != 0 ]; then
			add_end_of_file $FILE "$SSH_PARAM=$SSH_VALUE"
		else
			info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
			replace_in_file $FILE "^$SSH_PARAM.*" "$SSH_PARAM=$SSH_VALUE"
		fi
	fi
	if [ $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '{print $7}' | wc -w) -eq 0 ]; then
		warn "Have least user's INACTIVE password lifetime is not set. Fixing"
		for USERNAME in $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '{print $1}'); 
		do 
			chage --inactive $SSH_VALUE $USERNAME			
		done
	else
		if [ $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$7 > "'$SSH_VALUE'" {print $1}' | wc -l) -gt 0 ]; then
			warn "All user's INACTIVE value is not set $SSH_VALUE, fixing it."
			for USERNAME in $(egrep ^[^:]+:[^\!*] $SHA_FILE | awk -F: '$7 > "'$SSH_VALUE'" {print $1}'); 
			do 
				chage --inactive $SSH_VALUE $USERNAME
			done
		else
			ok "All user's INACTIVE value has set $SSH_VALUE: disables the account as soon as the password has expired"
		fi
	fi
}

# This function will be called if the script status is on enabled mode
apply () {
    if [ $OS_RELEASE -eq 2 ]; then
		apply_centos
	else
		apply_debian
	fi
}

# This function will check config parameters required
check_config() {
    if [ $OS_RELEASE -eq 2 ]; then
		OPTIONS=$OPTIONS_CENTOS
	else
		:
	fi
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.1.6_remove_nopasswd_sudoers.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 10.1.6 Remove nopasswd option from the sudoers configuration (Scored)
# Author : Samson wen, Samson <sccxboy@gmail.com>
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

NOPASSWD='NOPASSWD'
PASSWD='PASSWD'
FILE='/etc/sudoers'
INCLUDFILE='/etc/sudoers.d/*'

# This function will be called if the script status is on enabled / audit mode
audit () 
{
	does_file_exist $FILE 
    if [ $FNRET != 0 ]; then
		crit "$FILE is not exist!"
		FNRET=2
	else
    	does_pattern_exist_in_file $FILE $NOPASSWD
    	if [ $FNRET = 0 ]; then
        	crit "$NOPASSWD is set on $FILE, it's error conf"
        	FNRET=1
    	else
        	ok "$NOPASSWD is not set on $FILE, it's ok"
			if [ $(ls $(dirname $INCLUDFILE) | wc -l) -gt 0 ]; then
        		if [ $(grep $NOPASSWD $INCLUDFILE | wc -l) -gt 0 ]; then 
            		crit "$NOPASSWD is set on $INCLUDFILE, it's error conf"
            		FNRET=1
        		else
            		ok "$NOPASSWD is not set on $INCLUDFILE, it's ok"
            		FNRET=0
        		fi
			fi
    	fi
	fi
}

# This function will be called if the script status is on enabled mode
apply () {
    if [ $FNRET = 0 ]; then
        ok "APPLY: $NOPASSWD is not set on $FILE, it's ok"
    elif [ $FNRET = 1 ]; then
        info "$NOPASSWD is set on the $FILE or $INCLUDFILE, need remove"
        backup_file $FILE
        chmod 640 $FILE &&  sed -i -e "s/$NOPASSWD/$PASSWD/g" $FILE && chmod 440 $FILE 
		if [ $(ls $(dirname $INCLUDFILE) | wc -l) -gt 0 ]; then
			backup_file $INCLUDFILE
			chmod 640 $INCLUDFILE &&  sed -i -e "s/$NOPASSWD/$PASSWD/g" $INCLUDFILE && chmod 440 $INCLUDFILE
		fi
    elif [ $FNRET = 2 ]; then
		warn "$FILE is not exist! Maybe sudo package not installed."
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.1.7_remove_noauthenticate_sudoers.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 10.1.7 Remove not authenticate option from the sudoers configuration (Scored)
# Author : Samson wen, Samson <sccxboy@gmail.com>
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

NOAUTH='!authenticate'
AUTHENTICATE='authenticate'
FILE='/etc/sudoers'
INCLUDFILE='/etc/sudoers.d/'

# This function will be called if the script status is on enabled / audit mode
audit () 
{
	does_file_exist $FILE 
	if [ $FNRET != 0 ]; then
		crit "$FILE is not exist!"
		FNRET=2
	else
    	does_pattern_exist_in_file $FILE $NOAUTH
    	if [ $FNRET = 0 ]; then
        	crit "$NOAUTH is set on $FILE, it's error conf"
        	FNRET=1
    	else
        	ok "$NOAUTH is not set on $FILE, it's ok"
        	if [ $(grep $NOAUTH $INCLUDFILE -rh | wc -l) -gt 0 ]; then 
            		crit "$NOAUTH is set on $INCLUDFILE, it's error conf"
            		FNRET=1
        	else
            		ok "$NOAUTH is not set on $INCLUDFILE, it's ok"
            		FNRET=0
        	fi
    	fi
	fi
}

# This function will be called if the script status is on enabled mode
apply () {
    if [ $FNRET = 0 ]; then
        ok "APPLY: $NOAUTH is not set on $FILE, it's ok"
    elif [ $FNRET = 1 ]; then
        info "$NOAUTH is set on the $FILE or $INCLUDFILE, need remove"
        backup_file $FILE ${INCLUDFILE}/*
		chmod 640 $FILE ${INCLUDFILE}/* &&  sed -i -e "s/$NOAUTH/$AUTHENTICATE/g" $FILE ${INCLUDFILE}/* && chmod 440 $FILE ${INCLUDFILE}/*
    elif [ $FNRET = 1 ]; then
		warn "$FILE is not exist! Maybe sudo package not installed."
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.1.8_set_fail_delay_seconds.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux debian 9 or CentOS 8 Hardening
#

#
# 10.1.8 Set FAIL_DELAY Parameters Using pam_faildelay (Scored)
# Author : Samson wen, Samson <sccxboy@gmail.com>
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2

audit_debian () {
    is_pkg_installed $PACKAGE
    if [ $FNRET != 0 ]; then
        crit "$PACKAGE is not installed!"
        FNRET=1
    else
        ok "$PACKAGE is installed"
        does_pattern_exist_in_file $FILE $PATTERN
        if [ $FNRET = 0 ]; then
            ok "$PATTERN is present in $FILE"
            check_param_pair_by_pam $FILE $PAMLIBNAME $OPTIONNAME ge $CONDT_VAL  
            if [ $FNRET = 0 ]; then
                ok "$OPTIONNAME set condition is $CONDT_VAL"
            else
                crit "$OPTIONNAME set condition is not equal or greater than $CONDT_VAL"
            fi
        else
            crit "$PATTERN is not present in $FILE"
            FNRET=2
        fi
    fi
}

audit_centos () {
	SSH_PARAM=$(echo $OPTION | cut -d= -f 1)
	SSH_VALUE=$(echo $OPTION | cut -d= -f 2)
	PATTERN="^$SSH_PARAM[[:space:]]*[[:digit:]]*"
	does_pattern_exist_in_file $FILE "$PATTERN"
	if [ $FNRET = 0 ]; then
		ok "$SSH_PARAM is present in $FILE"
		if [ $(grep $PATTERN $FILE | awk '{print $2}') -ge 4 ]; then
			ok "$SSH_PARAM is set least four seconds between logon prompts following a failed console logon attempt"
			FNRET=0
		else
			crit "$SSH_PARAM is not set least four seconds between logon prompts following a failed console logon attempt"
			FNRET=2
		fi
	else
		crit "$PATTERN is not present in $FILE"
		FNRET=1
	fi
}

# This function will be called if the script status is on enabled / audit mode
audit () {
	if [ $OS_RELEASE -eq 2 ]; then
		audit_centos
	else
		audit_debian
	fi
}

apply_debian () {
    if [ $FNRET = 0 ]; then
        ok "$PACKAGE is installed"
    elif [ $FNRET = 1 ]; then
        crit "$PACKAGE is absent, installing it"
        install_package $PACKAGE
    elif [ $FNRET = 2 ]; then
        crit "$PATTERN is not present in $FILE, add default config to $FILE"
        add_line_file_before_pattern $FILE "auth       optional   pam_faildelay.so  delay=4000000" "# Outputs an issue file prior to each login prompt (Replaces the"
    elif [ $FNRET = 3 ]; then
        crit "$FILE is not exist, please check"
    elif [ $FNRET = 4 ]; then
        crit "$OPTIONNAME is not conf"
        add_option_to_auth_check $FILE $PAMLIBNAME "$OPTIONNAME=$CONDT_VAL"
     elif [ $FNRET = 5 ]; then
        crit "$OPTIONNAME set is not match legally, reset it to $CONDT_VAL"
        reset_option_to_auth_check $FILE $PAMLIBNAME "$OPTIONNAME" "$CONDT_VAL"
    fi 
}

apply_centos () {
	if [ $FNRET = 0 ]; then
		ok "$SSH_PARAM is set least four seconds between logon prompts following a failed console logon attempt"
	elif [ $FNRET = 1 ]; then
		warn "$PATTERN is not present in $FILE, adding it"
		add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
	elif [ $FNRET = 2 ]; then
		warn "Parameter $SSH_PARAM is present but less than $SSH_VALUE -- Fixing"		
		replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
	else
		:
	fi
}

# This function will be called if the script status is on enabled mode
apply () {
	if [ $OS_RELEASE -eq 2 ]; then
		apply_centos
	else
		apply_debian
	fi
}

# This function will check config parameters required
check_config() {
	# CentOS
	if [ $OS_RELEASE -eq 2 ]; then
		OPTION='FAIL_DELAY=4'
		FILE='/etc/login.defs'
	# Debian
	else
		PACKAGE='libpam-modules'
		PAMLIBNAME='pam_faildelay.so'
		PATTERN='^auth.*pam_faildelay.so'
		FILE='/etc/pam.d/login'
		OPTIONNAME='delay'
		# condition (microseconds)
		CONDT_VAL=4000000
	fi
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.1.9_set_create_home_bool.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux debian 7/8/9 or CentOS 8 Hardening
#

#
# 10.1.9 Set create home bool  (Scored)
# Author : Samson wen, Samson <sccxboy@gmail.com>
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

OPTIONS='CREATE_HOME=yes'
FILE='/etc/login.defs'

# This function will be called if the script status is on enabled / audit mode
audit () {
        for SSH_OPTION in $OPTIONS; do
            SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
            SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
            PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
            does_pattern_exist_in_file $FILE "$PATTERN"
            if [ $FNRET = 0 ]; then
                ok "$PATTERN is present in $FILE"
            else
                crit "$PATTERN is not present in $FILE"
            fi
        done
}

# This function will be called if the script status is on enabled mode
apply () {
    for SSH_OPTION in $OPTIONS; do
            SSH_PARAM=$(echo $SSH_OPTION | cut -d= -f 1)
            SSH_VALUE=$(echo $SSH_OPTION | cut -d= -f 2)
            PATTERN="^$SSH_PARAM[[:space:]]*$SSH_VALUE"
            does_pattern_exist_in_file $FILE "$PATTERN"
            if [ $FNRET = 0 ]; then
                ok "$PATTERN is present in $FILE"
            else
                warn "$PATTERN is not present in $FILE, adding it"
                does_pattern_exist_in_file $FILE "^$SSH_PARAM"
                if [ $FNRET != 0 ]; then
                    add_end_of_file $FILE "$SSH_PARAM $SSH_VALUE"
                else
                    info "Parameter $SSH_PARAM is present but with the wrong value -- Fixing"
                    replace_in_file $FILE "^$SSH_PARAM[[:space:]]*.*" "$SSH_PARAM $SSH_VALUE"
                fi
            fi
    done
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.2_disable_system_accounts.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 10.2 Disable System Accounts (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

SHELL='/bin/false'
FILE='/etc/passwd'
RESULT=''

# This function will be called if the script status is on enabled / audit mode
audit () {
    info "Checking if admin accounts have a login shell different than $SHELL"
    RESULT=$(egrep -v "^\+" $FILE | awk -F: '($1!="root" && $1!="sync" && $1!="shutdown" && $1!="halt" && $3<1000 && $7!="/usr/sbin/nologin" && $7!="/bin/false" && $7!="/sbin/nologin") {print}')
    IFS=$'\n'
    for LINE in $RESULT; do
        debug "line : $LINE"
        ACCOUNT=$( echo $LINE | cut -d: -f 1 )
        debug "Account : $ACCOUNT"
        debug "Exceptions : $EXCEPTIONS"
        debug "echo \"$EXCEPTIONS\" | grep -q $ACCOUNT"
        if echo "$EXCEPTIONS" | grep -q $ACCOUNT; then
            debug "$ACCOUNT is confirmed as an exception"
            RESULT=$(sed "s!$LINE!!" <<< "$RESULT")
        else
            debug "$ACCOUNT not found in exceptions"
        fi
    done
    if [ ! -z "$RESULT" ]; then
        crit "Some admin accounts don't have $SHELL as their login shell"
        crit "$RESULT"
    else
        ok "All admin accounts deactivated"
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
    RESULT=$(egrep -v "^\+" $FILE | awk -F: '($1!="root" && $1!="sync" && $1!="shutdown" && $1!="halt" && $3<1000 && $7!="/usr/sbin/nologin" && $7!="/bin/false") {print}')
    IFS=$'\n'
    for LINE in $RESULT; do
        debug "line : $LINE"
        ACCOUNT=$( echo $LINE | cut -d: -f 1 )
        debug "Account : $ACCOUNT"
        debug "Exceptions : $EXCEPTIONS"
        debug "echo \"$EXCEPTIONS\" | grep -q $ACCOUNT"
        if echo "$EXCEPTIONS" | grep -q $ACCOUNT; then
            debug "$ACCOUNT is confirmed as an exception"
            RESULT=$(sed "s!$LINE!!" <<< "$RESULT")
        else
            debug "$ACCOUNT not found in exceptions"
        fi
    done
    if [ ! -z "$RESULT" ]; then
        warn "Some admin accounts don't have $SHELL as their login shell -- Fixing"
        warn "$RESULT"
        for USER in $( echo "$RESULT" | cut -d: -f 1 ); do
            info "Setting $SHELL as $USER login shell"
            usermod -s $SHELL $USER
        done
    else
        ok "All admin accounts deactivated, nothing to apply"
    fi
}

# This function will create the config file for this check with default values
create_config() {
    cat <<EOF
status=disabled
# Put here your exceptions concerning admin accounts shells separated by spaces
EXCEPTIONS=""
EOF
}

# This function will check config parameters required
check_config() {
    if [ -z "$EXCEPTIONS" ]; then
        EXCEPTIONS="@"
    fi
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.3_default_root_group.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 10.3 Set Default Group for root Account (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2

USER='root'
EXPECTED_GID='0'

# This function will be called if the script status is on enabled / audit mode
audit () {
    if [ $(grep "^root:" /etc/passwd | cut -f4 -d:) = 0 ]; then
        ok "Root group has GID $EXPECTED_GID"
    else
        crit "Root group GID should be $EXPECTED_GID"
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
    if [ $(grep "^root:" /etc/passwd | cut -f4 -d:) = 0 ]; then
        ok "Root group GID is $EXPECTED_GID"
    else
        warn "Root group GID is not $EXPECTED_GID -- Fixing"
        usermod -g $EXPECTED_GID $USER
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.4_default_umask.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 10.4 Set Default umask for Users (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

USER='root'
PATTERN='umask 077'
FILES_TO_SEARCH='/etc/bash.bashrc /etc/profile.d /etc/profile'
FILE='/etc/profile.d/CIS_10.4_umask.sh'

# This function will be called if the script status is on enabled / audit mode
audit () {
    SEARCH_RES=0
    for FILE_SEARCHED in $FILES_TO_SEARCH; do
        if [ $SEARCH_RES = 1 ]; then break; fi
        if test -d $FILE_SEARCHED; then
            debug "$FILE_SEARCHED is a directory"
            for file_in_dir in $(ls $FILE_SEARCHED); do
                does_pattern_exist_in_file "$FILE_SEARCHED/$file_in_dir" "^$PATTERN"
                if [ $FNRET != 0 ]; then
                    debug "$PATTERN is not present in $FILE_SEARCHED/$file_in_dir"
                else
                    ok "$PATTERN is present in $FILE_SEARCHED/$file_in_dir"
                    SEARCH_RES=1
                    break
                fi
            done
        else
            does_pattern_exist_in_file "$FILE_SEARCHED" "^$PATTERN"
            if [ $FNRET != 0 ]; then
                debug "$PATTERN is not present in $FILE_SEARCHED"
            else
                ok "$PATTERN is present in $FILES_TO_SEARCH"
                SEARCH_RES=1
            fi
        fi
    done
    if [ $SEARCH_RES = 0 ]; then
        crit "$PATTERN is not present in $FILES_TO_SEARCH"
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
    SEARCH_RES=0
    for FILE_SEARCHED in $FILES_TO_SEARCH; do
        if [ $SEARCH_RES = 1 ]; then break; fi
        if test -d $FILE_SEARCHED; then
            debug "$FILE_SEARCHED is a directory"
            for file_in_dir in $(ls $FILE_SEARCHED); do
                does_pattern_exist_in_file "$FILE_SEARCHED/$file_in_dir" "^$PATTERN"
                if [ $FNRET != 0 ]; then
                    debug "$PATTERN is not present in $FILE_SEARCHED/$file_in_dir"
                else
                    ok "$PATTERN is present in $FILE_SEARCHED/$file_in_dir"
                    SEARCH_RES=1
                    break
                fi
            done
        else
            does_pattern_exist_in_file "$FILE_SEARCHED" "^$PATTERN"
            if [ $FNRET != 0 ]; then
                debug "$PATTERN is not present in $FILE_SEARCHED"
            else
                ok "$PATTERN is present in $FILES_TO_SEARCH"
                SEARCH_RES=1
            fi
        fi
    done
    if [ $SEARCH_RES = 0 ]; then
        warn "$PATTERN is not present in $FILES_TO_SEARCH"
        touch $FILE
        chmod 644 $FILE
        add_end_of_file $FILE "$PATTERN"
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/10.5_set_timeout_tty.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 10.5 Set Timeout on ttys
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2

USER='root'
PATTERN='TMOUT='
VALUE='600'
FILES_TO_SEARCH='/etc/bash.bashrc /etc/profile.d /etc/profile'
FILE='/etc/profile.d/CIS_10.5_timeout.sh'

# This function will be called if the script status is on enabled / audit mode
audit () {
    SEARCH_RES=0
    for FILE_SEARCHED in $FILES_TO_SEARCH; do
        if [ $SEARCH_RES = 1 ]; then break; fi
        if test -d $FILE_SEARCHED; then
            debug "$FILE_SEARCHED is a directory"
            for file_in_dir in $(ls $FILE_SEARCHED); do
                does_pattern_exist_in_file "$FILE_SEARCHED/$file_in_dir" "^$PATTERN"
                if [ $FNRET != 0 ]; then
                    debug "$PATTERN is not present in $FILE_SEARCHED/$file_in_dir"
                else
                    ok "$PATTERN is present in $FILE_SEARCHED/$file_in_dir"
                    SEARCH_RES=1
                    break
                fi
            done
        else
            does_pattern_exist_in_file "$FILE_SEARCHED" "^$PATTERN"
            if [ $FNRET != 0 ]; then
                debug "$PATTERN is not present in $FILE_SEARCHED"
            else
                ok "$PATTERN is present in $FILES_TO_SEARCH"
                SEARCH_RES=1
            fi
        fi
    done
    if [ $SEARCH_RES = 0 ]; then
        crit "$PATTERN is not present in $FILES_TO_SEARCH"
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
    SEARCH_RES=0
    for FILE_SEARCHED in $FILES_TO_SEARCH; do
        if [ $SEARCH_RES = 1 ]; then break; fi
        if test -d $FILE_SEARCHED; then
            debug "$FILE_SEARCHED is a directory"
            for file_in_dir in $(ls $FILE_SEARCHED); do
                does_pattern_exist_in_file "$FILE_SEARCHED/$file_in_dir" "^$PATTERN"
                if [ $FNRET != 0 ]; then
                    debug "$PATTERN is not present in $FILE_SEARCHED/$file_in_dir"
                else
                    ok "$PATTERN is present in $FILE_SEARCHED/$file_in_dir"
                    SEARCH_RES=1
                    break
                fi
            done
        else
            does_pattern_exist_in_file "$FILE_SEARCHED" "^$PATTERN"
            if [ $FNRET != 0 ]; then
                debug "$PATTERN is not present in $FILE_SEARCHED"
            else
                ok "$PATTERN is present in $FILES_TO_SEARCH"
                SEARCH_RES=1
            fi
        fi
    done
    if [ $SEARCH_RES = 0 ]; then
        warn "$PATTERN is not present in $FILES_TO_SEARCH"
        touch $FILE
        chmod 644 $FILE
        add_end_of_file $FILE "$PATTERN$VALUE"
        add_end_of_file $FILE "readonly TMOUT"
        add_end_of_file $FILE "export TMOUT"
    else
        ok "$PATTERN is present in $FILES_TO_SEARCH"
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/11.1_warning_banners.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening
#

#
# 11.1 Set Warning Banner for Standard Login Services (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

PERMISSIONS='644'
USER='root'
GROUP='root'
FILES='/etc/motd /etc/issue /etc/issue.net'

# This function will be called if the script status is on enabled / audit mode
audit () {
    for FILE in $FILES; do
		does_file_exist $FILE
		if [ $FNRET != 0 ]; then
			warn "$FILE does not exist"
			continue
		fi
        has_file_correct_ownership $FILE $USER $GROUP
        if [ $FNRET = 0 ]; then
            ok "$FILE has correct ownership"
        else
            crit "$FILE ownership was not set to $USER:$GROUP"
        fi
        has_file_correct_permissions $FILE $PERMISSIONS
        if [ $FNRET = 0 ]; then
            ok "$FILE has correct permissions"
        else
            crit "$FILE permissions were not set to $PERMISSIONS"
        fi
    done
}

# This function will be called if the script status is on enabled mode
apply () {
    for FILE in $FILES; do
        does_file_exist $FILE
        if [ $FNRET != 0 ]; then
            info "$FILE does not exist"
            touch $FILE
        fi
        has_file_correct_ownership $FILE $USER $GROUP
        if [ $FNRET = 0 ]; then
            ok "$FILE has correct ownership"
        else
            warn "fixing $FILE ownership to $USER:$GROUP"
            chown $USER:$GROUP $FILE
        fi
        has_file_correct_permissions $FILE $PERMISSIONS
        if [ $FNRET = 0 ]; then
            ok "$FILE has correct permissions"
        else
            info "fixing $FILE permissions to $PERMISSIONS"
            chmod 0$PERMISSIONS $FILE
        fi
    done
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/11.2_remove_os_info_warning_banners.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 11.2 Remove OS Information from Login Warning Banners (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=3

FILES='/etc/motd /etc/issue /etc/issue.net'
PATTERN='(\\v|\\r|\\m|\\s|Debian|CentOS)'

# This function will be called if the script status is on enabled / audit mode
audit () {
    for FILE in $FILES; do
        does_pattern_exist_in_file $FILE "$PATTERN"
        if [ $FNRET = 0 ]; then
            crit "$PATTERN is present in $FILE"
        else
            ok "$PATTERN is not present in $FILE"
        fi
    done
}

# This function will be called if the script status is on enabled mode
apply () {
    for FILE in $FILES; do
        does_pattern_exist_in_file $FILE "$PATTERN"
        if [ $FNRET = 0 ]; then
            warn "$PATTERN is present in $FILE"
            echo "Authorized uses only. All activity may be monitored and reported." > $FILE 
        else
            ok "$PATTERN is not present in $FILE"
        fi
    done
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.10_find_suid_files.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening
#

#
# 12.10 Find SUID System Executables (Not Scored)
#
# set -e # One error, it's over, for some user to audit desktop even  

# One variable unset, it's over
set -u

HARDENING_LEVEL=2

# This function will be called if the script status is on enabled / audit mode
audit () {
    info "Checking if there are suid files"
    RESULT=$(df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' $SUDO_CMD find '{}' -xdev -type f -perm -4000 -print)
    for BINARY in $RESULT; do
        if grep -q $BINARY <<< "$EXCEPTIONS"; then
            debug "$BINARY is confirmed as an exception"
            RESULT=$(grep -wv "$BINARY" <<< $RESULT)
        fi
    done
    if [ ! -z "$RESULT" ]; then
        crit "Some suid files are present"
        FORMATTED_RESULT=$(sed "s/ /\n/g" <<< $RESULT | sort | uniq | tr '\n' ' ')
        crit "$FORMATTED_RESULT"
		FNRET=1
    else
        ok "No unknown suid files found"
		FNRET=0
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
	if [ $FNRET = 1 ]; then
		warn "Removing suid on valid binary may seriously harm your system, report only here, need a manual fix."
	else
        ok "No unknown suid files found"
	fi
}

# This function will create the config file for this check with default values
create_config() {
    cat <<EOF
status=disabled
# Put Here your valid suid binaries so that they do not appear during the audit
EXCEPTIONS="/bin/mount /bin/ping /bin/ping6 /bin/su /bin/umount /usr/bin/chfn /usr/bin/chsh /usr/bin/gpasswd /usr/bin/newgrp /usr/bin/passwd /usr/bin/sudo /usr/bin/sudoedit /usr/lib/openssh/ssh-keysign"
EOF
}

# This function will check config parameters required
check_config() {
    # No param for this function
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.11_find_sgid_files.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening
#

#
# 12.11 Find SGID System Executables (Not Scored)
#

#set -e # One error, it's over, for some user to audit desktop even 

# One variable unset, it's over
set -u

HARDENING_LEVEL=2

# This function will be called if the script status is on enabled / audit mode
audit () {
    info "Checking if there are sgid files"
    RESULT=$(df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' $SUDO_CMD find '{}' -xdev -type f -perm -2000 -print)
    for BINARY in $RESULT; do
        if grep -q $BINARY <<< "$EXCEPTIONS"; then
            debug "$BINARY is confirmed as an exception"
            RESULT=$(sed "s!$BINARY!!" <<< $RESULT)
        fi
    done
    if [ ! -z "$RESULT" ]; then
        crit "Some sgid files are present"
        FORMATTED_RESULT=$(sed "s/ /\n/g" <<< $RESULT | sort | uniq | tr '\n' ' ')
        crit "$FORMATTED_RESULT"
		FNRET=1
    else
        ok "No unknown sgid files found"
		FNRET=0
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
	if [ $FNRET = 1 ]; then
    	warn "Removing sgid on valid binary may seriously harm your system, report only here"
	else
        ok "No unknown sgid files found"
	fi
}

# This function will create the config file for this check with default values
create_config() {
    cat <<EOF
status=disabled
# Put here valid binaries with sgid enabled separated by spaces
EXCEPTIONS="/sbin/unix_chkpwd /usr/bin/bsd-write /usr/bin/chage /usr/bin/crontab /usr/bin/expiry /usr/bin/mutt_dotlock /usr/bin/screen /usr/bin/ssh-agent /usr/bin/wall /usr/sbin/postdrop /usr/sbin/postqueue /usr/bin/at /usr/bin/dotlockfile /usr/bin/mail-lock /usr/bin/mail-touchlock /usr/bin/mail-unlock"
EOF
}

# This function will check config parameters required
check_config() {
    if [ -z "$EXCEPTIONS" ]; then
        EXCEPTIONS="@"
    fi
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.12_etc_group_backup_permissions.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS 8 Hardening
#

#
# 12.12 Verify Permissions on /etc/group- (Scored)
# Author: Samson-W (sccxboy@gmail.com)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=1

FILE='/etc/group-'
PERMISSIONS='644'
USER='root'
GROUP='root'

# This function will be called if the script status is on enabled / audit mode
audit () {
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		crit "$FILE ownership was not set to $USER:$GROUP"
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        crit "$FILE permissions were not set to $PERMISSIONS"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		warn "fixing $FILE ownership to $USER:$GROUP"
		chown $USER:$GROUP $FILE
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        info "fixing $FILE permissions to $PERMISSIONS"
        chmod 0$PERMISSIONS $FILE
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.13_etc_gshadow_backup_permissions.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS 8 Hardening
#

#
# 12.13 Verify Permissions on /etc/gshadow- (Scored)
# Author: Samson-W (sccxboy@gmail.com)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=1

FILE='/etc/gshadow-'
PERMISSIONS='640'
PERMISSIONS_CENTOS='0'
USER='root'
GROUP='shadow'
GROUP_CENTOS='root'

# This function will be called if the script status is on enabled / audit mode
audit () {
	if [ $OS_RELEASE -eq 2 ]; then
		PERMISSIONS=$PERMISSIONS_CENTOS
		GROUP=$GROUP_CENTOS
	else
		:
	fi
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		crit "$FILE ownership was not set to $USER:$GROUP"
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        crit "$FILE permissions were not set to $PERMISSIONS"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
	if [ $OS_RELEASE -eq 2 ]; then
		PERMISSIONS=$PERMISSIONS_CENTOS
		GROUP=$GROUP_CENTOS
	else
		:
	fi
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		warn "fixing $FILE ownership to $USER:$GROUP"
		chown $USER:$GROUP $FILE
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        info "fixing $FILE permissions to $PERMISSIONS"
        chmod 0$PERMISSIONS $FILE
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.1_etc_passwd_permissions.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening
#

#
# 12.1 Verify Permissions on /etc/passwd (Scored)
# Modify by: Samson-W (sccxboy@gmail.com)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=1

FILE='/etc/passwd'
PERMISSIONS='644'
USER='root'
GROUP='root'

# This function will be called if the script status is on enabled / audit mode
audit () {
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		crit "$FILE ownership was not set to $USER:$GROUP"
	fi
	has_file_correct_permissions $FILE $PERMISSIONS
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct permissions"
	else
        crit "$FILE permissions were not set to $PERMISSIONS"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		warn "fixing $FILE ownership to $USER:$GROUP"
		chown $USER:$GROUP $FILE
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        info "fixing $FILE permissions to $PERMISSIONS"
        chmod 0$PERMISSIONS $FILE
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.2_etc_shadow_permissions.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening
#

#
# 12.2 Verify Permissions on /etc/shadow (Scored)
# Modify by: Samson-W (sccxboy@gmail.com)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=1

FILE='/etc/shadow'
PERMISSIONS='640'
PERMISSIONS_CENTOS='0'
USER='root'
GROUP='shadow'
GROUP_CENTOS='root'

# This function will be called if the script status is on enabled / audit mode
audit () {
	if [ $OS_RELEASE -eq 2 ]; then
		PERMISSIONS=$PERMISSIONS_CENTOS
		GROUP=$GROUP_CENTOS
	else
		:
	fi
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		crit "$FILE ownership was not set to $USER:$GROUP"
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        crit "$FILE permissions were not set to $PERMISSIONS"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
	if [ $OS_RELEASE -eq 2 ]; then
		PERMISSIONS=$PERMISSIONS_CENTOS
		GROUP=$GROUP_CENTOS
	else
		:
	fi
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		warn "fixing $FILE ownership to $USER:$GROUP"
		chown $USER:$GROUP $FILE
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        info "fixing $FILE permissions to $PERMISSIONS"
        chmod 0$PERMISSIONS $FILE
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.3_etc_group_permissions.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening
#

#
# 12.3 Verify Permissions on /etc/group (Scored)
# Modify by: Samson-W (sccxboy@gmail.com)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=1

FILE='/etc/group'
PERMISSIONS='644'
USER='root'
GROUP='root'

# This function will be called if the script status is on enabled / audit mode
audit () {
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		crit "$FILE ownership was not set to $USER:$GROUP"
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        crit "$FILE permissions were not set to $PERMISSIONS"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		warn "fixing $FILE ownership to $USER:$GROUP"
		chown $USER:$GROUP $FILE
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        info "fixing $FILE permissions to $PERMISSIONS"
        chmod 0$PERMISSIONS $FILE
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.4_etc_gshadow_permissions.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening
#

#
# 12.4 Verify Permissions on /etc/gshadow (Scored)
# Author: Samson-W (sccxboy@gmail.com)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=1

FILE='/etc/gshadow'
PERMISSIONS='640'
PERMISSIONS_CENTOS='0'
USER='root'
GROUP='shadow'
GROUP_CENTOS='root'

# This function will be called if the script status is on enabled / audit mode
audit () {
	if [ $OS_RELEASE -eq 2 ]; then
		PERMISSIONS=$PERMISSIONS_CENTOS
		GROUP=$GROUP_CENTOS
	else
		:
	fi
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		crit "$FILE ownership was not set to $USER:$GROUP"
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        crit "$FILE permissions were not set to $PERMISSIONS"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
	if [ $OS_RELEASE -eq 2 ]; then
		PERMISSIONS=$PERMISSIONS_CENTOS
		GROUP=$GROUP_CENTOS
	else
		:
	fi
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		warn "fixing $FILE ownership to $USER:$GROUP"
		chown $USER:$GROUP $FILE
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        info "fixing $FILE permissions to $PERMISSIONS"
        chmod 0$PERMISSIONS $FILE
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.5_etc_passwd_backup_permissions.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS 8 Hardening
#

#
# 12.5 Verify Permissions on /etc/passwd- (Scored)
# Author: Samson-W (sccxboy@gmail.com)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=1

FILE='/etc/passwd-'
PERMISSIONS='644'
USER='root'
GROUP='root'

# This function will be called if the script status is on enabled / audit mode
audit () {
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		crit "$FILE ownership was not set to $USER:$GROUP"
	fi
	has_file_correct_permissions $FILE $PERMISSIONS
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct permissions"
	else
        crit "$FILE permissions were not set to $PERMISSIONS"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		warn "fixing $FILE ownership to $USER:$GROUP"
		chown $USER:$GROUP $FILE
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        info "fixing $FILE permissions to $PERMISSIONS"
        chmod 0$PERMISSIONS $FILE
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.6_etc_shadow_backup_permissions.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening
#

#
# 12.6 Verify Permissions on /etc/shadow- (Scored)
# Author: Samson-W (sccxboy@gmail.com)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=1

FILE='/etc/shadow-'
PERMISSIONS='640'
PERMISSIONS_CENTOS='0'
USER='root'
GROUP='shadow'
GROUP_CENTOS='root'

# This function will be called if the script status is on enabled / audit mode
audit () {
	if [ $OS_RELEASE -eq 2 ]; then
		PERMISSIONS=$PERMISSIONS_CENTOS
		GROUP=$GROUP_CENTOS
	else
		:
	fi
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		crit "$FILE ownership was not set to $USER:$GROUP"
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        crit "$FILE permissions were not set to $PERMISSIONS"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
	if [ $OS_RELEASE -eq 2 ]; then
		PERMISSIONS=$PERMISSIONS_CENTOS
		GROUP=$GROUP_CENTOS
	else
		:
	fi
	has_file_correct_ownership $FILE $USER $GROUP
	if [ $FNRET = 0 ]; then
		ok "$FILE has correct ownership"
	else
		warn "fixing $FILE ownership to $USER:$GROUP"
		chown $USER:$GROUP $FILE
	fi
    has_file_correct_permissions $FILE $PERMISSIONS
    if [ $FNRET = 0 ]; then
        ok "$FILE has correct permissions"
    else
        info "fixing $FILE permissions to $PERMISSIONS"
        chmod 0$PERMISSIONS $FILE
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.7_find_world_writable_file.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS 8 Hardening
#

#
# 12.7 Find World Writable Files (Not Scored)
#

set -u # One variable unset, it's over

HARDENING_LEVEL=3

# This function will be called if the script status is on enabled / audit mode
audit () {
    info "Checking if there are world writable files"
    RESULT=$(df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' $SUDO_CMD find '{}' -xdev -type f -perm -0002 -print 2>/dev/null)
    if [ ! -z "$RESULT" ]; then
        crit "Some world writable files are present"
        FORMATTED_RESULT=$(sed "s/ /\n/g" <<< $RESULT | sort | uniq | tr '\n' ' ')
        crit "$FORMATTED_RESULT"
    else
        ok "No world writable files found"
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
    RESULT=$(df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type f -perm -0002 -print 2>/dev/null)
    if [ ! -z "$RESULT" ]; then
        warn "chmoding o-w all files in the system"
        df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -type f -perm -0002 -print 2>/dev/null|  xargs chmod o-w
    else
        ok "No world writable files found, nothing to apply"
    fi
}

# This function will check config parameters required
check_config() {
    # No param for this function
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.8_find_unowned_files.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS 8 Hardening
#

#
# 12.8 Find Un-owned Files and Directories (Scored)
#

set -u # One variable unset, it's over

HARDENING_LEVEL=2

USER='root'

# This function will be called if the script status is on enabled / audit mode
audit () {
    info "Checking if there are unowned files"
    RESULT=$(df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' $SUDO_CMD find '{}' -xdev -nouser -print 2>/dev/null)
    if [ ! -z "$RESULT" ]; then
        crit "Some unowned files are present"
        FORMATTED_RESULT=$(sed "s/ /\n/g" <<< $RESULT | sort | uniq | tr '\n' ' ')
        crit "$FORMATTED_RESULT"
    else
        ok "No unowned files found"
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
    RESULT=$(df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -nouser -ls 2>/dev/null)
    if [ ! -z "$RESULT" ]; then
        warn "Applying chown on all unowned files in the system"
        df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -nouser -print 2>/dev/null | xargs chown $USER
    else
        ok "No unowned files found, nothing to apply"
    fi
}

# This function will check config parameters required
check_config() {
    # No param for this function
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/12.9_find_ungrouped_files.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS 8 Hardening
#

#
# 12.9 Find Un-grouped Files and Directories (Scored)
#

set -u # One variable unset, it's over

HARDENING_LEVEL=2

GROUP='root'

# This function will be called if the script status is on enabled / audit mode
audit () {
    info "Checking if there are ungrouped files"
    RESULT=$(df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' $SUDO_CMD find '{}' -xdev -nogroup -print 2>/dev/null)
    if [ ! -z "$RESULT" ]; then
        crit "Some ungrouped files are present"
        FORMATTED_RESULT=$(sed "s/ /\n/g" <<< $RESULT | sort | uniq | tr '\n' ' ')
        crit "$FORMATTED_RESULT"
    else
        ok "No ungrouped files found"
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
    RESULT=$(df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -nogroup -ls 2>/dev/null)
    if [ ! -z "$RESULT" ]; then
        warn "Applying chgrp on all ungrouped files in the system"
        df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -nogroup -print 2>/dev/null | xargs chgrp $GROUP
    else
        ok "No ungrouped files found, nothing to apply"
    fi
}

# This function will check config parameters required
check_config() {
    # No param for this function
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/13.10_find_user_rhosts_files.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 13.10 Check for Presence of User .rhosts Files (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2

ERRORS=0
FILENAME=".rhosts"

# This function will be called if the script status is on enabled / audit mode
audit () {
    for DIR in $(cat /etc/passwd | egrep -v '(root|halt|sync|shutdown)' | awk -F: '($7 != "/usr/sbin/nologin" && $7 != "/bin/false" && $7 !="/nonexistent" ) { print $6 }'); do
    debug "Working on $DIR"
        for FILE in $DIR/$FILENAME; do
            if [ ! -h "$FILE" -a -f "$FILE" ]; then
                crit "$FILE present"
                ERRORS=$((ERRORS+1))
            fi
        done
    done

    if [ $ERRORS = 0 ]; then
        ok "No $FILENAME present in users home directory"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
    info "If the audit returns something, please check with the user why he has this file"
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/13.11_find_passwd_group_inconsistencies.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 13.11 Check Groups in /etc/passwd (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2

ERRORS=0

# This function will be called if the script status is on enabled / audit mode
audit () {

    for GROUP in $(cut -s -d: -f4 /etc/passwd | sort -u ); do
        debug "Working on group $GROUP"
        if ! grep -q -P "^.*?:[^:]*:$GROUP:" /etc/group; then
            crit "Group $GROUP is referenced by /etc/passwd but does not exist in /etc/group"
            ERRORS=$((ERRORS+1))
        fi
    done

    if [ $ERRORS = 0 ]; then
        ok "passwd and group Groups are consistent"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
    info "Solving passwd and group consistency automatically may seriously harm your system, report only here"
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/13.12_users_valid_homedir.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 13.12 Check That Users Are Assigned Valid Home Directories (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2

ERRORS=0

# This function will be called if the script status is on enabled / audit mode
audit () {
    RESULT=$(cat /etc/passwd | awk -F: '{ print $1 ":" $3 ":" $6 }')
    for LINE in $RESULT; do 
        debug "Working on $LINE"
        USER=$(awk -F: {'print $1'} <<< $LINE)
        USERID=$(awk -F: {'print $2'} <<< $LINE)
        DIR=$(awk -F: {'print $3'} <<< $LINE)
        if [ $USERID -ge 1000 -a ! -d "$DIR" -a $USER != "nfsnobody" -a $USER != "nobody" ]; then
            crit "The home directory ($DIR) of user $USER does not exist."
            ERRORS=$((ERRORS+1))    
        fi
    done

    if [ $ERRORS = 0 ]; then
        ok "All home directories exists"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
    info "Modifying home directories may seriously harm your system, report only here"
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/13.13_check_user_homedir_ownership.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 13.13 Check User Home Directory Ownership (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2

ERRORS=0

# This function will be called if the script status is on enabled / audit mode
audit () {
    RESULT=$(cat /etc/passwd | awk -F: '{ print $1 ":" $3 ":" $6 }')
    for LINE in $RESULT; do
        debug "Working on $LINE"
        USER=$(awk -F: {'print $1'} <<< $LINE)
        USERID=$(awk -F: {'print $2'} <<< $LINE)
        DIR=$(awk -F: {'print $3'} <<< $LINE)    
        if [ $USERID -ge 500 -a -d "$DIR" -a $USER != "nfsnobody" -a "$DIR" != '/' ]; then
            OWNER=$(stat -L -c "%U" "$DIR")
            if [ "$OWNER" != "$USER" ]; then
                crit "The home directory ($DIR) of user $USER is owned by $OWNER."
                ERRORS=$((ERRORS+1))
            fi
        fi
    done

    if [ $ERRORS = 0 ]; then
        ok "All home directories have correct ownership"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
    cat /etc/passwd | awk -F: '{ print $1 " " $3 " " $6 }' | while read USER USERID DIR; do
        if [ $USERID -ge 500 -a -d "$DIR" -a $USER != "nfsnobody" -a "$DIR" != '/' ]; then
            OWNER=$(stat -L -c "%U" "$DIR")
            if [ "$OWNER" != "$USER" ]; then
                warn "The home directory ($DIR) of user $USER is owned by $OWNER."
                chown $USER $DIR
            fi
        fi
    done
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/13.14_check_duplicate_uid.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 13.14 Check for Duplicate UIDs (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2

ERRORS=0

# This function will be called if the script status is on enabled / audit mode
audit () {
    RESULT=$(cat /etc/passwd | cut -f3 -d":" | sort -n | uniq -c | awk {'print $1":"$2'} )
    for LINE in $RESULT; do 
        debug "Working on line $LINE"
        OCC_NUMBER=$(awk -F: {'print $1'} <<< $LINE)
        USERID=$(awk -F: {'print $2'} <<< $LINE) 
        if [ $OCC_NUMBER -gt 1 ]; then
            USERS=$(awk -F: '($3 == n) { print $1 }' n=$USERID /etc/passwd | xargs)
            ERRORS=$((ERRORS+1))
            crit "Duplicate UID ($USERID): ${USERS}"
        fi
    done 

    if [ $ERRORS = 0 ]; then
        ok "No duplicate UIDs"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
    info "Editing automatically uids may seriously harm your system, report only here"
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/13.15_check_duplicate_gid.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 13.15 Check for Duplicate GIDs (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2

ERRORS=0

# This function will be called if the script status is on enabled / audit mode
audit () {
    RESULT=$(cat /etc/group | cut -f3 -d":" | sort -n | uniq -c | awk {'print $1":"$2'} )
    for LINE in $RESULT; do 
        debug "Working on line $LINE"
        OCC_NUMBER=$(awk -F: {'print $1'} <<< $LINE)
        GROUPID=$(awk -F: {'print $2'} <<< $LINE) 
        if [ $OCC_NUMBER -gt 1 ]; then
            USERS=$(awk -F: '($3 == n) { print $1 }' n=$GROUPID /etc/passwd | xargs)
            ERRORS=$((ERRORS+1))
            crit "Duplicate GID ($GROUPID): ${USERS}"
        fi
    done 

    if [ $ERRORS = 0 ]; then
        ok "No duplicate GIDs"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
    info "Editing automatically gids may seriously harm your system, report only here"
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/13.16_check_duplicate_username.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 13.16 Check for Duplicate User Names (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=1

ERRORS=0

# This function will be called if the script status is on enabled / audit mode
audit () {
    RESULT=$(cat /etc/passwd | cut -f1 -d":" | sort -n | uniq -c | awk {'print $1":"$2'} )
    for LINE in $RESULT; do 
        debug "Working on line $LINE"
        OCC_NUMBER=$(awk -F: {'print $1'} <<< $LINE)
        USERNAME=$(awk -F: {'print $2'} <<< $LINE) 
        if [ $OCC_NUMBER -gt 1 ]; then
            USERS=$(awk -F: '($3 == n) { print $1 }' n=$USERNAME /etc/passwd | xargs)
            ERRORS=$((ERRORS+1))
            crit "Duplicate username $USERNAME"
        fi
    done 

    if [ $ERRORS = 0 ]; then
        ok "No duplicate usernames"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
    info "Editing automatically username may seriously harm your system, report only here"
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/13.17_check_duplicate_groupname.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 13.17 Check for Duplicate Group Names (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=1

ERRORS=0

# This function will be called if the script status is on enabled / audit mode
audit () {
    RESULT=$(cat /etc/group | cut -f1 -d":" | sort -n | uniq -c | awk {'print $1":"$2'} )
    for LINE in $RESULT; do 
        debug "Working on line $LINE"
        OCC_NUMBER=$(awk -F: {'print $1'} <<< $LINE)
        GROUPNAME=$(awk -F: {'print $2'} <<< $LINE) 
        if [ $OCC_NUMBER -gt 1 ]; then
            USERS=$(awk -F: '($3 == n) { print $1 }' n=$GROUPNAME /etc/passwd | xargs)
            ERRORS=$((ERRORS+1))
            crit "Duplicate groupname $GROUPNAME"
        fi
    done 

    if [ $ERRORS = 0 ]; then
        ok "No duplicate groupnames"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
    info "Editing automatically groupname may seriously harm your system, report only here"
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/13.18_find_user_netrc_files.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 13.18 Check for Presence of User .netrc Files (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2

ERRORS=0
FILENAME='.netrc'

# This function will be called if the script status is on enabled / audit mode
audit () {
    for DIR in $(cat /etc/passwd | egrep -v '(root|halt|sync|shutdown)' | awk -F: '($7 != "/usr/sbin/nologin" && $7 != "/bin/false" && $7 !="/nonexistent" ) { print $6 }'); do
    debug "Working on $DIR"
        for FILE in $DIR/$FILENAME; do
            if [ ! -h "$FILE" -a -f "$FILE" ]; then
                crit "$FILE present"
                ERRORS=$((ERRORS+1))
            fi
        done
    done

    if [ $ERRORS = 0 ]; then
        ok "No $FILENAME present in users home directory"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
    info "If the audit returns something, please check with the user why he has this file"
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/13.19_find_user_forward_files.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 13.19 Check for Presence of User .forward Files (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=2

ERRORS=0
FILENAME='.forward'

# This function will be called if the script status is on enabled / audit mode
audit () {
    for DIR in $(cat /etc/passwd | egrep -v '(root|halt|sync|shutdown)' | awk -F: '($7 != "/usr/sbin/nologin" && $7 != "/bin/false" && $7 !="/nonexistent" ) { print $6 }'); do
    debug "Working on $DIR"
        for FILE in $DIR/$FILENAME; do
            if [ ! -h "$FILE" -a -f "$FILE" ]; then
                crit "$FILE present"
                ERRORS=$((ERRORS+1))
            fi
        done
    done

    if [ $ERRORS = 0 ]; then
        ok "No $FILENAME present in users home directory"
    fi 
}

# This function will be called if the script status is on enabled mode
apply () {
    info "If the audit returns something, please check with the user why he has this file"
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /etc/default/cis-hardening file nor cis-hardening directory in current environment."
     echo "Cannot source CIS_ROOT_DIR variable, aborting."
    exit 128
fi

# Main function, will call the proper functions given the configuration (audit, enabled, disabled)
if [ -r $CIS_ROOT_DIR/lib/main.sh ]; then
    . $CIS_ROOT_DIR/lib/main.sh
else
    echo "Cannot find main.sh, have you correctly defined your root directory? Current value is $CIS_ROOT_DIR in /etc/default/cis-hardening"
    exit 128
fi


================================================
FILE: bin/hardening/13.1_remove_empty_password_field.sh
================================================
#!/bin/bash

#
# harbian-audit for Debian GNU/Linux 7/8/9  Hardening
#

#
# 13.1 Ensure Password Fields are Not Empty (Scored)
#

set -e # One error, it's over
set -u # One variable unset, it's over

HARDENING_LEVEL=1

FILE='/etc/shadow'

# This function will be called if the script status is on enabled / audit mode
audit () {
    info "Checking if accounts have an empty password"
    RESULT=$($SUDO_CMD cat $FILE | awk -F: '($2 == "" ) { print $1 }')
    if [ ! -z "$RESULT" ]; then
        crit "Some accounts have an empty password"
        crit $RESULT
    else
        ok "All accounts have a password"
    fi
}

# This function will be called if the script status is on enabled mode
apply () {
    RESULT=$(cat $FILE | awk -F: '($2 == "" ) { print $1 }')
    if [ ! -z "$RESULT" ]; then
        warn "Some accounts have an empty password"
        for ACCOUNT in $RESULT; do
            info "Locking $ACCOUNT"
            passwd -l $ACCOUNT >/dev/null 2>&1
        done
    else
        ok "All accounts have a password"
    fi
}

# This function will check config parameters required
check_config() {
    :
}

# Source Root Dir Parameter
if [ -r /etc/default/cis-hardening ]; then
    . /etc/default/cis-hardening
fi
if [ -z "$CIS_ROOT_DIR" ]; then
     echo "There is no /e
Download .txt
gitextract_sowemua5/

├── .gitignore
├── LICENSE
├── README-CN.md
├── README.md
├── bin/
│   ├── harbianaudit.sh
│   ├── hardening/
│   │   ├── 1.1_install_updates.sh
│   │   ├── 1.2_enable_verify_sign_packages_from_repository.sh
│   │   ├── 1.3_enable_verify_sign_of_local_packages.sh
│   │   ├── 1.4_set_no_allow_insecure_repository_by_apt.sh
│   │   ├── 1.5.11_ensure_core_file_size_configured.sh
│   │   ├── 1.5.12_ensure_systemd_coredump_processsizemax.sh
│   │   ├── 1.5.13_ensure_systemd_coredump_storage.sh
│   │   ├── 1.5.1_ensure_fs_protected_hardlinks.sh
│   │   ├── 1.5.2_ensure_fs_protected_symlinks.sh
│   │   ├── 1.5.3_ensure_kernel_yama_ptrace_scope.sh
│   │   ├── 1.5.4_ensure_fs_suid_dumpable.sh
│   │   ├── 1.5.5_ensure_kernel_dmesg_restrict.sh
│   │   ├── 1.5.7_ensure_automatic_error_reporting_configured.sh
│   │   ├── 1.5.8_ensure_kernel_kptr_restrict.sh
│   │   ├── 1.5.9_ensure_kernel_randomize_va_space.sh
│   │   ├── 10.1.10_set_maxlogins_for_all_accounts.sh
│   │   ├── 10.1.11_ensure_no_shosts_cfg_on_system.sh
│   │   ├── 10.1.1_set_password_exp_days.sh
│   │   ├── 10.1.2_set_password_min_days_change.sh
│   │   ├── 10.1.3_set_password_exp_warning_days.sh
│   │   ├── 10.1.4_set_password_encrypt_method.sh
│   │   ├── 10.1.5_set_password_lock_inactive_user.sh
│   │   ├── 10.1.6_remove_nopasswd_sudoers.sh
│   │   ├── 10.1.7_remove_noauthenticate_sudoers.sh
│   │   ├── 10.1.8_set_fail_delay_seconds.sh
│   │   ├── 10.1.9_set_create_home_bool.sh
│   │   ├── 10.2_disable_system_accounts.sh
│   │   ├── 10.3_default_root_group.sh
│   │   ├── 10.4_default_umask.sh
│   │   ├── 10.5_set_timeout_tty.sh
│   │   ├── 11.1_warning_banners.sh
│   │   ├── 11.2_remove_os_info_warning_banners.sh
│   │   ├── 12.10_find_suid_files.sh
│   │   ├── 12.11_find_sgid_files.sh
│   │   ├── 12.12_etc_group_backup_permissions.sh
│   │   ├── 12.13_etc_gshadow_backup_permissions.sh
│   │   ├── 12.1_etc_passwd_permissions.sh
│   │   ├── 12.2_etc_shadow_permissions.sh
│   │   ├── 12.3_etc_group_permissions.sh
│   │   ├── 12.4_etc_gshadow_permissions.sh
│   │   ├── 12.5_etc_passwd_backup_permissions.sh
│   │   ├── 12.6_etc_shadow_backup_permissions.sh
│   │   ├── 12.7_find_world_writable_file.sh
│   │   ├── 12.8_find_unowned_files.sh
│   │   ├── 12.9_find_ungrouped_files.sh
│   │   ├── 13.10_find_user_rhosts_files.sh
│   │   ├── 13.11_find_passwd_group_inconsistencies.sh
│   │   ├── 13.12_users_valid_homedir.sh
│   │   ├── 13.13_check_user_homedir_ownership.sh
│   │   ├── 13.14_check_duplicate_uid.sh
│   │   ├── 13.15_check_duplicate_gid.sh
│   │   ├── 13.16_check_duplicate_username.sh
│   │   ├── 13.17_check_duplicate_groupname.sh
│   │   ├── 13.18_find_user_netrc_files.sh
│   │   ├── 13.19_find_user_forward_files.sh
│   │   ├── 13.1_remove_empty_password_field.sh
│   │   ├── 13.20_shadow_group_empty.sh
│   │   ├── 13.2_remove_legacy_passwd_entries.sh
│   │   ├── 13.3_remove_legacy_shadow_entries.sh
│   │   ├── 13.4_remove_legacy_group_entries.sh
│   │   ├── 13.5_find_0_uid_non_root_account.sh
│   │   ├── 13.6_sanitize_root_path.sh
│   │   ├── 13.7_check_user_dir_perm.sh
│   │   ├── 13.8_check_user_dot_file_perm.sh
│   │   ├── 13.9_set_perm_on_user_netrc.sh
│   │   ├── 14.1_security_related_NAT_slipstreaming.sh
│   │   ├── 14.2_check_abuse_777_permissions.sh
│   │   ├── 2.10_home_nodev.sh
│   │   ├── 2.11_removable_device_nodev.sh
│   │   ├── 2.12_removable_device_noexec.sh
│   │   ├── 2.13_removable_device_nosuid.sh
│   │   ├── 2.14_run_shm_nodev.sh
│   │   ├── 2.15_run_shm_nosuid.sh
│   │   ├── 2.16_run_shm_noexec.sh
│   │   ├── 2.17_sticky_bit_world_writable_folder.sh
│   │   ├── 2.18_disable_cramfs.sh
│   │   ├── 2.19_disable_freevxfs.sh
│   │   ├── 2.1_tmp_partition.sh
│   │   ├── 2.20_disable_jffs2.sh
│   │   ├── 2.21_disable_hfs.sh
│   │   ├── 2.22_disable_hfsplus.sh
│   │   ├── 2.23_disable_squashfs.sh
│   │   ├── 2.24_disable_udf.sh
│   │   ├── 2.25_disable_automounting.sh
│   │   ├── 2.26_home_nosuid.sh
│   │   ├── 2.27_nfs_nosuid.sh
│   │   ├── 2.28_nfs_noexec.sh
│   │   ├── 2.29_nfs_RPCSEC_GSS.sh
│   │   ├── 2.2_tmp_nodev.sh
│   │   ├── 2.3_tmp_nosuid.sh
│   │   ├── 2.4_tmp_noexec.sh
│   │   ├── 2.5_var_partition.sh
│   │   ├── 2.6.1_var_tmp_partition.sh
│   │   ├── 2.6.2_var_tmp_nodev.sh
│   │   ├── 2.6.3_var_tmp_nosuid.sh
│   │   ├── 2.6.4_var_tmp_noexec.sh
│   │   ├── 2.7_var_log_partition.sh
│   │   ├── 2.8_var_log_audit_partition.sh
│   │   ├── 2.9_home_partition.sh
│   │   ├── 3.1_bootloader_ownership.sh
│   │   ├── 3.2_bootloader_permissions.sh
│   │   ├── 3.3_bootloader_password.sh
│   │   ├── 3.4_root_password.sh
│   │   ├── 4.1.1_ensure_ufw_installed.sh
│   │   ├── 4.1.2_ensure_ufw_service_configured.sh
│   │   ├── 4.1_restrict_core_dumps.sh
│   │   ├── 4.2_enable_nx_support.sh
│   │   ├── 4.3_enable_randomized_vm_placement.sh
│   │   ├── 4.4_disable_prelink.sh
│   │   ├── 4.5_enable_apparmor.sh
│   │   ├── 4.6_enable_selinux.sh
│   │   ├── 4.7_enable_selinux_policy.sh
│   │   ├── 4.8_disable_usb_devices.sh
│   │   ├── 5.1.1_disable_nis.sh
│   │   ├── 5.1.2_disable_rsh.sh
│   │   ├── 5.1.3_disable_rsh_client.sh
│   │   ├── 5.1.4_disable_talk.sh
│   │   ├── 5.1.5_disable_talk_client.sh
│   │   ├── 5.1.6_disable_telnet_server.sh
│   │   ├── 5.1.7_disable_inetd.sh
│   │   ├── 5.2_install_screen.sh
│   │   ├── 5.3_enable_openssh_server.sh
│   │   ├── 5.4_disable_ctrl_alt_del_target.sh
│   │   ├── 5.5_ensure_installed_sudo.sh
│   │   ├── 6.10_disable_http_server.sh
│   │   ├── 6.11_disable_imap_pop.sh
│   │   ├── 6.12_disable_samba.sh
│   │   ├── 6.13_disable_http_proxy.sh
│   │   ├── 6.14_disable_snmp_server.sh
│   │   ├── 6.15_mta_localhost.sh
│   │   ├── 6.16_disable_rsync.sh
│   │   ├── 6.17_ensure_virul_scan_server_is_enabled.sh
│   │   ├── 6.18_ensure_virusscan_program_update_is_enabled.sh
│   │   ├── 6.19_configure_ntp.sh
│   │   ├── 6.1_disable_xwindow_system.sh
│   │   ├── 6.20_configure_chrony.sh
│   │   ├── 6.2_disable_avahi_server.sh
│   │   ├── 6.3_disable_print_server.sh
│   │   ├── 6.4_disable_dhcp.sh
│   │   ├── 6.5_ensure_time_sync_server_is_installed.sh
│   │   ├── 6.6_disable_ldap.sh
│   │   ├── 6.7_disable_nfs_rpc.sh
│   │   ├── 6.8_disable_dns_server.sh
│   │   ├── 6.9_disable_ftp.sh
│   │   ├── 7.1.1_disable_ip_forwarding.sh
│   │   ├── 7.1.2_disable_send_packet_redirects.sh
│   │   ├── 7.1.3_disable_interface_promisc_mode.sh
│   │   ├── 7.2.1_disable_source_routed_packets.sh
│   │   ├── 7.2.2_disable_icmp_redirect.sh
│   │   ├── 7.2.3_disable_secure_icmp_redirect.sh
│   │   ├── 7.2.4_log_martian_packets.sh
│   │   ├── 7.2.5_ignore_broadcast_requests.sh
│   │   ├── 7.2.6_enable_bad_error_message_protection.sh
│   │   ├── 7.2.7_enable_source_route_validation.sh
│   │   ├── 7.2.8_enable_tcp_syn_cookies.sh
│   │   ├── 7.3.1_disable_ipv6_router_advertisement.sh
│   │   ├── 7.3.2_disable_ipv6_redirect.sh
│   │   ├── 7.4.1_install_tcp_wrapper.sh
│   │   ├── 7.4.2_hosts_allow.sh
│   │   ├── 7.4.3_hosts_allow_permissions.sh
│   │   ├── 7.4.4_hosts_deny.sh
│   │   ├── 7.4.5_hosts_deny_permissions.sh
│   │   ├── 7.6_disable_wireless.sh
│   │   ├── 7.7.1_enable_firewall.sh
│   │   ├── 7.7.2_ensure_set_firewall_rules.sh
│   │   ├── 7.7.3_ensure_firewall_set_protect_dos_attacks.sh
│   │   ├── 7.7.4.1_ensure_default_deny_firewall_policy.sh
│   │   ├── 7.7.4.2_ensure_loopback_traffic_is_configured.sh
│   │   ├── 7.7.4.3_ensure_firewall_rules_exist_for_all_open_ports.sh
│   │   ├── 7.7.4.4_ensure_outbound_and_established_connections_are_configured.sh
│   │   ├── 7.7.5.1_ensure_default_deny_firewall_policy_for_v6.sh
│   │   ├── 7.7.5.2_ensure_loopback_traffic_is_configured_for_v6.sh
│   │   ├── 7.7.5.3_ensure_firewall_rules_exist_for_all_open_ports_for_v6.sh
│   │   ├── 7.7.5.4_ensure_outbound_and_established_connections_are_configured_for_v6.sh
│   │   ├── 8.0_enable_auditd_kernel.sh
│   │   ├── 8.1.1.1_audit_log_storage.sh
│   │   ├── 8.1.1.2_halt_when_audit_log_full.sh
│   │   ├── 8.1.1.3_keep_all_audit_logs.sh
│   │   ├── 8.1.1.4_set_failure_mode.sh
│   │   ├── 8.1.1.5_ensure_set_remote_server.sh
│   │   ├── 8.1.1.6_ensure_set_encrypt_for_audit_remote.sh
│   │   ├── 8.1.1.7_ensure_set_action_for_audit_storage_full.sh
│   │   ├── 8.1.1.8_ensure_set_action_for_net_fail.sh
│   │   ├── 8.1.1.9_set_space_left_audit.sh
│   │   ├── 8.1.10_record_dac_edit.sh
│   │   ├── 8.1.11_record_failed_access_file.sh
│   │   ├── 8.1.12_record_syscall_execve.sh
│   │   ├── 8.1.13_record_successful_mount.sh
│   │   ├── 8.1.14_record_file_deletions.sh
│   │   ├── 8.1.15_record_sudoers_edit.sh
│   │   ├── 8.1.16_record_sudo_usage.sh
│   │   ├── 8.1.17_record_kernel_modules.sh
│   │   ├── 8.1.18_record_Events_netfilter.sh
│   │   ├── 8.1.19_record_sshkeysign_usage.sh
│   │   ├── 8.1.20_record_open_by_handle_at_syscall.sh
│   │   ├── 8.1.21_record_Events_that_privileged_passwd_cmd_usage.sh
│   │   ├── 8.1.22_record_Events_that_privileged_priv_change_cmd_usage.sh
│   │   ├── 8.1.23_record_Events_that_privileged_postfix_cmd_usage.sh
│   │   ├── 8.1.24_record_crontab_cmd_usage.sh
│   │   ├── 8.1.25_record_pam_timestamp_check_cmd_usage.sh
│   │   ├── 8.1.26_record_pam_tally_cmd_usage.sh
│   │   ├── 8.1.27_record_Events_that_modify_conf_files.sh
│   │   ├── 8.1.28_record_acl_cmd_usage.sh
│   │   ├── 8.1.29_record_usermod_cmd_usage.sh
│   │   ├── 8.1.2_enable_auditd.sh
│   │   ├── 8.1.30_record_unix_update_cmd_usage.sh
│   │   ├── 8.1.31_record_file_transfer_related.sh
│   │   ├── 8.1.32_record_ufw_of_debian_like.sh
│   │   ├── 8.1.33_record_iptables_restore_exec.sh
│   │   ├── 8.1.34_record_privileged_commands.sh
│   │   ├── 8.1.35_freeze_auditd_conf.sh
│   │   ├── 8.1.3_audit_bootloader.sh
│   │   ├── 8.1.4_record_date_time_edit.sh
│   │   ├── 8.1.5_record_user_group_edit.sh
│   │   ├── 8.1.6_record_network_edit.sh
│   │   ├── 8.1.7_record_mac_edit.sh
│   │   ├── 8.1.8_record_login_logout.sh
│   │   ├── 8.1.9_record_session_init.sh
│   │   ├── 8.2.1_install_rsyslog.sh
│   │   ├── 8.2.2_enable_rsyslog.sh
│   │   ├── 8.2.3_set_logfile_perm_cfg_rsyslog.sh
│   │   ├── 8.2.4_rsyslog_remote_host.sh
│   │   ├── 8.3.1_install_syslog-ng.sh
│   │   ├── 8.3.2_enable_syslog-ng.sh
│   │   ├── 8.3.3_set_logfile_perm.sh
│   │   ├── 8.3.4_syslog-ng_remote_host.sh
│   │   ├── 8.4.1_install_aide.sh
│   │   ├── 8.4.2_aide_cron.sh
│   │   ├── 8.5_ensure_permissions_on_all_logfiles.sh
│   │   ├── 8.6_verify_integrity_packages.sh
│   │   ├── 8.7.1_journald_config_compress.sh
│   │   ├── 8.7.2_journald_config_storage.sh
│   │   ├── 9.1.1_enable_cron.sh
│   │   ├── 9.1.2_crontab_perm_ownership.sh
│   │   ├── 9.1.3_cron_hourly_perm_ownership.sh
│   │   ├── 9.1.4_cron_daily_perm_ownership.sh
│   │   ├── 9.1.5_cron_weekly_perm_ownership.sh
│   │   ├── 9.1.6_cron_monthly_perm_ownership.sh
│   │   ├── 9.1.7_cron_d_perm_ownership.sh
│   │   ├── 9.1.8_cron_users.sh
│   │   ├── 9.2.10_pam_maxclassrepeat_cracklib.sh
│   │   ├── 9.2.11_pam_deny_times_tally2.sh
│   │   ├── 9.2.12_pam_lockout_failed_tally2.sh
│   │   ├── 9.2.13_pam_even_deny_root_tally2.sh
│   │   ├── 9.2.14_pam_dictcheck_pwquality.sh
│   │   ├── 9.2.15_pam_printlastlog_to_showfailed_lastlog.sh
│   │   ├── 9.2.16_pam_limit_password_reuse.sh
│   │   ├── 9.2.17_pam_password_sha512_unix.sh
│   │   ├── 9.2.18_pam_auth_without_nullpwd_unix.sh
│   │   ├── 9.2.1_pam_retry_cracklib.sh
│   │   ├── 9.2.2_pam_minlen_cracklib.sh
│   │   ├── 9.2.3_pam_dcredit_cracklib.sh
│   │   ├── 9.2.4_pam_ucredit_cracklib.sh
│   │   ├── 9.2.5_pam_ocredit_cracklib.sh
│   │   ├── 9.2.6_pam_lcredit_cracklib.sh
│   │   ├── 9.2.7_pam_difok_cracklib.sh
│   │   ├── 9.2.8_pam_minclass_cracklib.sh
│   │   ├── 9.2.9_pam_maxrepeat_cracklib.sh
│   │   ├── 9.3.10_disable_sshd_setenv.sh
│   │   ├── 9.3.11_sshd_ciphers.sh
│   │   ├── 9.3.12_sshd_idle_timeout.sh
│   │   ├── 9.3.13_sshd_limit_access.sh
│   │   ├── 9.3.14_ssh_banner.sh
│   │   ├── 9.3.15_sshd_printlastlog.sh
│   │   ├── 9.3.16_sshd_IgnoreUserKnownHosts.sh
│   │   ├── 9.3.17_sshd_GSSAPIAuthentication.sh
│   │   ├── 9.3.18_sshd_KerberosAuthentication.sh
│   │   ├── 9.3.19_sshd_StrictModes.sh
│   │   ├── 9.3.1_sshd_protocol.sh
│   │   ├── 9.3.20_sshd_compression.sh
│   │   ├── 9.3.21_sshd_MACs.sh
│   │   ├── 9.3.22_ssh_check_pub_hostkey_permission.sh
│   │   ├── 9.3.23_ssh_check_priv_hostkey_permission.sh
│   │   ├── 9.3.24_sshd_kexalgorithms.sh
│   │   ├── 9.3.25_sshd_logingracetime.sh
│   │   ├── 9.3.2_sshd_loglevel.sh
│   │   ├── 9.3.3_sshd_conf_perm_ownership.sh
│   │   ├── 9.3.4_disable_x11_forwarding.sh
│   │   ├── 9.3.5_sshd_maxauthtries.sh
│   │   ├── 9.3.6_enable_sshd_ignorerhosts.sh
│   │   ├── 9.3.7_disable_sshd_hostbasedauthentication.sh
│   │   ├── 9.3.8_disable_root_login.sh
│   │   ├── 9.3.9_disable_sshd_permitemptypasswords.sh
│   │   └── 9.4_pam_restrict_su.sh
│   └── hardening.sh
├── docs/
│   ├── STIG-Benchmark/
│   │   ├── stig-Ubuntu_16-04_LTS.txt
│   │   └── stig-rhel-7-v1r4.txt
│   ├── complianced_image/
│   │   ├── AMI/
│   │   │   ├── how_to_creating_and_making_an_AMI_public.mkd
│   │   │   └── how_to_use_harbian_audit_complianced_Debian_9.mkd
│   │   └── QEMU/
│   │       ├── how_to_creating_and_making_a_QEMU_img_for_centos8.mkd
│   │       ├── how_to_creating_and_making_a_QEMU_img_for_debian9.mkd
│   │       ├── how_to_use_QEMU_image_of_harbian_audit_complianced_Debian_9.mkd
│   │       └── signature/
│   │           ├── debian9.9-harbian-0910.qcow2.sig
│   │           └── debian9.9-harbian-0910.qcow2.tar.gz.sig
│   ├── configurations/
│   │   ├── build-simple-cdd-cfg/
│   │   │   ├── Readme
│   │   │   ├── usr_share_simple-cdd_profiles_default.packages
│   │   │   └── usr_share_simple-cdd_profiles_default.preseed
│   │   ├── debian-config-4-build-deb/
│   │   │   ├── debian/
│   │   │   │   ├── Readme
│   │   │   │   ├── changelog
│   │   │   │   ├── compat
│   │   │   │   ├── control
│   │   │   │   ├── copyright
│   │   │   │   └── rules
│   │   │   └── how-to-build-deb-package.md
│   │   ├── etc.audit.auditd.conf
│   │   ├── etc.audit.rules.d.audit.rules_for_debian
│   │   ├── etc.iptables.rules.v4.sh
│   │   ├── etc.iptables.rules.v6.sh
│   │   ├── etc.login.defs
│   │   ├── etc.nftables.conf
│   │   ├── etc.ssh.sshd_config
│   │   ├── manual-operation-docs/
│   │   │   ├── how_to_config_grub2_password_protection.mkd
│   │   │   ├── how_to_deploy_audisp_remote_for_audit_log.mkd
│   │   │   ├── how_to_fix_SELinux_access_denied.mkd
│   │   │   ├── how_to_migrating_from_iptables_to_nftables_in_debian10.md
│   │   │   ├── how_to_persistent_iptables_rules_with_debian_9.mkd
│   │   │   └── how_to_persistent_nft_rules_with_debian_10.mkd
│   │   └── usr.share.netfilter-persistent.plugins.d.15-nft
│   ├── harbian_audit_Debian_9_Benchmark_v0.1.mkd
│   └── use-cases/
│       ├── apache2-usecase/
│       │   ├── Readme.mkd
│       │   └── etc.iptables.rules.v4.4http.sh
│       ├── hyperledger-cello-usecase/
│       │   ├── README.mkd
│       │   ├── master-ufw-rules.conf
│       │   └── worker-ufw-rules.conf
│       ├── nodejs-redis-mysql-usecase/
│       │   ├── README.md
│       │   └── helloworld/
│       │       ├── app.js
│       │       ├── config/
│       │       │   └── config.js
│       │       ├── package.json
│       │       └── services/
│       │           ├── LogService.js
│       │           ├── RedisService.js
│       │           └── SqlService.js
│       └── tls-transmission-usecase/
│           ├── nginx-mutual-ssl-proxy-http-service/
│           │   ├── Readme.mkd
│           │   ├── iptables_ufw-4-client.cfg
│           │   └── iptables_ufw-4-server.cfg
│           └── using-Nginx-as-SSL-tunnel-4TCP-UDP-service/
│               ├── Readme.mkd
│               ├── iptables_ufw-4-client.cfg
│               └── iptables_ufw-4-server.cfg
├── etc/
│   ├── conf.d/
│   │   ├── .gitignore
│   │   └── README
│   ├── default.cfg
│   └── hardening.cfg
├── lib/
│   ├── common.sh
│   ├── constants.sh
│   ├── main.sh
│   └── utils.sh
└── src/
    ├── skel
    └── skel.cfg
Download .txt
SYMBOL INDEX (11 symbols across 2 files)

FILE: docs/use-cases/nodejs-redis-mysql-usecase/helloworld/services/RedisService.js
  class RedisService (line 5) | class RedisService {
    method constructor (line 6) | constructor() {
    method init (line 13) | init() {
    method get (line 32) | get(key, type) {
    method set (line 54) | set(key, value, type) {

FILE: docs/use-cases/nodejs-redis-mysql-usecase/helloworld/services/SqlService.js
  class SqlService (line 6) | class SqlService {
    method constructor (line 7) | constructor() {
    method init (line 13) | async init() {
    method init_database (line 43) | async init_database() {
    method init_tables (line 48) | async init_tables(data) {
    method query (line 67) | query(sql, params) {
Condensed preview — 352 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,077K chars).
[
  {
    "path": ".gitignore",
    "chars": 6,
    "preview": "tmp/*\n"
  },
  {
    "path": "LICENSE",
    "chars": 35147,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "README-CN.md",
    "chars": 12048,
    "preview": "# harbian-audit审计与加固\n\n## 简介 \n本项目是面向 Debian GNU/Linux、CentOS 8 和 Ubuntu 发行版的安全审计与加固工具。当前主要测试环境为 Debian GNU/Linux 9/10/11/"
  },
  {
    "path": "README.md",
    "chars": 15896,
    "preview": "# harbian-audit Hardening\n\n## Introduction \n\nHardened Debian GNU/Linux and CentOS 8 distro auditing.  \n\nThe main test en"
  },
  {
    "path": "bin/harbianaudit.sh",
    "chars": 1128,
    "preview": "#!/bin/bash\n# For make deb package \n/opt/harbianaudit/bin/hardening.sh --init\n/opt/harbianaudit/bin/hardening.sh --audit"
  },
  {
    "path": "bin/hardening/1.1_install_updates.sh",
    "chars": 2494,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux Debian 9/10/11/12/13 or CentOS 8 Hardening\n# Modify by: Samson-W (sa"
  },
  {
    "path": "bin/hardening/1.2_enable_verify_sign_packages_from_repository.sh",
    "chars": 2956,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux Debian 9/10/11/12/13 or CentOS 8 Hardening\n#\n\n#\n# 1.2 Enable Option "
  },
  {
    "path": "bin/hardening/1.3_enable_verify_sign_of_local_packages.sh",
    "chars": 3019,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux Debian 9/10/11/12/13 or CentOS 8 Hardening\n#\n\n#\n# 1.3 Enable verify "
  },
  {
    "path": "bin/hardening/1.4_set_no_allow_insecure_repository_by_apt.sh",
    "chars": 3066,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux Debian 9/10/11/12/13 or CentOS 8 Hardening\n#\n\n#\n# 1.4 Set no allow i"
  },
  {
    "path": "bin/hardening/1.5.11_ensure_core_file_size_configured.sh",
    "chars": 1484,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 1.5.11 Ensure core file size is configured\n#\n\nset -e\nset -"
  },
  {
    "path": "bin/hardening/1.5.12_ensure_systemd_coredump_processsizemax.sh",
    "chars": 1773,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 1.5.12 Ensure systemd-coredump ProcessSizeMax is configure"
  },
  {
    "path": "bin/hardening/1.5.13_ensure_systemd_coredump_storage.sh",
    "chars": 1744,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 1.5.13 Ensure systemd-coredump Storage is configured\n#\n\nse"
  },
  {
    "path": "bin/hardening/1.5.1_ensure_fs_protected_hardlinks.sh",
    "chars": 1516,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 1.5.1 Ensure fs.protected_hardlinks is configured\n#\n\nset -"
  },
  {
    "path": "bin/hardening/1.5.2_ensure_fs_protected_symlinks.sh",
    "chars": 1512,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 1.5.2 Ensure fs.protected_symlinks is configured\n#\n\nset -e"
  },
  {
    "path": "bin/hardening/1.5.3_ensure_kernel_yama_ptrace_scope.sh",
    "chars": 1524,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 1.5.3 Ensure kernel.yama.ptrace_scope is configured\n#\n\nset"
  },
  {
    "path": "bin/hardening/1.5.4_ensure_fs_suid_dumpable.sh",
    "chars": 1492,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 1.5.4 Ensure fs.suid_dumpable is configured\n#\n\nset -e\nset "
  },
  {
    "path": "bin/hardening/1.5.5_ensure_kernel_dmesg_restrict.sh",
    "chars": 1512,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 1.5.5 Ensure kernel.dmesg_restrict is configured\n#\n\nset -e"
  },
  {
    "path": "bin/hardening/1.5.7_ensure_automatic_error_reporting_configured.sh",
    "chars": 1516,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 1.5.7 Ensure Automatic Error Reporting is configured\n#\n\nse"
  },
  {
    "path": "bin/hardening/1.5.8_ensure_kernel_kptr_restrict.sh",
    "chars": 1508,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 1.5.8 Ensure kernel.kptr_restrict is configured\n#\n\nset -e\n"
  },
  {
    "path": "bin/hardening/1.5.9_ensure_kernel_randomize_va_space.sh",
    "chars": 1528,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 1.5.9 Ensure kernel.randomize_va_space is configured\n#\n\nse"
  },
  {
    "path": "bin/hardening/10.1.10_set_maxlogins_for_all_accounts.sh",
    "chars": 3065,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux debian 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 10.1.10 Set maxlogins for "
  },
  {
    "path": "bin/hardening/10.1.11_ensure_no_shosts_cfg_on_system.sh",
    "chars": 1909,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 10.1.11 Ensure no shosts configure file on s"
  },
  {
    "path": "bin/hardening/10.1.1_set_password_exp_days.sh",
    "chars": 2764,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 10.1.1 Set Password Expiration Da"
  },
  {
    "path": "bin/hardening/10.1.2_set_password_min_days_change.sh",
    "chars": 2848,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 10.1.2 Set Password Change Minimu"
  },
  {
    "path": "bin/hardening/10.1.3_set_password_exp_warning_days.sh",
    "chars": 2784,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 10.1.3 Set Password Expiring Warn"
  },
  {
    "path": "bin/hardening/10.1.4_set_password_encrypt_method.sh",
    "chars": 2441,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 10.1.4 Set Password Expiration Da"
  },
  {
    "path": "bin/hardening/10.1.5_set_password_lock_inactive_user.sh",
    "chars": 5763,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13  Hardening\n#\n\n#\n# 10.1.5 Ensure inactive password "
  },
  {
    "path": "bin/hardening/10.1.6_remove_nopasswd_sudoers.sh",
    "chars": 2551,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 10.1.6 Remove nopasswd option from the sudoe"
  },
  {
    "path": "bin/hardening/10.1.7_remove_noauthenticate_sudoers.sh",
    "chars": 2361,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 10.1.7 Remove not authenticate option from t"
  },
  {
    "path": "bin/hardening/10.1.8_set_fail_delay_seconds.sh",
    "chars": 4367,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux debian 9 or CentOS 8 Hardening\n#\n\n#\n# 10.1.8 Set FAIL_DELAY Paramete"
  },
  {
    "path": "bin/hardening/10.1.9_set_create_home_bool.sh",
    "chars": 2545,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux debian 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 10.1.9 Set create home boo"
  },
  {
    "path": "bin/hardening/10.2_disable_system_accounts.sh",
    "chars": 3474,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 10.2 Disable System Accounts (Scored)\n#\n\nset"
  },
  {
    "path": "bin/hardening/10.3_default_root_group.sh",
    "chars": 1568,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 10.3 Set Default Group for root Account (Sco"
  },
  {
    "path": "bin/hardening/10.4_default_umask.sh",
    "chars": 3511,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 10.4 Set Default umask for Users (Scored)\n#\n"
  },
  {
    "path": "bin/hardening/10.5_set_timeout_tty.sh",
    "chars": 3665,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 10.5 Set Timeout on ttys\n#\n\nset -e # One err"
  },
  {
    "path": "bin/hardening/11.1_warning_banners.sh",
    "chars": 2503,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 11.1 Set Warning Banner for Stand"
  },
  {
    "path": "bin/hardening/11.2_remove_os_info_warning_banners.sh",
    "chars": 1812,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 11.2 Remove OS Information from Login Warnin"
  },
  {
    "path": "bin/hardening/12.10_find_suid_files.sh",
    "chars": 2468,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 12.10 Find SUID System Executable"
  },
  {
    "path": "bin/hardening/12.11_find_sgid_files.sh",
    "chars": 2560,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 12.11 Find SGID System Executable"
  },
  {
    "path": "bin/hardening/12.12_etc_group_backup_permissions.sh",
    "chars": 2051,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS 8 Hardening\n#\n\n#\n# 12.12 Verify Permissi"
  },
  {
    "path": "bin/hardening/12.13_etc_gshadow_backup_permissions.sh",
    "chars": 2304,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS 8 Hardening\n#\n\n#\n# 12.13 Verify Permissi"
  },
  {
    "path": "bin/hardening/12.1_etc_passwd_permissions.sh",
    "chars": 2026,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 12.1 Verify Permissions on /etc/p"
  },
  {
    "path": "bin/hardening/12.2_etc_shadow_permissions.sh",
    "chars": 2290,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 12.2 Verify Permissions on /etc/s"
  },
  {
    "path": "bin/hardening/12.3_etc_group_permissions.sh",
    "chars": 2039,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 12.3 Verify Permissions on /etc/g"
  },
  {
    "path": "bin/hardening/12.4_etc_gshadow_permissions.sh",
    "chars": 2289,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 12.4 Verify Permissions on /etc/g"
  },
  {
    "path": "bin/hardening/12.5_etc_passwd_backup_permissions.sh",
    "chars": 2037,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS 8 Hardening\n#\n\n#\n# 12.5 Verify Permissio"
  },
  {
    "path": "bin/hardening/12.6_etc_shadow_backup_permissions.sh",
    "chars": 2289,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS 8 Hardening\n#\n\n#\n# 12.6 Verify Permissions on /etc/s"
  },
  {
    "path": "bin/hardening/12.7_find_world_writable_file.sh",
    "chars": 2038,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS 8 Hardening\n#\n\n#\n# 12.7 Find World Writa"
  },
  {
    "path": "bin/hardening/12.8_find_unowned_files.sh",
    "chars": 2005,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS 8 Hardening\n#\n\n#\n# 12.8 Find Un-owned Fi"
  },
  {
    "path": "bin/hardening/12.9_find_ungrouped_files.sh",
    "chars": 2022,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS 8 Hardening\n#\n\n#\n# 12.9 Find Un-grouped "
  },
  {
    "path": "bin/hardening/13.10_find_user_rhosts_files.sh",
    "chars": 1762,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.10 Check for Presence of User .rhosts Fil"
  },
  {
    "path": "bin/hardening/13.11_find_passwd_group_inconsistencies.sh",
    "chars": 1650,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.11 Check Groups in /etc/passwd (Scored)\n#"
  },
  {
    "path": "bin/hardening/13.12_users_valid_homedir.sh",
    "chars": 1831,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.12 Check That Users Are Assigned Valid Ho"
  },
  {
    "path": "bin/hardening/13.13_check_user_homedir_ownership.sh",
    "chars": 2274,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.13 Check User Home Directory Ownership (S"
  },
  {
    "path": "bin/hardening/13.14_check_duplicate_uid.sh",
    "chars": 1781,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.14 Check for Duplicate UIDs (Scored)\n#\n\ns"
  },
  {
    "path": "bin/hardening/13.15_check_duplicate_gid.sh",
    "chars": 1783,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.15 Check for Duplicate GIDs (Scored)\n#\n\ns"
  },
  {
    "path": "bin/hardening/13.16_check_duplicate_username.sh",
    "chars": 1795,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.16 Check for Duplicate User Names (Scored"
  },
  {
    "path": "bin/hardening/13.17_check_duplicate_groupname.sh",
    "chars": 1801,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.17 Check for Duplicate Group Names (Score"
  },
  {
    "path": "bin/hardening/13.18_find_user_netrc_files.sh",
    "chars": 1760,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.18 Check for Presence of User .netrc File"
  },
  {
    "path": "bin/hardening/13.19_find_user_forward_files.sh",
    "chars": 1764,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.19 Check for Presence of User .forward Fi"
  },
  {
    "path": "bin/hardening/13.1_remove_empty_password_field.sh",
    "chars": 1778,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.1 Ensure Password Fields are Not Empty (S"
  },
  {
    "path": "bin/hardening/13.20_shadow_group_empty.sh",
    "chars": 2399,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.20 Ensure shadow group is empty (Scored)\n"
  },
  {
    "path": "bin/hardening/13.2_remove_legacy_passwd_entries.sh",
    "chars": 1805,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.2 Verify No Legacy \"+\" Entries Exist in /"
  },
  {
    "path": "bin/hardening/13.3_remove_legacy_shadow_entries.sh",
    "chars": 1815,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.3 Verify No Legacy \"+\" Entries Exist in /"
  },
  {
    "path": "bin/hardening/13.4_remove_legacy_group_entries.sh",
    "chars": 1788,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.4 Verify No Legacy \"+\" Entries Exist in /"
  },
  {
    "path": "bin/hardening/13.5_find_0_uid_non_root_account.sh",
    "chars": 2257,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.5 Verify No UID 0 Accounts Exist Other Th"
  },
  {
    "path": "bin/hardening/13.6_sanitize_root_path.sh",
    "chars": 2723,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.6 Ensure root PATH Integrity (Scored)\n#\n\n"
  },
  {
    "path": "bin/hardening/13.7_check_user_dir_perm.sh",
    "chars": 4271,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.7 Check Permissions on User Home Director"
  },
  {
    "path": "bin/hardening/13.8_check_user_dot_file_perm.sh",
    "chars": 2759,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.8 Check User Dot File Permissions (Scored"
  },
  {
    "path": "bin/hardening/13.9_set_perm_on_user_netrc.sh",
    "chars": 2547,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 13.9 Check Permissions on User .netrc Files "
  },
  {
    "path": "bin/hardening/14.1_security_related_NAT_slipstreaming.sh",
    "chars": 4155,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 Hardening\n# Author: Samson-W (samson@hardenedlinux.org"
  },
  {
    "path": "bin/hardening/14.2_check_abuse_777_permissions.sh",
    "chars": 2063,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11 Hardening\n#\n\n#\n# 14.2 To ensure there are no files permissio"
  },
  {
    "path": "bin/hardening/2.10_home_nodev.sh",
    "chars": 2512,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 2.10 Add nodev Option to /home (Scored)\n#\n\ns"
  },
  {
    "path": "bin/hardening/2.11_removable_device_nodev.sh",
    "chars": 2377,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n# Modify by: Samson-W (sccxboy@gmail.com)\n#\n\n#\n# 2."
  },
  {
    "path": "bin/hardening/2.12_removable_device_noexec.sh",
    "chars": 2379,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n# Modify by: Samson-W (sccxboy@gmail.com)\n#\n\n#\n# 2."
  },
  {
    "path": "bin/hardening/2.13_removable_device_nosuid.sh",
    "chars": 2399,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n# Modify by: Samson-W (sccxboy@gmail.com)\n#\n\n#\n# 2."
  },
  {
    "path": "bin/hardening/2.14_run_shm_nodev.sh",
    "chars": 2528,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 2.14 Add nodev Option to /run/shm Partition "
  },
  {
    "path": "bin/hardening/2.15_run_shm_nosuid.sh",
    "chars": 2530,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 2.15 Add nosuid Option to /run/shm Partition"
  },
  {
    "path": "bin/hardening/2.16_run_shm_noexec.sh",
    "chars": 2530,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 2.16 Add noexec Option to /run/shm Partition"
  },
  {
    "path": "bin/hardening/2.17_sticky_bit_world_writable_folder.sh",
    "chars": 3239,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/2.18_disable_cramfs.sh",
    "chars": 2592,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13  Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/2.19_disable_freevxfs.sh",
    "chars": 2597,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13  Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/2.1_tmp_partition.sh",
    "chars": 3269,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux Debian 7/8/9 or CentOS Hardening\n# Modify by: Samson-W (sccxboy@gmai"
  },
  {
    "path": "bin/hardening/2.20_disable_jffs2.sh",
    "chars": 2591,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13  Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/2.21_disable_hfs.sh",
    "chars": 2585,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13  Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/2.22_disable_hfsplus.sh",
    "chars": 2597,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13  Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/2.23_disable_squashfs.sh",
    "chars": 2597,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13  Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/2.24_disable_udf.sh",
    "chars": 2585,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13  Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/2.25_disable_automounting.sh",
    "chars": 2432,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS  Hardening\n# Modify by: Samson-W (samson@hardened"
  },
  {
    "path": "bin/hardening/2.26_home_nosuid.sh",
    "chars": 2582,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9   Hardening\n#\n\n#\n# 2.26 Set nosuid option for /home filesystem/Par"
  },
  {
    "path": "bin/hardening/2.27_nfs_nosuid.sh",
    "chars": 2827,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9   Hardening\n#\n\n#\n# 2.27 Set nosuid option for nfs/nfs4 filesystem/"
  },
  {
    "path": "bin/hardening/2.28_nfs_noexec.sh",
    "chars": 2827,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9   Hardening\n#\n\n#\n# 2.28 Set noexec option for nfs/nfs4 filesystem/"
  },
  {
    "path": "bin/hardening/2.29_nfs_RPCSEC_GSS.sh",
    "chars": 2845,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9   Hardening\n#\n\n#\n# 2.29 Set RPCSEC_GSS option for nfs/nfs4 filesys"
  },
  {
    "path": "bin/hardening/2.2_tmp_nodev.sh",
    "chars": 4429,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux Debian 7/8/9/10/11/12/13 or CentOS Hardening\n# Modify by: Samson-W ("
  },
  {
    "path": "bin/hardening/2.3_tmp_nosuid.sh",
    "chars": 4261,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux Debian 7/8/9/10/11/12/13 or CentOS Hardening\n# Modify by: Samson-W ("
  },
  {
    "path": "bin/hardening/2.4_tmp_noexec.sh",
    "chars": 4259,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux Debian 7/8/9/10/11/12/13 or CentOS Hardening\n# Modify by: Samson-W ("
  },
  {
    "path": "bin/hardening/2.5_var_partition.sh",
    "chars": 1955,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 2.5 Create Separate Partition for /var (Scor"
  },
  {
    "path": "bin/hardening/2.6.1_var_tmp_partition.sh",
    "chars": 1965,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 2.6.1 Create Separate Partition for /var/tmp"
  },
  {
    "path": "bin/hardening/2.6.2_var_tmp_nodev.sh",
    "chars": 2530,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 2.6.2 Set nodev option for /var/tmp Partitio"
  },
  {
    "path": "bin/hardening/2.6.3_var_tmp_nosuid.sh",
    "chars": 2532,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 2.6.3 Set nosuid option for /var/tmp Partiti"
  },
  {
    "path": "bin/hardening/2.6.4_var_tmp_noexec.sh",
    "chars": 2532,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 2.6.4 Set noexec option for /var/tmp Partiti"
  },
  {
    "path": "bin/hardening/2.7_var_log_partition.sh",
    "chars": 1959,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 2.7 Create Separate Partition for /var/log ("
  },
  {
    "path": "bin/hardening/2.8_var_log_audit_partition.sh",
    "chars": 1975,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 2.8 Create Separate Partition for /var/log/a"
  },
  {
    "path": "bin/hardening/2.9_home_partition.sh",
    "chars": 1957,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 2.9 Create Separate Partition for /home (Sco"
  },
  {
    "path": "bin/hardening/3.1_bootloader_ownership.sh",
    "chars": 2875,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS  Hardening\n# Modify by: Samson-W (samson@hardened"
  },
  {
    "path": "bin/hardening/3.2_bootloader_permissions.sh",
    "chars": 2181,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/3.3_bootloader_password.sh",
    "chars": 2629,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/3.4_root_password.sh",
    "chars": 1580,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 3.4 Require Authentication for Single-User M"
  },
  {
    "path": "bin/hardening/4.1.1_ensure_ufw_installed.sh",
    "chars": 1444,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 4.1.1 Ensure ufw is installed\n#\n\nset -e\nset -u\n\nHARDENING_"
  },
  {
    "path": "bin/hardening/4.1.2_ensure_ufw_service_configured.sh",
    "chars": 1480,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 13\n#\n\n#\n# 4.1.2 Ensure ufw service is configured\n#\n\nset -e\nset -u\n\nH"
  },
  {
    "path": "bin/hardening/4.1_restrict_core_dumps.sh",
    "chars": 3199,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS Hardening\n#Modify by: Samson-W (samson@h"
  },
  {
    "path": "bin/hardening/4.2_enable_nx_support.sh",
    "chars": 2377,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 4.2 Enable XD/NX Support on 32-bit x86 Syste"
  },
  {
    "path": "bin/hardening/4.3_enable_randomized_vm_placement.sh",
    "chars": 1929,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 4.3 Enable Randomized Virtual Memory Region "
  },
  {
    "path": "bin/hardening/4.4_disable_prelink.sh",
    "chars": 1820,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/4.5_enable_apparmor.sh",
    "chars": 4366,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS Hardening\n# Modify by: Samson-W (samson@"
  },
  {
    "path": "bin/hardening/4.6_enable_selinux.sh",
    "chars": 4664,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 or CentOS 8 Hardening\n#\n\n#\n# 4.6 Activate SELinux (Sco"
  },
  {
    "path": "bin/hardening/4.7_enable_selinux_policy.sh",
    "chars": 2831,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 or CentOS 8 Hardening\n#\n\n#\n# 4.7 Enable SELinux target"
  },
  {
    "path": "bin/hardening/4.8_disable_usb_devices.sh",
    "chars": 4203,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 or CentOS Hardening\n# Modify by: Samson-W (samson@hard"
  },
  {
    "path": "bin/hardening/5.1.1_disable_nis.sh",
    "chars": 1678,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/5.1.2_disable_rsh.sh",
    "chars": 3448,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS Hardening\n# Modify by: Samson-W (samson@"
  },
  {
    "path": "bin/hardening/5.1.3_disable_rsh_client.sh",
    "chars": 2003,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/5.1.4_disable_talk.sh",
    "chars": 3481,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS Hardening\n# Modify by: Samson-W (samson@"
  },
  {
    "path": "bin/hardening/5.1.5_disable_talk_client.sh",
    "chars": 1841,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/5.1.6_disable_telnet_server.sh",
    "chars": 3437,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS Hardening\n# Modify by: Samson-W (samson@"
  },
  {
    "path": "bin/hardening/5.1.7_disable_inetd.sh",
    "chars": 1847,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/5.2_install_screen.sh",
    "chars": 1638,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 5.2 Install screen (Scored)\n# Au"
  },
  {
    "path": "bin/hardening/5.3_enable_openssh_server.sh",
    "chars": 2468,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 5.3 Ensure openssh server is ena"
  },
  {
    "path": "bin/hardening/5.4_disable_ctrl_alt_del_target.sh",
    "chars": 2046,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9 or CentOS Hardening\n#\n\n#\n# 5.4 Ensure ctrl-alt-del is disabled (Sc"
  },
  {
    "path": "bin/hardening/5.5_ensure_installed_sudo.sh",
    "chars": 2407,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9 or CentOS Hardening\n#\n\n#\n# 5.8 Ensure sudo is installed (Scored)\n#"
  },
  {
    "path": "bin/hardening/6.10_disable_http_server.sh",
    "chars": 2553,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedlinu"
  },
  {
    "path": "bin/hardening/6.11_disable_imap_pop.sh",
    "chars": 2721,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n#\n\n#\n# 6.11 Ensure IMAP and POP server is "
  },
  {
    "path": "bin/hardening/6.12_disable_samba.sh",
    "chars": 2408,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedlinu"
  },
  {
    "path": "bin/hardening/6.13_disable_http_proxy.sh",
    "chars": 2458,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedlinu"
  },
  {
    "path": "bin/hardening/6.14_disable_snmp_server.sh",
    "chars": 2468,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n#\n\n#\n# 6.14 Ensure SNMP Server is not enab"
  },
  {
    "path": "bin/hardening/6.15_mta_localhost.sh",
    "chars": 2190,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 6.15 Configure Mail Transfer Agent for Local"
  },
  {
    "path": "bin/hardening/6.16_disable_rsync.sh",
    "chars": 2616,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n#\n\n#\n# 6.16 Ensure rsync service is not en"
  },
  {
    "path": "bin/hardening/6.17_ensure_virul_scan_server_is_enabled.sh",
    "chars": 2657,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13  Hardening\n# todo test for centos\n\n#\n# 6.17 Ensure"
  },
  {
    "path": "bin/hardening/6.18_ensure_virusscan_program_update_is_enabled.sh",
    "chars": 2935,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13  Hardening\n# todo test for centos\n\n#\n# 6.18 Ensure vir"
  },
  {
    "path": "bin/hardening/6.19_configure_ntp.sh",
    "chars": 4482,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n# todo base centos7 v2r3 of STIG\n\n#\n# 6.19"
  },
  {
    "path": "bin/hardening/6.1_disable_xwindow_system.sh",
    "chars": 2288,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 6.1 Ensure the X Window system is not instal"
  },
  {
    "path": "bin/hardening/6.20_configure_chrony.sh",
    "chars": 3029,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9 Hardening\n#\n\n#\n# 6.20 Configure Network Time Protocol (chrony) (Sc"
  },
  {
    "path": "bin/hardening/6.2_disable_avahi_server.sh",
    "chars": 2694,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedlinu"
  },
  {
    "path": "bin/hardening/6.3_disable_print_server.sh",
    "chars": 2551,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedlinu"
  },
  {
    "path": "bin/hardening/6.4_disable_dhcp.sh",
    "chars": 2456,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedlinu"
  },
  {
    "path": "bin/hardening/6.5_ensure_time_sync_server_is_installed.sh",
    "chars": 1806,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9  Hardening\n#\n\n#\n# 6.19 Ensure time synchronization server is insta"
  },
  {
    "path": "bin/hardening/6.6_disable_ldap.sh",
    "chars": 2435,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedlinu"
  },
  {
    "path": "bin/hardening/6.7_disable_nfs_rpc.sh",
    "chars": 2535,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedlinu"
  },
  {
    "path": "bin/hardening/6.8_disable_dns_server.sh",
    "chars": 2452,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedlinu"
  },
  {
    "path": "bin/hardening/6.9_disable_ftp.sh",
    "chars": 2656,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/7.1.1_disable_ip_forwarding.sh",
    "chars": 2543,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.1.1 Disable IP Forwarding (Sco"
  },
  {
    "path": "bin/hardening/7.1.2_disable_send_packet_redirects.sh",
    "chars": 2642,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS  Hardening\n#\n\n#\n# 7.1.2 Disable Send Packet Redir"
  },
  {
    "path": "bin/hardening/7.1.3_disable_interface_promisc_mode.sh",
    "chars": 1873,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS  Hardening\n#\n\n#\n# 7.1.3 Disable promiscuous mode "
  },
  {
    "path": "bin/hardening/7.2.1_disable_source_routed_packets.sh",
    "chars": 2587,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.2.1 Disable Source Routed Pack"
  },
  {
    "path": "bin/hardening/7.2.2_disable_icmp_redirect.sh",
    "chars": 2568,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.2.2 Disable ICMP Redirect Acce"
  },
  {
    "path": "bin/hardening/7.2.3_disable_secure_icmp_redirect.sh",
    "chars": 2575,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.2.3 Disable Secure ICMP Redire"
  },
  {
    "path": "bin/hardening/7.2.4_log_martian_packets.sh",
    "chars": 2550,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.2.4 Log Suspicious Packets (Sc"
  },
  {
    "path": "bin/hardening/7.2.5_ignore_broadcast_requests.sh",
    "chars": 2528,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.2.5 Enable Ignore Broadcast Re"
  },
  {
    "path": "bin/hardening/7.2.6_enable_bad_error_message_protection.sh",
    "chars": 2538,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.2.6 Enable Bad Error Message P"
  },
  {
    "path": "bin/hardening/7.2.7_enable_source_route_validation.sh",
    "chars": 2568,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.2.7 Enable RFC-recommended Sou"
  },
  {
    "path": "bin/hardening/7.2.8_enable_tcp_syn_cookies.sh",
    "chars": 2506,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.2.8 Enable TCP SYN Cookies (Sc"
  },
  {
    "path": "bin/hardening/7.3.1_disable_ipv6_router_advertisement.sh",
    "chars": 2900,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.3.1 Disable IPv6 Router Advert"
  },
  {
    "path": "bin/hardening/7.3.2_disable_ipv6_redirect.sh",
    "chars": 2912,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.3.2 Disable IPv6 Redirect Acce"
  },
  {
    "path": "bin/hardening/7.4.1_install_tcp_wrapper.sh",
    "chars": 1939,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n# Modify by: Samson-W (samson@hardenedl"
  },
  {
    "path": "bin/hardening/7.4.2_hosts_allow.sh",
    "chars": 1734,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.4.2 Create /etc/hosts.allow (N"
  },
  {
    "path": "bin/hardening/7.4.3_hosts_allow_permissions.sh",
    "chars": 1835,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.4.3 Verify Permissions on /etc"
  },
  {
    "path": "bin/hardening/7.4.4_hosts_deny.sh",
    "chars": 2285,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.4.4 Create /etc/hosts.deny (Sc"
  },
  {
    "path": "bin/hardening/7.4.5_hosts_deny_permissions.sh",
    "chars": 1832,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 7.4.5 Verify Permissions on /etc"
  },
  {
    "path": "bin/hardening/7.6_disable_wireless.sh",
    "chars": 2007,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 or CentOS Hardening\n#\n\n#\n# 7.6 Ensure wireless interfa"
  },
  {
    "path": "bin/hardening/7.7.1_enable_firewall.sh",
    "chars": 5299,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS Hardening\n#\n\n#\n# 7.7.1 Ensure Firewall i"
  },
  {
    "path": "bin/hardening/7.7.2_ensure_set_firewall_rules.sh",
    "chars": 2426,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 Hardening\n#\n\n#\n# 7.7.2 Ensure the Firewall is set rule"
  },
  {
    "path": "bin/hardening/7.7.3_ensure_firewall_set_protect_dos_attacks.sh",
    "chars": 3582,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 Hardening\n#\n\n#\n# 7.7.3 Ensure the Firewall is set rule"
  },
  {
    "path": "bin/hardening/7.7.4.1_ensure_default_deny_firewall_policy.sh",
    "chars": 2630,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 Hardening\n#\n\n#\n# 7.7.4.1 Ensure default deny firewall "
  },
  {
    "path": "bin/hardening/7.7.4.2_ensure_loopback_traffic_is_configured.sh",
    "chars": 4197,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 Hardening\n#\n\n#\n# 7.7.4.2 Ensure loopback traffic is co"
  },
  {
    "path": "bin/hardening/7.7.4.3_ensure_firewall_rules_exist_for_all_open_ports.sh",
    "chars": 3848,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 Hardening\n#\n\n#\n# 7.7.4.3 Ensure firewall rules exist f"
  },
  {
    "path": "bin/hardening/7.7.4.4_ensure_outbound_and_established_connections_are_configured.sh",
    "chars": 3304,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 Hardening\n#\n\n#\n# 7.7.4.4 Ensure outbound and establish"
  },
  {
    "path": "bin/hardening/7.7.5.1_ensure_default_deny_firewall_policy_for_v6.sh",
    "chars": 2896,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 Hardening\n#\n\n#\n# 7.7.5.1 Ensure default deny firewall "
  },
  {
    "path": "bin/hardening/7.7.5.2_ensure_loopback_traffic_is_configured_for_v6.sh",
    "chars": 4517,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 Hardening\n#\n\n#\n# 7.7.5.2 Ensure loopback traffic is co"
  },
  {
    "path": "bin/hardening/7.7.5.3_ensure_firewall_rules_exist_for_all_open_ports_for_v6.sh",
    "chars": 4316,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 Hardening\n#\n\n#\n# 7.7.5.3 Ensure default deny firewall "
  },
  {
    "path": "bin/hardening/7.7.5.4_ensure_outbound_and_established_connections_are_configured_for_v6.sh",
    "chars": 3637,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10/11/12/13 Hardening\n#\n\n#\n# 7.7.5.4 Ensure outbound and establish"
  },
  {
    "path": "bin/hardening/8.0_enable_auditd_kernel.sh",
    "chars": 1810,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9  Hardening\n#\n\n#\n# 8.0 Ensure CONFIG_AUDIT is enabled in your r"
  },
  {
    "path": "bin/hardening/8.1.1.1_audit_log_storage.sh",
    "chars": 2011,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS  Hardening\n#\n\n#\n# 8.1.1.1 Configure Audit Log Sto"
  },
  {
    "path": "bin/hardening/8.1.1.2_halt_when_audit_log_full.sh",
    "chars": 3076,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 8.1.1.2 Disable System on Audit "
  },
  {
    "path": "bin/hardening/8.1.1.3_keep_all_audit_logs.sh",
    "chars": 3025,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 8.1.1.3 Keep All Auditing Inform"
  },
  {
    "path": "bin/hardening/8.1.1.4_set_failure_mode.sh",
    "chars": 2164,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10 or CentOS Hardening\n#\n\n#\n# 8.1.1.4 Set failure mode of audit se"
  },
  {
    "path": "bin/hardening/8.1.1.5_ensure_set_remote_server.sh",
    "chars": 2406,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10 or CentOS Hardening\n#\n\n#\n# 8.1.1.5 Ensure set remote_server for"
  },
  {
    "path": "bin/hardening/8.1.1.6_ensure_set_encrypt_for_audit_remote.sh",
    "chars": 2893,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10 or CentOS Hardening\n#\n\n#\n# 8.1.1.6 Ensure enable_krb5 set to ye"
  },
  {
    "path": "bin/hardening/8.1.1.7_ensure_set_action_for_audit_storage_full.sh",
    "chars": 2897,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10 or CentOS Hardening\n#\n\n#\n# 8.1.1.7 Ensure set action for audit "
  },
  {
    "path": "bin/hardening/8.1.1.8_ensure_set_action_for_net_fail.sh",
    "chars": 2912,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10 or CentOS Hardening\n#\n\n#\n# 8.1.1.8 Ensure set action for networ"
  },
  {
    "path": "bin/hardening/8.1.1.9_set_space_left_audit.sh",
    "chars": 3438,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 9/10 or CentOS Hardening\n#\n\n#\n# 8.1.1.9 Set space left for auditd se"
  },
  {
    "path": "bin/hardening/8.1.10_record_dac_edit.sh",
    "chars": 4588,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 8.1.10 Collect Discretionary Acc"
  },
  {
    "path": "bin/hardening/8.1.11_record_failed_access_file.sh",
    "chars": 3832,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 8.1.11 Collect Unsuccessful Unau"
  },
  {
    "path": "bin/hardening/8.1.12_record_syscall_execve.sh",
    "chars": 2474,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 8.1.12 Collect the execution of "
  },
  {
    "path": "bin/hardening/8.1.13_record_successful_mount.sh",
    "chars": 2728,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 8.1.13 Collect Successful File S"
  },
  {
    "path": "bin/hardening/8.1.14_record_file_deletions.sh",
    "chars": 2992,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 8.1.14 Collect File Deletion Eve"
  },
  {
    "path": "bin/hardening/8.1.15_record_sudoers_edit.sh",
    "chars": 2479,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 8.1.15 Collect Changes to System"
  },
  {
    "path": "bin/hardening/8.1.16_record_sudo_usage.sh",
    "chars": 2088,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 8.1.16 Collect System Administra"
  },
  {
    "path": "bin/hardening/8.1.17_record_kernel_modules.sh",
    "chars": 3150,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 8.1.17 Collect Kernel Module Loa"
  },
  {
    "path": "bin/hardening/8.1.18_record_Events_netfilter.sh",
    "chars": 3015,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 10/11/12/13 Hardening\n#\n\n#\n# 8.1.18 Record netfilter related Events "
  },
  {
    "path": "bin/hardening/8.1.19_record_sshkeysign_usage.sh",
    "chars": 3480,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10/11/12/13 or CentOS Hardening\n#\n\n#\n# 8.1.19  Recorded ssh-ke"
  },
  {
    "path": "bin/hardening/8.1.20_record_open_by_handle_at_syscall.sh",
    "chars": 2562,
    "preview": "#!/bin/bash\n\n#\n# harbian-audit for Debian GNU/Linux 7/8/9/10 or CentOS Hardening\n#\n\n#\n# 8.1.20  Recorded open_by_handle_"
  }
]

// ... and 152 more files (download for full content)

About this extraction

This page contains the full source code of the hardenedlinux/harbian-audit GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 352 files (1.9 MB), approximately 537.0k tokens, and a symbol index with 11 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!