100% found this document useful (1 vote)
47 views5 pages

CyberPatriot Linux Security Checklist

This document is a CyberPatriot checklist for securing a LAMP server, detailing steps for Linux, Apache, MySQL, and PHP configurations. It includes tasks such as updating the system, configuring firewalls, managing user accounts, and securing services. The checklist aims to enhance the security posture of the server by following best practices and ensuring proper configurations.

Uploaded by

Zayd Yaeesh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
47 views5 pages

CyberPatriot Linux Security Checklist

This document is a CyberPatriot checklist for securing a LAMP server, detailing steps for Linux, Apache, MySQL, and PHP configurations. It includes tasks such as updating the system, configuring firewalls, managing user accounts, and securing services. The checklist aims to enhance the security posture of the server by following best practices and ensuring proper configurations.

Uploaded by

Zayd Yaeesh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Team Number _________________

Round # ___ Date: ___ / ___ / ___


Operating System ______________

CyberPatriot Categorized Checklist


_______________________________________________________________________________________________________________________________________
Securing a LAMP server

LINUX
1. Update the machine
a. apt-get update
b. apt-get upgrade
c. apt-get dist-upgrade
2. Install clamtk
a. apt-get install clamtk
b. Run the scan
i. freshclam
3. Set automatic Updates
a. System settings>software & updates>Updates
i. Automatically check for updates
ii. Important security updates
4. Search for all prohibited files
a. find / -name “*.{extension}” –type f
5. Configure the firewall
a. apt-get install ufw / yum install ufw
b. ufw enable
c. ufw status
6. Edit the [Link] file
a. Ubuntu
i. Edit /etc/lightdm/[Link] or /usr/share/lightdm/[Link]/[Link]
ii. allow-guest=false
iii. greeter0hide-users=true
iv. greeter-show-manual-login=true
v. autologin-user=none
b. Debian
i. Edit /etc/lightdm/[Link]
1. Greeter-hide-users=true
2. Greeter-allow-guest=false
3. Greeter-show-manual-login=true
4. Allow-guest=false
5. Autologin-user=none
ii. Edit /etc/gdm3/[Link]-defaults
1. Disable-user-list=true
2. Disable-restart-buttons=true
3. AutomaticLoginEnable = false
7. Create any missing users
a. ___________________
b. ___________________
8. Change all the user passwords to “Cyb3rPatr!0t$”
9. Edit the /etc/[Link]
a. FAILLOG_ENAB YES
b. LOG_UNKFAIL_ENAB YES
c. SYSLOG_SU_ENAB YES
d. SYSLOG_SG_ENAB YES
e. PASS_MAX_DAYS 90
f. PASS_MIN_DAYS 10
g. PASS_WARN_AGE 7
i. Add the following to the line that ends in difok=3 to /etc/pam.d/common-password
ii. ucredit=-1 lcredit=-1 dcredit=-1 ocredit=-1

Page 1
Team Number _________________
Round # ___ Date: ___ / ___ / ___
Operating System ______________

CyberPatriot Categorized Checklist


_______________________________________________________________________________________________________________________________________
10. Delete any users
a. ______________ ___________
b. ______________ ___________
c. ______________ ___________
11. Check the /etc/passwd file
a. Look for any repeating UID or GID
b. Make sure no programs have a /bin/sh or /bin/bash
c. Only root should have a UID and GID of 0
12. Check the /etc/group file and manage the groups
a. Add all the admins to the sudo and adm group.
13. Disable the root accounts
a. passwd –l root
14. secure SSH if required
a. edit /etc/ssh/sshd_config
i. LoginGraceTime 60
ii. PermitRootLogin no
iii. Protocol 2
iv. PermitEmptyPasswords no
v. PasswordAuthentication yes
vi. X11Fowarding no
vii. UsePAM yes
viii. UsePrivilegeSeparation yes
15. Secure the /etc/shadow file
a. chmod 640 /etc/shadow
16. Look for any bad programs
a. dpkg –l | grep {PACKAGE}
i. John The Ripper (JTR)
ii. Hydra
iii. Nginx
iv. Samba
v. Bind9
vi. Vsftpd/ftp
1. If required then secure the /etc/[Link]
a. anonymous_enable=ON
b. local_enable=YES
c. write_enable=YES
d. chroot_local_user=YES
vii. Tftpd
viii. X11vnc/tightvncserver
ix. Snmp
x. Nfs
xi. Sendmail/postfix
xii. Xinetd
17. Configure /etc/[Link]
a. Sysctl -p
b. Add this to the bottom of the /etc/[Link] file
i. Disable ICMP redirects
1. [Link].accept_redirects = 0
ii. Disable IP redirecting
1. net.ipv4.ip_forward = 0
2. [Link].send_redirects = 0
3. [Link].send_redirects = 0
iii. Disable IP spoofing

