Sachen hinzugefügt

This commit is contained in:
Alfred Krohmer 2013-11-05 10:50:33 +01:00
parent fda7af9ea5
commit 9543593a69
16 changed files with 297 additions and 24 deletions

View File

@ -0,0 +1,6 @@
Description='LAN Interface'
Interface=enp1s0
Connection=ethernet
IP=static
Address=('10.20.0.101/24')
Gateway='10.20.0.1'

View File

@ -0,0 +1,17 @@
Description='LAN Interface'
Interface=eth1
Connection=ethernet
IP=static
Address=('10.20.0.1/24')
#Routes=('192.168.0.0/24 via 192.168.1.2')
#Gateway='141.76.90.1'
#DNS=('8.8.8.8')
## For IPv6 autoconfiguration
#IP6=stateless
## For IPv6 static address configuration
#IP6=static
#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#Routes6=('abcd::1234')
#Gateway6='1234:0:123::abcd'

17
aufgabe2/headnode/network Normal file
View File

@ -0,0 +1,17 @@
Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address=('141.76.90.104/24')
#Routes=('192.168.0.0/24 via 192.168.1.2')
Gateway='141.76.90.1'
DNS=('8.8.8.8')
## For IPv6 autoconfiguration
#IP6=stateless
## For IPv6 static address configuration
#IP6=static
#Address6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#Routes6=('abcd::1234')
#Gateway6='1234:0:123::abcd'

58
aufgabe3/iptables.rules Normal file
View File

@ -0,0 +1,58 @@
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
# allow established connections
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
# allow traffic from private LAN
-A INPUT -i eth1 -j ACCEPT
-A FORWARD -i eth1 -j ACCEPT
# allow icmp
-A INPUT -p icmp -j ACCEPT
# allow loopback
-A INPUT -i lo -j ACCEPT
# uni subnets
:uni - [0:0]
-A INPUT -s 141.30.0.0/16 -j uni
-A INPUT -s 141.76.0.0/16 -j uni
# reject unknown traffic with nice errors
-A INPUT -p tcp -j REJECT --reject-with tcp-reset
-A INPUT -p udp -j REJECT --reject-with icmp-port-unreachable
-A INPUT -j REJECT --reject-with icmp-proto-unreachable
# ---------------------------------------------------------------
# internal traffic
#
:internal - [0:0]
-A uni -j internal
-A internal -p tcp --dport 22 -j ACCEPT
-A internal -p tcp --dport 80 -j ACCEPT
-A internal -p tcp --dport 443 -j ACCEPT
# ---------------------------------------------------------------
# public traffic
:public - [0:0]
-A INPUT -j public
# ---------------------------------------------------------------
COMMIT
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
# masquerading
-A POSTROUTING -o eth0 -j MASQUERADE
COMMIT

130
aufgabe3/sshd_config Normal file
View File

@ -0,0 +1,130 @@
# $OpenBSD: sshd_config,v 1.90 2013/05/16 04:09:14 dtucker Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# 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.
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# The default requires explicit activation of protocol 1
#Protocol 2
# 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
#HostKey /etc/ssh/ssh_host_ecdsa_key
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024
# Ciphers and keying
#RekeyLimit default none
# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
#RSAAuthentication yes
#PubkeyAuthentication yes
# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile .ssh/authorized_keys
#AuthorizedPrincipalsFile none
#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody
# 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 no
#PermitEmptyPasswords no
# Change to no to disable s/key passwords
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
#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 and
# PasswordAuthentication. Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
#X11DisplayOffset 10
#X11UseLocalhost yes
PrintMotd no # pam does that
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
UsePrivilegeSeparation sandbox # Default for new installations.
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
# no default banner path
#Banner /etc/motd
# override default of no subsystems
Subsystem sftp /usr/lib/ssh/sftp-server
# Example of overriding settings on a per-user basis
#Match User anoncvs
# X11Forwarding no
# AllowTcpForwarding no
# ForceCommand cvs server

33
aufgabe4/journald.conf Normal file
View File

@ -0,0 +1,33 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# See journald.conf(5) for details
[Journal]
#Storage=auto
#Compress=yes
#Seal=yes
#SplitMode=login
#SyncIntervalSec=5m
#RateLimitInterval=30s
#RateLimitBurst=1000
#SystemMaxUse=
#SystemKeepFree=
#SystemMaxFileSize=
#RuntimeMaxUse=
#RuntimeKeepFree=
#RuntimeMaxFileSize=
#MaxRetentionSec=
#MaxFileSec=1month
ForwardToSyslog=yes
#ForwardToKMsg=no
#ForwardToConsole=no
#TTYPath=/dev/console
#MaxLevelStore=debug
#MaxLevelSyslog=debug
#MaxLevelKMsg=notice
#MaxLevelConsole=info

