Theory DMZInteger
subsection ‹DMZ: Integer›
theory
DMZInteger
imports
"../../UPF-Firewall"
begin
text‹This scenario is slightly more complicated than the SimpleDMZ
one, as we now also model specific servers within one
network. Therefore, we cannot use anymore the modelling using
datatype synonym, but only use the one where an address is modelled as an
integer (with ports).
The scenario is the following:
\begin{labeling}{Networks:}
\item[Networks:]
\begin{itemize}
\item Intranet (Company intern network)
\item DMZ (demilitarised zone, servers, etc), containing
at least two distinct servers ``mail'' and ``web''
\item Internet (``all others'')
\end{itemize}
\item[Policy:]
\begin{itemize}
\item allow http(s) from Intranet to Internet
\item deny all trafic from Internet to Intranet
\item allo imaps and smtp from intranet to mailserver
\item allow smtp from Internet to mailserver
\item allow http(s) from Internet to webserver
\item deny everything else
\end{itemize}
\end{labeling}
›
definition
intranet::"adr⇩i⇩p net" where
"intranet = {{(a,b) . (a > 1 ∧ a < 4) }}"
definition
dmz :: "adr⇩i⇩p net" where
"dmz = {{(a,b). (a > 6) ∧ (a < 11)}}"
definition
mail :: "adr⇩i⇩p net" where
"mail = {{(a,b). a = 7}}"
definition
web :: "adr⇩i⇩p net" where
"web = {{(a,b). a = 8 }}"
definition
internet :: "adr⇩i⇩p net" where
"internet = {{(a,b). ¬ ( (a > 1 ∧ a < 4) ∨ (a > 6) ∧ (a < 11)) }}"
definition
Intranet_mail_port :: "(adr⇩i⇩p,'b) FWPolicy" where
"Intranet_mail_port = (allow_from_to_ports {21::port,14} intranet mail)"
definition
Intranet_Internet_port :: "(adr⇩i⇩p,'b) FWPolicy" where
"Intranet_Internet_port = allow_from_to_ports {80::port,90} intranet internet"
definition
Internet_web_port :: "(adr⇩i⇩p,'b) FWPolicy" where
"Internet_web_port = (allow_from_to_ports {80::port,90} internet web)"
definition
Internet_mail_port :: "(adr⇩i⇩p,'b) FWPolicy" where
"Internet_mail_port = (allow_all_from_port_to internet (21::port) dmz )"
definition
policyPort :: "(adr⇩i⇩p, DummyContent) FWPolicy" where
"policyPort = deny_all ++
Intranet_Internet_port ++
Intranet_mail_port ++
Internet_mail_port ++
Internet_web_port"
text ‹
We only want to create test cases which are sent between the three main networks:
e.g. not between the mailserver and the dmz. Therefore, the constraint looks as follows.
›
definition
not_in_same_net :: "(adr⇩i⇩p,DummyContent) packet ⇒ bool" where
"not_in_same_net x = ((src x ⊏ internet ⟶ ¬ dest x ⊏ internet) ∧
(src x ⊏ intranet ⟶ ¬ dest x ⊏ intranet) ∧
(src x ⊏ dmz ⟶ ¬ dest x ⊏ dmz))"
lemmas PolicyLemmas = policyPort_def dmz_def internet_def intranet_def mail_def web_def
Intranet_Internet_port_def Intranet_mail_port_def Internet_web_port_def
Internet_mail_port_def src_def dest_def IntegerPort.src_port
in_subnet_def IntegerPort.dest_port
end