Page 2
Team Number _________________
Round # ___ Date: ___ / ___ / ___
Operating System ______________

CyberPatriot Categorized Checklist


_______________________________________________________________________________________________________________________________________
1. [Link].rp_filter=1
iv. Disable IP source routing
1. [Link].accept_source_route=0
v. SYN Flood Protection
1. net.ipv4.tcp_max_syn_backlog = 2048
2. net.ipv4.tcp_synack_retries = 2
3. net.ipv4.tcp_syn_retries = 5
4. net.ipv4.tcp_syncookies = 1
vi. Disable IPV6
1. [Link].disable_ipv6 = 1
2. [Link].disable_ipv6
3. [Link].disable_ipv6
18. Check cronjobs
a. Check these folders
i. /etc/cron.*
ii. /etc/crontab
iii. /var/spool/cron/crontabs
b. Check the init files
i. /etc/init
ii. /etc/init.d
c. Check for each user
i. crontab –u {USER} -l
19. Check sudoers
a. When using the sudo su command it should always ask for a password, if not
i. Check /etc/sudoers
ii. Or /etc/sudoers.d
b. Make sure that there are no NOPASSWD values set
i. Change all of them to ALL=(ALL:ALL) ALL
20. Check the runlevels if unable to boot into GUI
a. To check the run level
i. runlevel
b. Runlevels
i. 0-System halt;No activity
ii. 1-Single user
iii. 2-Multi-user, no filesystem
iv. 3-Multi-user, commandline only
v. 4-user defineable
vi. 5-multi-users,GUI
vii. 6-Reboot
c. To change the run level
i. Telinit {level}
APACHE
1. Hide Apache Version number.
a. Add the following lines to the bottom of /etc/apache2/[Link]
i. ServerSignature Off
ii. ServerTokens Prod
2. Make sure Apache is running under its own user account and group.
a. Add a separate user “apache”
b. Edit the /etc/apache2/[Link] file
i. User apache
ii. Group apache
3. Ensure that file outside the web root directory are not accessed. /etc/apache2/[Link]
a. <Directory />

Page 3
Team Number _________________
Round # ___ Date: ___ / ___ / ___
Operating System ______________

CyberPatriot Categorized Checklist


_______________________________________________________________________________________________________________________________________
Order Deny,Allow
Dent from all
Options -Indexes
AllowOverride None
</Directory>
<Directory /html>
Order Allow,Deny
Allow from all
</Directory>
4. Turn off directory browsing, Follow symbolic links and CGI execution
a. Add Options None to a <Directory /html> tag
5. Install modsecurity
a. apt-get install mod_security
b. service httpd restart
6. Lower the Timeout value in /etc/apache2/[Link]
a. Timeout 45
MySQL
1. Restrict remote MySQL access
a. Edit /etc/mysql/[Link]
i. Bind-address=[Link]
2. Disable use of LOCAL INFILE
a. Edit /etc/mysql/[Link]
i. [mysqld]
ii. local-infile=0
3. Create Application Specific user
a. root@Ubuntu:~# mysql –u root –p
b. mysql> CREATE USER ‘myusr’@’localhost’ IDENTIFIED BY ‘password’;
c. mysql> GRANT SELECT,INSERT,UPDATE,DELETE ON mydb.* TO ‘myusr’@’localhost’ IDENTIFIED BY
‘password’;
d. mysql> FLUSH PRIVILEGES;
4. Improve Security with mysql_secure-installation
a. root@Ubuntu:~# mysql_secure_installation
i. change the root password?: y
ii. Remove anonymous users?: y
iii. Disallow root login remotely?: y
iv. Remove test database and access to it?: y
v. Reload privilege tables now?: y
PHP
1. Restrict PHP Information Leakage
a. Edit /etc/php5/apaceh2/[Link]
i. expose_php = off
2. Disable Remote Code Execution
a. Edit /etc/php5/apache2/[Link]
i. allow_url_fopen=Off
ii. allow_url_include=Off
3. Disable dangerous PHP Functions
a. Edit /etc/php5/apache2/[Link]
i. disable_functions=exec,shell_exec,passthru,system,popen,curl_exec,curl_multi_exec,par
se_ini_file,show_source,proc_open,pcntl_exec
4. Enable Limits in PHP
a. Edit /etc/php5/apache2/[Link]
i. upload_max_filesize = 2M
ii. max_execution_time = 30
iii. max_input_time = 60

