136 lines
4.2 KiB
TeX
136 lines
4.2 KiB
TeX
\documentclass[11pt,a4paper]{article}
|
|
\usepackage[portuguese]{babel}
|
|
\usepackage[lining]{ebgaramond}
|
|
\usepackage{listings}
|
|
\usepackage{booktabs}
|
|
|
|
% \usepa
|
|
|
|
\lstdefinestyle{mystyle}{
|
|
basicstyle=\ttfamily\footnotesize,
|
|
breakatwhitespace=false,
|
|
breaklines=true,
|
|
captionpos=b,
|
|
keepspaces=true,
|
|
numbers=left,
|
|
numbersep=5pt,
|
|
showspaces=false,
|
|
showstringspaces=false,
|
|
showtabs=false,
|
|
tabsize=2
|
|
}
|
|
|
|
\lstset{style=mystyle}
|
|
|
|
\setlength{\parindent}{0em}
|
|
\setlength{\parskip}{2ex}
|
|
|
|
\title{Practical Assignment \#2}
|
|
\author{
|
|
João Neto -- 2023234004\\[1em]
|
|
Vasco Alves -- 2022228207
|
|
}
|
|
|
|
\begin{document}
|
|
\maketitle
|
|
\tableofcontents
|
|
\newpage
|
|
|
|
\section{Introdução}
|
|
|
|
Este projecto tem como âmbito implementar uma rede virtual privada (VPN) em um cenário de road-warrior,
|
|
ou seja, onde o administrador de acesso da rede é o cliente ou tem acesso a ele.
|
|
|
|
Para tal, foi implementado um servidor e um cliente OpenVPN, certificados por uma autoriadade central (CA)
|
|
que em si é self-signed. Para além disto, foi implementado um sistema de autenticação de dois factores
|
|
através do plugin google-authenticator para o OpenVPN.
|
|
|
|
Existe ainda um servidor Apache e um servidro de OpenSSL OCSP. Para simpliflicar, a elaboração do
|
|
projecto foram colocados na mesma maquina virtual, mas por razoes de seguranca poderia querer ter
|
|
estes serviços separados.
|
|
|
|
Temos então três máquinas virtuais:
|
|
|
|
\begin{tabular}{l l l}
|
|
|
|
{\bf Nome} & {\bf Script} & {\bf Rede} \\\toprule
|
|
Road Warrior & VM\_ROAD\_WARRIOR.sh & Rede Externa 193.168.0.0/24 \\
|
|
VPN Gateway & VM\_OPENVPN\_GATEWAY.sh & Router \\
|
|
OpenSSL / Apache & VM\_OPENSSL\_APACHE.sh & Reder Interna 10.60.0.0/24 \\
|
|
\end{tabular}
|
|
|
|
|
|
|
|
|
|
\section{Criação de certificados}
|
|
Criar chaves com 2048 bits.
|
|
|
|
\begin{lstlisting}[language=bash]
|
|
cert_ca="/C=PT/ST=Coimbra/L=Coimbra/O=UC/CN=CoimbraVPN"
|
|
cert_vpn="/C=PT/ST=Coimbra/L=Coimbra/O=UC/CN=gateway"
|
|
cert_user="/C=PT/ST=Coimbra/L=Coimbra/O=UC/CN=warrior"
|
|
cert_apache="/C=PT/ST=Coimbra/L=Coimbra/O=UC/CN=apache.coimbra"
|
|
|
|
openssl genrsa -out "ca.key" 2048
|
|
openssl req -x509 -nodes -days 365 -key "ca.key" -out "ca.crt" -subj "$cert_ca"
|
|
openssl genrsa -out "vpn.key" 2048
|
|
openssl req -new -key "vpn.key" -out "vpn.csr" -subj "$cert_vpn"
|
|
openssl ca -batch -in "vpn.csr" -cert "ca.crt" -keyfile "ca.key" -out "vpn.crt" -config cheese.cfg
|
|
openssl dhparam -out "dh2048.pem" 2048
|
|
openvpn --genkey secret "ta.key"
|
|
openssl genrsa -out user.key
|
|
openssl req -new -key user.key -out user.csr -subj "$cert_user"
|
|
openssl ca -batch -in "user.csr" -cert "ca.crt" -keyfile "ca.key" -out "user.crt" -config cheese.cfg
|
|
openssl genrsa -out apache.key
|
|
openssl req -new -key apache.key -out apache.csr -subj "$cert_apache" -addext "subjectAltName = IP:10.60.0.1,DNS:apache"
|
|
openssl ca -batch -in "apache.csr" -cert "ca.crt" -keyfile "ca.key" -out "apache.crt" -config cheese.cfg
|
|
\end{lstlisting}
|
|
|
|
Criar chave secreta.
|
|
\begin{lstlisting}[language=bash]
|
|
openssl --genkey secret ta.key
|
|
\end{lstlisting}
|
|
|
|
|
|
\section{Configuração da \textit{Gateway} VPN}
|
|
|
|
\section{Configurar TOTP}
|
|
|
|
|
|
|
|
Foi criado o ficheiro \texttt{totp} com a configuração de autenticação a
|
|
ser utilizada pelo plugin de PAM para o openvpn.
|
|
|
|
\begin{lstlisting}[language=bash]
|
|
plugin /usr/lib64/openvpn/plugins/openvpn-plugin-auth-pam.so totp
|
|
\end{lstlisting}
|
|
|
|
\subsection{Aceder ao código}
|
|
Primeiro, na gateway, entramos como o utilizador desejado e obtemos a chave
|
|
do gerador de palavras passes temporarias. Ao inserir a chave no
|
|
\texttt{google authenticator} podemos obter a nossa primeira chave de 6 digitos.
|
|
|
|
\begin{lstlisting}[language=bash]
|
|
su john
|
|
google-authenticator
|
|
\end{lstlisting}
|
|
|
|
\section{Revocation e OCSP}
|
|
|
|
\subsection{Testar OSCP via revoke}
|
|
|
|
\begin{enumerate}
|
|
\item Conectar ao VPN e ver que funciona
|
|
\item Na maquina host, nao nas vms, na repo mesmo.
|
|
\item revogar o certificado via openssl -revoke user.crt -config cheese.cfg -keyfile ca.key -cert ca.crt
|
|
\item Fechae OSCP e correr VM\_OPENSSL novamente (copiar index.txt e serial?)
|
|
\item Tentar outra vez e ver que de facto falha
|
|
\end{enumerate}
|
|
|
|
|
|
|
|
\section{Conclusion}
|
|
Conclusão!!!
|
|
|
|
\end{document}
|