2
aufgabe5/genders Normal file
View File

@ -0,0 +1,2 @@
zotac0 headnode
zotac[1-4] computenode

3
aufgabe5/pdsh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
PDSH_RCMD_TYPE="`cat /etc/pdsh/rcmd_default`" /usr/bin/pdsh $@

1
aufgabe5/rcmd_default Normal file
View File

@ -0,0 +1 @@
ssh

View File

@ -16,7 +16,7 @@ Nun kann die eigentliche Konfiguration per git heruntergeladen werden:
Wir legten das Repository {\tt lctp} an.
\subsubsection{Etckeeper}
\subsubsection{etckeeper}
Um die Konfiguration in {\tt /etc } versionierbar und damit nachvollziehbar zu machen installierten wir {\tt etckeeper}:

View File

@ -7,19 +7,4 @@ Das entsprechende Paket war nicht im offiziellen Arch Linux Repository
vorhanden, deshalb haben wir es über das AUR (siehe \ref{sec:aur}) installiert.
\subsubsection{Gruppenverwaltung}
Zur Verwaltung mehrerer Rechner in Gruppen (in unserem Fall Head-Node und Compute-Nodes) greift {\tt pdsh} auf Gruppen-Dateien von {\tt dsh} zurück. Diese können entweder pro Benutzer in { \tt $\tilde{}$/.dsh/group} oder systemweit in {\tt /etc/dsh/group} hinterlegt werden; da sowieso jeder Benutzer die gleichen Gruppen-Dateien verwendet, haben wir letzteres verwendet.
Dabei wurden folgende Gruppen-Dateien mit entsprechendem Inhalt angelegt:
\begin{itemize}
\item {\ttfamily \bfseries headnode}: \\
{\tt zotac0}
\item {\ttfamily \bfseries computenode}: \\
{\tt zotac1} \\
{\tt zotac2} \\
{\tt zotac3} \\
{\tt zotac4}
\item {\ttfamily \bfseries all}: \\
Kombination aus {\tt headnode} und {\tt computenode}
\end{itemize}
Zur Verwaltung mehrerer Rechner in Gruppen (in unserem Fall Headnode und Computenodes) greift {\tt pdsh} auf die Gruppenbeschreibungsdatei {\tt /etc/genders} (siehe \emph{aufgabe5/genders}) zurück. Dort können mehrere Hosts in verschiedene Gruppen eingeteilt werden. Außerdem mussten wir noch ein Wrapper-Script in {\tt /usr/local/bin} erstellen, das die Umgebungsvariable {\tt PDSH\_RCMD\_TYPE=ssh} setzt (siehe \emph{aufgabe5/pdsh}).

View File

