From 93daa37a443b16d453025d947071a81743f6940f Mon Sep 17 00:00:00 2001 From: Etienne Ischer Date: Tue, 4 Sep 2018 16:51:59 +0200 Subject: [PATCH] avancement model et methodes --- .DS_Store | Bin 8196 -> 8196 bytes annexes/glossary.tex | 1 + bibli.bib | 6 ++++ chapitres/introduction/network.tex | 2 +- chapitres/model/classes.tex | 48 +++++++++++++++++++++++++++ chapitres/model/methodes.tex | 36 +++++++++++++++++++++ index.tex | 50 ++++++++++++++++++++++++----- 7 files changed, 134 insertions(+), 9 deletions(-) create mode 100644 chapitres/model/classes.tex create mode 100644 chapitres/model/methodes.tex diff --git a/.DS_Store b/.DS_Store index 6958cf47fa37b7c3e682e3fdb4c1c76eedaed247..543c4f4eb6d326f3c9ec3d2fd7102226945e72f8 100644 GIT binary patch delta 90 zcmZp1XmOa}FUrQiz`)4BAi%&-!H~*OoKl>ela#-)a2or>2Hwr=94s6%AQkKki41u_ hn2M|_KZjv5kH9}hhRxi957{=eOMGM5{78hI8350W7ghiO delta 69 zcmV-L0J{H#K!iY$PZb3K0003101yBGWdL(xcXM!JY;R(*ah3;>fDN+;2m}ZL1(PQb b{s95ACK2HVk$@Ys2N?DQvltcc0+E0ieJm6N diff --git a/annexes/glossary.tex b/annexes/glossary.tex index 1f28d8e..f3e9581 100644 --- a/annexes/glossary.tex +++ b/annexes/glossary.tex @@ -18,6 +18,7 @@ \newacronym{json}{JSON}{JavaScript Object Notation} \newacronym{tdd}{TDD}{Test Driven Development} \newacronym{osi}{OSI}{Open Systems Interconnection} +\newacronym{cidr}{CIDR}{Classless Inter-Domain Routing} \newglossaryentry{firewall}{ name=firewall, diff --git a/bibli.bib b/bibli.bib index 57d43c7..6f16029 100644 --- a/bibli.bib +++ b/bibli.bib @@ -93,3 +93,9 @@ title = {GitKraken, The legendary Git GUI client for Windows, Mac and Linux}, note = {URL: "\url{https://www.gitkraken.com/}"} } + +@misc{wikipedia, + author = {Wikimedia Foundation Inc.}, + title = {Wikipedia, The Free Encyclopedia}, + note = {URL: "\url{https://www.gitkraken.com/}"} +} \ No newline at end of file diff --git a/chapitres/introduction/network.tex b/chapitres/introduction/network.tex index 4722b1a..63f3a58 100644 --- a/chapitres/introduction/network.tex +++ b/chapitres/introduction/network.tex @@ -8,4 +8,4 @@ Le but d'un réseau informatique et d'acheminer des données sous forme de paque \section{Le modèle OSI} -Le modèle \gls{osi} est un découpage en couches des +Le modèle \gls{osi} est un découpage en sept couches, représentant les différents acteurs nécessaires à l'échange et la compréhension de l'information. diff --git a/chapitres/model/classes.tex b/chapitres/model/classes.tex new file mode 100644 index 0000000..e8a677d --- /dev/null +++ b/chapitres/model/classes.tex @@ -0,0 +1,48 @@ +\chapter{Les classes} + +\section{Credential} + +Cette classe est utilisée pour sauvegarder les informations d'identifications pour accéder aux équipements et est identifiable par un nom unique. Le mot de passe est enregistré dans la base de donnée de façon chiffrée, mais avec un chiffrement symétrique, car il est nécessaire de pouvoir le réutiliser pour s'authentifier par la suite sur les équipements. Les fonctions pour chiffrer et déchiffrer le mot de passe sont fournit par l'attribut "password". + +\begin{lstlisting}[language=Ruby, title="app/model/credential.rb"] + # Returns the decrypted value of the 'encrypted_password' field + def password + @password = SymmetricEncryption.decrypt(encrypted_password) + end + + # Encrypt the clear text password and set the 'encrypted_password' field. + # + # Params: + # * new_password: the new value of the password + def password=(new_password) + @password = SymmetricEncryption.encrypt(new_password) + self.encrypted_password = @password + end +\end{lstlisting} + +\section{Address} + +Décrit un objet réseau qui se caractérise par un réseau IPv4 au format \acrshort{cidr}. De ce réseau nous allons pouvoir en déduire la première et dernière addresse. Ces addresses seront ensuite convertie en base10 pour pouvoir être indexé par la base de donnée. Ainsi \lstinline{start_ip} est la représentation numérique de la première addresse IP de ce réseau, et \lstinline{end_ip} la dernière. Dans le cas où le réseau ne contient qu'une seule adresse IP (masque réseau de 32 bits (cité la doc réseau au début)), ces deux adresses seront identiques. Ces valeurs sont calculés à chaque modifications de l'attribut network. + +\begin{lstlisting}[language=Ruby, title="app/model/address.rb"] + # Override setter method for the 'network' field. + # It must update the 'start_ip' and 'end_ip' aswell. + # + # Params: + # * value: the new value of the network + def network=(value) + super(value) + set_ip + end + + --- + + # Define 'start_ip' and 'end_ip' fields from 'network' + def set_ip + return if network.nil? + return unless network.match?(network_regex) + ip = IPAddr.new network + self.start_ip = ip.to_range.first.to_i + self.end_ip = ip.to_range.last.to_i + end +\end{lstlisting} \ No newline at end of file diff --git a/chapitres/model/methodes.tex b/chapitres/model/methodes.tex new file mode 100644 index 0000000..cfde274 --- /dev/null +++ b/chapitres/model/methodes.tex @@ -0,0 +1,36 @@ +\chapter{Les méthodes} + +\section{route} + +La méthode "route" retourne la route (\lstinline{Route}), utilisée par l'équipement (\lstinline{Device}) pour atteindre le réseau spécifié. + +\begin{lstlisting}[language=Ruby] + # Params: + # * network: an IPv4 network to test + def route(network) + ip_net = IPAddr.new network + ip = ip_net.to_i + + candidate_routes = routes.where(:start_ip.lte => ip, :end_ip.gte => ip) + + choosed_route(candidate_routes) + end +\end{lstlisting} + +\section{crossed?} + +La méthode "crossed?" est un élément essentiel pour l'analyse des règles de sécurité (\lstinline{Policy}). Elle permet de déterminer sur un équipement (\lstinline{Device}) est traversé par un flux définit par deux réseaux. Pour cela, il faut utiliser la méthode "route" de la table de routage (\lstinline{RoutingTable}) de l'équipement en question et comparer l'interface de sortie des deux routes (Route) retourné. Si elles sont différentes, cela signifique que le flux traverse ce firewall. + +\begin{lstlisting}[language=Ruby] + # Params: + # * network1: the *source* network + # * network2: the *destination* network + def crossed?(network1, network2) + return false unless routing_table + route1 = routing_table.route(network1) + route2 = routing_table.route(network2) + + return false unless route1 && route2 + route1.interface != route2.interface + end +\end{lstlisting} \ No newline at end of file diff --git a/index.tex b/index.tex index d347245..3909659 100644 --- a/index.tex +++ b/index.tex @@ -12,19 +12,51 @@ \usepackage{enumitem} \graphicspath{{images/}{../images/}} \usepackage{fancyhdr} -\usepackage[table,xcdraw]{xcolor} \usepackage[acronym]{glossaries} +\usepackage[table,xcdraw,dvipsnames]{xcolor} +\definecolor{light-gray}{gray}{0.90} + +\usepackage{mdframed} +\usepackage{listings} +\lstloadlanguages{Ruby} +\lstset{% + basicstyle=\ttfamily\color{Black}, + commentstyle = \ttfamily\color{OliveGreen}, + keywordstyle=\ttfamily\color{RoyalBlue}, + stringstyle=\color{BrickRed}, + columns=fullflexible, + xleftmargin=-10pt +} +\surroundwithmdframed[ + hidealllines=true, + backgroundcolor=light-gray, + innerleftmargin=15pt, + innertopmargin=0pt, + innerbottommargin=0pt, + leftmargin=1, + rightmargin=1, + outerlinewidth=1, + linecolor=light-gray]{lstlisting} +\surroundwithmdframed[ + hidealllines=true, + backgroundcolor=light-gray, + innerleftmargin=1pt, + leftmargin=1, + rightmargin=1, + outerlinewidth=1, + linecolor=light-gray]{lstinline} + % Marges \usepackage{geometry} \geometry{ - left=2.5cm, - right=2cm, - top=2cm, - bottom=1.5cm, - headheight=35pt, - includehead,includefoot, - heightrounded, + left=2.5cm, + right=2cm, + top=2cm, + bottom=1.5cm, + headheight=35pt, + includehead,includefoot, + heightrounded } % En-têtes et pieds de page @@ -90,6 +122,8 @@ % LaTeX \part{Méthodologies et développement} +\include{chapitres/model/classes} +\include{chapitres/model/methodes} % Méthodologies et développement % Gestion de projet % Agile/scrum