Back to Securing a Machine

Many exposed-service issues come from unsafe settings, not unpatched software. This page focuses on service configuration problems such as unnecessary features, overly broad network exposure, and information disclosure.

Web Servers

Apache

Configuration files:

/etc/apache2/apache2.conf
/etc/httpd/conf/httpd.conf

Common issues:

Fixes:

Options -Indexes
ServerTokens Prod
ServerSignature Off

Restart Apache:

sudo systemctl restart apache2

Nginx

Configuration file:

/etc/nginx/nginx.conf

Common issues:

Fixes:

autoindex off;
server_tokens off;

Restart Nginx:

sudo systemctl restart nginx

IIS

Open IIS Manager:

inetmgr

Common issues:

Fixes:

Restart IIS:

iisreset

Web Applications

Common locations:

Linux:

/var/www/
/var/www/html/
/srv/www/

Windows:

C:\inetpub\wwwroot

Common issues:

Fixes:

sudo chown -R www-data:www-data /var/www
sudo chmod -R 755 /var/www
find /var/www -type f

Investigate files such as:

shell.php
cmd.php
upload.php

Disable execution in upload paths whenever possible and remove unused extensions or plugins.

Databases

MySQL / MariaDB

Configuration file:

/etc/mysql/mysql.conf.d/mysqld.cnf

Common issue:

Fix:

bind-address = 127.0.0.1

Restart MySQL:

sudo systemctl restart mysql

PostgreSQL

Configuration files:

/etc/postgresql/*/main/postgresql.conf
/etc/postgresql/*/main/pg_hba.conf

Common issue:

Fix:

listen_addresses = 'localhost'

Restart PostgreSQL:

sudo systemctl restart postgresql

Containers

Docker

Common issues:

Checks:

docker ps
docker inspect container_id
docker port container_id

Fixes:

docker stop container_id
docker rm container_id

Remove or reconfigure containers exposing unnecessary services or ports.

Quick Review Checklist

When reviewing configurations, check for:

If any of these appear, disable or restrict them wherever possible.

Back to Securing a Machine