@ -5,12 +5,22 @@ Wir haben uns für {\tt OpenSSH} als SSH-Server entschieden. Diesen haben wir mi
\shellcmd{pacman -S openssh}
Desweiteren wurden in {\tt /etc/ssh/sshd\_config} folgende Zeilen verändert, um den ''root-Account'' zu deaktivieren und den passwortlosen Zugriff zu aktivieren:
Desweiteren wurden in {\tt /etc/ssh/sshd\_config} (siehe \emph{aufgabe3/sshd\_config}) folgende Zeilen verändert, um den ''root-Account'' zu deaktivieren und den passwortlosen Zugriff zu aktivieren:
\shellcmd{PermitRootLogin no} \\
\shellcmd{PasswordAuthentication no} \\
\shellcmd{ChallengeResponseAuthentication no}
\begin{lstlisting}
PermitRootLogin no
PasswordAuthentication no
ChallengeResponseAuthentication no
\end{lstlisting}
\subsubsection{iptables}
Um den Zugriff auf das universitätsinterne Netz zu beschränken wurde ein Filter {\tt uni} zur {\tt iptables.rules} unter {\tt /etc/iptables} hinzugefügt, der nur IP-Adressen aus den Bereichen 141.30.0.0/16 und 141.76.0.0/16 akzeptiert und die Zugriffe auf Port 22, 80 und 443 beschränkt.
Um den Zugriff auf das universitätsinterne Netz zu beschränken wurde ein Filter-Chain {\tt uni} zur {\tt iptables.rules} unter {\tt /etc/iptables} (siehe \emph{aufgabe3/iptables.rules}) hinzugefügt, der nur IP-Adressen aus den Bereichen 141.30.0.0/16 und 141.76.0.0/16 akzeptiert und die Zugriffe auf Port 22, 80 und 443 beschränkt.
\subsubsection{Absicherung für externen Zugriff}
Um den Zugriff aus einem externen Netz abzusichern, könnte man z.B. den externen SSH-Port auf einen anderen Port als 22 legen, so dass dieser nicht zu leicht erraten werden kann. Zusätzlich könnte man per {\tt fail2ban} IPs, die z.B. per Bruteforce zu häufig versuchen sich einzuloggen, aussperren. Außerdem könnte man den externen SSH-Port auch erst per Port-Knocking freischalten, bei dem der Client z.B. mit einem Script erst an mehrere Ports »klopfen« muss, bevor er sich verbinden kann. Desweiteren könnte man den Login von außen nur für bestimmte Benutzer erlauben.
\subsubsection{Automatisierung für neue Nutzer}
Das automatisierte Hinzufügen neuer Nutzer haben wir über ein Script {\tt newuser} (siehe \emph{aufgabe3/newuser}) gelöst. Dieses Script legt einen neuen Benutzer an, erstellt sein Home-Verzeichnis, generiert ein neues Public-Private-Key-Paar für SSH und trägt den eigenen Public-Key in die {\tt authorized\_keys} sowie für den Zugriff auf das git-Repository ein.

View File

@ -24,6 +24,12 @@ Nach ursprünglichen Schwierigkeiten mit dem Internet-Zugang im TGI-Labor (keine
Nach dem erfolgreichen Reboot haben wir dann das Netzwerk auf eine statische IP-Adresse mittels {\tt netctl} konfiguriert. Damit waren sowohl die Headnode als auch der erste Computenode grundsätzlich einsatzfähig.
\subsubsection{Netzwerk-Konfiguration}
Auf dem Headnode bzw. Computenode haben wir mit {\tt netctl} die beiden Netzwerk-Interfaces {\tt eth0} und {\tt eth1} bzw. {\tt enp1s0} auf eine statische IP-Adresse (wie im Cluster-Layout angegeben) konfiguriert (siehe \emph{aufgabe2/headnode/network} und \emph{aufgabe2/headnode/internal} bzw. \emph{aufgabe2/computenode/internal}).
Auf dem Headnode mussten wir noch mittels {\tt iptables} das {\tt MASQUERADE}-Target in der {\tt POSTROUTING}-Chain in der {\tt nat}-Tabelle auf dem {\tt eth0}-Interface setzen (siehe \emph{aufgabe3/iptables.rules}) und mit {\tt sysctl} (\emph{/etc/sysctl.d}) die Option {\tt net.ipv4.ip\_forward = 1} (siehe \emph{aufgabe2/10-ip-forward-conf}) freischalten, damit die Computenodes auch auf das Internet zugreifen können (Paketinstallationen, Updates, etc.).
\input{abschnitte/bs-ssh}
\input{abschnitte/bs-git}

View File

@ -3,8 +3,13 @@
\usepackage{multirow}
\usepackage{hyperref}
\usepackage{tabularx}
\usepackage{listings}
\usepackage{courier}
\usepackage{microtype}
\RequirePackage{mymacros}
\lstset{basicstyle=\footnotesize\ttfamily,breaklines=true,xleftmargin=1cm}
% schönere Hyperlinkfarben
\definecolor{darkred}{rgb}{0.5, 0, 0}
\definecolor{darkgreen}{rgb}{0, 0.5, 0}

View File

@ -1 +1 @@
\newcommand{\shellcmd}[1]{\nopagebreak\hspace{4ex}\texttt{\footnotesize\$ #1}}
\newcommand{\shellcmd}[1]{\nopagebreak\hspace{1cm}\texttt{\footnotesize\$ #1}}

View File

@ -121,7 +121,7 @@ Host zotac0
HostName 141.76.90.104
EOF</pre>
<pre>git clone git@zotac0:lctp.git</pre>
<pre>cd lctp && git submodule update</pre>
<pre>cd lctp && git submodule init && git submodule update</pre>
</section>
<section id="team">
<h2>Team</h2>