\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{Maxime Simorre (ERROMIS)} \pdfinfo{ /Title (configuration-systeme-et-reseau-sous-linux.pdf) /Creator (Cheatography) /Author (Maxime Simorre (ERROMIS)) /Subject (Configuration système et réseau sous Linux Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{54A30F} \definecolor{LightBackground}{HTML}{F4F9F0} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Configuration système et réseau sous Linux Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{Maxime Simorre (ERROMIS)} via \textcolor{DarkBackground}{\uline{cheatography.com/208581/cs/44718/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}Maxime Simorre (ERROMIS) \\ \uline{cheatography.com/erromis} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 18th October, 2024.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{2} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Lancer et gérer le réseau virtuel (NEmu)}} \tn % Row 0 \SetRowColor{LightBackground} Lancer le réseau virtuel & \seqsplit{/mnt/netta/apps/vnet/nemu-vnet} netadm \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Restaurer un réseau virtuel sauvegardé & \seqsplit{/mnt/netta/apps/vnet/nemu-restore} \textasciitilde{}/vnet/netadm.tgz \tn % Row Count 5 (+ 3) % Row 2 \SetRowColor{LightBackground} Quitter le réseau virtuel & quit() \tn % Row Count 7 (+ 2) % Row 3 \SetRowColor{white} Sauvegarder le réseau virtuel & save() \tn % Row Count 9 (+ 2) % Row 4 \SetRowColor{LightBackground} Redémarrer tout le réseau & reboot() \tn % Row Count 11 (+ 2) % Row 5 \SetRowColor{white} Redémarrer une machine spécifique & RebootVNode("\textless{}nom de la VM\textgreater{}") \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{5.6 cm} x{2.4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Gestion des utilisateurs}} \tn % Row 0 \SetRowColor{LightBackground} Changer le mot de passe root & passwd \textless{}login\textgreater{} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Ajouter un nouvel utilisateur & adduser \textless{}login\textgreater{} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Se connecter en tant qu'utilisateur & login \textless{}login\textgreater{} \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} Revenir au compte administrateur & exit \tn % Row Count 8 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{5.2 cm} x{2.8 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Gestion du système}} \tn % Row 0 \SetRowColor{LightBackground} Changer le nom de la machine & hostname \textless{}name\textgreater{} \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Modifier /etc/hostname pour renommer la machine de façon permanente.} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.68 cm} x{4.32 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Configuration réseau avec ifconfig}} \tn % Row 0 \SetRowColor{LightBackground} Configurer une interface & ifconfig \textless{}iface\textgreater{} \textless{}@IP\textgreater{} netmask \textless{}netmask\textgreater{} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Lister les interfaces & ifconfig -a \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Allumer une interface & ifconfig \textless{}iface\textgreater{} up \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} Eteindre une interface & ifconfig \textless{}iface\textgreater{} down \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} Ajouter une passerelle par défaut & route add default gw \textless{}@IP passerelle\textgreater{} \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.68 cm} x{4.32 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Configuration réseau avec ip}} \tn % Row 0 \SetRowColor{LightBackground} Lister toutes les interfaces & ip -br addr \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Configurer une interface & ip addr add \textless{}@IP\textgreater{}/\textless{}netmask\textgreater{} dev \textless{}iface\textgreater{} \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} Activer une interface & ip link set \textless{}iface\textgreater{} up \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} Eteindre une interface & ip link set \textless{}iface\textgreater{} down \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} Ajouter une passerelle par défaut & ip route add default via \textless{}@IP passerelle\textgreater{} \tn % Row Count 10 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.96 cm} x{3.04 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Test de configuration}} \tn % Row 0 \SetRowColor{LightBackground} Tester la connectivité réseau : & ping \textless{}destination\textgreater{} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Tracer le chemin des paquets avec traceroute & traceroute \textless{}destination\textgreater{} \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Pensez à activer Activer le transfert de paquets : \newline echo 1 \textgreater{} \seqsplit{/proc/sys/net/ipv4/ip\_forward} sur le routeur} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Configuration IP permanente}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Ajouter une configuration statique dan dans /etc/network/interfaces \newline % Row Count 2 (+ 2) auto eth0 \newline % Row Count 3 (+ 1) iface eth0 inet static \newline % Row Count 4 (+ 1) address 192.168.0.1 \newline % Row Count 5 (+ 1) netmask 255.255.255.0 \newline % Row Count 6 (+ 1) gateway 192.168.0.254 \newline % Row Count 7 (+ 1) echo 1 \textgreater{} \seqsplit{/proc/sys/net/ipv4/ip\_forward} (si routeur)% Row Count 9 (+ 2) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{Pensez à démarrer ou éteindre l'interface} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{Manipulation de fichiers réseau}} \tn \SetRowColor{white} \mymulticolumn{1}{x{8.4cm}}{Modifier le fichier /etc/hosts pour associer un nom à une IP : \newline % Row Count 2 (+ 2) nano /etc/hosts% Row Count 3 (+ 1) } \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{5.36 cm} x{2.64 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Capture réseau}} \tn % Row 0 \SetRowColor{LightBackground} Lancer Wireshark pour capturer le trafic & wireshark -i eth0 -k \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.68 cm} x{4.32 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Serveur Web}} \tn % Row 0 \SetRowColor{LightBackground} Lancer un serveur web avec Busybox & busybox httpd -f -vv -h /var/www/html \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Ajouter une authentification & echo "\textless{}username\textgreater{}:\$(busybox httpd -m '\textless{}password\textgreater{}')" \textgreater{} /etc/httpd.conf \tn % Row Count 6 (+ 4) % Row 2 \SetRowColor{LightBackground} Relance le serveur web & busybox httpd -f -vv -h /var/www/html -r "Restricted Area:" -c /etc/httpd.conf \tn % Row Count 10 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Il faut créer une page index.html dans /var/www/html} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Serveur HTTPS}} \tn % Row 0 \SetRowColor{LightBackground} Crée un répertoire de configuration & mkdir \seqsplit{/etc/lighttpd/security} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} Créer une clé privée et un certificat auto-signé & openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out \textless{}nom\textgreater{}.crt -keyout \textless{}nom\textgreater{}.key \tn % Row Count 7 (+ 5) % Row 2 \SetRowColor{LightBackground} Créer un fichier pem & cat \textless{}nom\textgreater{}.key \textless{}nom\textgreater{}.crt \textgreater{} \textless{}nom\textgreater{}.pem \tn % Row Count 9 (+ 2) % Row 3 \SetRowColor{white} Démarrer un service (lighttpd ici) & systemctl start \textless{}service\textgreater{} \tn % Row Count 11 (+ 2) % Row 4 \SetRowColor{LightBackground} Vérifier le statut d'un service & systemctl status \textless{}service\textgreater{} \tn % Row Count 13 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{8.4cm}}{\bf\textcolor{white}{A ECRIRE DANS \seqsplit{/etc/lighttpd/conf-enabled/tls}.conf}} \tn \SetRowColor{LightBackground} \mymulticolumn{1}{x{8.4cm}}{server.modules += ("mod\_openssl") \newline \$SERVER{[}"socket"{]} == "0.0.0.0:443" \{ \newline ssl.engine = "enable" \newline ssl.pemfile = \seqsplit{"/etc/lighttpd/security/alcest}.pem" \newline \} \newline server.modules += ( "mod\_auth", "mod\_authn\_file") \newline auth.backend = "htpasswd" \newline auth.backend.htpasswd.userfile = "/etc/lighttpd/security/\textless{}auth \newline file\textgreater{}" \newline auth.require = ( "/" =\textgreater{} \newline ( \newline "method" =\textgreater{} "basic", \newline "realm" =\textgreater{} "password required", \newline "require" =\textgreater{} "valid-user" \newline ) \newline )} \tn \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4.4 cm} x{3.6 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Commandes ARP}} \tn % Row 0 \SetRowColor{LightBackground} Consulter la table ARP & arp -n ou ip neigh \tn % Row Count 1 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{3.52 cm} x{4.48 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Man in the Middle (MITM)}} \tn % Row 0 \SetRowColor{LightBackground} Lancer une attaque ARP spoofing & arpspoof -t \textless{}@IP victime\textgreater{} \textless{}@IP passerelle\textgreater{} \tn % Row Count 2 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{8.4cm}}{Pensez à activer l'IP forwarding echo 1 \textgreater{} \seqsplit{/proc/sys/net/ipv4/ip\_forward}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Attaque par dictionnaire}} \tn % Row 0 \SetRowColor{LightBackground} Lancer une attaque par dictionnaire avec Hydra & hydra -V -f -l admin -P \textless{}fichier de mots de passe\textgreater{} http-get://\textless{}IP cible\textgreater{} \tn % Row Count 4 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{8.4cm}{x{4 cm} x{4 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{8.4cm}}{\bf\textcolor{white}{Attaque Deny Of Services (DOS)}} \tn % Row 0 \SetRowColor{LightBackground} Lance une attaque DOS sur la victime avec une IP usurpée & hping3 -{}-flood -{}-syn -{}-spoof \textless{}@IP source usurpée\textgreater{} \textless{}@IP victime\textgreater{} \tn % Row Count 4 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}