Page 4
Team Number _________________
Round # ___ Date: ___ / ___ / ___
Operating System ______________

CyberPatriot Categorized Checklist


_______________________________________________________________________________________________________________________________________

Page 5

Common questions

Powered by AI

Setting group policies in the /etc/group file ensures that only authorized administrators have elevated privileges, thereby minimizing unauthorized access. Similarly, modifying sudoers configuration to require password authentication and avoid NOPASSWD entries reduces the risk of privilege escalation. These measures collectively safeguard the system by strictly controlling user permissions and authentication .

Restricting SSH configurations enhances security by minimizing risk factors such as unauthorized root access and potential credential exposure. Recommended settings include 'PermitRootLogin no', which prevents remote root logins, and 'PasswordAuthentication yes', which assures that only users with valid credentials can log in. Additionally, 'Protocol 2' ensures the use of a more secure protocol version .

Automatic updates ensure that the system receives and applies security patches and updates regularly, reducing vulnerabilities and protecting against threats. The key steps to configure it include accessing System Settings, navigating to 'Software & Updates,' and then setting the system to automatically check for and apply important security updates .

MySQL configurations such as restricting remote access ('bind-address=127.0.0.1'), disallowing unsafe file operations ('local-infile=0'), and removing anonymous users enhance security by limiting who can access the database and what they can do. These measures prevent unauthorized entries and potential data breaches by ensuring only known users with proper credentials can interact with the database .

Disabling IPV6 can enhance security by preventing certain IPV6-specific vulnerabilities and reducing attack vectors on a system not configured to use or monitor IPV6 traffic. The necessary steps include editing the sysctl.conf file to include 'net.ipv6.conf.all.disable_ipv6 = 1' and similar lines for default and local options, thus fully disabling the protocol and protecting the system .

Disabling dangerous PHP functions such as 'exec', 'shell_exec', and 'system' mitigates the risk of remote code execution vulnerabilities. The recommended configuration, added in /etc/php5/apache2/php.ini, sets 'disable_functions=exec,shell_exec,passthru,system,popen,etc.' to prevent these functions from being exploited by malicious users, thus enhancing the security of web applications running on the server .

Critical components include setting 'ServerSignature Off' and 'ServerTokens Prod' in the apache2.conf file, which hide server version details from error pages and HTTP headers. This obfuscation prevents attackers from gaining information about the server software, thereby reducing the likelihood of targeted attacks based on known vulnerabilities of specific server versions .

The sysctl.conf file allows setting kernel parameters to prevent network-level attacks. Configurations like 'net.ipv4.conf.all.rp_filter=1' enforce reverse path filtering, mitigating IP spoofing. 'net.ipv4.tcp_syncookies=1' helps protect against SYN flood attacks by using SYN cookies. Enforcing these settings strengthens the system's defense against common networking threats like IP spoofing and denial-of-service attacks .

Editing the lightdm.conf file enhances security by disabling guest login and hiding user lists from the greeter screen, reducing the surface for unauthorized access. Configurations such as 'allow-guest=false' and 'greeter-show-manual-login=true' enforce these security measures by ensuring only authenticated users can attempt login .

Regularly reviewing and managing cron jobs is crucial as they can be exploited to run unauthorized scripts or malware if misconfigured. Checking directories like /etc/cron.* and individual user crontabs ensures only authorized jobs are scheduled, thereby preventing attack vectors like persistent backdoors or unauthorized data exfiltration, which can compromise system integrity .

You might also like