CentOS 7:Minimal-Installation

Aus Fortinet Wiki
Zur Navigation springen Zur Suche springen


Vorwort

Das Ziel dieser Installations-Anleitung ist ein möglichst schlankes Linux CentOS 7 zu installieren und auf Sicherheit zu achten. Dabei wurden zusätzliche Informationen/Konfiguration der folgenden Seite benutzt:

       https://highon.coffee/blog/security-harden-centos-7/

Es wurden nicht alle Implementierungen dieser Seite benutzt dh. es gilt zusätzlich zu diesen Konfiguration ebenfalls die "Benutzerfreundlichkeit" zu waren. Dies bedeutet das diese Installation/Konfiguration Grundlage bietet für etliche Installationen. Die Installation/Konfiguration wurde "top-down" durchgeführt was wiederum bedeutet: Wenn Modifikationen innerhalb der Dokumentation einzeln ausgeführt werden kann es zu Problemen kommen da vers. Konfigurationen auf vorhergehenden Konfigurationen basieren. In dieser Dokumentation werden "iptable" sowie "firewalld" (soll "iptable" ersetzen komplett deaktiviert. Das gleiche gilt für "selinux". Dies wird durchgeführt da davon ausgegangen wird das der Server bereits über eine Firewall im DMZ geschützt wird.

Test- und Installationsmaschinen waren:

VMware ESXi 5.5 (64bit)
2.4 GHz (1 Core), 4 GB RAM, 20GB HD

Datenschutz

        *********************************************************************
        *                                                                   *
        *  THIS FILE MAY CONTAIN CONFIDENTIAL, PRIVILEGED OR OTHER LEGALLY  *
        *      PROTECTED INFORMATION. YOU ARE PROHIBITED FROM COPYING,      *
        *    DISTRIBUTING OR OTHERWISE USING IT WITHOUT PERMISSION FROM     *
        *                  ALSO SCHWEIZ AG SWITZERLAND.                     *
        *                                                                   *
        *********************************************************************

"Die in diesen Artikeln enthaltenen Informationen sind vertraulich und dürfen ohne
schriftliche Zustimmung von der ALSO Schweiz AG gegenüber Dritt-Unternehmen nicht 
                         bekannt gemacht werden"

Installation CentOS 7 CD/ISO

Bei der Installation dieses CentOS 7 benutzen wird das "minimal" ISO Image dh. dieses bietet von Grundauf die Möglichkeit möglichst eine "minimal" Installation auszuführen und eine CentOS 7 Server gerecht zu werden. Das benutzte ISO kann unter folgenden Link runtergeladen werden:

       http://isoredirect.centos.org/centos/7/isos/x86_64/CentOS-7-x86_64-Minimal-1503-01.iso

Beim booten des ISO Images wird das ISO Image selber überprüft dh. es ist keine Eingabe nötig. Nach ca. 1 - 2 Minuten erscheint auf der Console die erste Konfigurations Oberfläche. In dieser Konfigurations Oberfläche wird folgendes Konfiguriert:

       Localization:
       
       Date&Time: Europe/Zürich (setze den Timeserver zB ch.pool.ntp.org)
       Language Support: English (United States)
       Keyboard: Swiss German
       Software:
       
       Software Selection: Minimal Install
       
       NOTE Wenn man die "Software Selection" genauer anschaut stehen dort verschiedenen Positionen/Software zur
            verfügung diese sind jedoch per Standard alle "deaktiviert"!
       System:
       
       Kdump: Disabled
       
       NOTE Für einen produktiven Server sollte "Kdump" deaktiviert werden. Bei "Kdump" handelt es sich um eine Funktion
            die es ergmölicht einen "dump" des Kernels/Memory für ein Troubleshooting durchzuführen. Der Nachteil wenn
            "Kdump" dennoch aktiviert wird ist das diese Funktion "permanent" Memory belegt das anderen Applikationen nicht
            zur Verfügung steht. Aus diesem Grund wird "Kdump" für einen produkten Server deaktiviert!
       Installation Destination:
       
       2048	/
       4096	swap
       1048	/var
       500	/boot
       12.5	/export
       
       NOTE Unter diesem Punkt kann das Layout der Disk durchgeführt werden. Dabei steht ein Link zur Verfügung der ein Standard
            Layout durchführt (basierend auf xfs und LVM) das nachträglich erweitert/modifiziert werden kann. Die Grösse von "/"
            hängt davon ab welche Applikation installiert wird. Ein Centos 7 minimal Installation belegt ca. 850 MB. Per Standard
            wird /, swap, sowie /boot erstellt. Für /boot werden 500 MB alloziert und für swap 2 GB. Der Rest des zur Verfügung
            stehenden Festplattzen Kapazität wird / zugewiesen. Folgend einer klassichen Aufteilen wird / 2 GB zugewiesen. für
            swap mind. die Grösse des zur Verfügung stehenden Memory (in unserem Fall 4 GB). Für /var das im normal Fall Log's
            sowie temporäre Daten verarbeitet werden (spool) 1024. Der Rest der Festplatten Kapazität weisen wir /export zu dh.
            diese Partition enthält Speicher Daten die nicht temporärer Natur sind zB Mailbox, File Storage etc. Die Zuteilung
            der Festplattzen Kapazität steht im direkten Zusammenhang mit der eingesetzten Applikation. Diesem Umstand ist Rechnung
            zu tragen. Als Filesystem sollte xfs benutzt werden sowie LVM!
       Network & Hostname:
       
       Aktiviere die entsprechende Netzwerkkarte und konfiguriere diese sowie im Ausgangspunkt (unten) konfiguriere den Hostnamen:
       
       General: All users may connect to this network (disabled)
       Connection Name: ens32
       IPv4 Settings: 198.18.0.19 255.255.255.224 198.18.0.1
                      DNS: 198.18.0.1
                      Domains: comcept.ch
       
       NOTE Das Interface muss explizit aktiviert werden (oben Rechts). Danach konfigurieren wir das Interface anhand einer 
            statischen Konfiguration (Fix IP). Wird dieser Dokumentation gefolgt werden DHCP Komponenten später komplett 
            entfernt. Unter CentOS 7 wird neu der NetworkManager benutzt. Dieser ist ebenfalls zuständig, dass ein Interface
            Name "ens32" benutzt wird. Diesem Umstand wird später Rechnung getragen dh. wird umbenannt in den allgemein üblichen
            Standard "eth0" resp. den benutzen Namen der aus dem "Bios" stammt.

Nach der Eingabe der nötigen Informationen beginnt die Instalation im Hintergrund und es kann ein "root" Passwort vergeben werden. Wird das "root" Passwort zu kurz gewählt kann dies zwar durchgeführt werden jedoch muss 2 X bestätigt werden damit dieses gesetzt wird. Sobald die Installation abgeschlossen ist ca. 2 - 3 Minuten muss bestätigt werden damit ein Neustart ausgeführt wird. Dabei ist zu berücksichtigen in welcher Reihenfolge zB im Bios die "Boot Reihenfolge" gesetzt ist damit nicht erneut von dem ISO Image resp. Media die Installation ausgeführt wird.

OS Modifikationen/Manipulationen

Konfiguration: Update des Systems sowie Installation Packages

Nach dem ersten Neustart erscheint das Login. Logge dich über die Console ein:

       login: root

Nun als erstes sollte ein komplettes Update durchgeführt werden des CentOS. Dies ist nur dann möglich wenn die statische Konfiguration anhand des Default Gateways sowie DNS Server korrekt durchgeführt wurde sowie dem Server erlaubt ist auf das Internet zu zugreifen. Führe ein Update des CentOS mit folgenden Befehl aus:

       # yum update

Nach einem erfolgreichen Update kontrolliere/stellt sich die Kapazität der Festplatte folgermassen dar:

       # df -h
       Filesystem                 Size  Used Avail Use% Mounted on
       /dev/mapper/centos-root    2.0G  886M  1.2G  44% /
       devtmpfs                   2.0G     0  2.0G   0% /dev
       tmpfs                      2.0G     0  2.0G   0% /dev/shm
       tmpfs                      2.0G  8.5M  2.0G   1% /run
       tmpfs                      2.0G     0  2.0G   0% /sys/fs/cgroup
       /dev/mapper/centos-export   13G   33M   13G   1% /export
       /dev/mapper/centos-var    1014M  110M  905M  11% /var
       /dev/sda1                  497M  142M  355M  29% /boot

Die "minimal" Installation von CentOS 7 verfügt nicht über "nslookup". Dieses ist jedoch nützlich deshalb werden wir es installieren:

       # yum install bind-utils

Wie schon erwähnt benutzt CentOS 7 den "NetworkManager" (ip addr). Dieser soll der Nachfolger von "ifconfig" Befehl darstellen. Der "NetworkManager" bietet ein Vielzahl von vers. Tools die jedoch für einen produkten Server übertrieben sind und da wir in den nachfolgenden Schritten die Konfigurationen manuell ausführen wird später der "NetworkManager" komplett entfernt. Aus diesem Grund installieren wir "ifconfig" resp. "net-tools" da dieses Package genau das bietet was gebraucht wird:

       # yum install net-tools

In den nachfolgenden Schritten in dieser Dokumentation benötigen wir immer wieder Downloads. Diese werden am einfachsten über "wget" runtergeladen. Da CentOS 7 "minimal" ebenfalls nicht über dieses Tool verfügt installieren wir dieses:

       # yum install wget

Konfiguration: Entfernen von Packages "postfix, firewalld"

CentOS 7 minimal kommt mit einer Postfix Installation. Je nach dem was auf dem Server eingesetzt wird kann dies Sinn machen diese Package nicht zu deinstallieren. In unserem Fall wird dieses Package deinstalliert:

       # rpm -e postfix
       # groupdel postdrop
       # userdel postfix
       # groupdel postfix
       
       # rm -rf /var/lib/postfix
       # rm -rf /var/spool/postfix

Wie schon gesagt "firewalld" ist der Nachfolger von "iptable". Da wir jedoch keine Firewall benötigen auf unserem Server wird dieses Package deinstalliert:

       # systemctl mask firewalld
       ln -s '/dev/null' '/etc/systemd/system/firewalld.service'
       # systemctl stop firewalld
       
       # rpm -e firewalld
       
       # rm -rf /var/log/firewalld
       # rm -rf /etc/systemd/system/firewalld.service
       # rm -rf /etc/selinux/targeted/modules/active/modules/firewalld.pp
       # rm -rf /etc/firewalld

Konfiguration: Deaktivierung von SELinux

Ebenfalls wir kein "selinux" benötigt. Mit "selinux" kann gesteuert werden "wer" auf "welche" Prozesse Zugriff hat und "wer" nicht etc. Das Package wird nicht deinstalliert sondern mit der Konfiguration im "config" File "SELINUX=disabled" komplett deaktiviert:

       # vi /etc/selinux/config
       
       --------------- /etc/selinux/config --------------- 
       
       # This file controls the state of SELinux on the system.
       # SELINUX= can take one of these three values:
       #     enforcing - SELinux security policy is enforced.
       #     permissive - SELinux prints warnings instead of enforcing.
       #     disabled - No SELinux policy is loaded.
       SELINUX=disabled
       # SELINUXTYPE= can take one of three two values:
       #     targeted - Targeted processes are protected,
       #     minimum - Modification of targeted policy. Only selected processes are protected.
       #     mls - Multi Level Security protection.
       SELINUXTYPE=targeted
       
       --------------- /etc/selinux/config --------------- 
       
       NOTE Damit die Aenderung aktiviert wird wird später ein Neustart des Servers ausgeführt!

Konfiguration: Hinzufügen von Paramenter in GRUB für "eth0"

Wie schon bei der Installation erwähnt wird als Interface "ens32" benutzt und nicht der Bios Name wie per Standard zB "eth0". Damit wir wieder mit "eth0" arbeiten können muss in der Grub Konfig beim Start des Server eine entsprechende Anweisung hinterlegt werden dh. füge am Ende für die Anweisung "GRUB_CMDLINE_LINUX" die Option "net.ifnames=0 biosdevname=0" hinzu:

       # vi /etc/default/grub
       
       --------------- /etc/default/grub --------------- 
       
       GRUB_TIMEOUT=5
       GRUB_DEFAULT=saved
       GRUB_DISABLE_SUBMENU=true
       GRUB_TERMINAL_OUTPUT="console"
       GRUB_CMDLINE_LINUX="ipv6.disable=1 rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0"
       GRUB_DISABLE_RECOVERY="true"
       
       --------------- /etc/default/grub ---------------

Damit die entsprechende Erweiterung in das entsprechende Image geschrieben wird muss folgendes ausgeführt werden:

       # grub2-mkconfig -o /boot/grub2/grub.cfg
       Generating grub configuration file ...
       Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64
       Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img
       Found linux image: /boot/vmlinuz-3.10.0-229.4.2.el7.x86_64
       Found initrd image: /boot/initramfs-3.10.0-229.4.2.el7.x86_64.img
       Found linux image: /boot/vmlinuz-0-rescue-c3b16f0a6f9e45578d59905dd36ee9f6
       Found initrd image: /boot/initramfs-0-rescue-c3b16f0a6f9e45578d59905dd36ee9f6.img
       done

Damit nur User "root" dieses Konfig File sehen sowie modifizieren kann vergeben wir für das File neue Rechte die diesem Umstand Rechnung tragen:

       # chmod 600 /boot/grub2/grub.cfg

Konfiguration: Entfernen von Packages "NetworkManager, dhclient"

Damit nach einem Neustart der Konfiguration in "grub.cfg" Rechnung getragen wird muss nun das Interface -in unserem Fall- "ens32" auf "eth0" umkonfiguriert werden. Führe folgendes durch:

       # mv /etc/sysconfig/network-scripts/ifcfg-ens32 /etc/sysconfig/network-scripts/ifcfg-eth0

Stoppe den "NetworkManager" sowie entferne diesen:

       # systemctl stop NetworkManager 
       # systemctl disable NetworkManager
       
       # rpm -e NetworkManager NetworkManager-tui
       # rpm -e NetworkManager-libnm

Entferne ebenfalls das "DHCP Client Package". Das "dhclient" Package steht im direkten Zusammenhang mit den Package "dracut-network" sowie "kexec-tools" die ebenfalls entfernt werden können:

       # rpm -e --nodeps dhclient
       # rpm -e dracut-network kexec-tools

Nun könne auch die entsprechenden Verzeichnisse des "NetworkManager" entfernt werden nachdem die vorhergehenden Packages entfernt wurden:

       # rm -rf /var/lib/NetworkManager
       # rm -rf /etc/NetworkManager
       # rm -rf /usr/share/doc/NetworkManager

Konfiguration: Modifikation des Netzwerks für "eth0"

Bevor ein Neustart ausgeführt wird sollte die Konfiguration des Netzwerks basierend auf den Namen "eth0" kontrolliert werden. Dabei werden wir IPv6 komplett deaktivieren in der Netzwerk Konfiguration da wir IPv6 nicht benötigen:

       # vi /etc/sysconfig/network-scripts/ifcfg-eth0
       
       --------------- /etc/sysconfig/network-scripts/ifcfg-eth0 ---------------
       
       TYPE="Ethernet"
       BOOTPROTO="static"
       DEFROUTE="yes"
       IPV4_FAILURE_FATAL="no"
       IPV6INIT="no"
       IPV6_AUTOCONF="no"
       IPV6_DEFROUTE="no"
       IPV6_FAILURE_FATAL="no"
       NAME="eth0"
       #UUID="c2e6177b-6e8b-468d-91ce-5eaf07792602"
       DEVICE="eth0"
       ONBOOT="yes"
       DNS1="198.18.0.1"
       DOMAIN="comcept.ch"
       IPADDR="198.18.0.19"
       PREFIX="27"
       GATEWAY="198.18.0.1"
       IPV6_PEERDNS="no"
       IPV6_PEERROUTES="no"
       IPV6_PRIVACY="no"
       #USERS="root"
       USERCTL="no"
       
       --------------- /etc/sysconfig/network-scripts/ifcfg-eth0 ---------------
       

Ueberprüfe die Rechte des Files "/etc/sysconfig/network-scripts/ifcfg-eth0":

       # ls -al /etc/sysconfig/network-scripts/ifcfg-eth0
       -rw-r--r--. 1 root root 409 Jun  2 20:03 /etc/sysconfig/network-scripts/ifcfg-eth0

Ueberprüfe die "Host" Einträge und füge den Server Namen inkl. FQDN sowie die entsprechende IP hinzu:

       # vi /etc/hosts
       
       --------------- /etc/hosts ---------------
       
       127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
       #::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
       198.18.0.19 kolab.comcept.ch kolab
       
       --------------- /etc/hosts ---------------

Ueberprüfe die Rechte des Files "/etc/hosts":

       # ls -la /etc/hosts
       -rw-r--r--. 1 root root 193 Jun  2 20:06 /etc/hosts

Die DNS Konfiguration des Servers wird im nachfolgenden File konfiguriert:

       # vi /etc/resolv.conf 
       
       --------------- /etc/resolv.conf ---------------
       
       domain comcept.ch
       search dns1.comcept.ch 198.18.0.1
       nameserver 198.18.0.1
       nameserver 127.0.0.1
       
       --------------- /etc/resolv.conf ---------------

Ueberprüfe die Rechte des Files "/etc/resolv.conf":

       # ls -la /etc/resolv.conf
       -rw-r--r--. 1 root root 79 Jun  2 20:07 /etc/resolv.conf

Konfiguriere das File "host.conf" dh. Die Anweisung "order" gibt an wie eine DNS Auflösung durchgeführt wird. Da "hosts,bind" konfiguriert wird, wird bei einem DNS Lookup zuerst das File "/etc/hosts" konsultiert. Wird in diesem File kein entsprechender Eintrag gefunden wird der konfigurierte DNS Server konsultiert. Bei der Konfiguration "multi" die per Standard auf "on" steht, wird konfiguriert das wenn auf einem Interface "mehrere" IP's resp. Hostnamen existieren nur der erste Eintrag in "/etc/hosts" zurück gegeben wird. Dies bedeutet es gilt mit "off" im File "/etc/hosts" der Vorgang "top down first match wins":

       # vi /etc/host.conf 
       
       --------------- /etc/host.conf ---------------
       
       # Lookup names via /etc/hosts first then fall back to DNS resolver
       order hosts,bind
       
       # We have machines with multiple addresses
       multi off
       
       --------------- /etc/host.conf ---------------

Ueberprüfe die Rechte des Files "/etc/host.conf":

       # ls -la /etc/host.conf
       -rw-r--r--. 1 root root 138 Jun  2 20:11 /etc/host.conf

Im File /etc/sysconfig/network" wird der Default Gateway (inkl. Device Name eth0) Konfiguriert sowie Hostname:

       # vi /etc/sysconfig/network
       
       --------------- /etc/sysconfig/network ---------------
       
       NETWORKING=yes
       HOSTNAME=kolab
       GATEWAY=198.18.0.1
       GATEWAYDEV=eth0
       NETWORKING_IPV6=no
       IPV6INIT=no
       
       --------------- /etc/sysconfig/network ---------------

Ueberprüfe die Rechte des Files "/etc/sysconfig/network":

       # ls -la /etc/sysconfig/network
       -rw-r--r--. 1 root root 63 Jun  2 20:13 /etc/sysconfig/network

Modifiziere das nachfolgende File und entferne die OS Informationen sowie Version sofern gewünscht. Diese File wird beim Neustart des Server ausgelesen sowie einige Applikationen benützen das File um das OS resp. die Version auszulesen:

       # echo kolab 7.1.1503 > /etc/redhat-release
       
       # more /etc/redhat-release 
       kolab 7.1.1503

Damit alle Modifikationen aktiviert werden führen wir nun einen Neustart aus:

       # reboot

Nachdem Neustart kontrolliere die Netzwerk Konfiguration auf "eth0" anhand des Packages "net-tools" resp. ifconfig Befehls:

       # ifconfig
       eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
               inet 198.18.0.19  netmask 255.255.255.224  broadcast 198.18.0.31
               inet6 fe80::20c:29ff:fe3d:e4bb  prefixlen 64  scopeid 0x20<link>
               ether 00:0c:29:3d:e4:bb  txqueuelen 1000  (Ethernet)
               RX packets 363  bytes 48539 (47.4 KiB)
               RX errors 0  dropped 307  overruns 0  frame 0
               TX packets 62  bytes 8182 (7.9 KiB)
               TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
       
       lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
               inet 127.0.0.1  netmask 255.0.0.0
               inet6 ::1  prefixlen 128  scopeid 0x10<host>
               loop  txqueuelen 0  (Local Loopback)
               RX packets 0  bytes 0 (0.0 B)
               RX errors 0  dropped 0  overruns 0  frame 0
               TX packets 0  bytes 0 (0.0 B)
               TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
       # service network status
       Configured devices:
       lo eth0
       Currently active devices:
       lo eth0

Wenn nachträglich durch einen Fehler Modifikationen an der Netzwerk Konfiguration durchgeführt werden müssen so kann nachträglich folgendes ausgeführt werden:

       # service network restart
       Restarting network (via systemctl):  [  OK  ]

Konfiguration: Passwort für "Single User Mode"

Um zu verhindern das im "Single User Mode" kein Passwort von User "root" abgefragt wird modifiziere folgendes File:

       # vi /etc/sysconfig/init
       
       --------------- /etc/sysconfig/init ---------------
       
       # color => new RH6.0 bootup
       # verbose => old-style bootup
       # anything else => new style bootup without ANSI colors or positioning
       BOOTUP=color
       # column to start "[  OK  ]" label in
       RES_COL=60
       # terminal sequence to move to that column. You could change this
       # to something like "tput hpa ${RES_COL}" if your terminal supports it
       MOVE_TO_COL="echo -en \\033[${RES_COL}G"
       # terminal sequence to set color to a 'success' color (currently: green)
       SETCOLOR_SUCCESS="echo -en \\033[0;32m"
       # terminal sequence to set color to a 'failure' color (currently: red)
       SETCOLOR_FAILURE="echo -en \\033[0;31m"
       # terminal sequence to set color to a 'warning' color (currently: yellow)
       SETCOLOR_WARNING="echo -en \\033[0;33m"
       # terminal sequence to reset to the default color.
       SETCOLOR_NORMAL="echo -en \\033[0;39m"
       SINGLE=/sbin/sulogin
       
       --------------- /etc/sysconfig/init ---------------

Die Anweisung "SINGLE=/sbin/sulogin" erzwingt im "Single User Mode" das Abfragen des "root" Passwortes. Diese Mode "von der Kommandozeile" ist unter CentOS 7 nicht zuständig um ein User "root" vergessenes Passwort neu zu setzen. Dieser Vorgang ist nur möglich über den Neustart des Servers in den "Single User Mode" oder auch "Rescue" genannte. Bei dieser Modifikation geht es nur darum wenn auf Kommandozeile der "Single User Mode" ausgeführt wird:

       # init s
       
       Welcome to rescue mode! Type "systemctl default" or ^D to enter the default mode.
       Type "journalctl -xb" to view system logs. Type "systemctl reboot" to reboot.
       Give root password for maintenance
       (or type Control-D to continue): xxxxxxx
       # 

Durch die Modifikation wird das User "root" Passwort abgefragt. Um aus dem "Single User Mode" wiederum auszusteigen benütze folgendes und es wird ein Neustart ausgeführt:

       # systemctl reboot

Konfiguration: Verhindern von "core" Files System/User

Damit verhindert wird das bei einem Crash oder auch gewollt für sämtliche User resp. Prozesse ein "core" File erstellt wird führe folgende Konfiguration durch:

       # vi /etc/security/limits.conf
       
       --------------- /etc/security/limits.conf ---------------
       
       #<domain>      <type>  <item>         <value>
       #
       
       #*               soft    core            0
       #*               hard    rss             10000
       #@student        hard    nproc           20
       #@faculty        soft    nproc           20
       #@faculty        hard    nproc           50
       #ftp             hard    nproc           0
       #@student        -       maxlogins       4
       *                hard    core            0
       
       # End of file
       
       --------------- /etc/security/limits.conf ---------------

Konfiguration: Korrektes setzen der Zeitzone nach Systemstart

Um zu verhindern das nach dem Start eine falsche "Zeitzone" gesetzt wird sowie daraus resultierend die falsche Zeit kann nachfolgende Konfiguration durchgeführt werden um dies zu verhindern:

       # rm -rf /etc/localtime
       # ln -snf /usr/share/zoneinfo/Europe/Zurich /etc/localtime
       # vi /etc/sysconfig/clock
       
       --------------- /etc/sysconfig/clock ---------------
       
       ZONE="Europe/Zurich"
       UTC=true
       ARC=false
       
       --------------- /etc/sysconfig/clock ---------------

Führe eine Synch durch dh. durch folgenden Befehl wir die Hardware Clock der momentanen System Clock angepasst:

      # hwclock -wu

Beim nächsten Neustart wird die Konfiguration die wir durchgeführt haben aktiv.

Konfiguration: Ueberschreiben von Kernel, TCP Paramenter (syctl.conf)

Wenn ein CentOS resp. ein Linux im allgemeinen gestartet wird, werden verschiedenen "Kernel" Parameter sowie "TCP IPv4" Einstellungen/Konfigurationen geladen. Anhand des Files "/etc/sysctl.conf" das KEINE solchen Parameter per Standard enthält können diese Parameter resp. Konfiguration beim Start mitgegeben werden resp. Standards überschrieben werden:

       # cp -p /etc/sysctl.conf /etc/sysctl.conf.orig
       
       NOTE Falls es zu Problemen kommt was unter normalen Umständen nicht zu erwarten ist kann das orginal File zurück kopiert werden
            und mit dem modifizierten File überschrieben werden sowie ein Neustart ausgeführt werden!
       
       # vi /etc/sysctl.conf
       
       --------------- /etc/sysctl.conf ---------------
       
       # System default settings live in /usr/lib/sysctl.d/00-system.conf.
       # To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
       #
       # For more information, see sysctl.conf(5) and sysctl.d(5).
       
       # Kernel sysctl configuration file for Linux
       #
       # Version 1.9 - 2011-03-23
       # Michiel Klaver - IT Professional
       # http://klaver.it/linux/ for the latest version - http://klaver.it/bsd/ for a BSD variant
       #
       # This file should be saved as /etc/sysctl.conf and can be activated using the command:
       # sysctl -e -p /etc/sysctl.conf
       #
       # For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and sysctl.conf(5) for more details.
       #
       # Tested with: Debian 4 etchnhalf kernel version 2.6.24 default stock out-of-the-box
       #              Debian 5 kernel version 2.6.26 default stock out-of-the-box
       #              CentOS 5.4 kernel 2.6.18 default stock out-of-the-box
       
       #
       # Intended use for dedicated server systems at high-speed networks with loads of RAM and bandwidth available
       # Optimised and tuned for high-performance web/ftp/mail/dns servers with high connection-rates
       # DO NOT USE at busy networks or xDSL/Cable connections where packetloss can be expected
       # ----------
       
       # Credits:
       # http://www.enigma.id.au/linux_tuning.txt
       # http://www.securityfocus.com/infocus/1729
       # http://fasterdata.es.net/TCP-tuning/linux.html
       # http://fedorahosted.org/ktune/browser/sysctl.ktune
       # http://www.cymru.com/Documents/ip-stack-tuning.html
       # http://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt
       # http://www.frozentux.net/ipsysctl-tutorial/chunkyhtml/index.html
       # http://knol.google.com/k/linux-performance-tuning-and-measurement
       # http://www.cyberciti.biz/faq/linux-kernel-tuning-virtual-memory-subsystem/
       # http://www.redbooks.ibm.com/abstracts/REDP4285.html
       # http://www.speedguide.net/read_articles.php?id=121
       # http://lartc.org/howto/lartc.kernel.obscure.html
       # http://en.wikipedia.org/wiki/Sysctl
       
       
       ###
       ### GENERAL SYSTEM SECURITY OPTIONS ###
       ###
       
       # Disable core dumps for SUID programs
       fs.suid_dumpable = 0
       
       # Auto-reboot linux 30 seconds after a kernel panic
       kernel.panic = 30
       kernel.panic_on_oops = 30
       
       # Controls the System Request debugging functionality of the kernel
       kernel.sysrq = 0
       
       # Controls whether core dumps will append the PID to the core filename.
       # Useful for debugging multi-threaded applications.
       kernel.core_uses_pid = 1
       
       #Allow for more PIDs
       kernel.pid_max = 65536
       
       # The contents of /proc/<pid>/maps and smaps files are only visible to
       # readers that are allowed to ptrace() the process
       kernel.maps_protect = 1
       
       #Enable ExecShield protection
       kernel.exec-shield = 1
       kernel.randomize_va_space = 1
       
       # Controls the maximum size of a message, in bytes
       kernel.msgmnb = 65536
       
       # Controls the default maxmimum size of a mesage queue
       kernel.msgmax = 65536
       
       
       
       ###
       ### IMPROVE SYSTEM MEMORY MANAGEMENT ###
       ###
       
       # Increase size of file handles and inode cache
       fs.file-max = 209708
       
       # Do less swapping
       vm.swappiness = 10
       vm.dirty_ratio = 60
       vm.dirty_background_ratio = 2
       
       # specifies the minimum virtual address that a process is allowed to mmap
       vm.mmap_min_addr = 4096
       
       # No overcommitment of available memory
       vm.overcommit_ratio = 0
       vm.overcommit_memory = 0
       
       # Set maximum amount of memory allocated to shm to 256MB
       kernel.shmmax = 268435456
       kernel.shmall = 268435456
       
       # Keep at least 64MB of free RAM space available
       vm.min_free_kbytes = 65536
       
       
       
       ###
       ### GENERAL NETWORK SECURITY OPTIONS ###
       ###
       
       #Prevent SYN attack, enable SYNcookies (they will kick-in when the max_syn_backlog reached)
       net.ipv4.tcp_syncookies = 1
       net.ipv4.tcp_syn_retries = 5
       net.ipv4.tcp_synack_retries = 2
       net.ipv4.tcp_max_syn_backlog = 4096
       
       # Disables packet forwarding
       net.ipv4.ip_forward = 0
       net.ipv4.conf.all.forwarding = 0
       net.ipv4.conf.default.forwarding = 0
       net.ipv6.conf.all.forwarding = 0
       net.ipv6.conf.default.forwarding = 0
       
       # Disables IP source routing
       net.ipv4.conf.all.send_redirects = 0
       net.ipv4.conf.default.send_redirects = 0
       net.ipv4.conf.all.accept_source_route = 0
       net.ipv4.conf.default.accept_source_route = 0
       net.ipv6.conf.all.accept_source_route = 0
       net.ipv6.conf.default.accept_source_route = 0
       
       # Enable IP spoofing protection, turn on source route verification
       net.ipv4.conf.all.rp_filter = 1
       net.ipv4.conf.default.rp_filter = 1
       
       # Disable ICMP Redirect Acceptance
       net.ipv4.conf.all.accept_redirects = 0
       net.ipv4.conf.default.accept_redirects = 0
       net.ipv6.conf.all.accept_redirects = 0
       net.ipv6.conf.default.accept_redirects = 0
       
       # Disable Log Spoofed Packets, Source Routed Packets, Redirect Packets
       net.ipv4.conf.all.log_martians = 0
       net.ipv4.conf.default.log_martians = 0
       
       # Decrease the time default value for tcp_fin_timeout connection
       net.ipv4.tcp_fin_timeout = 15
       
       # Decrease the time default value for connections to keep alive
       net.ipv4.tcp_keepalive_time = 300
       net.ipv4.tcp_keepalive_probes = 5
       net.ipv4.tcp_keepalive_intvl = 15
       
       # Don't relay bootp
       net.ipv4.conf.all.bootp_relay = 0
       
       # Don't proxy arp for anyone
       net.ipv4.conf.all.proxy_arp = 0
       
       # Turn on SACK
       net.ipv4.tcp_dsack = 1
       net.ipv4.tcp_sack = 1
       net.ipv4.tcp_fack = 1
       
       # Turn on the tcp_timestamps
       net.ipv4.tcp_timestamps = 1
       
       # Don't ignore directed pings
       net.ipv4.icmp_echo_ignore_all = 0
       
       # Enable ignoring broadcasts request
       net.ipv4.icmp_echo_ignore_broadcasts = 1
       
       # Enable bad error message Protection
       net.ipv4.icmp_ignore_bogus_error_responses = 1
       
       # Allowed local port range
       #net.ipv4.ip_local_port_range = 16384 65536
       
       # Enable a fix for RFC1337 - time-wait assassination hazards in TCP
       net.ipv4.tcp_rfc1337 = 1
       
       
       
       ###
       ### TUNING NETWORK PERFORMANCE ###
       ###
       
       # Do a 'modprobe tcp_cubic' first
       net.ipv4.tcp_congestion_control = cubic
       
       # Turn on the tcp_window_scaling
       net.ipv4.tcp_window_scaling = 1
       
       # Increase the maximum total buffer-space allocatable
       # This is measured in units of pages (4096 bytes)
       net.ipv4.tcp_mem = 65536 131072 262144
       net.ipv4.udp_mem = 65536 131072 262144
       
       # Increase the read-buffer space allocatable
       net.ipv4.tcp_rmem = 8192 87380 16777216
       net.ipv4.udp_rmem_min = 16384
       net.core.rmem_default = 131072
       net.core.rmem_max = 16777216
       
       # Increase the write-buffer-space allocatable
       net.ipv4.tcp_wmem = 8192 65536 16777216
       net.ipv4.udp_wmem_min = 16384
       net.core.wmem_default = 131072
       net.core.wmem_max = 16777216
       
       # Increase number of incoming connections
       net.core.somaxconn = 32768
       
       # Increase number of incoming connections backlog
       net.core.netdev_max_backlog = 4096
       net.core.dev_weight = 64
       
       # Increase the maximum amount of option memory buffers
       net.core.optmem_max = 65536
       
       # Increase the maximum number of skb-heads to be cached
       #net.core.hot_list_length = 1024
       
       # Increase the tcp-time-wait buckets pool size to prevent simple DOS attacks
       net.ipv4.tcp_max_tw_buckets = 1440000
       net.ipv4.tcp_tw_recycle = 1
       net.ipv4.tcp_tw_reuse = 1
       
       # Limit number of orphans, each orphan can eat up to 16M (max wmem) of unswappable memory
       net.ipv4.tcp_max_orphans = 16384
       net.ipv4.tcp_orphan_retries = 0
       
       # Increase the maximum memory used to reassemble IP fragments
       net.ipv4.ipfrag_high_thresh = 512000
       net.ipv4.ipfrag_low_thresh = 446464
       
       # don't cache ssthresh from previous connection
       net.ipv4.tcp_no_metrics_save = 1
       net.ipv4.tcp_moderate_rcvbuf = 1
       
       # Increase RPC slots
       sunrpc.tcp_slot_table_entries = 32
       sunrpc.udp_slot_table_entries = 32
       
       # Increase size of RPC datagram queue length
       net.unix.max_dgram_qlen = 50
       
       # Don't allow the arp table to become bigger than this
       net.ipv4.neigh.default.gc_thresh3 = 2048
       
       # Tell the gc when to become aggressive with arp table cleaning.
       # Adjust this based on size of the LAN. 1024 is suitable for most /24 networks
       net.ipv4.neigh.default.gc_thresh2 = 1024
       
       # Adjust where the gc will leave arp table alone - set to 32.
       net.ipv4.neigh.default.gc_thresh1 = 32
       
       # Adjust to arp table gc to clean-up more often
       net.ipv4.neigh.default.gc_interval = 30
       
       # Increase TCP queue length
       net.ipv4.neigh.default.proxy_qlen = 96
       net.ipv4.neigh.default.unres_qlen = 6
       
       # Enable Explicit Congestion Notification (RFC 3168), disable it if it doesn't work for you
       net.ipv4.tcp_ecn = 1
       net.ipv4.tcp_ecn = 2
       net.ipv4.tcp_reordering = 3
       
       # How many times to retry killing an alive TCP connection
       net.ipv4.tcp_retries2 = 15
       net.ipv4.tcp_retries1 = 3
       
       # This will enusre that immediatly subsequent connections use the new values
       net.ipv4.route.flush = 1
       net.ipv6.route.flush = 1
       
       --------------- /etc/sysctl.conf ---------------
       
       # cp -p /etc/sysctl.conf /etc/sysctl.conf.modified

Ueberprüfe die Rechte des Files "/etc/sysctl.conf":

       # ls -al /etc/sysctl.conf
       -rw-r--r--. 1 root root 8271 Jun  2 20:17 /etc/sysctl.conf

Konfiguration: Hinzufügen des "epel" Repositorie

Die Repositories resp. die Standard Repositories eines CentOS 7 befindet sich im folgenden Verzeichnis:

       /etc/yum.repos.d/

Wenn nachträglich zusätzliche Software installiert werden soll können zusätzliche Repositories installiert werden. Ein nützliches Repository stellt "epel" dar. Dieses wird folgendermassen installiert:

       # cd /root
       # wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
       # rpm -ivh epel-release-7-5.noarch.rpm
       # rm -rf epel-release-7-5.noarch.rpm 
       # yum repolist
       Loaded plugins: fastestmirror
       Loading mirror speeds from cached hostfile
        * base: mirror.switch.ch
        * epel: epel.check-update.co.uk
        * extras: mirror.switch.ch
        * updates: mirror.switch.ch
       repo id                                repo name                                                             status
       base/7/x86_64                          CentOS-7 - Base                                                       8,652
       epel/x86_64                            Extra Packages for Enterprise Linux 7 - x86_64                        7,990
       extras/7/x86_64                        CentOS-7 - Extras                                                       128
       updates/7/x86_64 

Konfiguration: Aufliste der installierten Packages

Dies Liste der installierten Packages nach unserer Installation sieht basierend auf CentOS 7 minimal Installation folgendermassen aus:

       # rpm -q --all
       kernel-3.10.0-229.el7.x86_64
       centos-release-7-1.1503.el7.centos.2.8.x86_64
       filesystem-3.2-18.el7.x86_64
       ncurses-base-5.9-13.20130511.el7.noarch
       biosdevname-0.6.1-2.el7.x86_64
       linux-firmware-20140911-0.1.git365e80c.el7.noarch
       microcode_ctl-2.1-10.el7.x86_64
       glibc-common-2.17-78.el7.x86_64
       parted-3.1-20.el7.x86_64
       glibc-2.17-78.el7.x86_64
       authconfig-6.2.8-9.el7.x86_64
       libstdc++-4.8.3-9.el7.x86_64
       passwd-0.79-4.el7.x86_64
       bash-4.2.46-12.el7.x86_64
       xfsprogs-3.2.1-6.el7.x86_64
       pcre-8.32-14.el7.x86_64
       btrfs-progs-3.16.2-1.el7.x86_64
       zlib-1.2.7-13.el7.x86_64
       tar-1.26-29.el7.x86_64
       audit-libs-2.4.1-5.el7.x86_64
       iwl6000g2b-firmware-17.168.5.2-36.el7.noarch
       sed-4.2.2-5.el7.x86_64
       iwl6000-firmware-9.221.4.1-36.el7.noarch
       popt-1.13-16.el7.x86_64
       iwl7260-firmware-22.0.7.0-36.el7.noarch
       libcom_err-1.42.9-7.el7.x86_64
       iwl1000-firmware-39.31.5.1-36.el7.noarch
       libdb-5.3.21-17.el7_0.1.x86_64
       iwl105-firmware-18.168.6.1-36.el7.noarch
       bzip2-libs-1.0.6-12.el7.x86_64
       ivtv-firmware-20080701-26.el7.noarch
       grep-2.20-1.el7.x86_64
       iwl4965-firmware-228.61.2.24-36.el7.noarch
       libffi-3.0.13-11.el7.x86_64
       iwl100-firmware-39.31.5.1-36.el7.noarch
       libgpg-error-1.12-3.el7.x86_64
       iwl135-firmware-18.168.6.1-36.el7.noarch
       libacl-2.2.51-12.el7.x86_64
       gpg-pubkey-f4a80eb5-53a7ff4b
       cpio-2.11-22.el7.x86_64
       nss-util-3.18.0-1.el7_1.x86_64
       libnl3-3.2.21-8.el7.x86_64
       libblkid-2.23.2-22.el7_1.x86_64
       libgcrypt-1.5.3-12.el7_1.1.x86_64
       sqlite-3.7.17-4.el7.x86_64
       systemd-208-20.el7_1.3.x86_64
       libcap-ng-0.7.3-5.el7.x86_64
       dracut-033-241.el7_1.1.x86_64
       libidn-1.28-3.el7.x86_64
       systemd-sysv-208-20.el7_1.3.x86_64
       gmp-6.0.0-11.el7.x86_64
       nss-sysinit-3.18.0-2.2.el7_1.x86_64
       file-5.11-21.el7.x86_64
       selinux-policy-3.13.1-23.el7_1.7.noarch
       libnl3-cli-3.2.21-8.el7.x86_64
       kernel-tools-libs-3.10.0-229.4.2.el7.x86_64
       cyrus-sasl-lib-2.1.26-17.el7.x86_64
       openssl-libs-1.0.1e-42.el7.4.x86_64
       groff-base-1.22.2-8.el7.x86_64
       openssh-server-6.6.1p1-12.el7_1.x86_64
       libunistring-0.9.3-9.el7.x86_64
       openssl-1.0.1e-42.el7.4.x86_64
       diffutils-3.3-4.el7.x86_64
       kernel-tools-3.10.0-229.4.2.el7.x86_64
       xz-5.1.2-9alpha.el7.x86_64
       nss-tools-3.18.0-2.2.el7_1.x86_64
       libnfnetlink-1.0.1-4.el7.x86_64
       kexec-tools-2.0.7-19.el7_1.2.x86_64
       newt-0.52.15-4.el7.x86_64
       dracut-config-rescue-033-241.el7_1.1.x86_64
       libdaemon-0.14-7.el7.x86_64
       libgudev1-208-20.el7_1.3.x86_64
       gdbm-1.10-8.el7.x86_64
       binutils-2.23.52.0.1-30.el7_1.2.x86_64
       pciutils-libs-3.2.1-4.el7.x86_64
       tzdata-2015d-1.el7.noarch
       libtasn1-3.8-2.el7.x86_64
       bind-libs-9.9.4-18.el7_1.1.x86_64
       net-tools-2.0-0.17.20131004git.el7.x86_64
       libteam-1.15-1.el7.x86_64
       epel-release-7-5.noarch
       glib2-2.40.0-4.el7.x86_64
       shared-mime-info-1.1-7.el7.x86_64
       dbus-glib-0.100-7.el7.x86_64
       gobject-introspection-1.36.0-4.el7.x86_64
       vim-minimal-7.4.160-1.el7.x86_64
       elfutils-libs-0.160-1.el7.x86_64
       avahi-libs-0.6.31-14.el7.x86_64
       pinentry-0.8.1-14.el7.x86_64
       make-3.82-21.el7.x86_64
       ncurses-5.9-13.20130511.el7.x86_64
       libproxy-0.4.11-6.el7.x86_64
       libmnl-1.0.3-7.el7.x86_64
       iptables-1.4.21-13.el7.x86_64
       ustr-1.0.4-16.el7.x86_64
       libverto-0.2.5-4.el7.x86_64
       krb5-libs-1.12.2-14.el7.x86_64
       libcurl-7.29.0-19.el7.x86_64
       gzip-1.5-7.el7.x86_64
       cracklib-dicts-2.9.0-11.el7.x86_64
       libpwquality-1.2.3-4.el7.x86_64
       pam-1.1.8-12.el7.x86_64
       openldap-2.4.39-6.el7.x86_64
       libutempter-1.1.6-4.el7.x86_64
       python-2.7.5-16.el7.x86_64
       dbus-python-1.1.1-9.el7.x86_64
       gettext-0.18.2.1-4.el7.x86_64
       dhcp-libs-4.2.5-36.el7.centos.x86_64
       procps-ng-3.3.10-3.el7.x86_64
       python-slip-0.4.0-2.el7.noarch
       yum-metadata-parser-1.1.4-10.el7.x86_64
       python-configobj-4.7.2-7.el7.noarch
       newt-python-0.52.15-4.el7.x86_64
       python-backports-ssl_match_hostname-3.4.0.2-4.el7.noarch
       python-pyudev-0.15-6.el7.noarch
       python-pycurl-7.19.0-17.el7.x86_64
       grubby-8.28-11.el7.x86_64
       logrotate-3.8.6-4.el7.x86_64
       kmod-14-10.el7.x86_64
       alsa-lib-1.0.28-2.el7.x86_64
       mariadb-libs-5.5.41-2.el7_0.x86_64
       fipscheck-1.4.1-5.el7.x86_64
       dmidecode-2.12-5.el7.x86_64
       qrencode-libs-3.4.1-3.el7.x86_64
       device-mapper-libs-1.02.93-3.el7.x86_64
       iputils-20121221-6.el7.x86_64
       device-mapper-event-libs-1.02.93-3.el7.x86_64
       polkit-0.112-5.el7.x86_64
       os-prober-1.58-5.el7.x86_64
       cronie-1.4.11-13.el7.x86_64
       grub2-tools-2.02-0.16.el7.centos.x86_64
       lvm2-libs-2.02.115-3.el7.x86_64
       gnutls-3.3.8-12.el7.x86_64
       libsoup-2.46.0-3.el7.x86_64
       libpciaccess-0.13.1-4.1.el7.x86_64
       fxload-2002_04_11-16.el7.x86_64
       alsa-tools-firmware-1.0.27-4.el7.x86_64
       kpartx-0.4.9-77.el7.x86_64
       pth-2.0.7-22.el7.x86_64
       rpm-build-libs-4.11.1-25.el7.x86_64
       gpgme-1.3.2-5.el7.x86_64
       yum-plugin-fastestmirror-1.1.31-29.el7.noarch
       libaio-0.3.109-12.el7.x86_64
       hardlink-1.0-19.el7.x86_64
       plymouth-scripts-0.8.9-0.13.20140113.el7.centos.x86_64
       libpipeline-1.2.3-3.el7.x86_64
       jansson-2.4-6.el7.x86_64
       kbd-legacy-1.15.5-11.el7.noarch
       kbd-1.15.5-11.el7.x86_64
       teamd-1.15-1.el7.x86_64
       rsyslog-7.4.7-7.el7_0.x86_64
       rdma-7.1_3.17-5.el7.noarch
       grub2-2.02-0.16.el7.centos.x86_64
       libgcc-4.8.3-9.el7.x86_64
       lvm2-2.02.115-3.el7.x86_64
       setup-2.8.71-5.el7.noarch
       audit-2.4.1-5.el7.x86_64
       basesystem-10.0-7.el7.centos.noarch
       tuned-2.4.1-1.el7.noarch
       kbd-misc-1.15.5-11.el7.noarch
       aic94xx-firmware-30-6.el7.noarch
       nss-softokn-freebl-3.16.2.3-9.el7.x86_64
       xz-libs-5.1.2-9alpha.el7.x86_64
       ncurses-libs-5.9-13.20130511.el7.x86_64
       sudo-1.8.6p7-13.el7.x86_64
       libsepol-2.1.9-3.el7.x86_64
       e2fsprogs-1.42.9-7.el7.x86_64
       libselinux-2.2.2-6.el7.x86_64
       iprutils-2.4.3-3.el7.x86_64
       info-5.1-4.el7.x86_64
       libsysfs-2.1.0-16.el7.x86_64
       rootfiles-8.1-11.el7.noarch
       iwl6000g2a-firmware-17.168.5.3-36.el7.noarch
       chkconfig-1.3.61-4.el7.x86_64
       iwl2030-firmware-18.168.6.1-36.el7.noarch
       dbus-libs-1.6.12-11.el7.x86_64
       iwl5000-firmware-8.83.5.1_1-36.el7.noarch
       iwl5150-firmware-8.24.2.2-36.el7.noarch
       readline-6.2-9.el7.x86_64
       iwl3945-firmware-15.32.2.9-36.el7.noarch
       gawk-4.0.2-4.el7.x86_64
       iwl2000-firmware-18.168.6.1-36.el7.noarch
       elfutils-libelf-0.160-1.el7.x86_64
       iwl6050-firmware-41.28.5.1-36.el7.noarch
       libattr-2.4.46-12.el7.x86_64
       iwl3160-firmware-22.0.7.0-36.el7.noarch
       libcap-2.22-8.el7.x86_64
       nspr-4.10.8-1.el7_1.x86_64
       libuuid-2.23.2-22.el7_1.x86_64
       expat-2.1.0-8.el7.x86_64
       libmount-2.23.2-22.el7_1.x86_64
       p11-kit-0.20.7-3.el7.x86_64
       systemd-libs-208-20.el7_1.3.x86_64
       lua-5.1.4-14.el7.x86_64
       util-linux-2.23.2-22.el7_1.x86_64
       findutils-4.5.11-3.el7.x86_64
       dracut-network-033-241.el7_1.1.x86_64
       file-libs-5.11-21.el7.x86_64
       nss-3.18.0-2.2.el7_1.x86_64
       tcp_wrappers-libs-7.6-77.el7.x86_64
       libxml2-2.9.1-5.el7_1.2.x86_64
       nss-softokn-3.16.2.3-9.el7.x86_64
       bind-license-9.9.4-18.el7_1.1.noarch
       libassuan-2.1.0-3.el7.x86_64
       ca-certificates-2015.2.4-70.0.el7_1.noarch
       e2fsprogs-libs-1.42.9-7.el7.x86_64
       openssh-6.6.1p1-12.el7_1.x86_64
       which-2.20-7.el7.x86_64
       openssh-clients-6.6.1p1-12.el7_1.x86_64
       libgomp-4.8.3-9.el7.x86_64
       bind-libs-lite-9.9.4-18.el7_1.1.x86_64
       kmod-libs-14-10.el7.x86_64
       selinux-policy-targeted-3.13.1-23.el7_1.7.noarch
       sysvinit-tools-2.88-14.dsf.el7.x86_64
       dnsmasq-2.66-13.el7_1.x86_64
       slang-2.2.4-11.el7.x86_64
       kernel-3.10.0-229.4.2.el7.x86_64
       lzo-2.06-6.el7_0.2.x86_64
       hwdata-0.252-7.8.el7_1.x86_64
       ethtool-3.15-2.el7.x86_64
       libpcap-1.5.3-4.el7_1.2.x86_64
       hostname-3.13-3.el7.x86_64
       freetype-2.4.11-10.el7_1.1.x86_64
       keyutils-libs-1.5.8-3.el7.x86_64
       centos-logos-70.0.6-2.el7.centos.noarch
       p11-kit-trust-0.20.7-3.el7.x86_64
       bind-utils-9.9.4-18.el7_1.1.x86_64
       less-458-8.el7.x86_64
       wget-1.14-10.el7_0.1.x86_64
       nettle-2.7.1-4.el7.x86_64
       pkgconfig-0.27.1-4.el7.x86_64
       libcroco-0.6.8-5.el7.x86_64
       gettext-libs-0.18.2.1-4.el7.x86_64
       gsettings-desktop-schemas-3.8.2-3.el7.x86_64
       libdb-utils-5.3.21-17.el7_0.1.x86_64
       libss-1.42.9-7.el7.x86_64
       mozjs17-17.0.0-10.el7.x86_64
       libselinux-utils-2.2.2-6.el7.x86_64
       libedit-3.0-12.20121213cvs.el7.x86_64
       libmodman-2.0.1-8.el7.x86_64
       snappy-1.1.0-3.el7.x86_64
       libnetfilter_conntrack-1.0.4-2.el7.x86_64
       iproute-3.10.0-21.el7.x86_64
       libsemanage-2.1.10-16.el7.x86_64
       libssh2-1.4.3-8.el7.x86_64
       curl-7.29.0-19.el7.x86_64
       cracklib-2.9.0-11.el7.x86_64
       rpm-libs-4.11.1-25.el7.x86_64
       coreutils-8.22-11.el7.x86_64
       shadow-utils-4.1.5.1-18.el7.x86_64
       rpm-4.11.1-25.el7.x86_64
       libuser-0.60-5.el7.x86_64
       python-libs-2.7.5-16.el7.x86_64
       python-decorator-3.4.0-3.el7.noarch
       policycoreutils-2.2.5-15.el7.x86_64
       pygobject3-base-3.8.2-6.el7.x86_64
       dhcp-common-4.2.5-36.el7.centos.x86_64
       libselinux-python-2.2.2-6.el7.x86_64
       python-slip-dbus-0.4.0-2.el7.noarch
       python-iniparse-0.4-9.el7.noarch
       pyliblzma-0.5.3-11.el7.x86_64
       python-backports-1.0-8.el7.x86_64
       python-setuptools-0.9.8-3.el7.noarch
       pyxattr-0.5.1-5.el7.x86_64
       python-urlgrabber-3.10-6.el7.noarch
       avahi-autoipd-0.6.31-14.el7.x86_64
       plymouth-core-libs-0.8.9-0.13.20140113.el7.centos.x86_64
       fipscheck-lib-1.4.1-5.el7.x86_64
       virt-what-1.13-5.el7.x86_64
       device-mapper-1.02.93-3.el7.x86_64
       cryptsetup-libs-1.6.6-3.el7.x86_64
       dbus-1.6.12-11.el7.x86_64
       initscripts-9.49.24-1.el7.x86_64
       polkit-pkla-compat-0.1-4.el7.x86_64
       cronie-anacron-1.4.11-13.el7.x86_64
       crontabs-1.11-6.20121102git.el7.noarch
       device-mapper-event-1.02.93-3.el7.x86_64
       wpa_supplicant-2.0-13.el7_0.x86_64
       trousers-0.3.11.2-3.el7.x86_64
       glib-networking-2.40.0-1.el7.x86_64
       libdrm-2.4.56-2.el7.x86_64
       alsa-firmware-1.0.28-2.el7.noarch
       ebtables-2.0.10-13.el7.x86_64
       libestr-0.1.9-2.el7.x86_64
       gnupg2-2.0.22-3.el7.x86_64
       rpm-python-4.11.1-25.el7.x86_64
       pygpgme-0.3-9.el7.x86_64
       yum-3.4.3-125.el7.centos.noarch
       device-mapper-persistent-data-0.4.1-2.el7.x86_64
       plymouth-0.8.9-0.13.20140113.el7.centos.x86_64
       json-c-0.11-4.el7_0.x86_64
       libndp-1.2-4.el7.x86_64
       ppp-2.4.5-33.el7.x86_64
       numactl-libs-2.0.9-4.el7.x86_64
       dhclient-4.2.5-36.el7.centos.x86_64
       irqbalance-1.0.7-1.el7.x86_64
       man-db-2.6.3-9.el7.x86_64

Konfiguration: Installation des Plug-In "yum-priorities"

Unter normalen Umständen wenn ein "yum update" ausgeführt wird, werden alle Packages ohne Rücksicht auf Kompatibilität auf den neusten Stand gebracht. Wenn später RPM Packages installiert werden die Ihre Kompatibilität auf den "Core" Packages bauen kann dies bei einem Update (yum update) Probleme verursachen da keine Rückwärtskompatiblität gewährleistet ist zB auf den Libraries. Um diese zu verhindern kann das Package "yum-priorities" installiert werden. Anhand der Konfiguration innerhalb der Repo Files (priority=) werden den verschiedenen Container Prioritäten vergeben. Dabei sollte folgendes gelten:

      priority=1         [base], [addons], [updates], [extras] 
      
      priority=2         [centosplus],[contrib]
      
      priority=10        Third Party Repositories

Weitere Informationen findet man auch unter folgenden Link:

      http://wiki.centos.org/PackageManagement/Yum/Priorities?highlight=%28priorities%29

Führe die Installation von "yum-priorities" aus:

      # yum -y update

Lösche alle "yum update" Informationen

      # yum clean all

Installiere das Package:

      # yum install yum-priorities

Folgender Befehl gibt Auskunft über die Repo Liste sowie ob diese aktiviert/deaktivert ist (enabled=1/0):

      # yum repolist all
      Loaded plugins: fastestmirror, priorities
      Loading mirror speeds from cached hostfile
       * base: mirror.switch.ch
       * epel: ftp.fi.muni.cz
       * extras: mirror.switch.ch
       * updates: mirror.switch.ch
      repo id                         repo name                                                            status
      C7.0.1406-base/x86_64           CentOS-7.0.1406 - Base                                               disabled
      C7.0.1406-centosplus/x86_64     CentOS-7.0.1406 - CentOSPlus                                         disabled
      C7.0.1406-extras/x86_64         CentOS-7.0.1406 - Extras                                             disabled
      C7.0.1406-fasttrack/x86_64      CentOS-7.0.1406 - CentOSPlus                                         disabled
      C7.0.1406-updates/x86_64        CentOS-7.0.1406 - Updates                                            disabled
      base/7/x86_64                   CentOS-7 - Base                                                      enabled: 8,652
      base-debuginfo/x86_64           CentOS-7 - Debuginfo                                                 disabled
      base-source/7                   CentOS-7 - Base Sources                                              disabled
      centosplus/7/x86_64             CentOS-7 - Plus                                                      disabled
      centosplus-source/7             CentOS-7 - Plus Sources                                              disabled
      cr/7/x86_64                     CentOS-7 - cr                                                        disabled
      epel/x86_64                     Extra Packages for Enterprise Linux 7 - x86_64                       enabled: 7,990
      epel-debuginfo/x86_64           Extra Packages for Enterprise Linux 7 - x86_64 - Debug               disabled
      epel-source/x86_64              Extra Packages for Enterprise Linux 7 - x86_64 - Source              disabled
      epel-testing/x86_64             Extra Packages for Enterprise Linux 7 - Testing - x86_64             disabled
      epel-testing-debuginfo/x86_64   Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Debug     disabled
      epel-testing-source/x86_64      Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Source    disabled
      extras/7/x86_64                 CentOS-7 - Extras                                                    enabled:   128
      extras-source/7                 CentOS-7 - Extras Sources                                            disabled
      fasttrack/7/x86_64              CentOS-7 - fasttrack                                                 disabled
      updates/7/x86_64                CentOS-7 - Updates                                                   enabled:   601
      updates-source/7                CentOS-7 - Updates Sources                                           disabled
      repolist: 17,371

Nun vergebe jedem existierenden Repo file in "/etc/yum.repos.d" die entsprechende "priority=" sowie achte darauf ob ein entsprechenden Container "enabled=" aktiviert oder deaktiviert ist. Es ist wichtig auch den Container die deaktiviert sind "enabled=0" eine Priorität zu vergeben für den Fall das der Container später aktiviert wird (enabled=1):

Durch den folgenden Eintrag im File "priorities.conf" wird "yum-priorities" aktiviert:

       # vi /etc/yum/pluginconf.d/priorities.conf
       
       --------------- /etc/yum/pluginconf.d/priorities.conf ---------------
       
       [main]
       enabled = 1
       
       --------------- /etc/yum/pluginconf.d/priorities.conf ---------------
       # vi /etc/yum.repos.d/CentOS-Base.repo 
       
       --------------- /etc/yum.repos.d/CentOS-Base.repo ---------------
       
       # CentOS-Base.repo
       #
       # The mirror system uses the connecting IP address of the client and the
       # update status of each mirror to pick mirrors that are updated to and
       # geographically close to the client.  You should use this for CentOS updates
       # unless you are manually picking other mirrors.
       #
       # If the mirrorlist= does not work for you, as a fall back you can try the
       # remarked out baseurl= line instead.
       #
       #
       
       [base]
       name=CentOS-$releasever - Base
       mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
       #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
       gpgcheck=1
       gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       priority=1
       
       #released updates
       [updates]
       name=CentOS-$releasever - Updates
       mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
       #baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
       gpgcheck=1
       gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       priority=1
       
       #additional packages that may be useful
       [extras]
       name=CentOS-$releasever - Extras
       mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
       #baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
       gpgcheck=1
       gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       priority=1
       
       #additional packages that extend functionality of existing packages
       [centosplus]
       name=CentOS-$releasever - Plus
       mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
       #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
       gpgcheck=1
       enabled=0
       gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       priority=2
       
       --------------- /etc/yum.repos.d/CentOS-Base.repo ---------------

Das nachfolgende File existiert nicht im Verzeichins "/etc/yum.repos.d/" jedoch ist dieses File Wichtig denn wenn von einem Media ein Package installiert wird soll "yum-priorities" auch greifen:

       # vi /etc/yum.repos.d/CentOS-Media.repo
       
       --------------- /etc/yum.repos.d/CentOS-Media.repo ---------------
       
       # CentOS-Media.repo
       #
       # This repo is used to mount the default locations for a CDROM / DVD on
       #  CentOS-5.  You can use this repo and yum to install items directly off the
       #  DVD ISO that we release.
       #
       # To use this repo, put in your DVD and use it with the other repos too:
       #  yum --enablerepo=c7-media [command]
       #
       # or for ONLY the media repo, do this:
       #
       #  yum --disablerepo=\* --enablerepo=c7-media [command]
       
       [c5-media]
       name=CentOS-$releasever - Media
       baseurl=file:///media/CentOS/
        file:///media/cdrom/
        file:///media/cdrecorder/
       gpgcheck=1
       enabled=0
       gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
       priority=2
       
       --------------- /etc/yum.repos.d/CentOS-Media.repo ---------------

Ueberprüfe die Rechte des Files "/etc/yum.repos.d/CentOS-Media.repo":

       # ls -la /etc/yum.repos.d/CentOS-Media.repo
       -rw-r--r-- 1 root root 620 Jun  3 09:48 /etc/yum.repos.d/CentOS-Media.repo

Achte darauf das alle Repo Files mit den entsprechenden Einträgen versehen werden wie zB "epel" Repo:

       # vi /etc/yum.repos.d/epel.repo 
       
       --------------- /etc/yum.repos.d/epel.repo ---------------
       
       [epel]
       name=Extra Packages for Enterprise Linux 7 - $basearch
       #baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch
       mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
       failovermethod=priority
       enabled=1
       gpgcheck=1
       gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
       priority=10
       
       [epel-debuginfo]
       name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
       #baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch/debug
       mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch
       failovermethod=priority
       enabled=0
       gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
       gpgcheck=1
       priority=10
       
       [epel-source]
       name=Extra Packages for Enterprise Linux 7 - $basearch - Source
       #baseurl=http://download.fedoraproject.org/pub/epel/7/SRPMS
       mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch
       failovermethod=priority
       enabled=0
       gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
       gpgcheck=1
       priority=10
       
       --------------- /etc/yum.repos.d/epel.repo ---------------
       # vi /etc/yum.repos.d/epel-testing.repo 
       
       --------------- /etc/yum.repos.d/epel-testing.repo ---------------
       
       [epel-testing]
       name=Extra Packages for Enterprise Linux 7 - Testing - $basearch
       #baseurl=http://download.fedoraproject.org/pub/epel/testing/7/$basearch
       mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-epel7&arch=$basearch
       failovermethod=priority
       enabled=0
       gpgcheck=1
       gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
       priority=10
       
       [epel-testing-debuginfo]
       name=Extra Packages for Enterprise Linux 7 - Testing - $basearch - Debug
       #baseurl=http://download.fedoraproject.org/pub/epel/testing/7/$basearch/debug
       mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel7&arch=$basearch
       failovermethod=priority
       enabled=0
       gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
       gpgcheck=1
       priority=10
       
       [epel-testing-source]
       name=Extra Packages for Enterprise Linux 7 - Testing - $basearch - Source
       #baseurl=http://download.fedoraproject.org/pub/epel/testing/7/SRPMS
       mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel7&arch=$basearch
       failovermethod=priority
       enabled=0
       gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
       gpgcheck=1
       priority=10
       
       --------------- /etc/yum.repos.d/epel-testing.repo ---------------

Nun kann anhand eines "yum update" überprüft werden ob "yum-priorities" greift und korrekt konfiguriert ist:

       # yum update
       Loaded plugins: fastestmirror, priorities
       base                                                                                        | 3.6 kB  00:00:00     
       extras                                                                                      | 3.4 kB  00:00:00     
       updates                                                                                     | 3.4 kB  00:00:00     
       Loading mirror speeds from cached hostfile
        * base: mirror.skylink-datacenter.de
        * epel: ftp.fi.muni.cz
        * extras: mirror.skylink-datacenter.de
        * updates: mirror.skylink-datacenter.de
       65 packages excluded due to repository priority protections
       No packages marked for update

Ueberprüfe nach der Konfiguration welche Container aktiviert wurden und welche deaktiviert sind sowie ob "yum-priorities" greift:

       # yum repolist all
       Loaded plugins: fastestmirror, priorities
       Loading mirror speeds from cached hostfile
        * base: ftp.plusline.de
        * epel: ftp.fi.muni.cz
        * extras: mirror.switch.ch
        * updates: mirror.euserv.net
       65 packages excluded due to repository priority protections
       repo id                        repo name                                                          status
       C7.0.1406-base/x86_64          CentOS-7.0.1406 - Base                                             disabled
       C7.0.1406-centosplus/x86_64    CentOS-7.0.1406 - CentOSPlus                                       disabled
       C7.0.1406-extras/x86_64        CentOS-7.0.1406 - Extras                                           disabled
       C7.0.1406-fasttrack/x86_64     CentOS-7.0.1406 - CentOSPlus                                       disabled
       C7.0.1406-updates/x86_64       CentOS-7.0.1406 - Updates                                          disabled
       base/7/x86_64                  CentOS-7 - Base                                                    enabled:    8,652
       base-debuginfo/x86_64          CentOS-7 - Debuginfo                                               disabled
       base-source/7                  CentOS-7 - Base Sources                                            disabled
       c5-media                       CentOS-7 - Media                                                   disabled
       centosplus/7/x86_64            CentOS-7 - Plus                                                    disabled
       centosplus-source/7            CentOS-7 - Plus Sources                                            disabled
       cr/7/x86_64                    CentOS-7 - cr                                                      disabled
       epel/x86_64                    Extra Packages for Enterprise Linux 7 - x86_64                     enabled: 7,925+65
       epel-debuginfo/x86_64          Extra Packages for Enterprise Linux 7 - x86_64 - Debug             disabled
       epel-source/x86_64             Extra Packages for Enterprise Linux 7 - x86_64 - Source            disabled
       epel-testing/x86_64            Extra Packages for Enterprise Linux 7 - Testing - x86_64           disabled
       epel-testing-debuginfo/x86_64  Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Debug   disabled
       epel-testing-source/x86_64     Extra Packages for Enterprise Linux 7 - Testing - x86_64 - Source  disabled
       extras/7/x86_64                CentOS-7 - Extras                                                  enabled:      128
       extras-source/7                CentOS-7 - Extras Sources                                          disabled
       fasttrack/7/x86_64             CentOS-7 - fasttrack                                               disabled
       updates/7/x86_64               CentOS-7 - Updates                                                 enabled:      601
       updates-source/7               CentOS-7 - Updates Sources                                         disabled
       repolist: 17,306

Konfiguration: Modifikation System Shell Templates

Die nachfolgenden Konfigurationen betreffen die Shell sowie die Erstellung eines neuen Users dh. in unserem Fall "sysop". Dieser User wird benutzt um sich über SSH in das System einzuloggen. Das einloggen über SSH anhand des Users "root" wird verhindert und somit muss mit "sysop" eingeloggt werden und anhand "su -" auf User "root" gewechselt werden! Der User "sysop" verfügt über keine entsprechenden Rechte. Wenn ein User auf dem System erstellt wird werden die entsprechenden Profile Templates benutzt um diese in das Homeverzeichnis des Users zu kopieren. Nachfolgend die Manipulation dieser Templates damit die nötigen Aenderungen bereits in den Templates der User enthalten sind:

       # vi /etc/skel/.bashrc
       
       --------------- /etc/skel/.bashrc ---------------
               
       # .bashrc
       
       # User specific aliases and functions
       
       alias rm='rm -i'
       alias cp='cp -i'
       alias mv='mv -i'
       
       # Source global definitions
       if [ -f /etc/bashrc ]; then
               . /etc/bashrc
       fi
       
       # Uncomment the following line if you don't like systemctl's auto-paging feature:
       # export SYSTEMD_PAGER=
       
       # User specific aliases and functions
       
       --------------- /etc/skel/.bashrc ---------------
       # vi /etc/skel/.bash_profile 
       
       --------------- /etc/skel/.bash_profile  ---------------
       
       # .bash_profile
       
       # Get the aliases and functions
       if [ -f ~/.bashrc ]; then
               . ~/.bashrc
       fi
       
       # User specific environment and startup programs
       
       HISTSIZE=1000
       TMOUT=7200
       
       PATH=$PATH:$HOME/.local/bin:$HOME/bin
       BASH_ENV=$HOME/.bashrc
       USERNAME="root"
       
       export USERNAME PATH BASH_ENV
       
       --------------- /etc/skel/.bash_profile  ---------------
       # vi /etc/profile
       
       --------------- /etc/profile ---------------
       
       HOSTNAME=`/usr/bin/hostname 2>/dev/null`
       HISTSIZE=1000
       TMOUT=7200
       
       --------------- /etc/profile ---------------
       # vi /etc/skel/.bash_logout 
       
       --------------- /etc/skel/.bash_logout ---------------
       
       # ~/.bash_logout
       
       clear
       
       --------------- /etc/skel/.bash_logout ---------------

In folgenden File werden die regulären "shell" konfiguriert dh. nur eine Shell die im folgenden File konfiguriert ist darf benutzt werden sowie gilt als reguläre Shell:

       # vi /etc/shells
       
       --------------- /etc/shells ---------------
       
       /bin/sh
       /bin/bash
       /sbin/nologin
       /usr/bin/sh
       /usr/bin/bash
       /usr/sbin/nologin
       
       --------------- /etc/shells ---------------

Ueberprüfe die Rechte des Files "/etc/shells":

       # ls -al /etc/shells
       -rw-r--r--. 1 root root 76 Jun  7 2013 /etc/shells

Konfiguration: Modifikation Home Verzeichnis User "root"

Die Template Files sind vorbereitet. Das Homeverzeichnis sowie die darin enthaltenen Files des User "root" befinden sich im Verzeichnis "/root". Wir passen die entsprechenden Rechte dieses Homeverzeichnis sowie dessen Files an:

       # chown root:root /root
       # chmod 700 /root
       # chown root:root /root/.*
       # chmod 600 /root/.bashrc /root/.bash_profile /root/.bash_logout /root/.cshrc /root/.tcshrc

Konfiguration: Hinzufügen eines neuen User "sysop"

Wir erstellen den User "sysop" der Mitglied ist von der Gruppe "sysop":

       # groupadd -g 200 sysop
       # cat /etc/group | grep sysop
       # useradd -u 200 -g 200 -d /export/sysop -s /bin/bash -c SysOperator sysop
       # cat /etc/passwd | grep sysop
       sysop:x:200:200:SysOperator:/export/sysop:/bin/bash
       # chown sysop:sysop /export/sysop
       # chmod 700 /export/sysop
       # chown root:sysop /export/sysop/.bash*
       # chmod 640 /export/sysop/.bash*
       # vi /export/sysop/.bash_profile 
       
       --------------- /export/sysop/.bash_profile ---------------
       
       # .bash_profile
       
       # Get the aliases and functions
       if [ -f ~/.bashrc ]; then
               . ~/.bashrc
       fi
       
       # User specific environment and startup programs
       
       HISTSIZE=1000
       TMOUT=7200
       
       PATH=$PATH:$HOME/.local/bin:$HOME/bin
       BASH_ENV=$HOME/.bashrc
       USERNAME="sysop"
       
       export USERNAME PATH BASH_ENV
       
       --------------- /export/sysop/.bash_profile ---------------
       # passwd sysop
       Changing password for user sysop.
       New password: 
       Retype new password: 
       passwd: all authentication tokens updated successfully.

Konfiguration: Entfernen von System User und/oder Gruppe

Im "/etc/passwd" sowie "/etc/group" existieren einige User/Gruppen die komplett unnötig sind auf dem System. Diese werden entfernt sowie event. existierenden überflüssig gewordenen Verzeichnisse der User/Gruppe:

       # userdel lp
       # userdel ftp
       # userdel games
       
       # rm -rf /var/lib/games
       # rm -rf /var/games
       # rm -rf /usr/lib/games
       # rm -rf /usr/lib64/games
       # rm -rf /usr/share/games
       # rm -rf /usr/games
       # rm -rf /usr/local/games
       
       # rm -rf /home
       
       # groupdel games
       # groupdel dip
       # groupdel news
       # groupdel dialout
       # groupdel tape
       # groupdel floppy
       # groupdel audio

Nach der Modifikation ergiebt sich in "/etc/passwd" folgendes Bild:

       # cat /etc/passwd
       root:x:0:0:root:/root:/bin/bash
       bin:x:1:1:bin:/bin:/sbin/nologin
       daemon:x:2:2:daemon:/sbin:/sbin/nologin
       adm:x:3:4:adm:/var/adm:/sbin/nologin
       sync:x:5:0:sync:/sbin:/bin/sync
       shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
       halt:x:7:0:halt:/sbin:/sbin/halt
       mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
       operator:x:11:0:operator:/root:/sbin/nologin
       nobody:x:99:99:Nobody:/:/sbin/nologin
       avahi-autoipd:x:170:170:Avahi IPv4LL Stack:/var/lib/avahi-autoipd:/sbin/nologin
       dbus:x:81:81:System message bus:/:/sbin/nologin
       polkitd:x:999:998:User for polkitd:/:/sbin/nologin
       tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
       sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
       sysop:x:200:200:SysOperator:/export/sysop:/bin/bash

Nach der Modifikation ergiebt sich in "/etc/group" folgendes Bild:

       # cat /etc/group
       root:x:0:
       bin:x:1:
       daemon:x:2:
       sys:x:3:
       adm:x:4:
       tty:x:5:
       disk:x:6:
       mem:x:8:
       kmem:x:9:
       wheel:x:10:
       cdrom:x:11:
       mail:x:12:
       man:x:15:
       video:x:39:
       lock:x:54:
       nobody:x:99:
       users:x:100:
       utmp:x:22:
       utempter:x:35:
       avahi-autoipd:x:170:
       ssh_keys:x:999:
       systemd-journal:x:190:
       dbus:x:81:
       polkitd:x:998:
       tss:x:59:
       sshd:x:74:
       sysop:x:200:

Konfiguration: Modifikation der System Password Policy

Nun wenn ein Passwort vergeben wird für einen User zB "sysop" und/oder dieser mit dem definiert Passwort einlogg steuert das File "/etc/pam.d/passwd" welche Restriktionen gelten. Dabei setzen wir die "minimal" Länge eines Passwortes zB 8 sowie wieviel Mal ein User sich mit einem falschen Passwort anmelden kann bevor er vorübergehend ausgesperrt wird (retry=3):

       # vi /etc/pam.d/passwd
       
       --------------- /etc/pam.d/passwd ---------------
       
       #%PAM-1.0
       auth       include      system-auth
       account    include      system-auth
       password   substack     system-auth
       -password   optional    pam_gnome_keyring.so use_authtok
       password   substack     postlogin
       password   required     pam_cracklib.so retry=3 minlen=8
       password   sufficient   pam_unix.so nullok use_authtok md5 shadow
       password   required     pam_deny.so
       
       --------------- /etc/pam.d/passwd ---------------

In dem nachfolgend File werden die #auskommentierten Zeilen ersetzt mit neuen Einträgen:

       # vi /etc/pam.d/system-auth
       
       --------------- /etc/pam.d/system-auth ---------------
       
       #%PAM-1.0
       # This file is auto-generated.
       # User changes will be destroyed the next time authconfig is run.
       auth        required      pam_env.so
       auth        sufficient    pam_unix.so nullok try_first_pass
       auth        requisite     pam_succeed_if.so uid >= 1000 quiet_success
       auth        required      pam_deny.so
       
       account     required      pam_unix.so
       account     sufficient    pam_localuser.so
       #account     sufficient    pam_succeed_if.so uid < 1000 quiet
       account     required      pam_permit.so
       
       password    requisite     pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
       #password    sufficient    pam_unix.so sha512 shadow nullok try_first_pass use_authtok
       password    required      pam_deny.so
       
       session     optional      pam_keyinit.so revoke
       session     required      pam_limits.so
       -session     optional      pam_systemd.so
       session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
       session     required      pam_unix.so
       
       --------------- /etc/pam.d/system-auth ---------------

Konfiguration: Verhindern von ausführen CTRL+ALT+Del

Wenn man über Console verbunden ist mit dem System und ein User führt "CTRL+ALT+Del" aus so wird ein Neustart des Servers ausgeführt. Dies möchte man verhindern. Für tiefere Versionen von CentOS wird das im File "/etc/inittab" konfiguriert. Dieses File wird jedoch unter CentOS 7 nicht mehr benutzt. Um "CTRL+ALT+Del" zu verhindern muss das entsprechende "systemctl" neu verlinkt werden und zwar zu "/dev/null". Dies bedeutet: "CTRL+ALT+Del" kann zwar ausgeführt werden jedoch das Script wird zu "/dev/null" gesendet dh. es wird nichts ausgegührt:

       # ln -s /dev/null /etc/systemd/system/ctrl-alt-del.target

Konfiguration: Modifikation Schnittstelle "securetty"

Im nachfolgenden File wird definiert welche Schnittstellen für zB "getty", "aggetty" zur Verfügung stehen:


       # vi /etc/securetty 
       
       --------------- /etc/securetty ---------------
       
       console
       vc/1
       #vc/2
       #vc/3
       #vc/4
       #vc/5
       #vc/6
       #vc/7
       #vc/8
       #vc/9
       #vc/10
       #vc/11
       tty1
       #tty2
       #tty3
       #tty4
       #tty5
       #tty6
       #tty7
       #tty8
       #tty9
       #tty10
       #tty11
       ttyS0
       ttyS1
       ttysclp0
       sclp_line0
       3270/tty1
       hvc0
       #hvc1
       #hvc2
       #hvc3
       #hvc4
       #hvc5
       #hvc6
       #hvc7
       
       --------------- /etc/securetty ---------------

Konfiguration: Hinzufügen eines Login Banners

Wenn ein User sich einloggt dh. über SSH, Console etc. kann ein Banner konfiguriert werden der diesem User angzeigt wird. Dieser Banner wird im File "/etc/issue" definiert. Für SSH muss dieser Banner im File "/etc/sshd_config" definiert werden was später durchgeführt wird:

       # vi /etc/issue
       
       --------------- /etc/issue ---------------
       
       #
       # WARNING:      You must have prior authorization to access this system.
       #               All connections are logged and monitored. By connecting
       #               to this system you fully consent to all monitoring.
       #               Unauthorized access or use will be prosecuted to the
       #               full extent of the law. You have been warned!
       #
       
       --------------- /etc/issue ---------------

Konfiguration: Modifikation SSH Server/Client

Auf dem CentOS 7 System ist OpenSSH installiert. Das Konfig File des SSH Servers (OpenSSH) definiert wie sich der SSH Server verhalten soll. Dies bedeutet: Wir konfigurieren das der SSH Server nicht mehr auf Allen IP's hört (LISTEN) sondern auf der spezifischen Server IP. Ebenso erlauben wir nur Login's für den User "sysop" sowie definieren den Banner. Wichtig ist auch nur das SSH 2 Protokoll zu erlauben. Weitere gesetzte Optionen können anhand der Optionen eruiert werden jedoch handelt es sich um Restriktionen die ausschliesslich ein Login erlaubt auf SSH Ebene dh. kein Rhosts, X11 Forwarding etc.:

       NOTE Folgende Seite resp. Link gibt Auskunft wie ein SSH Server/Client mit einem "hardening" versehen wird. Dies ist insofern
            dann Wichtig, wenn der SSH Server public erreichbar ist. Einige der Konfgurationen sind in dieser Dokumentation enthalten
            andere aus "Kompatibilitätsgründen" nicht. Von daher ist es wichtig, wenn diese Konfiguration durchgeführt wird auf den
            Server lokal zugriff zu haben um auszuschliessen das ein "Ungewollter Ausschluss" durch das "hardening" durchgeführt wird:
            
            https://stribika.github.io/2015/01/04/secure-secure-shell.html
       # vi /etc/ssh/sshd_config
       
       --------------- /etc/ssh/sshd_config ---------------
       
       #       $OpenBSD: sshd_config,v 1.93 2014/01/10 05:59:19 djm Exp $
       
       # This is the sshd server system-wide configuration file.  See
       # sshd_config(5) for more information.
       
       # This sshd was compiled with PATH=/usr/local/bin:/usr/bin
       
       # The strategy used for options in the default sshd_config shipped with
       # OpenSSH is to specify options with their default value where
       # possible, but leave them commented.  Uncommented options override the
       # default value.
       
       # If you want to change the port on a SELinux system, you have to tell
       # SELinux about this change.
       # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER
       #
       Port 22
       #Protocol 2,1
       Protocol 2
       #AddressFamily any
       ListenAddress 198.18.0.19
       #ListenAddress ::
       
       # Allow only certain Users to Login
       AllowUsers sysop
       
       # HostKey for protocol version 1
       #HostKey /etc/ssh/ssh_host_key
       # HostKeys for protocol version 2
       HostKey /etc/ssh/ssh_host_rsa_key
       #HostKey /etc/ssh/ssh_host_dsa_key
       
       # Lifetime and size of ephemeral version 1 server key
       #KeyRegenerationInterval 1h
       #ServerKeyBits 768
       
       # Logging
       # obsoletes QuietMode and FascistLogging
       #SyslogFacility AUTH
       SyslogFacility AUTHPRIV
       #LogLevel INFO
       
       # Authentication:
       
       #LoginGraceTime 2m
       PermitRootLogin no
       StrictModes yes
       #MaxAuthTries 6
       
       RSAAuthentication no
       #PubkeyAuthentication yes
       #AuthorizedKeysFile     .ssh/authorized_keys
       
       # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
       RhostsRSAAuthentication no
       # similar for protocol version 2
       #HostbasedAuthentication no
       # Change to yes if you don't trust ~/.ssh/known_hosts for
       # RhostsRSAAuthentication and HostbasedAuthentication
       #IgnoreUserKnownHosts no
       # Don't read the user's ~/.rhosts and ~/.shosts files
       IgnoreRhosts yes
       
       # To disable tunneled clear text passwords, change to no here!
       PasswordAuthentication yes
       PermitEmptyPasswords no
       PasswordAuthentication yes
       
       # Change to no to disable s/key passwords
       #ChallengeResponseAuthentication yes
       ChallengeResponseAuthentication no
       
       # Kerberos options
       KerberosAuthentication no
       #KerberosOrLocalPasswd yes
       #KerberosTicketCleanup yes
       #KerberosGetAFSToken no
       
       # GSSAPI options
       #GSSAPIAuthentication no
       GSSAPIAuthentication yes
       #GSSAPICleanupCredentials yes
       GSSAPICleanupCredentials yes
       
       # Set this to 'yes' to enable PAM authentication, account processing,
       # and session processing. If this is enabled, PAM authentication will
       # be allowed through the ChallengeResponseAuthentication mechanism.
       # Depending on your PAM configuration, this may bypass the setting of
       # PasswordAuthentication, PermitEmptyPasswords, and
       # "PermitRootLogin without-password". If you just want the PAM account and
       # session checks to run without PAM authentication, then enable this but set
       # ChallengeResponseAuthentication=no
       #UsePAM no
       UsePAM yes
       
       # Accept locale-related environment variables
       AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
       AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
       AcceptEnv LC_IDENTIFICATION LC_ALL
       #AllowTcpForwarding yes
       #GatewayPorts no
       X11Forwarding no
       #X11Forwarding yes
       #X11DisplayOffset 10
       #X11UseLocalhost yes
       #PrintMotd yes
       #PrintLastLog yes
       #TCPKeepAlive yes
       #UseLogin no
       #UsePrivilegeSeparation yes
       #PermitUserEnvironment no
       #Compression delayed
       #ClientAliveInterval 0
       #ClientAliveCountMax 3
       #ShowPatchLevel no
       #UseDNS yes
       #PidFile /var/run/sshd.pid
       #MaxStartups 10
       #PermitTunnel no
       #ChrootDirectory none
       
       # no default banner path
       Banner /etc/issue
       
       # override default of no subsystems
       Subsystem       sftp    /usr/libexec/openssh/sftp-server
       
       --------------- /etc/ssh/sshd_config ---------------

Auf der Installation des CentOS 7 läuft ebenfalls der "Client" von SSH (OpenSSH). Auch hier definieren wir analog des Servers die entsprechenden Punkte:

       # vi /etc/ssh/ssh_config
       
       --------------- /etc/ssh/ssh_config ---------------
       
       #       $OpenBSD: ssh_config,v 1.28 2013/09/16 11:35:43 sthen Exp $
       
       # This is the ssh client system-wide configuration file.  See
       # ssh_config(5) for more information.  This file provides defaults for
       # users, and the values can be changed in per-user configuration files
       # or on the command line.
       
       # Configuration data is parsed as follows:
       #  1. command line options
       #  2. user-specific file
       #  3. system-wide file
       # Any configuration value is only changed the first time it is set.
       # Thus, host-specific definitions should be at the beginning of the
       # configuration file, and defaults at the end.
       
       # Site-wide defaults for some commonly used options.  For a comprehensive
       # list of available options, their meanings and defaults, please see the
       # ssh_config(5) man page.
       
       # Host *
       #   ForwardAgent no
       ForwardX11 no
       #   RhostsRSAAuthentication no
       #   RSAAuthentication yes
       #   PasswordAuthentication yes
       #   HostbasedAuthentication no
       #   BatchMode no
       #   CheckHostIP yes
       #   AddressFamily any
       #   ConnectTimeout 0
       #   StrictHostKeyChecking ask
       #   IdentityFile ~/.ssh/identity
       #   IdentityFile ~/.ssh/id_rsa
       #   IdentityFile ~/.ssh/id_dsa
       Port 22
       Protocol 2
       #   Cipher 3des
       #   Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
       #   EscapeChar ~
       #   Tunnel no
       #   TunnelDevice any:any
       #   PermitLocalCommand no
       Host *
               GSSAPIAuthentication yes
       # If this option is set to yes then remote X11 clients will have full access
       # to the original X11 display. As virtually no X11 client supports the untrusted
       # mode correctly we set this to yes.
               ForwardX11Trusted yes
       # Send locale-related environment variables
               SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
               SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
               SendEnv LC_IDENTIFICATION LC_ALL
       
       --------------- /etc/ssh/ssh_config ---------------

Nach der Modifikation der Konfiguration Files des SSH Server muss dieser neu gestartet werden:

       # systemctl restart sshd.service

Konfiguration: Modifikation "cron.allow/deny"

Die nachfolgenden Files definieren welcher User eine Cron-Job (crontab -e) ausführen darf und welche nicht:

       # vi /etc/cron.allow
       
       --------------- /etc/cron.allow ---------------
       
       root
       
       --------------- /etc/cron.allow ---------------

Ueberprüfe die Rechte des Files "/etc/cron.allow":

       # ls -la /etc/cron.allow
       -rw-r--r-- 1 root root 5 Jun  2 23:22 /etc/cron.allow

Passe die Rechte für "/etc/cron.allow" an damit nur User "root" das File modifizieren und sehen kann:

       # chmod 600 /etc/cron.allow

Definiere welche User "keinen" Cron-Job ausführen dürfen. Im nachfolgenden File sind User aufgeführt die auf dem System nicht existieren dh. es sind provilaktische Einträge da diese User per Standard in Gebrauch sind:

       # vi /etc/cron.deny
       
       --------------- /etc/cron.deny ---------------
       
       bin
       daemon
       adm
       lp
       sync
       shutdown
       halt
       mail
       news
       uucp
       operator
       games
       gopher
       ftp
       nobody
       nscd
       vcsa
       rpc
       mailnull
       smmsp
       pcap
       dbus
       avahi
       sshd
       rpcuser
       nfsnobody
       haldaemon
       avahi-autoipd
       ntp
       sysop
       apache
       apache-ssl
       postfix
       vscan
       named
       postgrey
       
       --------------- /etc/cron.deny ---------------

Ueberprüfe die Rechte des Files "/etc/cron.deny":

       # ls -la /etc/cron.deny
       -rw------- 1 root root 234 Jun  2 23:22 /etc/cron.deny

Konfiguration: Modifikation Log Rotation

Im File "/etc/logrotate.conf" werden Log Files des Systems für eine Rotation konfiguriert. Weitere Log Files können hinzugefügt werden. Es wird jedoch empfohlen für spätere Applikationen eine Log Rotation unter "/etc/logrotate.d" zu konfigurieren da in diesen Files spezifisches Neustarten der entsprechenden Deamons besser kontrolliert werden können. Dies spätere Konfiguration dh. der Applikations Log's sollten "daily" für "31" Tage rotiert werden damit im Fall einer Analyse die Logs täglich als "Satz" zur Verfügung stehen. Aus diesem Grund werden wir "weekly" auf "daily" konfigurieren sowie dies für "31" Tage:

       # vi /etc/logrotate.conf 
       
       --------------- /etc/logrotate.conf ---------------
       
       # see "man logrotate" for details
       # rotate log files weekly
       daily
       
       # keep 4 weeks worth of backlogs
       rotate 31
       
       # create new (empty) log files after rotating old ones
       create
       
       # uncomment this if you want your log files compressed
       compress
       
       # RPM packages drop log rotation information into this directory
       include /etc/logrotate.d
       
       # no packages own wtmp -- we'll rotate them here
       /var/log/wtmp {
           monthly
           minsize 1M
           create 0664 root utmp
           rotate 1
       }
       
       /var/log/btmp {
           missingok
           monthly
           minsize 1M
           create 0664 root utmp
           rotate 1
       }
       
       # system-specific logs may be also be configured here.
       
       --------------- /etc/logrotate.conf ---------------

Ab CentOS 6 ist das File "/etc/crontab" leer und es kümmert sich "/etc/anacrontab" um die Ausführung der stündlichen, wöchentlichen und monatlichen Jobs. "anachron" ist jedoch kein Deamon/Service und wird über "crond" ausgeführt anhand des Packages "cronie-anacron" was nicht entfernt werden solle da dieses vielfach in Zusammenhang steht mit anderen Abhängigkeiten. "anachron" ist nicht Ideal für Server und wurde eintliche für Workstations konzepiert die nicht 24 X 7 in Betrieb sind. Um weiterhin Transparent über "crond" zu arbeiten sollte "/etc/anacrontab" deaktiviert werden dh. deaktiviere die Konfiguration in "/etc/anacrontab":

       # vi /etc/anacrontab
       
       --------------- /etc/anacrontab ---------------
       
       # /etc/anacrontab: configuration file for anacron
       
       # See anacron(8) and anacrontab(5) for details.
       
       SHELL=/bin/sh
       PATH=/sbin:/bin:/usr/sbin:/usr/bin
       MAILTO=""
       # the maximal random delay added to the base delay of the jobs
       #RANDOM_DELAY=45
       # the jobs will be started during the following hours only
       #START_HOURS_RANGE=3-22
       
       #period in days   delay in minutes   job-identifier   command
       #1      5       cron.daily              nice run-parts /etc/cron.daily
       #7      25      cron.weekly             nice run-parts /etc/cron.weekly
       #@monthly 45    cron.monthly            nice run-parts /etc/cron.monthly
       
       --------------- /etc/anacrontab ---------------

Wie schon erwähnt damit "hourly, daily, weekly und monthly" berücksichtigt werden muss dies nun im File "/etc/crontab" definiert werden da nun dies nicht mehr über "/etc/anacrontab" abgearbeitet wird. Wird dies nicht durchgeführt werden folgende Verzeichnisse und deren Inhalt Ignoriert sowie auch "/etc/logrotate.conf" da sich ein entsprechendes Script im Verzeichnis "cron.daily" befindet (logrotate) das "/etc/logrotate.conf" ausführt dh. dafür zuständig ist das die Files in "/etc/logrotate.d" verarbeitet werden:

       /etc/cron.hourly
       /etc/cron.daily
       /etc/cron.weekly
       /etc/cron.monthly
       # vi /etc/crontab
       
       --------------- /etc/crontab---------------
       
       SHELL=/bin/bash
       PATH=/sbin:/bin:/usr/sbin:/usr/bin
       #MAILTO=root
       
       # For details see man 4 crontabs
       
       # Example of job definition:
       # .---------------- minute (0 - 59)
       # |  .------------- hour (0 - 23)
       # |  |  .---------- day of month (1 - 31)
       # |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
       # |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
       # |  |  |  |  |
       # *  *  *  *  * user-name  command to be executed
       # run-parts
       01 * * * * root run-parts /etc/cron.hourly
       02 0 * * * root run-parts /etc/cron.daily
       22 0 * * 0 root run-parts /etc/cron.weekly
       42 0 1 * * root run-parts /etc/cron.monthly
       
       --------------- /etc/crontab ---------------

Danach ist es empfehlenswert den Service "crond" neu zu starten:

       # systemctl restart crond.service

Konfiguration: Hinzufügen einer Zeit Synchronisierung

Auf dem CentOS 7 Server ist das Binary "ntpdate" nicht enthalten dh. dieses benutzen wird ohne den Server zu installieren resp. zu konfigurieren um eine NTP Zeitsynchonisation ohne Deamon durchzuführen. Durch die Installation "yum install ntp" werden mehrere Package installiert wie "ntpdate" da unter diesen Abhängigkeiten bestehen. Da wir jedoch nur "ntpdate" benutzen deinstallieren wir nachtrgälich "ntp". Wenn versucht wird "ntpdate" zu installieren werden die gleichen Package installiert wie für "ntp":

       # yum install ntp
       # rpm -e ntp

Das Package resp. Binary "ntpdate" ist installiert. Lege nun ein Log File an für die NTP Synchronisierung:

       # mkdir /var/log/ntp
       # touch /var/log/ntp/ntp.log
       # chown root:root /var/log/ntp/ntp.log
       # chmod 644 /var/log/ntp/ntp.log

Erstelle nun einen entsprechenden Cron-Job unter "crontab -e" der das Binary "ntpdate" mit einem entsprechenden NTP Server zB "ch.pool.ntp.org" synchronisiert:

       # crontab -e
       
       --------------- crontab ---------------
       
       # Get the time from timeserver
       0 0,3,6,9,12,15,18,21 * * * /usr/sbin/ntpdate ch.pool.ntp.org >> /var/log/ntp/ntp.log
       
       --------------- crontab ---------------
       
       NOTE Im "crontab" bedeuten die ersten 5 Positionen (* * * * *) folgendes:
            
            *                 Minuten (0-59)
              *               Stunden (0-23)
                *             TagDesMonats (1-31)
                  *           Monat des Jahres (1-12)
                    *         TagDerWoche (0-6 with 0=Sunday)

Um einen Test manuell auszuführen benutze folgendes Kommando:

       # /usr/sbin/ntpdate ch.pool.ntp.org
        2 Jun 17:30:02 ntpdate[1726]: step time server 193.239.220.29 offset -21594.314498 sec

Konfiguration: Deaktivierung/Aktivierung Systemdienste

Auf einem CentOS 7 wie auf anderen CentOS Versionen sind einige System Dienste aktiviert ohne das diese gebraucht werden. Aus Sicherheitsgründen sollten diese deaktiviert/aktiviert werden. Dies bedeutet: Nachfolgendes Bulk Kommandos aktivieren die nötigen Services und deaktiviert die unnötigen:

       # systemctl disable xinetd ;\
       # systemctl disable rexec ;\
       # systemctl disable rsh ;\
       # systemctl disable rlogin ;\
       # systemctl disable ypbind ;\
       # systemctl disable tftp ;\
       # systemctl disable certmonger ;\
       # systemctl disable cgconfig ;\
       # systemctl disable cgred ;\
       # systemctl disable cpuspeed ;\
       # systemctl enable irqbalance ;\
       # systemctl disable kdump ;\
       # systemctl disable mdmonitor ;\
       # systemctl disable messagebus ;\
       # systemctl disable netconsole ;\
       # systemctl disable ntpdate ;\
       # systemctl disable oddjobd ;\
       # systemctl disable portreserve ;\
       # systemctl enable psacct ;\
       # systemctl disable qpidd ;\
       # systemctl disable quota_nld ;\
       # systemctl disable rdisc ;\
       # systemctl disable rhnsd ;\
       # systemctl disable rhsmcertd ;\
       # systemctl disable saslauthd ;\
       # systemctl disable smartd ;\
       # systemctl disable sysstat ;\
       # systemctl enable crond ;\
       # systemctl disable atd ;\
       # systemctl disable nfslock ;\
       # systemctl disable named ;\
       # systemctl disable httpd ;\
       # systemctl disable dovecot ;\
       # systemctl disable squid ;\
       # systemctl disable snmpd ;\
       # systemctl disable avahi-daemon ;\
       # systemctl disable cups ;\
       # systemctl disable openldap

Die nachfolgenden Befehle deaktivieren die "RPC" Services im Zusammenhang mit Secure Protocols (RPCsec GSS). Diese werden oft im Zusammenhang mit Kerberos und NFS benutzt. Der Service "repcgssd" ist die Client Seite von "RPCsec GSS". Wenn das System keine "Secure RPC" benötigt können diese Services deaktiviert werden:

       # systemctl disable rpcgssd
       # systemctl disable rpcsvcgssd

Der "rpcidmapd" Service ist zuständig um User Namen und Gruppen (UID GID) auf NFS4 Mounts zu mappen. Wenn kein NFS benutzt wird auf dem lokalen System sollte dieser Service deaktiviert werden:

       # systemctl disable rpcidmapd

Das Script "netfs" verwaltet beim Neustart vers. Netzwerk basierende Filesysteme und mountet diese. Dazu gehören zB Samba und NFS. Wenn diese Filesysteme auf dem lokalen System nicht benutzt werden sollten dieses Script/Service deaktiviert werden. Die deaktivierung dieses Script/Service verhindert ebenfalls Manipulationen an "/etc/fstab" indem die Mount Points konfiguriert werden/sind:

       # systemctl disable netfs

Wenn NFS auf dem lokalen System nicht benutzt wird kann auch dieser Service deaktiviert werden:

       # systemctl disable nfs

Nach der Deaktivierung der Service ergiebt sich folgende Situation betreffend Services:

       # systemctl list-unit-files
       UNIT FILE                              STATE   
       proc-sys-fs-binfmt_misc.automount      static  
       dev-hugepages.mount                    static  
       dev-mqueue.mount                       static  
       proc-sys-fs-binfmt_misc.mount          static  
       sys-fs-fuse-connections.mount          static  
       sys-kernel-config.mount                static  
       sys-kernel-debug.mount                 static  
       tmp.mount                              disabled
       brandbot.path                          disabled
       systemd-ask-password-console.path      static  
       systemd-ask-password-plymouth.path     static  
       systemd-ask-password-wall.path         static  
       session-1.scope                        static  
       arp-ethers.service                     disabled
       auditd.service                         enabled 
       autovt@.service                        disabled
       blk-availability.service               disabled
       brandbot.service                       static  
       console-getty.service                  disabled
       console-shell.service                  disabled
       cpupower.service                       disabled
       crond.service                          enabled 
       dbus-org.freedesktop.hostname1.service static  
       dbus-org.freedesktop.locale1.service   static  
       dbus-org.freedesktop.login1.service    static  
       dbus-org.freedesktop.machine1.service  static  
       dbus-org.freedesktop.timedate1.service static  
       dbus.service                           static  
       debug-shell.service                    disabled
       dm-event.service                       disabled
       dnsmasq.service                        disabled
       dracut-cmdline.service                 static  
       dracut-initqueue.service               static  
       dracut-mount.service                   static  
       dracut-pre-mount.service               static  
       dracut-pre-pivot.service               static  
       dracut-pre-trigger.service             static  
       dracut-pre-udev.service                static  
       dracut-shutdown.service                static  
       ebtables.service                       disabled
       emergency.service                      static  
       getty@.service                         enabled 
       halt-local.service                     static  
       initrd-cleanup.service                 static  
       initrd-parse-etc.service               static  
       initrd-switch-root.service             static  
       initrd-udevadm-cleanup-db.service      static  
       iprdump.service                        disabled
       iprinit.service                        disabled
       iprupdate.service                      disabled
       irqbalance.service                     enabled 
       kmod-static-nodes.service              static  
       lvm2-lvmetad.service                   disabled
       lvm2-monitor.service                   enabled 
       lvm2-pvscan@.service                   static  
       messagebus.service                     static  
       microcode.service                      enabled 
       ntpdate.service                        disabled
       plymouth-halt.service                  disabled
       plymouth-kexec.service                 disabled
       plymouth-poweroff.service              disabled
       plymouth-quit-wait.service             disabled
       plymouth-quit.service                  disabled
       plymouth-read-write.service            disabled
       plymouth-reboot.service                disabled
       plymouth-start.service                 disabled
       plymouth-switch-root.service           static  
       polkit.service                         static  
       quotaon.service                        static  
       rc-local.service                       static  
       rdisc.service                          disabled
       rdma.service                           disabled
       rescue.service                         static  
       rhel-autorelabel-mark.service          static  
       rhel-autorelabel.service               static  
       rhel-configure.service                 static  
       rhel-dmesg.service                     disabled
       rhel-domainname.service                disabled
       rhel-import-state.service              static  
       rhel-loadmodules.service               static  
       rhel-readonly.service                  static  
       rsyslog.service                        enabled 
       serial-getty@.service                  disabled
       sshd-keygen.service                    static  
       sshd.service                           enabled 
       sshd@.service                          static  
       systemd-ask-password-console.service   static  
       systemd-ask-password-plymouth.service  static  
       systemd-ask-password-wall.service      static  
       systemd-backlight@.service             static  
       systemd-binfmt.service                 static  
       systemd-fsck-root.service              static  
       systemd-fsck@.service                  static  
       systemd-halt.service                   static  
       systemd-hibernate.service              static  
       systemd-hostnamed.service              static  
       systemd-hybrid-sleep.service           static  
       systemd-initctl.service                static  
       systemd-journal-flush.service          static  
       systemd-journald.service               static  
       systemd-kexec.service                  static  
       systemd-localed.service                static  
       systemd-logind.service                 static  
       systemd-machined.service               static  
       systemd-modules-load.service           static  
       systemd-nspawn@.service                disabled
       systemd-poweroff.service               static  
       systemd-quotacheck.service             static  
       systemd-random-seed.service            static  
       systemd-readahead-collect.service      enabled 
       systemd-readahead-done.service         static  
       systemd-readahead-drop.service         enabled 
       systemd-readahead-replay.service       enabled 
       systemd-reboot.service                 static  
       systemd-remount-fs.service             static  
       systemd-shutdownd.service              static  
       systemd-suspend.service                static  
       systemd-sysctl.service                 static  
       systemd-timedated.service              static  
       systemd-tmpfiles-clean.service         static  
       systemd-tmpfiles-setup-dev.service     static  
       systemd-tmpfiles-setup.service         static  
       systemd-udev-settle.service            static  
       systemd-udev-trigger.service           static  
       systemd-udevd.service                  static  
       systemd-update-utmp-runlevel.service   static  
       systemd-update-utmp.service            static  
       systemd-user-sessions.service          static  
       systemd-vconsole-setup.service         static  
       tcsd.service                           disabled
       teamd@.service                         static  
       tuned.service                          enabled 
       wpa_supplicant.service                 disabled
       -.slice                                static  
       machine.slice                          static  
       system.slice                           static  
       user.slice                             static  
       dbus.socket                            static  
       dm-event.socket                        enabled 
       lvm2-lvmetad.socket                    enabled 
       sshd.socket                            disabled
       syslog.socket                          static  
       systemd-initctl.socket                 static  
       systemd-journald.socket                static  
       systemd-shutdownd.socket               static  
       systemd-udevd-control.socket           static  
       systemd-udevd-kernel.socket            static  
       basic.target                           static  
       bluetooth.target                       static  
       cryptsetup.target                      static  
       ctrl-alt-del.target                    masked  
       default.target                         enabled 
       emergency.target                       static  
       final.target                           static  
       getty.target                           static  
       graphical.target                       disabled
       halt.target                            disabled
       hibernate.target                       static  
       hybrid-sleep.target                    static  
       initrd-fs.target                       static  
       initrd-root-fs.target                  static  
       initrd-switch-root.target              static  
       initrd.target                          static  
       iprutils.target                        disabled
       kexec.target                           disabled
       local-fs-pre.target                    static  
       local-fs.target                        static  
       multi-user.target                      enabled 
       network-online.target                  static  
       network.target                         static  
       nss-lookup.target                      static  
       nss-user-lookup.target                 static  
       paths.target                           static  
       poweroff.target                        disabled
       printer.target                         static  
       reboot.target                          disabled
       remote-fs-pre.target                   static  
       remote-fs.target                       enabled 
       rescue.target                          disabled
       rpcbind.target                         static  
       runlevel0.target                       disabled
       runlevel1.target                       disabled
       runlevel2.target                       disabled
       runlevel3.target                       disabled
       runlevel4.target                       disabled
       runlevel5.target                       disabled
       runlevel6.target                       disabled
       shutdown.target                        static  
       sigpwr.target                          static  
       sleep.target                           static  
       slices.target                          static  
       smartcard.target                       static  
       sockets.target                         static  
       sound.target                           static  
       suspend.target                         static  
       swap.target                            static  
       sysinit.target                         static  
       system-update.target                   static  
       time-sync.target                       static  
       timers.target                          static  
       umount.target                          static  
       systemd-readahead-done.timer           static  
       systemd-tmpfiles-clean.timer           static  
       
       203 unit files listed.

Basierend auf den deaktivierten Services sieht das System betreffend Prozesse folgendermassen aus:

       # top
       Tasks:  97 total,   3 running,  94 sleeping,   0 stopped,   0 zombie
       %Cpu(s):  0.0 us,  0.3 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
       KiB Mem :  4047992 total,  3899544 free,    71852 used,    76596 buff/cache
       KiB Swap:  4194300 total,  4194300 free,        0 used.  3845896 avail Mem 
       
         PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                         
         379 root      20   0       0      0      0 S  0.3  0.0   0:00.01 xfsaild/dm-0                                    
           1 root      20   0   54160   3796   2404 S  0.0  0.1   0:00.90 systemd                                         
           2 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kthreadd                                        
           3 root      20   0       0      0      0 S  0.0  0.0   0:00.00 ksoftirqd/0                                     
           4 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kworker/0:0                                     
           5 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kworker/0:0H                                    
           6 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kworker/u2:0                                    
           7 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 migration/0                                     
           8 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcu_bh                                          
           9 root      20   0       0      0      0 S  0.0  0.0   0:00.00 rcuob/0                                         
          10 root      20   0       0      0      0 S  0.0  0.0   0:00.08 rcu_sched                                       
          11 root      20   0       0      0      0 R  0.0  0.0   0:00.03 rcuos/0                                         
          12 root      rt   0       0      0      0 S  0.0  0.0   0:00.00 watchdog/0                                      
          13 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 khelper                                         
          14 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kdevtmpfs                                       
          15 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 netns                                           
          16 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 writeback                                       
          17 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kintegrityd                                     
          18 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 bioset                                          
          19 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 kblockd                                         
          20 root      20   0       0      0      0 S  0.0  0.0   0:00.00 khubd                                           
          21 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 md                                              
          22 root      20   0       0      0      0 S  0.0  0.0   0:00.17 kworker/0:1                                     
          24 root      20   0       0      0      0 S  0.0  0.0   0:00.00 khungtaskd                                      
          25 root      20   0       0      0      0 S  0.0  0.0   0:00.00 kswapd0                                         
          26 root      25   5       0      0      0 S  0.0  0.0   0:00.00 ksmd                                            
          27 root      39  19       0      0      0 S  0.0  0.0   0:00.00 khugepaged                                      
          28 root      20   0       0      0      0 S  0.0  0.0   0:00.00 fsnotify_mark                                   
          29 root       0 -20       0      0      0 S  0.0  0.0   0:00.00 crypto 

Nach der Installation vers. Package sowie Modifikationen des System ergiebt sich betreffend Filesystem folgendes Bild:

       # df -h
       Filesystem                 Size  Used Avail Use% Mounted on
       /dev/mapper/centos-root    2.0G  851M  1.2G  42% /
       devtmpfs                   2.0G     0  2.0G   0% /dev
       tmpfs                      2.0G     0  2.0G   0% /dev/shm
       tmpfs                      2.0G  8.4M  2.0G   1% /run
       tmpfs                      2.0G     0  2.0G   0% /sys/fs/cgroup
       /dev/sda1                  497M  138M  359M  28% /boot
       /dev/mapper/centos-export   13G   33M   13G   1% /export
       /dev/mapper/centos-var    1014M  138M  877M  14% /var

Hinweise - Bug (RemoveOnStop)

Wenn man nach allen Modifikationen die Log Files anschaut so fällt einem folgende Fehlermeldung auf:

       # cat /var/log/messages | grep RemoveOnStop
       
       Jun  3 19:39:12 kolab systemd: [/usr/lib/systemd/system/dm-event.socket:10] Unknown lvalue 'RemoveOnStop' in section 'Socket'
       Jun  3 19:39:12 kolab systemd: [/usr/lib/systemd/system/lvm2-lvmetad.socket:9] Unknown lvalue 'RemoveOnStop' in section 'Socket'
       
       NOTE Bei diesen Meldungen handelt es sich um Script Fehler in den entsprechenden "systemctl" Scripts und sind als
            Bug deklariert und zwar als nicht "System Critical/Relevant. Dieser "Bug" wird in Version 219 was wiederum
            CentOS 7.2 entspricht gelöst.