docs/diploma
diff thesis/tex/5-Improvements.tex @ 317:3b7680af0ebe
work in enc and auth
author | meillo@marmaro.de |
---|---|
date | Wed, 21 Jan 2009 17:26:18 +0100 |
parents | 1b2f12da528a |
children | 426ad56236ce |
line diff
1.1 --- a/thesis/tex/5-Improvements.tex Wed Jan 21 15:19:25 2009 +0100 1.2 +++ b/thesis/tex/5-Improvements.tex Wed Jan 21 17:26:18 2009 +0100 1.3 @@ -1,10 +1,10 @@ 1.4 \chapter{Improvement plans} 1.5 1.6 -<< what to implement how in future >> 1.7 +The last chapter came to the result that further development is best done in a double-strategy. First the existing code base should be improved to satisfy the most important needs in order to make it usable for some more time. Then \masqmail\ should get redesigned from scratch and rebuild to gain a secure and modern \MTA\ architecture for the future. 1.8 1.9 -short time goals on current code: first part. 1.10 +This chapter finally gives concrete suggestions \emph{how} to realize these plans. 1.11 1.12 -long time goal, a new architecture: second part. 1.13 +The first part covers the short-time goals which base on current code. The second part deals with the long-time goal---the redesign. 1.14 1.15 1.16 1.17 @@ -17,30 +17,25 @@ 1.18 1.19 \subsubsection*{Encryption} 1.20 1.21 -Electronic mail is very weak to sniffing attacks, because all data transfer is unencrypted. This concerns the message's content, as well as the email addresses in header and envelope, but also authentication dialogs that may transfer plain text passwords (\NAME{PLAIN} and \NAME{LOGIN} are examples). Adding encryption is therefor wanted. 1.22 +Encryption should be the first funtionality to add to the current code. This requirement was already discussed on page \pageref{requirement-encryption}. As explained there, \NAME{STARTTLS} encryption---as defined in \RFC\,2487---should be added to \masqmail. 1.23 1.24 -The common way to encrypt \SMTP\ dialogs is using \name{Transport Layer Security} (short: \TLS, successor of \NAME{SSL}). \TLS\ encrypts the datagrams of the \name{transport layer}. This means it works below the application protocols and can be used by any of them\citeweb{wikipedia:tls}. 1.25 +Adding encryption requires changes mainly in three source files: \path{smtp_in.c}, \path{smtp_out.c}, and in \path{conf.c}. 1.26 1.27 -\TLS\ allows to create secure tunnels through which arbitrary programs can communicate. Hence one can add secure communication afterwards to programs without changing them. \name{OpenSSL} for example---a free implementation---allows traffic to be piped into a command; a secure tunnel is created and the traffic is forwarded through it. Or a secure tunnel can be set up between a local and a remote port; this tunnel can then be used by any application. 1.28 +The first file includes the functionality for the \SMTP\ server. It needs to offer \NAME{STARTTLS} support to clients and needs to initiate the encryption when the client requests it. Additionally, the server should be able to insist on encryption before it accepts any message. 1.29 1.30 -The \NAME{POP} protocol, for example, is good suited for such tunneling, but \SMTP\ is is not generally. Outgoing \SMTP\ client connections can be tunneled without problem---\masqmail\ already provides a configure option called \texttt{wrapper} to do so. Tunneling incomming connections to a server leads to problems with \SMTP. As data comes encrypted through the tunnel to the receiving host and gets then decrypted and forwarded on local to the port the application listens on. From the \MTA's view, this makes all connections appear to come from localhost, unfortunately. Figure \ref{fig:stunnel} depicts the data flow. 1.31 +The second file includes the functionality for the \SMTP\ client. It should start the encryption by issuing the \NAME{STARTTLS} keyword if the server supports it. It should be possible to send messages only if encryption is possible. 1.32 1.33 -For incoming connections, \NAME{STARTTLS}---defined in \RFC2487---is what \mta{}s implement. 1.34 +The third file controls the configuration files. New configuration option need to be added. The encryption policy for incoming connections needs to be defined. Three choises seem necessary: no encryption, offer encryption, insist on encryption. The encryption policy for outgoing connections should be part of each route setup. The options are the same: never encrypt, encrypt if possible, insist on encryption. 1.35 1.36 -\masqmail\ is already able to encrypt outgoing connections, but encryption of incoming connections, using \NAME{STARTTLS} should be implemented. This only affects the \SMTP\ server module. 1.37 +\NAME{STARTTLS} uses \NAME{TLS} encryption which is based on certificates. Thus the \MTA\ needs its own certificate. This should be generated during installation. A third party application like \name{openssl} should be taken for this job. The encryption itself should also be done using an available library. Open\NAME{SSL} or a substitute like Gnu\NAME{TLS} does then become a dependency for \masqmail. Gnu\NAME{TLS} seems to be the better choice because the Open\NAME{SSL} license is incompatible to the \NAME{GPL}, under which \masqmail\ and Gnu\NAME{TLS} are covered. 1.38 1.39 -%TLS/SSL prevents attackers to listen on the cable 1.40 -%but it does not prevent man-in-the-middle attacks 1.41 -%signed certificates help here 1.42 -% or PGP encryption 1.43 +User definable paths to \masqmail's secret key, \masqmail's certificate, and the public certificates of trusted \name{Certificate Authorities} (short: \NAME{CA}s) are also nice to have. 1.44 1.45 1.46 -%do not use stunnel wit SMTP: 1.47 -%because all incoming mail would be from 127.0.0.1 !! 1.48 -%use STARTTLS instead 1.49 +<< TLS patch of qmail >> 1.50 1.51 %postfix: main.cf 1.52 -%\begin{verbatim} 1.53 +% 1.54 % smtpd_use_tls = yes 1.55 % smtpd_tls_received_header = no (does not log in received headers) 1.56 % 1.57 @@ -52,45 +47,37 @@ 1.58 % smtp_tls_key_file = /etc/postfix/key.pem 1.59 % smtp_tls_cert_file = /etc/postfix/cert.pem 1.60 % smtp_tls_CA_file = /etc/postfix/CAcert.pem 1.61 -%\end{verbatim} 1.62 1.63 1.64 1.65 1.66 \subsubsection*{Authentication} 1.67 1.68 -Several ways to restrict access are available. The most simple one is restrictiction by the \NAME{IP} address. No extra complexity is added this way, but static \NAME{IP} addresses are mandatory. This kind of restriction may be enabled using the operating system's \path{hosts.allow} and \path{hosts.deny} files. To allow only connections to port 25 from localhost or the local network \texttt{192.168.100.0/24} insert the line ``\texttt{25: ALL}'' into \path{hosts.deny} and ``\texttt{25: 127.0.0.1, 192.168.100.}'' into \path{hosts.allow}. 1.69 +Authentication is the second function to add; it is important to restrict the access to \masqmail, especially for mail relay. The requirements for authentication where identified on page \pageref{requirement-authentication}. 1.70 1.71 -If static access restriction is not possible, for example if mail from locations with changing \NAME{IP} addresses wants to be accepted, some kind of authentication mechanism is required. Three common kinds exist: 1.72 +Static access restriction, based on the \NAME{IP} address is already possible by using \name{TCP Wrappers}. This makes it easy to refuse all connections from outside the local net for example, which is a good prevention of being an open relay. More detailed static restrictions, like splitting between mail for the system and mail to relay, should not be added to the current code. This may be a concern for the new design. 1.73 1.74 -\begin{enumerate} 1.75 - \item \SMTP-after-\NAME{POP}: uses authenication on the \NAME{POP} protocol to permit incoming \SMTP\ connections for a limited time afterwards. 1.76 - \item \SMTP\ authentication: is an extension to \SMTP. Authentication can be requested before mail is accepted. 1.77 - \item Certificates: confirm the identity of someone. 1.78 -\end{enumerate} 1.79 +Of the dynamic, secret based, authentication methods (\SMTP-after-\NAME{POP}, \SMTP\ authentication, and certificates) the first one drops out as it requires a \NAME{POP} server running on the same or a trusted host. \NAME{POP} servers are rare on workstations and home servers do also not regularly include them. Thus it is no option for \masqmail. 1.80 1.81 -The first mechanism requires a \NAME{POP} (or \NAME{IMAP}) server running on the same host (or a trusted one), to enable the \SMTP\ server to use the login dates on the \NAME{POP} server. This is a common practice used by mail service providers, but is not adequate for the environments \masqmail\ is designed for. 1.82 +Authentication based on certificates does suffer from the certificate infrastructure that is required. Although certificates are already used for encryption, its management overhead prevented wide spread usage for authentication. 1.83 1.84 -Certificate based authentication, like provided by \NAME{TLS}, suffers from the overhead of certificate management. But \NAME{TLS} provides encryption too, so is useful anyway. 1.85 - 1.86 -\SMTP\ authentication (also refered to as \NAME{SMTP-AUTH}) suppoert is easiest received by using a \name{Simple Authentication and Security Layer} implementation. \person{Dent} sees in \NAME{SASL} the best solution for authenticating dynamic users: 1.87 +\SMTP\ authentication (also refered to as \NAME{SMTP-AUTH}) support is easiest received by using a \name{Simple Authentication and Security Layer} (short: \NAME{SASL}) implementation. \person{Dent} sees in \NAME{SASL} the best solution for dynamic authentication of users: 1.88 \begin{quote} 1.89 %None of these add-ons is an ideal solution. They require additional code compiled into your existing daemons that may then require special write accesss to system files. They also require additional work for busy system administrators. If you cannot use any of the nonauthenticating alternatives mentioned earlier, or your business requirements demand that all of your users' mail pass through your system no matter where they are on the Internet, SASL is probably the solution that offers the most reliable and scalable method to authenticate users. 1.90 None of these [authentication methods] is an ideal solution. They require additional code compiled into your existing daemons that may then require special write accesss to system files. They also require additional work for busy system administrators. If you cannot use any of the nonauthenticating alternatives mentioned earlier, or your business requirements demand that all of your users' mail pass through your system no matter where they are on the Internet, \NAME{SASL} is probably the solution that offers the most reliable and scalable method to authenticate users. 1.91 \hfill\cite[page 44]{dent04} 1.92 \end{quote} 1.93 1.94 +In the meanwhile is \NAME{SMTP-AUTH} supported by most email clients and if encryption is used then even insecure authentication methods like \NAME{PLAIN} and \NAME{LOGIN} become secure. 1.95 1.96 -Compare static with dynamic authentication: pros and cons; usecases: when to use what; how could this be covered by architecture (e.g. smtp submission). 1.97 -%either by 1.98 -%- network/ip address 1.99 -% easiest: restricting by static IP addresses (Access control via hosts.allow/hosts.deny) 1.100 -%or 1.101 -%- some kind of auth (for dynamic remote hosts) 1.102 -% adds complexity 1.103 -% - SASL 1.104 -% - POP/IMAP: pop-before-smtp, DRAC, WHOSON 1.105 -% - TLS (certificates) 1.106 +<< what to do in code (same like for enc?) >> 1.107 + 1.108 +<< where to store login data >> 1.109 + 1.110 + 1.111 +<< Compare static with dynamic authentication: pros and cons; usecases: when to use what; >> 1.112 + 1.113 +<< how could this be covered by architecture (e.g. smtp submission). >> 1.114 1.115 1.116 1.117 @@ -107,6 +94,8 @@ 1.118 +--------+ ||||| +--------+ 1.119 \end{verbatim} 1.120 1.121 +<< refer back to enc and auth >> 1.122 + 1.123 1.124 \subsubsection*{Reliability} 1.125