merge
This commit is contained in:
@@ -10,14 +10,15 @@
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {1}Introdução}{2}{section.1}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {2}Criação de certificados}{2}{section.2}\protected@file@percent }
|
||||
\def\@LN@column{1}
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {3}Configuração da \textit {Gateway} VPN}{3}{section.3}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {3.1}Configurar TOTP}{3}{subsection.3.1}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {3.2}Encaminhamento e Firewall}{3}{subsection.3.2}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {4}Configuração do Cliente (Road Warrior)}{3}{section.4}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {3}Configuração geral}{3}{section.3}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {4}Configuração da \textit {Gateway} VPN}{3}{section.4}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1}Configurar TOTP}{3}{subsection.4.1}\protected@file@percent }
|
||||
\def\@LN@column{1}
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {5}Servidor Apache e OCSP}{4}{section.5}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1}Revocation e OCSP}{4}{subsection.5.1}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {4.2}Encaminhamento e Firewall}{4}{subsection.4.2}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {5}Configuração do Cliente (Road Warrior)}{4}{section.5}\protected@file@percent }
|
||||
\def\@LN@column{1}
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {6}Conclusão}{5}{section.6}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {6}Servidor Apache e OCSP}{5}{section.6}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {subsection}{\numberline {6.1}Revocation e OCSP}{5}{subsection.6.1}\protected@file@percent }
|
||||
\@writefile{toc}{\contentsline {section}{\numberline {7}Conclusão}{5}{section.7}\protected@file@percent }
|
||||
\xdef \mintedoldcachechecksum{\detokenize{\minted@cachechecksum }}
|
||||
\gdef \@abspage@last{5}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
This is pdfTeX, Version 3.141592653-2.6-1.40.29 (TeX Live 2026/Arch Linux) (preloaded format=pdflatex 2026.4.13) 24 APR 2026 17:22
|
||||
This is pdfTeX, Version 3.141592653-2.6-1.40.29 (TeX Live 2026/Arch Linux) (preloaded format=pdflatex 2026.4.13) 24 APR 2026 18:42
|
||||
entering extended mode
|
||||
\write18 enabled.
|
||||
%&-line parsing enabled.
|
||||
@@ -840,9 +840,9 @@ LaTeX Font Info: Font shape `T1/Raleway-OsF/bold/n' aliased to
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/b/n' will be
|
||||
(Font) scaled to size 10.95pt on input line 2.
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/bold/it' aliased to
|
||||
(Font) `T1/Raleway-OsF/b/it' on input line 4.
|
||||
(Font) `T1/Raleway-OsF/b/it' on input line 5.
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/b/it' will be
|
||||
(Font) scaled to size 10.95pt on input line 4.
|
||||
(Font) scaled to size 10.95pt on input line 5.
|
||||
)
|
||||
\tf@toc=\write5
|
||||
\openout5 = `relatorio.toc'.
|
||||
@@ -852,7 +852,7 @@ LaTeX Font Info: Font shape `T1/Raleway-OsF/b/it' will be
|
||||
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}{/usr/share/texmf-dist/fonts
|
||||
/enc/dvips/raleway/a_itoun2.enc}]
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/m/it' will be
|
||||
(Font) scaled to size 10.95pt on input line 46.
|
||||
(Font) scaled to size 10.95pt on input line 42.
|
||||
(/usr/share/texmf-dist/tex/latex/listings/lstlang1.sty
|
||||
File: lstlang1.sty 2025/11/14 1.11b listings language file
|
||||
)
|
||||
@@ -860,30 +860,30 @@ File: lstlang1.sty 2025/11/14 1.11b listings language file
|
||||
File: lstlang1.sty 2025/11/14 1.11b listings language file
|
||||
)
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/m/n' will be
|
||||
(Font) scaled to size 9.0pt on input line 73.
|
||||
(Font) scaled to size 9.0pt on input line 86.
|
||||
LaTeX Font Info: Font shape `T1/cmtt/bx/n' in size <9> not available
|
||||
(Font) Font shape `T1/cmtt/m/n' tried instead on input line 82.
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/bold/it' aliased to
|
||||
(Font) `T1/Raleway-OsF/b/it' on input line 93.
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/b/it' will be
|
||||
(Font) scaled to size 14.4pt on input line 93.
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/bold/n' aliased to
|
||||
(Font) `T1/Raleway-OsF/b/n' on input line 95.
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/b/n' will be
|
||||
(Font) scaled to size 12.0pt on input line 95.
|
||||
(Font) Font shape `T1/cmtt/m/n' tried instead on input line 95.
|
||||
[2{/usr/share/texmf-dist/fonts/enc/dvips/cm-super/cm-super-t1.enc}]
|
||||
<google-authenticator.jpg, id=58, 225.84375pt x 447.6725pt>
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/bold/it' aliased to
|
||||
(Font) `T1/Raleway-OsF/b/it' on input line 141.
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/b/it' will be
|
||||
(Font) scaled to size 14.4pt on input line 141.
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/bold/n' aliased to
|
||||
(Font) `T1/Raleway-OsF/b/n' on input line 143.
|
||||
LaTeX Font Info: Font shape `T1/Raleway-OsF/b/n' will be
|
||||
(Font) scaled to size 12.0pt on input line 143.
|
||||
<google-authenticator.jpg, id=60, 225.84375pt x 447.6725pt>
|
||||
File: google-authenticator.jpg Graphic file (type jpg)
|
||||
<use google-authenticator.jpg>
|
||||
Package pdftex.def Info: google-authenticator.jpg used on input line 120.
|
||||
(pdftex.def) Requested size: 225.84319pt x 447.6714pt.
|
||||
Package pdftex.def Info: google-authenticator.jpg used on input line 169.
|
||||
(pdftex.def) Requested size: 87.59998pt x 173.64207pt.
|
||||
|
||||
|
||||
LaTeX Warning: `h' float specifier changed to `ht'.
|
||||
|
||||
[3] [4 </home/raw/uni/fsi/trabalho/relatorio/google-authenticator.jpg>]
|
||||
[5]
|
||||
runsystem(latexminted cleantemp --timestamp 20260424172206 C117BC0880C49B7BB81
|
||||
runsystem(latexminted cleantemp --timestamp 20260424184203 C117BC0880C49B7BB81
|
||||
87B6D1568B650)...executed.
|
||||
|
||||
(/home/raw/uni/fsi/trabalho/relatorio/relatorio.aux)
|
||||
@@ -899,32 +899,28 @@ Package rerunfilecheck Warning: File `relatorio.out' has changed.
|
||||
|
||||
Package rerunfilecheck Info: Checksums for `relatorio.out':
|
||||
(rerunfilecheck) Before: <no file>
|
||||
(rerunfilecheck) After: 97318B6716690DCCEA5502A17BBBBFD0;1443.
|
||||
(rerunfilecheck) After: 421D094394457CC27F2EA2D1C1EC716E;1586.
|
||||
)
|
||||
Here is how much of TeX's memory you used:
|
||||
20169 strings out of 469495
|
||||
373283 string characters out of 5470098
|
||||
1295490 words of memory out of 5000000
|
||||
48459 multiletter control sequences out of 15000+600000
|
||||
20227 strings out of 469495
|
||||
373994 string characters out of 5470098
|
||||
1301885 words of memory out of 5000000
|
||||
48492 multiletter control sequences out of 15000+600000
|
||||
830020 words of font info for 92 fonts, out of 8000000 for 9000
|
||||
16 hyphenation exceptions out of 8191
|
||||
90i,6n,99p,490b,1296s stack positions out of 10000i,1000n,20000p,200000b,200000s
|
||||
|
||||
pdfTeX warning (dest): name{subsection.3.3} has been referenced but does not ex
|
||||
ist, replaced by a fixed one
|
||||
|
||||
</usr/share/texmf-dist/fonts/type1/impallari/raleway/Raleway-Bold.pfb></usr/sha
|
||||
re/texmf-dist/fonts/type1/impallari/raleway/Raleway-BoldItalic.pfb></usr/share/
|
||||
texmf-dist/fonts/type1/impallari/raleway/Raleway-Italic.pfb></usr/share/texmf-d
|
||||
ist/fonts/type1/impallari/raleway/Raleway-Regular.pfb></usr/share/texmf-dist/fo
|
||||
nts/type1/public/cm-super/sfit0900.pfb></usr/share/texmf-dist/fonts/type1/publi
|
||||
c/cm-super/sftt0900.pfb></usr/share/texmf-dist/fonts/type1/public/cm-super/sftt
|
||||
1095.pfb>
|
||||
90i,6n,99p,490b,2124s stack positions out of 10000i,1000n,20000p,200000b,200000s
|
||||
</usr/share/texmf-dist/fonts/type1/impallari/raleway/Raleway-Bold.pfb></usr/s
|
||||
hare/texmf-dist/fonts/type1/impallari/raleway/Raleway-BoldItalic.pfb></usr/shar
|
||||
e/texmf-dist/fonts/type1/impallari/raleway/Raleway-Italic.pfb></usr/share/texmf
|
||||
-dist/fonts/type1/impallari/raleway/Raleway-Regular.pfb></usr/share/texmf-dist/
|
||||
fonts/type1/public/cm-super/sfit0900.pfb></usr/share/texmf-dist/fonts/type1/pub
|
||||
lic/cm-super/sftt0900.pfb></usr/share/texmf-dist/fonts/type1/public/cm-super/sf
|
||||
tt1095.pfb>
|
||||
Output written on /home/raw/uni/fsi/trabalho/relatorio/relatorio.pdf (5 pages,
|
||||
167001 bytes).
|
||||
176238 bytes).
|
||||
PDF statistics:
|
||||
158 PDF objects out of 1000 (max. 8388607)
|
||||
134 compressed objects within 2 object streams
|
||||
72 named destinations out of 1000 (max. 500000)
|
||||
189 PDF objects out of 1000 (max. 8388607)
|
||||
165 compressed objects within 2 object streams
|
||||
97 named destinations out of 1000 (max. 500000)
|
||||
6 words of extra memory for PDF output out of 10000 (max. 10000000)
|
||||
|
||||
|
||||
Binary file not shown.
@@ -38,18 +38,27 @@
|
||||
|
||||
\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.
|
||||
Este projeto tem como âmbito implementar, uma rede virtual privada (VPN) num cenário
|
||||
de road-warrior, configurar \textit{two-factor authentication} (2FA) com os serviços
|
||||
OpenVPN e Apache, e gerir certificados X.509 utilizando OCSP.
|
||||
|
||||
Para tal, foi implementado um servidor e um cliente OpenVPN, certificados por uma autoridade 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 \textit{google-authenticator} para o OpenVPN.
|
||||
% NOTE(vasco): Eu acho que basta explicar o cenario e explicar como decidimos
|
||||
% implementar
|
||||
|
||||
Existe ainda um servidor Apache e um servidor de OpenSSL OCSP. Para simplificar, a elaboração do
|
||||
projecto foram colocados na mesma maquina virtual, mas por razoes de seguranca poderia querer ter
|
||||
estes serviços separados.
|
||||
% Para tal, foi implementado um servidor e um cliente OpenVPN, certificados por uma
|
||||
% autoridade central (CA) que em si é \textit{self-signed}. Para além disto, foi implementado
|
||||
% um sistema de autenticação de dois factores através do plugin
|
||||
% \textit{google-authenticator} para o OpenVPN e para o servidor de Apache.
|
||||
|
||||
Temos então três máquinas virtuais:
|
||||
Decidimos utilizar apenas três máquinas virtuais: o cliente (ou \textit{road warrior}),
|
||||
a \textit{gateway} que utiliza OpenVPN e um servidor interno com OpenSSL e Apache.
|
||||
Isto simplifica a elaboração do projecto, mas por razões de segurança poderia querer
|
||||
separar a máquina de OpenSSL de outras máquinas destinadas a serviços da rede intera,
|
||||
pois esta contém o \textit{certificate authority} CA.
|
||||
|
||||
% Ambos o OpenVPN eo servidor Apache utilizam 2FA,
|
||||
% recebendo o utilizador, e uma password que é uma concatenação da palavra-passe do utilizador
|
||||
% e de uma password temporária (TOTP) de 6 dígitos. O servidor de Apache implementa a mesma autenticação.
|
||||
|
||||
\begin{tabular}{l l l}
|
||||
|
||||
@@ -59,15 +68,19 @@ Temos então três máquinas virtuais:
|
||||
OpenSSL / Apache & VM\_OPENSSL\_APACHE.sh & Rede Interna 10.60.0.0/24 \\
|
||||
\end{tabular}
|
||||
|
||||
|
||||
|
||||
\section{Criação de certificados}
|
||||
|
||||
Criar chaves com 2048 bits.
|
||||
Os certificados utilizados foram auto-certificados por uma autoridade central que "pertence"
|
||||
à máquina de OpenSSL. Esta mesma faz a gestão da lista de revogação.
|
||||
|
||||
Todos os certificados são criados de uma so vez e são depois copiados para as respetivas
|
||||
máquinas virtuais.
|
||||
Todas as chaves foram criadas no mesmo computador, com as variáveis que estão
|
||||
neste código, aspetos importantes para mais tarde serão os parâmetros de CN
|
||||
que precisam de ser passados mais tarde para aceder ao Apache e ao gateway.
|
||||
Numa situação normal teríamos uma autoridade de certificação para enviar e
|
||||
no fundo gerir todos, mas para este cenário podemos inicializar as máquinas
|
||||
com as chaves, requests e certificados necessários.
|
||||
|
||||
O código para gerar os certificados X.509:
|
||||
|
||||
\begin{lstlisting}[language=bash]
|
||||
cert_ca="/C=PT/ST=Coimbra/L=Coimbra/O=UC/CN=CoimbraVPN"
|
||||
@@ -90,6 +103,41 @@ openssl req -new -key apache.key -out apache.csr -subj "$cert_apache" -addext "s
|
||||
openssl ca -batch -in "apache.csr" -cert "ca.crt" -keyfile "ca.key" -out "apache.crt" -config cheese.cfg
|
||||
\end{lstlisting}
|
||||
|
||||
% Porque é que precisamos de uma chave secreta?
|
||||
% Criar chave secreta.
|
||||
|
||||
\begin{lstlisting}[language=bash]
|
||||
openssl --genkey secret ta.key
|
||||
\end{lstlisting}
|
||||
\section{Configuração geral}
|
||||
Para configurar as VMs era preciso introduzir os mesmos comandos várias vezes, o que levava muitas vezes a erros de escrita, ou a correr o mesmo comando várias vezes, por isso criamos vários ficheiros .sh para conseguir facilitar o processo. A utilização de ficheiros .sh também vem com outros positivos pois facilita a testagem, e a recriação do cenário rapidamente.
|
||||
|
||||
No entanto para os serviços que configuramos, instalar, desativar e dar flush às iptables não foi suficiente, tivemos que criar pastas e sincronizar os relógios de todas as VMs visto que elas estarem ligeiramente atrasadas nunca conseguíamos acertar na password do google-authenticator que utiliza o tempo local para calcular a sua chave.
|
||||
\begin{lstlisting}[language=bash]
|
||||
yum install -y epel-release
|
||||
yum install -y openvpn iptables-services dhcp-client
|
||||
systemctl stop firewalld
|
||||
systemctl disable firewalld
|
||||
systemctl mask firewalld
|
||||
systemctl enable iptables
|
||||
iptables -F
|
||||
|
||||
CA_DIR="/etc/pki/CA"
|
||||
mkdir -p "${CA_DIR}/newcerts"
|
||||
mkdir -p "${CA_DIR}/private"
|
||||
touch "${CA_DIR}/index.txt"
|
||||
cp ca/serial "${CA_DIR}/serial"
|
||||
|
||||
mkdir -p /etc/openvpn/server
|
||||
mkdir -p /etc/openvpn/client
|
||||
|
||||
# NOTE(vasco): tive problemas com a sincronizacao de tempo
|
||||
# se nao tiver sincronizado, o TOTP nao funciona
|
||||
systemctl stop chronyd
|
||||
ntpdate pool.ntp.org
|
||||
systemctl start chronyd
|
||||
\end{lstlisting}
|
||||
|
||||
\section{Configuração da \textit{Gateway} VPN}
|
||||
|
||||
\subsection{Configurar TOTP}
|
||||
@@ -112,13 +160,13 @@ ProtectHome=false
|
||||
\end{lstlisting}
|
||||
|
||||
Primeiro, na gateway, entramos como o utilizador desejado e obtemos a chave
|
||||
do gerador de palavras passes temporarias. Ao inserir a chave no
|
||||
do gerador de palavras passes temporárias. Ao inserir a chave no
|
||||
\texttt{google authenticator} podemos obter um código QR, a nossa primeira
|
||||
chave de 6 digitos.
|
||||
chave de 6 dígitos.
|
||||
|
||||
\begin{figure}[h]
|
||||
\centering
|
||||
\includegraphics{google-authenticator}
|
||||
\includegraphics[width=8em]{google-authenticator}
|
||||
\end{figure}
|
||||
|
||||
\begin{lstlisting}[language=bash]
|
||||
@@ -151,9 +199,9 @@ iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o enp0s8 -j MASQUERADE
|
||||
\section{Configuração do Cliente (Road Warrior)}
|
||||
|
||||
O cliente encontra-se na rede externa (\texttt{193.136.212.10}) e liga-se à VPN
|
||||
gateway na porta 1194. Para garantir a segurança, utiliza-mos autenticação mútua (os certificados X.509)
|
||||
e um \textit{two factor authentication} (2FA) como palavras-passe temporarias, geradas através do
|
||||
\textit{Google Authenticator}.
|
||||
gateway na porta 1194. Para garantir a segurança, utilizamos autenticação mútua (os certificados X.509)
|
||||
e um \textit{two factor authentication} (2FA) como palavras-passe temporárias, geradas através do
|
||||
\textit{Google Authenticator}.
|
||||
|
||||
\begin{lstlisting}[language=bash]
|
||||
client
|
||||
@@ -175,7 +223,6 @@ da autoridade de certificação.
|
||||
|
||||
\subsection{Revocation e OCSP}
|
||||
|
||||
|
||||
\begin{enumerate}
|
||||
\item Estabelecer a ligação VPN e verificar a conectividade à rede interna.
|
||||
\item No diretório da autoridade de certificação (máquina \textit{host}), revogar o certificado do utilizador:
|
||||
@@ -187,13 +234,15 @@ openssl ca -revoke user.crt -config cheese.cfg -keyfile ca.key -cert ca.crt
|
||||
\end{enumerate}
|
||||
|
||||
|
||||
|
||||
\section{Conclusão}
|
||||
|
||||
A implementação deste projeto permitiu consolidar conhecimentos sobre redes privadas virtuais e segurança em comunicações.
|
||||
A combinação de certificados digitais com autenticação de dois fatores (TOTP) garante uma robustez significativa contra
|
||||
ataques de interceção e roubo de credenciais.
|
||||
|
||||
A integração do protocolo OCSP permite uma gestão dinâmica da confiança, possibilitando a revogação imediata de acesso a clientes comprometidos sem necessidade de redistribuição de listas de revogação (CRLs) volumosas. Em suma, o sistema cumpre os requisitos de confidencialidade, integridade e disponibilidade propostos.
|
||||
% Conclusão!!!
|
||||
Atingimos o objetivo deste trabalho, conseguimos configurar o VPN tunnel,
|
||||
o two-factor authentication e conseguimos criar e retirar acesso aos
|
||||
certificados que emitimos. Utilizar mais maquinas para simular um cenario
|
||||
maior seria redundante, teriamos que emitir mais certificados mas não iamos
|
||||
aprender muito mais.
|
||||
|
||||
% Para aprofundar (???)
|
||||
|
||||
\end{document}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
\babel@toc {portuguese}{}\relax
|
||||
\contentsline {section}{\numberline {1}Introdução}{2}{section.1}%
|
||||
\contentsline {section}{\numberline {2}Criação de certificados}{2}{section.2}%
|
||||
\contentsline {section}{\numberline {3}Configuração da \textit {Gateway} VPN}{3}{section.3}%
|
||||
\contentsline {subsection}{\numberline {3.1}Configurar TOTP}{3}{subsection.3.1}%
|
||||
\contentsline {subsection}{\numberline {3.2}Encaminhamento e Firewall}{3}{subsection.3.2}%
|
||||
\contentsline {section}{\numberline {4}Configuração do Cliente (Road Warrior)}{3}{section.4}%
|
||||
\contentsline {section}{\numberline {5}Servidor Apache e OCSP}{4}{section.5}%
|
||||
\contentsline {subsection}{\numberline {5.1}Revocation e OCSP}{4}{subsection.5.1}%
|
||||
\contentsline {section}{\numberline {6}Conclusão}{5}{section.6}%
|
||||
\contentsline {section}{\numberline {3}Configuração geral}{3}{section.3}%
|
||||
\contentsline {section}{\numberline {4}Configuração da \textit {Gateway} VPN}{3}{section.4}%
|
||||
\contentsline {subsection}{\numberline {4.1}Configurar TOTP}{3}{subsection.4.1}%
|
||||
\contentsline {subsection}{\numberline {4.2}Encaminhamento e Firewall}{4}{subsection.4.2}%
|
||||
\contentsline {section}{\numberline {5}Configuração do Cliente (Road Warrior)}{4}{section.5}%
|
||||
\contentsline {section}{\numberline {6}Servidor Apache e OCSP}{5}{section.6}%
|
||||
\contentsline {subsection}{\numberline {6.1}Revocation e OCSP}{5}{subsection.6.1}%
|
||||
\contentsline {section}{\numberline {7}Conclusão}{5}{section.7}%
|
||||
|
||||
Reference in New Issue
Block a user