# OS Hardening



# Remove Legacy Services

### The removal of legacy services

#### Check for legacy services

1. To check for legacy services, use the command the below

```
chkconfig --list
```

You should get an output similar to

[![03.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/r6RJro8aFj6SXYaW-03.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/r6RJro8aFj6SXYaW-03.PNG)

#### Disable legacy services

1. Confirm the necessity of the service and disable if not necessary with the below command

```
chkconfig "service name" off

I.e to disable netconsole
=========================

chkconfig netconsole off
```

# Disable Or Remove Server Services

### Disable or remove server services that are not going to be utilized (e.g. FTP, DNS, LDAP, SMB, DHCP, NFS, SNMP, etc.)

#### Display a list of services available

1. To display a list of services available use the command the below

```
systemctl -t service
```

This will display something similar to

[![04.PNG](https://docs.azandi.co.za/uploads/images/gallery/2020-04/scaled-1680-/aBmv3MhEvlgAvkAf-04.PNG)](https://docs.azandi.co.za/uploads/images/gallery/2020-04/aBmv3MhEvlgAvkAf-04.PNG)

#### Disable unnecessary services

1. Stop and turn OFF auto-start services not needed

```
systemctl stop "service name"
systemctl disable "service name"

I.e. to stop and disable the Postfix service
============================================

systemctl stop postfix
systemctl disable postfix
```

