docs/diploma

changeset 239:a6be202e1b49

reworked nearly everything in ch04!
author meillo@marmaro.de
date Sat, 10 Jan 2009 22:27:06 +0100
parents d60e5843db7f
children 046a8284b5d3
files thesis/tex/4-MasqmailsFuture.tex
diffstat 1 files changed, 233 insertions(+), 192 deletions(-) [+]
line diff
     1.1 --- a/thesis/tex/4-MasqmailsFuture.tex	Sat Jan 10 22:26:29 2009 +0100
     1.2 +++ b/thesis/tex/4-MasqmailsFuture.tex	Sat Jan 10 22:27:06 2009 +0100
     1.3 @@ -5,43 +5,6 @@
     1.4  
     1.5  
     1.6  
     1.7 -\section{Existing code base}
     1.8 -
     1.9 -Here regarded is version 0.2.21 of \masqmail. This is the last version released by Oliver \person{Kurth}, and the basis for my thesis.
    1.10 -
    1.11 -
    1.12 -\subsubsection*{The source code}
    1.13 -
    1.14 -\masqmail\ is written in the C programming language. The program, as of version 0.2.21, consists of 34 source code and eight header files, containing about 9,000 lines of code\footnote{Measured with \name{sloccount} by David A.\ Wheeler.}. Additionally, it includes a \name{base64} implementation (about 300 lines) and \name{md5} code (about 150 lines). For systems that do not provide \name{libident}, this library is distributed as well (circa 600 lines); an available shared library has higher precedence in linking, though.
    1.15 -
    1.16 -The only mandatory dependency is \name{glib}---a cross-platform software utility library, originated in the \NAME{GTK+} project. It provides safe replacements for many standard library functions, especially for the string functions. It also offers handy data containers, easy-to-use implementations of data structures, and much more.
    1.17 -
    1.18 -With \masqmail\ comes the small tool \path{mservdetect}; it helps setting up a configuration that uses the \name{mserver} system to detect the online state. Two other binaries get compiled for testing purposes: \path{readtest} and \path{smtpsend}. All three programs use \masqmail\ source code; they only add a file with a \verb+main()+ function each.
    1.19 -
    1.20 -\masqmail\ lacks an interface to plug in modules with additional functionality. There exists no add-on or module system. The code is only separated by function to the various source files. Some functional parts can be included or excluded by defining symbols at compile time. Adding maildir support, means giving the option \verb+--enable-maildir+ to the \path{configure} call. This preserves the concerning code to get removed by the preprocessor. Unfortunately the \verb+#ifdef+s are scattered through all the source, leading to a code that is hard to read.
    1.21 -%fixme: refer to ifdef-considered-harmful ?
    1.22 -
    1.23 -
    1.24 -
    1.25 -\subsubsection*{Features}
    1.26 -\label{sec:masqmail-features}
    1.27 -
    1.28 -\masqmail\ supports two channels for incoming mail: (1) Standard input, used when \path{masqmail} is executed on the command line and (2) a \NAME{TCP} socket, used by local or remote clients that talk \SMTP. The outgoing channels for mail are: (1) direct delivery to local mailboxes (in \name{mbox} or \name{maildir} format), (2) local pipes to pass mail to a program (e.g.\ gateways to \NAME{UUCP}, gateways to fax, or \NAME{MDA}s), and (3) \NAME{TCP} sockets to transfer mail to other \MTA{}s using the \SMTP\ protocol.
    1.29 -
    1.30 -Outgoing \SMTP\ connections feature \SMTP-\NAME{AUTH} and \SMTP-after-\NAME{POP} authentication, but incoming connections do not. Using wrappers for outgoing connections is supported. This allows encrypted communication through a gateway application like \name{openssl}.
    1.31 -
    1.32 -Mail queuing and alias expansion is both supported.
    1.33 -
    1.34 -\masqmail\ focuses on non-permanent online connections, thus a concept of online routes is used. One may configure any number of routes to send mail. Each route can have criteria to determine if some message is allowed to be sent over it. This concept is explained in section \ref{sec:masqmail-routes} in detail. Mail to destinations outside the local network gets queued until an online connections is available.
    1.35 -
    1.36 -The \masqmail\ executable can be called under various names for sendmail-compatibility reasons. This is organized by symbolic links with different names pointing to the \masqmail\ executable. The \sendmail\ names are \path{/usr/lib/sendmail} and \path{/usr/sbin/sendmail} because many programs expect the \mta\ to be located there. Further more \sendmail\ supports calling it with a different name instead of supplying command line arguments. The best known of this shortcuts is \path{mailq}, which is equivalent to calling it with the argument \verb+-bq+. \masqmail\ recognizes the shortcuts \path{mailq}, \path{smtpd}, \path{mailrm}, \path{runq}, \path{rmail}, and \path{in.smtpd}. The first two are inspired by \sendmail. Not implemented is the shortcut \path{newaliases} because \masqmail\ does not generate binary representations of the alias file.\footnote{A shell script named \path{newaliases}, that invokes \texttt{masqmail -bi}, can provide the command to satisfy other software needing it.} \path{hoststat} and \path{purgestat} are missing for complete sendmail-compatibility.
    1.37 -%masqmail: mailq, mailrm, runq, rmail, smtpd/in.smtpd
    1.38 -%sendmail: hoststat, mailq, newaliases, purgestat, smtpd
    1.39 -
    1.40 -Additional to the \mta\ job, \masqmail\ also offers mail retrieval services by being a \NAME{POP3} client. It can fetch mail from different remote locations, dependent on the active online connection.
    1.41 -
    1.42 -
    1.43 -
    1.44  
    1.45  
    1.46  
    1.47 @@ -57,11 +20,10 @@
    1.48  
    1.49  Functional requirements are about the function of the software. They define what the program can do and in what way.
    1.50  %fixme: add ref
    1.51 -The requirements are named ``RF'' for ``requirement, functional''.
    1.52 +The requirements are named ``\NAME{RF}'' for ``requirement, functional''.
    1.53  
    1.54  
    1.55 -\subsubsection*{RF1: Incoming and outgoing channels}
    1.56 -
    1.57 +\paragraph{\RF1: Incoming and outgoing channels}
    1.58  \sendmail-compatible \mta{}s must support at least two incoming channels: mail submitted using the \sendmail\ command, and mail received on a \NAME{TCP} port. Thus it is common to split the incoming channels into local and remote. This is done by \qmail\ and \postfix. The same way is \person{Hafiz}'s view \cite{hafiz05}.
    1.59  
    1.60  \SMTP\ is the primary mail transport protocol today, but with the increasing need for new protocols (see section \ref{sec:what-will-be-important}) in mind, support for more than just \SMTP\ is good to have. New protocols will show up, maybe multiple protocols need to be supported then. This leads to multiple remote channels, one for each supported protocol as it was done in other \MTA{}s. Best would be interfaces to add further protocols as modules.
    1.61 @@ -84,11 +46,12 @@
    1.62  
    1.63  An overview on in and outgoing channels required for an \MTA, gives figure \ref{fig:mta-channels}.
    1.64  
    1.65 +%fixme: write about submission (port 587)
    1.66  
    1.67  
    1.68  
    1.69 -\subsubsection*{RF2: Mail queuing}
    1.70  
    1.71 +\paragraph{\RF2: Mail queuing}
    1.72  Mail queuing removes the need to deliver instantly as a message is received. The queue provides fail-safe storage of mails until they are delivered. Mail queues are probably used in all \mta{}s, excluding the simple forwarders. The mail queue is essential for \masqmail, as \masqmail\ is used for non-permanent online connections. This means, mail must be queued until a online connection is available to send the message. This may be after a reboot. Hence the mail queue must provide persistence.
    1.73  
    1.74  The mail queue and the module(s) to manage it are the central part of the whole system. This demands especially for robustness and reliability, as a failure here can lead to loosing mail. An \MTA\ takes over responsibility for mail in accepting it, hence loosing mail messages is absolutely to avoid. This covers any kind of crash situation too. The worst thing acceptable to happen is an already sent mail to be sent again.
    1.75 @@ -96,8 +59,7 @@
    1.76  
    1.77  
    1.78  
    1.79 -\subsubsection*{RF3: Header sanitizing}
    1.80 -
    1.81 +\paragraph{\RF3: Header sanitizing}
    1.82  Mail coming into the system often lacks important header lines. At least the required ones must be added by the \MTA. One example is the \texttt{Date:} header, another is the, not required but recommended, \texttt{Message-ID:} header. Apart from adding missing headers, rewriting headers is important too. Changing the locally known domain part of email addresses to globally known ones is an example. \masqmail\ needs to be able to rewrite the domain part dependent on the route used to send the message, to prevent messages to get classified as spam.
    1.83  
    1.84  Generating the envelope is a related job. The envelope specifies the actual recipient of the mail, no matter what the \texttt{To:}, \texttt{Cc:}, and \texttt{Bcc:} headers contain. Multiple recipients lead to multiple different envelopes, containing all the same mail message.
    1.85 @@ -105,22 +67,19 @@
    1.86  
    1.87  
    1.88  
    1.89 -\subsubsection*{RF4: Aliasing}
    1.90 -
    1.91 +\paragraph{\RF4: Aliasing}
    1.92  Email addresses can have aliases, thus they need to be expanded. Aliases can be of different kind: another local user, a remote user, a list containing local and remote users, or a command. Most important are the aliases in the \path{aliases} file, usually located at \path{/etc/aliases}. Addresses expanding to lists of users lead to more envelopes. Aliases changing the recipient's domain part may require a different route to be used.
    1.93  
    1.94  
    1.95  
    1.96  
    1.97 -\subsubsection*{RF5: Selecting a route}
    1.98 -
    1.99 +\paragraph{\RF5: Selecting a route}
   1.100  One key feature of \masqmail\ is its ability to send mail out over different routes. The online state defines the active route to be used. A specific route may not be suited for all messages, thus these messages are hold back until a suiting route is active. For more information on this concept see section \ref{sec:masqmail-routes}.
   1.101  
   1.102  
   1.103  
   1.104  
   1.105 -\subsubsection*{RF6: Authentication}
   1.106 -
   1.107 +\paragraph{\RF6: Authentication}
   1.108  One thing to avoid is being an \name{open relay}. Open relays allow to relay mail from everywhere to everywhere. This is a source of spam. The solution is restricting relay\footnote{Relaying is passing mail, that is not from and not for the own system, through it.} access. It may be also wanted to refuse all connections to the \MTA\ except ones from a specific set of hosts.
   1.109  
   1.110  Several ways to restrict access are available. The most simple one is restriction by the \NAME{IP} address. No extra complexity is added this way, but the \NAME{IP} addresses have to be static or within known ranges. This approach is often used to allow relaying for local nets. The access check can be done by the \MTA\ or by a guard (e.g.\ \NAME{TCP} \name{Wrappers}) before. The main advantage here is the minimal setup and maintainence work needed. This kind of access restriction is important to be implemented.
   1.111 @@ -135,13 +94,12 @@
   1.112  
   1.113  
   1.114  
   1.115 -\subsubsection*{RF7: Encryption}
   1.116 -
   1.117 +\paragraph{\RF7: Encryption}
   1.118  Electronic mail is vulnerable to sniffing attacks, because in generic \SMTP\ all data transfer is unencrypted. Unencrypted is the message's content, the email addresses in header and envelope, but also authentication dialogs that transfer plain text passwords (e.g.\ \NAME{PLAIN} and \NAME{LOGIN}). Hence encryption is important.
   1.119  
   1.120  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.121  
   1.122 -Using secure tunnels, that are provided by external applications, is prefered as the \MTA\ needs not to bother with encryption then. Outgoing \SMTP\ connections can get encrypted using a secure tunnel, created by an external application (like \name{openssl}). But incoming connections, can not use external secure tunnels, because the remote \NAME{IP} address is hidden then; all connections appear to come from localhost instead. Figure \ref{fig:stunnel} depicts the situation of using an application like \name{stunnel} for incoming connections. The connection to port 25 comes from localhost, and that is the information the \MTA\ gets. Authentication based on \NAME{IP} addresses and many spam prevention methods are useless then.
   1.123 +Using secure tunnels, that are provided by external applications, is prefered because the \MTA\ needs not to bother with encryption then. Outgoing \SMTP\ connections can get encrypted using a secure tunnel, created by an external application (like \name{openssl}). But incoming connections can not use external secure tunnels, because the remote \NAME{IP} address is hidden then; all connections appear to come from localhost instead. Figure \ref{fig:stunnel} depicts the situation of using an application like \name{stunnel} for incoming connections. The connection to port 25 comes from localhost, and that is the information the \MTA\ gets. Authentication based on \NAME{IP} addresses and many spam prevention methods are useless then.
   1.124  
   1.125  \begin{figure}
   1.126  	\begin{center}
   1.127 @@ -151,28 +109,30 @@
   1.128  	\label{fig:stunnel}
   1.129  \end{figure}
   1.130  
   1.131 -\NAME{STARTTLS}---defined in \RFC2487---is what \mta{}s usually implement.
   1.132 +To provide encrypted incoming channels, the \MTA\ could implement encryption and listen on a port that is dedicated to encrypted \SMTP\ (\NAME{SMTPS}). This approach would be possible, but it is deprecated in favor for \NAME{STARTTLS}. \RFC3207 ``\SMTP\ Service Extension for Secure \SMTP\ over Transport Layer Security'' shows this in not mentioning \NAME{SMTPS} on port 465. Also port 465 is not even reserved for \NAME{SMTPS} anymore \citeweb{iana:port-numbers}.
   1.133  
   1.134 +\NAME{STARTTLS}---defined in \RFC2487---is what \RFC3207 recommends to use for secure \SMTP. The connection then goes over port 25 (or the submission port 587), but gets encrypted as the \NAME{STARTTLS} keyword is issued.
   1.135  
   1.136 -smtps on 465 (obsolete)
   1.137 +\NAME{STARTTLS} encryption should be supported.
   1.138  
   1.139 -starttls on port 25 (state-of-the-art)
   1.140  
   1.141  
   1.142 -\subsubsection*{RF8: Spam prevention}
   1.143 -
   1.144 +\paragraph{\RF8: Spam prevention}
   1.145  Spam is a major threat nowadays, but it is a war that is hard to win. The goal is to provide state-of-the-art spam protection, but not more (see section \ref{sec:swot-analysis}).
   1.146  
   1.147 -As spam is not just a nuisance for end users, but also for the infrastructure---the \mta{}s---by increasing the amount of mail messages, \MTA{}s need to protect them self.
   1.148 +As spam is not just a nuisance for end users, but also for the infrastructure---the \mta{}s---by increasing the amount of mail messages, \MTA{}s need to protect themselves.
   1.149  
   1.150 -Filtering spam can be done in two ways: Refusing spam during the \SMTP\ dialog or checking for spam after the mail was accepted and queued. Both have advantages and disadvantages, so modern \MTA{}s use them in combination. Spam is identified by the results of a set of checks. Static rules, querying databases (\NAME{DNS} blacklists), requesting special client behavior (\name{greylisting}, \name{hashcash}), or statistical analysis (\name{bayesian filters}) are checks that may be used. Running more checks leads to better results, but takes more system resources and more time.
   1.151 +Filtering spam can be done in two ways: Refusing spam during the \SMTP\ dialog or checking for spam after the mail was accepted and queued. Both ways have advantages and disadvantages, so modern \MTA{}s use them in combination. Spam is identified by the results of a set of checks. Static rules, querying databases (\NAME{DNS} blacklists \cite{cole07} \cite{levine08}), requesting special client behavior (\name{greylisting} \cite{harris03}, \name{hashcash} \cite{back02}), or statistical analysis (\name{bayesian filters} \cite{graham02}) are checks that may be used. Running more checks leads to better results, but takes more system resources and more time.
   1.152  
   1.153 -Doing some basic checks during the \SMTP\ dialog seems to be a must.
   1.154 +Doing some basic checks during the \SMTP\ dialog seems to be a must \cite[page~25]{eisentraut05}. They should best be included into the \MTA, because they need to be fast to avoid \SMTP\ dialog timeouts. Internal interfaces to specialized modules seem to be best.
   1.155  
   1.156 +More detailed checks after the message is queued should be done using external scanners. Interfaces to invoke them need to be defined. (See also the remarks about \name{amavis} in the next section.)
   1.157  
   1.158  
   1.159 -\subsubsection*{RF9: Virus checking}
   1.160  
   1.161 +
   1.162 +
   1.163 +\paragraph{\RF9: Virus checking}
   1.164  Related to spam is malicious content (short: \name{malware}) like viruses, worms, trojan horses. They, in contrast to spam, do not affect the \MTA\ itself, as they are in the mail's body. \MTA{}s searching for malware is equal to real world's post offices opening letters to check if they contain something that could harm the recipient. This is not a mail transport job. But the \MTA\ responsible for the recipient seems to be at a good position to do this work, so it is often done there.
   1.165  
   1.166  In any way should malware checking be performed by external programs that may be invoked by the \mta. But using mail deliver agents, like \name{procmail}, are better suited locations to invoke content scanners.
   1.167 @@ -181,8 +141,7 @@
   1.168  
   1.169  
   1.170  
   1.171 -\subsubsection*{RF10: Archiving}
   1.172 -
   1.173 +\paragraph{\RF10: Archiving}
   1.174  Mail archiving and auditability become more important as email establishes as technology for serious business communication. The ability to archive verbatim copies of every mail coming into and every mail going out of the system, with relation between them, appears to be a goal to achieve.
   1.175  
   1.176  \postfix\ for example has a \texttt{always\_bcc} feature, to send a copy of every outgoing mail to a definable recipient. At least this functionality should be given, although a more complete approach is preferable.
   1.177 @@ -195,148 +154,63 @@
   1.178  
   1.179  Here follows a list of non-functional requirements for \masqmail. These requirements specify the quality properties of software. The list is based on \person{Hafiz} \cite[page~2]{hafiz05}, with inspiration from \person{Spinellis} \cite[page~6]{spinellis06} and \person{Kan} \cite{kan03}.
   1.180  %fixme: refer to ch01 and ch02
   1.181 -These non-functional requirements are named ``RG'' for ``requirement, general''.
   1.182 +These non-functional requirements are named ``\NAME{RG}'' for ``requirement, general''.
   1.183  
   1.184  
   1.185 -\subsubsection*{RG1: Security}
   1.186 -\MTA{}s are critical points for computer security, as they are accessible from external networks. They must be secured with high effort. Properties like the need for high privilege level, from outside influenced work load, work on unsafe data, and demand for reliability, increase the need for security. \masqmail\ needs to be secure enough for its target field of operation.
   1.187 +\paragraph{\RG1: Security}
   1.188 +\MTA{}s are critical points for computer security, as they are accessible from external networks. They must be secured with high effort. Properties like the need for high privilege level, from outside influenced work load, work on unsafe data, and demand for reliability, increase the need for security. This is best done by modularization, also called \name{compartementalization}, as described in section \ref{sec:discussion-mta-arch}. \masqmail\ needs to be secure enough for its target field of operation. \masqmail\ is targeted to workstations and private networks, with explicit warning to not use it on permanent online hosts \citeweb{masqmail:homepage2}. But as non-permanent online connections and trustable environments become rare, \masqmail's security should be so good, that it is usable with permanent online connections and in unsafe environments. For example should mails with bad content not break \masqmail.
   1.189  
   1.190  
   1.191 -\subsubsection*{RG2: Reliability}
   1.192 -Reliability is the second essential quality property for an \MTA. Mail for which the \MTA\ took responsibility must never get lost. The \MTA\ must not be \emph{the cause} of any mail loss, no matter what happens. Unreliable \mta{}s are of no value.
   1.193 +\paragraph{\RG2: Reliability}
   1.194 +Reliability is the second essential quality property for an \MTA. Mail for which the \MTA\ took responsibility must never get lost while it is within the \MTA{}s responsibility. The \MTA\ must not be \emph{the cause} of any mail loss, no matter what happens. Unreliable \mta{}s are of no value. However, as the mail transport infrastructure are distributed systems, one of the communication partners or the transport medium may crash at any time during mail tranfer. Thus reliability is needed for mail transfer communication too.
   1.195  
   1.196 +The goal is to transfer exactly one copy of the message. \person{Tanenbaum} evaluates the situation and comes to the conclusion that ``in general, there is no way to arrange this.'' \cite[pages~377--379]{tanenbaum02}. Only strategies where now mail gets lost are acceptable; he identifies three of them, but one generates more duplicates than the others, so two strategies remain. (1) The client always reissues the transfer; the server first sends an acknowledgement, then handles the transfer. (2) The client reissues the transfer only if no acknowledgement was received; the server first handles the transfer and sends the acknowledgement afterwards. The first strategy does not need acknowledgements at all, however, it will lose mail if the second transfer fails too.
   1.197  
   1.198 -\subsubsection*{RG3: Robustness}
   1.199 +Hence, mail transfer between two processes must use the strategy: The client reissues if it receives no acknowledgement; the server first handles the message and then sends the acknowledgement. This strategy only leads to duplicates if a crash happens in the time between the message is fully transfered to the server and the acknowlegement is received by the client. No mail will get lost.
   1.200 +
   1.201 +
   1.202 +\paragraph{\RG3: Robustness}
   1.203  Being robust means handling errors properly. Small errors may get corrected, large errors may kill a process. Killed processes should restarted automatically and lead to a clean state again. Log messages should be written in every case. Robust software does not need a special environment, it creates a friendly environment itself. \person{Raymond}'s \name{Rule of Robustness} and his \name{Rule of Repair} are good descriptions \cite[pages~18--21]{raymond03}.
   1.204  
   1.205  
   1.206 -\subsubsection*{RG4: Extendability}
   1.207 +\paragraph{\RG4: Extendability}
   1.208  \masqmail's architecture needs to be extendable, to allow new features to be added afterwards. The reason for this need are changing requirements. New requirements appear, like more efficient mail transfer of large messages or a final solution for spam problem. Extendability is the ability of software to include new function with little work.
   1.209  
   1.210  
   1.211 -\subsubsection*{RG5: Maintainability}
   1.212 +\paragraph{\RG5: Maintainability}
   1.213  Maintaining software takes much time and effort. \person{Spinellis} guesses ``40\,\% to 70\,\% of the effort that goes into a software system is expended after the system is written first time.'' \cite[page~1]{spinellis03}. This work is called \emph{maintaining}. Hence making software good to maintain will ease work afterwards.
   1.214  
   1.215  
   1.216 -\subsubsection*{RG6: Testability}
   1.217 +\paragraph{\RG6: Testability}
   1.218  Good testability make maintenance easier too, because functionality is directly verifiable when changes are done, thus removing uncertainty. Modularized software makes testing easier, because parts can be tested without external influences. \person{Spinellis} sees testability as a sub-quality of maintainability.
   1.219  
   1.220  
   1.221 -\subsubsection*{RG7: Performance}
   1.222 +\paragraph{\RG7: Performance}
   1.223  Also called ``efficiency''. Efficient software requires few time and few resources. The merge of communication hardware and its move from service providers to homes and to mobile devices, demand smaller and more resource-friendly software. The amount of mail will be lower, even if much more mail will be sent. More important will be the energy consumption and heat emission. These topics increased in relevance during the past years and they are expected to become more central.
   1.224  
   1.225  
   1.226 -\subsubsection*{RG8: Availability}
   1.227 +\paragraph{\RG8: Availability}
   1.228  Availability is important for server programs. They must stay operational by blocking \name{denial of service} attacks and the like.
   1.229  
   1.230  
   1.231 -\subsubsection*{RG9: Portability}
   1.232 +\paragraph{\RG9: Portability}
   1.233  Source code that compiles and runs on various operation systems is called portable. Portability can be achieved by using standard features of the programming language and common libraries. Basic rules to achieve portable code are defined by \person{Kernighan} and \person{Pike} \cite{kernighan99}. Portable code lets software spread faster.
   1.234  
   1.235  
   1.236 -\subsubsection*{RG10: Usability}
   1.237 +\paragraph{\RG10: Usability}
   1.238  Usability, not mentioned by \person{Hafiz} (he focuses on architecture) but by \person{Spinellis} and \person{Kan}, is a property very important from the user's point of view. Software with bad usability is rarely used, no matter how good it is. If substitutes with better usability exist, the user will switch to one of them. Here, usability includes setting up and configuring; and the term ``users'' includes administrators. Having \mta{}s on home servers and workstations requires easy and standardized configuration. The common setups should be configurable with little action by the user. Complex configuration should be possible, but focused must be the most common form of configuration: choosing one of several common setups.
   1.239  
   1.240  
   1.241  
   1.242  
   1.243 -
   1.244 -
   1.245 -
   1.246 -
   1.247 -\section{Work to do}
   1.248 -
   1.249 -After \masqmail's features were presented in section \ref{sec:masqmail-features} and the requirements for modern \mta{}s were identified in section \ref{sec:mta-requirements}, here the differences between them are shown.
   1.250 -
   1.251 -
   1.252 -
   1.253 -\subsubsection*{Fulfilled requirements}
   1.254 -
   1.255 -\masqmail's incoming and outgoing channels are the ones common to most \MTA{}s: the \path{sendmail} command and \SMTP\ for incoming mail; local delivery, piping to commands, and \SMTP\ for outgoing mail. Support for other protocols is not available. To add it, modifications at many places in the source are needed.
   1.256 -
   1.257 -One single mail queue is used in \masqmail. The envelope and mail headers are generated when the mail is put into the queue. Aliasing is done on delivery, after the route to be used was determined. Headers can get rewritten then. These parts do all provide the functionality required.
   1.258 -
   1.259 -Static authentication, based on \NAME{IP} addresses, can be with \person{Venema}'s \NAME{TCP} \name{Wrapper}, by editing the \path{hosts.allow} and \path{hosts.deny} files. Dynamic \SMTP\ authentication is supported in form of \NAME{SMTP-AUTH} and \SMTP-after-\NAME{POP}, but only for outgoing channels. Similar for encryption which is also only available for outgoing channels; here a wrapper application like \name{openssl} is needed. Support for authentication and encryption of incoming connections is completely missing, although it is a basic requirement for secure emailing.
   1.260 -
   1.261 -\masqmail\ does not provide special support for spam filtering and content checking. But it is possible to use external filter applications by running two independent instances of \masqmail, connected by the filter application. The receiving \MTA\ instance accepts mail and pushes it into the filter application. The filter application receives mail, processes it, possible modifies it, and pushes it to a second \MTA\ instance. The second \MTA\ is responsible for further delivery of the mail.
   1.262 -%Appendix \ref{app:FIXME} shows configuration files to create such a setup.
   1.263 -This is a concept that works in general. However, real spam \emph{prevention}---to not even accept spam---or good filter interfaces are not available. But they are necessary for using \masqmail\ in an unsafe environment.
   1.264 -
   1.265 -There is currently no way of archiving every message going through \masqmail.
   1.266 -
   1.267 -
   1.268 -Non-functional requirements are not so easy to be marked as fulfilled or not. Instead they are discussed here.
   1.269 -
   1.270 -\masqmail\ needs to be ``secure enough'', but what is ``secure enough''? This depends on its target field. Currently \masqmail\ is targeted to workstations and private networks, with explicit warning to not use it on permanent online hosts \citeweb{masqmail:homepage2}. \masqmail's current security is bad. For instance does a long time known attack against \sendmail, described by \person{Sill} \cite[page~4]{sill02}, still outwit \masqmail. Its security, however, seems acceptable for use on workstations and private networks, if the environment is trustable. In environments where untrusted components or persons have access to \masqmail, its security is too low.
   1.271 -
   1.272 -Similar for its reliability. It has been reported that \masqmail\ has not sent mail under some circumstances \citeweb{FIXME}. %fixme
   1.273 -Situations where only one part of sent message was removed from the queue, and the other part remained as garbage, showed off, too---even to the author of this thesis. Fortunately, lost email was no big problem yet, but \person{Kurth} warns:
   1.274 -\begin{quote}
   1.275 -There may still be serious bugs in [masqmail], so mail might get lost. But in the nearly two years of its existence so far there was only one time a bug which caused mail retrieved via pop3 to be lost in rare circumstances.
   1.276 -\hfill\citeweb{masqmail:homepage2}
   1.277 -\end{quote}
   1.278 -In summary: Current reliability is not good enough.
   1.279 -
   1.280 -The logging behavior of \masqmail\ is good, although it does not cover all problem situations. For example, if the queue directory is world writeable by accident (or as action of an intruder), any user can remove messages from the queue or replace them with own ones. \masqmail\ does not even write a debug message in this case. The origin of this problem, however, is \masqmail's trust in its environment.
   1.281 -
   1.282 -\masqmail's extendability is very poor. This is a general problem of monolithic software, but can thus be provided with high effort. \exim\ is an example for good extendability in a monolithic program.
   1.283 -
   1.284 -The maintainability of \masqmail\ appears to be equivalent to other software of similar kind. Missing modularity and therefore more complexity makes the maintainer's work harder. In summary is \masqmail's maintainability bearable, like in average Free Software projects. The testability suffers from missing modularity. Testing program parts is hard to do. Anyhow, it is done by compiling parts of the source to special test programs.
   1.285 -
   1.286 -The performance---efficiency---of \masqmail\ is good enough for its target field of operation, where this is a minor goal. This applies equal to availability. Hence no further work needs to be done her.
   1.287 -
   1.288 -The code's portability is good with view on \unix-like operation systems. At least \name{Debian}, \name{Red Hat}, \NAME{SUSE}, \name{Slackware}, \name{Free}\NAME{BSD}, \name{Open}\NAME{BSD}, and \name{Net}\NAME{BSD} are reported to be able to compile and run \masqmail\ \citeweb{masqmail:homepage2}. Special requirements for the underlying file system are not known. Therefore, the portability is already good.
   1.289 -
   1.290 -The usability, from the administrator's point of view, is very good. \masqmail\ was developed to suite a specific, limited job---its configuration does perfect match. The user's view does not reach to the \MTA, as it is hidden behind the \name{mail user agent}.
   1.291 -
   1.292 -
   1.293 -
   1.294 -\subsubsection*{Missing parts}
   1.295 -
   1.296 -Support for other protocols than \SMTP\ seems not to be necessary at the moment. Adding such support will need lots of work in many parts of \masqmail. Hence delaying this work until the support becomes mandatory, appears to be the best strategy. This way work can be saved if some protocols never become popular.
   1.297 -
   1.298 -Authentication of incoming \SMTP\ connections is definitely needed and should be added soon. The same applies to encryption of incoming connections. These two features are essential for restricting relaying and for providing privacy.
   1.299 -
   1.300 -As authentication can be a guard against spam, filter facilities have lower priority. But basic spam filtering and interfaces for external tools should be implemented in future. Content checking should be left over to the \NAME{MDA}, to deal with it during local delivery.
   1.301 -
   1.302 -Archiving again is preferred to be implemented soon. It does not require much work, but enables all kinds of statistical analysis.
   1.303 -
   1.304 -Non-functional requirements need improvement too.
   1.305 -
   1.306 -\masqmail's security is bad, thus the program is forced into a limited field of operation. The field of operation even shrinks, as security becomes more important and networking and interaction increases. Save and trusted environment become rare. Improving security is an important thing to do.
   1.307 -
   1.308 -Reliability is also to improve. It is a key quality property for an \MTA, and not good enough in \masqmail. Additionally, the program is lacking robustness. Checking the environment and reporting bad characteristics is wanted. Especially improving robustness in relation to the queue is favorable; applying ideas of \name{crash-only software}\cite{candea03} will be a good step.
   1.309 -
   1.310 -Extendability, maintainability, and testability do all suffer from the monolithic architecture and are nearly impossible to improve without changing the programs structure. These properties can hardly be retrofitted into software. Extendability might become important in the future. The other two ease all further work on the software, and also improve security and reliability.
   1.311 -
   1.312 -Performance is a property that is nice to have. But as performance improvements are in contrast to many other quality properties (reliability, maintainability, usability, capability \cite[page~5]{kan03}), jeopardizing these to gain some more performance should not be done. \person{Kernighan} and \person{Pike} state clear: ``[T]he first principle of optimization is \emph{don't}.''\cite[page~165]{kernighan99}. \masqmail\ is not a program to be used on large servers, but on small devices. Thus important for \masqmail\ could be energy and heat saving, maybe also system resources, but not performance. Anyway, simplicity and clearness are of higher value.
   1.313 -
   1.314 -Portability among the various flavors of \unix\ systems is a goal, because these systems are the ones \MTA{}s run on usually. Portability problems with non-\unix\ platforms are primary expected to come from file systems lacking required features. But no special care should be taken here.
   1.315 -
   1.316 -Configuration could be eased more, by providing configuration generators to be able to use \masqmail\ right ``out of the box'' after running one of several configuration scripts for common setups. This would improve \masqmail's usability for not technical educated people.
   1.317 -
   1.318 -
   1.319 -
   1.320 -\subsubsection*{The need for structural changes}
   1.321 -
   1.322 -Adding authentication and encryption support, for example, is limited to a narrow region in the code. Such features are addable to the current code base without much problem. In contrast does adding support for new protocols or mail processing interfaces to external programs require a lot of effort. Changes in many parts of the source code are required. It is a bad idea to implement large retro-fitted features into software that is critical about security and reliability, like \MTA{}s. Worse if these features need changes in the program's structure, like adding mail scanning interfaces would do.
   1.323 -
   1.324 -If such large features are needed, it is best to redesign the program's structure and rebuild it. A program's structure is primary its architecture. Which is the most influencing design decision, and has the greatest impact on the program's future capabilities. The architecture defines what the program can do, and how it can be used. If the architecture does not fit to the requirements, development will reach a dead end \dots\ further work then will make everything worse. The only good solution is to change the architecture, which, sadly but most likely, means a redesign from scratch.
   1.325 -
   1.326 -Quality properties, like security and reliability, as well as extendability and maintainability, can hardly be added afterwards---if at all. Only structural changes will improve them. Hence, if security, reliability, extendability (to add support for future mail transfer protocols), or maintainability shall be improved, a redesign of \masqmail\ is the only sane way to go.
   1.327 -
   1.328 -%\person{Hafiz} adds: ``The major idea is that security cannot be retrofitted into an architecture.''\cite[page 64]{hafiz05}
   1.329 -
   1.330 -
   1.331 -
   1.332 -
   1.333 -\section{Discussion on MTA architecture}
   1.334 +\subsection{Architectural requirements}
   1.335 +\label{sec:discussion-mta-arch}
   1.336  
   1.337  \masqmail's current architecture is monolithic like \sendmail's and \exim's. But more than the other two, is it one block of interweaved code. \exim\ has a highly structured code with many internal interfaces, a good example is the one for authentication ``modules''. %fixme: add ref
   1.338  \sendmail\ provides now, with its \name{milter} interface, standardized connection channels to external modules.
   1.339  \masqmail\ has none of them; it is what \sendmail\ was in the beginning: a single large block.
   1.340  
   1.341 -Figure \ref{fig:masqmail-arch} is a call graph generated from \masqmail's source code, excluding logging functions. It gives a impression of how interweaved the internals are.
   1.342 +Figure \ref{fig:masqmail-arch} is a call graph generated from \masqmail's source code, excluding logging functions. It gives a impression of how interweaved the internals are. There are no compartments existent.
   1.343  %fixme: what is included, what not?
   1.344  
   1.345  \begin{figure}
   1.346 @@ -350,7 +224,7 @@
   1.347  
   1.348  \sendmail\ improved its old architecture by adding the milter interface, to include further functionality by invoking external programs. \exim\ was designed, and is carefully maintained, with a modular-like code structure in mind. \qmail\ started from scratch with a ``security-first'' approach, \postfix\ improved on it, and \name{sendmail X}/\name{MeTA1} tries to adopt the best of \qmail\ and \postfix\ to completely replace the old \sendmail\ architecture. \person{Hafiz} describes this evolution of \mta\ architecture very well \cite{hafiz05}.
   1.349  
   1.350 -Every one of these programs is more modular, or became more modular over time, than \masqmail\ is. Modern requirements like spam protection and future requirements like---probably---the use of new mail transport protocols demand for modular designs in order to keep the software simple. Simplicity is a key property for security. ``[T]he essence of security engineering is to build systems that are as simple as possible.''\cite[page 45]{graff03}
   1.351 +Every one of these programs is more modular, or became more modular over time, than \masqmail\ is. Modern requirements like spam protection and future requirements like---probably---the use of new mail transport protocols demand for modular designs in order to keep the software simple. Simplicity is a key property for security. ``the essence of security engineering is to build systems that are as simple as possible.'' \cite[page 45]{graff03}.
   1.352  
   1.353  \person{Hafiz} agrees: ``The goal of making software secure can be better achieved by making the design simple and easier to understand and verify.'' \cite[page 64]{hafiz05}. He identifies the security of \qmail\ to come from it's \name{compartmentalization}, which goes hand in hand with modularity:
   1.354  \begin{quote}
   1.355 @@ -361,14 +235,199 @@
   1.356  
   1.357  Modularity is also needed to satisfy modern \MTA\ requirements, in providing a clear interface to add functionality without increasing the overall complexity much.
   1.358  
   1.359 -Security comes from good design, as \person{Graff} and \person{van Wyk} explain:
   1.360 +Modularity is a goal that, if achieved, has positive influence on other important properties like security, testability, extendability, maintainability, and not least simplicity. These quality properties then, on their part, make achieving the functional requirements easier.
   1.361 +
   1.362 +Hence, aspiration for modularity, by compartmentalization, leads to improvement of the overall quality of the software. It is an architectural requirement for a secure and modern \MTA.
   1.363 +
   1.364 +
   1.365 +
   1.366 +
   1.367 +
   1.368 +\section{Fulfilled requirements}
   1.369 +\label{sec:fulfilled-requirements}
   1.370 +
   1.371 +Here follows a description of how far the requirements are already fulfilled by \masqmail.
   1.372 +
   1.373 +
   1.374 +\paragraph{\RF1: In/out channels}
   1.375 +\masqmail's incoming and outgoing channels are the ones required for an \MTA{}s at the moment. They are depicted in figure \ref{fig:masqmail-in-out} on page \pageref{fig:masqmail-in-out}. This is all what is currently needed. But new protocols and mailing concepts are likely to appear (see section \ref{sec:electronic-mail}). \masqmail\ has no support for adding further protocols. Thus modifications at many places in the source are needed to add them though. Today, support for further protocols is not needed, so \masqmail\ is regarded to fulfill \RF1, but the probable future need should be kept in mind.
   1.376 +
   1.377 +\paragraph{\RF2: Queueing}
   1.378 +One single mail queue is used in \masqmail; it satisfies all current requirements.
   1.379 +
   1.380 +\paragraph{\RF3: Header sanitizing}
   1.381 +The envelope and mail headers are generated when the mail is put into the queue. The requirements are fulfilled.
   1.382 +
   1.383 +\paragraph{\RF4: Aliasing}
   1.384 +Aliasing is done on delivery. All common kinds of aliases in the global aliases file are supported. \name{.forward} aliasing is not, but this is less common and seldom used.
   1.385 +
   1.386 +\paragraph{\RF5: Select route}
   1.387 +Setting of the route to use is done on delivery. Headers can get rewritten a second time then. This part does provide all the functionality required.
   1.388 +
   1.389 +\paragraph{\RF6: Authentication}
   1.390 +Static authentication, based on \NAME{IP} addresses, can be achieved with \person{Venema}'s \NAME{TCP} \name{Wrapper} \cite{venema92}, by editing the \path{hosts.allow} and \path{hosts.deny} files. This is only relevant to authenticate host that try to submit mail into the system. Dynamic (secret-based) \SMTP\ authentication is already supported in form of \NAME{SMTP-AUTH} and \SMTP-after-\NAME{POP}, but only for outgoing connections. For incoming connections, only address-based authentication is supported.
   1.391 +
   1.392 +\paragraph{\RF7: Encryption}
   1.393 +Similar is the situation for encryption which is also only available for outgoing channels; here a wrapper application like \name{openssl} is needed. This creates a secure tunnel to send mail trough, but state-of-the-art is using \NAME{STARTTLS}, which is not supported. For incoming channels, no encryption is available. The only possible setup to provide encryption of incoming channels is using an application like \name{stunnel} to translate between the secure connection to the remote host and the \MTA. Unfortunately, this suffers from the problem explained in section \ref{sec:FIXME} and figure \ref{fig:stunnel}. Anyway, this would still be no \NAME{STARTTLS} support.
   1.394 +
   1.395 +\paragraph{\RF8: Spam handling}
   1.396 +\masqmail\ nowadays does not provide special support for spam filtering. Spam prevention by not accepting spam during the \SMTP\ dialog is not possible at all. Spam filtering is only possible by using two \masqmail\ instances with an external spam filter inbetween. The mail flow is from the receiving \MTA\ instance, which accepts mail, to the filter application that processes and possible modifies it, to the second \MTA\ which is responsible for further delivery of the mail. This is a concept that works in general. And it is a good concept in principle to separate work with clear interfaces. But the need of two instances of the same \MTA (each for only half of the job) with doubled setup, is more a work-around. Best is to have this data flow respected in the \MTA\ design, like in \postfix. But the more important part of spam handling, for sure, is done during the \SMTP\ dialog in completely refusing unwanted mail.
   1.397 +
   1.398 +\paragraph{\RF9: Malware handling}
   1.399 +For malware handling applies nearly the same, except all checks are done after mail is accepted. So the possible setup is the same with the two \MTA\ instances and the filter inbetween. \masqmail\ does support such a setup, but not in a nice way.
   1.400 +
   1.401 +\paragraph{\RF10: Archiving}
   1.402 +There is currently no way of archiving every message going through \masqmail.
   1.403 +
   1.404 +
   1.405 +%Non-functional requirements are not so easy to be marked as fulfilled or not. Instead they are discussed here.
   1.406 +
   1.407 +\paragraph{\RG1: Security}
   1.408 +\masqmail's current security is bad. However, it seems acceptable for using \masqmail\ on workstations and private networks, if the environment is trustable and \masqmail\ is protected against remote attackers. In environments where untrusted components or persons have access to \masqmail, its security is too low. In any way, is a security report missing that confirms \masqmail's security level.
   1.409 +
   1.410 +\paragraph{\RG2: Reliability}
   1.411 +Similar is its reliability not good enough. Situations where only one part of sent message was removed from the queue, and the other part remained as garbage, showed off \citeweb{debian:bug245882}. Problems with large mail and small bandwidth were also reported \citeweb{debian:bug216226}. Fortunately, lost email was no big problem yet, but \person{Kurth} warns:
   1.412  \begin{quote}
   1.413 -Good design is the sword and shield of the security-conscious developer. Sound design defends your application from subversion or misuse, protecting your network and the information on it from internal and external attacks alike. It also provides a safe foundation for future extensions and maintenance of the software.
   1.414 -%
   1.415 -%Bad design makes life easier for attackers and harder for the good guys, especially if it contributes to a false sends of security while obscuring pertinent failings.
   1.416 -\hfill\cite[page 55]{graff03}
   1.417 +There may still be serious bugs in [masqmail], so mail might get lost. But in the nearly two years of its existence so far there was only one time a bug which caused mail retrieved via pop3 to be lost in rare circumstances.
   1.418 +\hfill\citeweb{masqmail:homepage2}
   1.419  \end{quote}
   1.420 +In summary: Current reliability needs to be improved.
   1.421 +%fixme: state machine
   1.422  
   1.423 +\paragraph{\RG3: Robustness}
   1.424 +The logging behavior of \masqmail\ is good, although it does not cover all problem situations. For example, if the queue directory is world writeable by accident (or as action of an intruder), any user can remove messages from the queue or replace them with own ones. \masqmail\ does not even write a debug message in this case. The origin of this problem, however, is \masqmail's trust in its environment.
   1.425 +
   1.426 +\paragraph{\RG4: Extendability}
   1.427 +\masqmail's extendability is very poor. This is a general problem of monolithic software, but can thus be provided with high effort. \exim\ is an example for good extendability in a monolithic program.
   1.428 +
   1.429 +\paragraph{\RG5: Maintainability}
   1.430 +The maintainability of \masqmail\ is equivalent to other software of similar kind. Missing modularity and therefore more complexity makes the maintainer's work harder. In summary is \masqmail's maintainability bearable, like in average Free Software projects.
   1.431 +
   1.432 +\paragraph{\RG6: Testability}
   1.433 +The testability suffers from missing modularity. Testing program parts is hard to do. Nevertheless, it is done by compiling parts of the source to special test programs.
   1.434 +
   1.435 +\paragraph{\RG7: Performance}
   1.436 +The performance---efficiency---of \masqmail\ is good enough for its target field of operation, where this is a minor goal.
   1.437 +
   1.438 +\paragraph{\RG8: Availability}
   1.439 +This applies equal to availability. Hence no further work needs to be done her.
   1.440 +
   1.441 +\paragraph{\RG9: Portability}
   1.442 +The code's portability is good with view on \unix-like operation systems. At least \name{Debian}, \name{Red Hat}, \NAME{SUSE}, \name{Slackware}, \name{Free}\NAME{BSD}, \name{Open}\NAME{BSD}, and \name{Net}\NAME{BSD} are reported to be able to compile and run \masqmail\ \citeweb{masqmail:homepage2}. Special requirements for the underlying file system are not known. Therefore, the portability is already good.
   1.443 +
   1.444 +\paragraph{\RG10: Usability}
   1.445 +The usability, from the administrator's point of view, is very good. \masqmail\ was developed to suite a specific, limited job---its configuration does perfect match. The user's view does not reach to the \MTA, as it is hidden behind the \name{mail user agent}.
   1.446 +
   1.447 +
   1.448 +
   1.449 +
   1.450 +
   1.451 +
   1.452 +\section{Work to do}
   1.453 +
   1.454 +After the requirements for modern \mta{}s were identified in section \ref{sec:mta-requirements} and \masqmail's features were set against them in section \ref{sec:fulfilled-requirements}, here the the work that is left to do is identified. Table \ref{tab:requirements} lists all requirements with importance and the work needed to achieve them. The attention a work task should receive---the focus---depends on its importance and the amount of work it includes.
   1.455 +
   1.456 +\begin{table}
   1.457 +	\begin{center}
   1.458 +		\input{input/requirements.tex}
   1.459 +	\end{center}
   1.460 +	\caption{Importance of and pending work for requirements}
   1.461 +	\label{tab:requirents}
   1.462 +\end{table}
   1.463 +
   1.464 +The importance is ranked from `-{}-' (not important) to `++' (very important). The pending work is ranked from `-{}-' (nothing) to `++' (very much). Large work tasks with high importance need to receive much attention, they are in focus. In contrast should small low importance work receive few attention. Here the attention/focus a task should get is calculated by summing up the importance and the pending work with equal weight. Normally, tasks with high focus are the ones of high priority and should be done first.
   1.465 +
   1.466 +The functional requirements that receive highest attention are \RF6: authentication, \RF7: encryption, and \RF8: spam handling. Of the non-functional requirements, \RG1: security, \RG2: reliability, and \RG4: Extendability, rank highest.
   1.467 +
   1.468 +These tasks to do are presented in more detail now.
   1.469 +
   1.470 +
   1.471 +
   1.472 +\subsubsection*{\TODO1: Encryption (\RF7)}
   1.473 +Encryption by using \NAME{STARTTLS} is definitely needed and should be added soon. This feature is essential for providing privacy.
   1.474 +
   1.475 +\subsubsection*{\TODO2: Spam handling (\RF8)}
   1.476 +\subsubsection*{\TODO6: Authentication (\RF6)}
   1.477 +Authentication of incoming \SMTP\ connections is definitely needed and should be added soon. It is essential for restricting relaying.
   1.478 +
   1.479 +As authentication can be a guard against spam, filter facilities have lower priority. But basic spam filtering and interfaces for external tools should be implemented in future. Content checking should be left over to the \NAME{MDA}, to deal with it during local delivery.
   1.480 +
   1.481 +\subsubsection*{\TODO3: Security (\RG1)}
   1.482 +\masqmail's security is bad, thus the program is forced into a limited field of operation. The field of operation even shrinks, as security becomes more important and networking and interaction increases. Save and trusted environment become rare. Improving security is an important thing to do.
   1.483 +
   1.484 +
   1.485 +\subsubsection*{\TODO4: Reliability (\RG2)}
   1.486 +Reliability is also to improve. It is a key quality property for an \MTA, and not good enough in \masqmail. Additionally, the program is lacking robustness. Checking the environment and reporting bad characteristics is wanted. Especially improving robustness in relation to the queue is favorable; applying ideas of \name{crash-only software}\cite{candea03} will be a good step.
   1.487 +
   1.488 +
   1.489 +\subsubsection*{\TODO5: Extendability (\RG4)}
   1.490 +Extendability, maintainability, and testability do all suffer from the monolithic architecture and are nearly impossible to improve without changing the programs structure. These properties can hardly be retrofitted into software. Extendability might become important in the future. The other two ease all further work on the software, and also improve security and reliability.
   1.491 +
   1.492 +
   1.493 +
   1.494 +\subsubsection*{Further \NAME{TODO}s}
   1.495 +
   1.496 +Support for other protocols than \SMTP\ seems not to be necessary at the moment. Adding such support will need lots of work in many parts of \masqmail. Hence delaying this work until the support becomes mandatory, appears to be the best strategy. This way work can be saved if some protocols never become popular.
   1.497 +
   1.498 +Archiving again is preferred to be implemented soon. It does not require much work, but enables all kinds of statistical analysis.
   1.499 +
   1.500 +Performance is a property that is nice to have. But as performance improvements are in contrast to many other quality properties (reliability, maintainability, usability, capability \cite[page~5]{kan03}), jeopardizing these to gain some more performance should not be done. \person{Kernighan} and \person{Pike} state clear: ``[T]he first principle of optimization is \emph{don't}.''\cite[page~165]{kernighan99}. \masqmail\ is not a program to be used on large servers, but on small devices. Thus important for \masqmail\ could be energy and heat saving, maybe also system resources, but not performance. Anyway, simplicity and clearness are of higher value.
   1.501 +
   1.502 +Portability among the various flavors of \unix\ systems is a goal, because these systems are the ones \MTA{}s run on usually. Portability problems with non-\unix\ platforms are primary expected to come from file systems lacking required features. But no special care should be taken here.
   1.503 +
   1.504 +Configuration could be eased more, by providing configuration generators to be able to use \masqmail\ right ``out of the box'' after running one of several configuration scripts for common setups. This would improve \masqmail's usability for not technical educated people.
   1.505 +
   1.506 +
   1.507 +
   1.508 +
   1.509 +
   1.510 +
   1.511 +\section{Ways for further development}
   1.512 +
   1.513 +
   1.514 +\subsubsection*{The need for structural changes}
   1.515 +
   1.516 +Adding authentication and encryption support, for example, is limited to a narrow region in the code. Such features are addable to the current code base without much problem. In contrast does adding support for new protocols or mail processing interfaces to external programs require a lot of effort. Changes in many parts of the source code are required. It is a bad idea to implement large retro-fitted features into software that is critical about security and reliability, like \MTA{}s. Worse if these features need changes in the program's structure, like adding mail scanning interfaces would do.
   1.517 +
   1.518 +If such large features are needed, it is best to redesign the program's structure and rebuild it. A program's structure is primary its architecture. Which is the most influencing design decision, and has the greatest impact on the program's future capabilities. The architecture defines what the program can do, and how it can be used. If the architecture does not fit to the requirements, development will reach a dead end \dots\ further work then will make everything worse. The only good solution is to change the architecture, which, sadly but most likely, means a redesign from scratch.
   1.519 +
   1.520 +Quality properties, like security and reliability, as well as extendability and maintainability, can hardly be added afterwards---if at all. Only structural changes will improve them. Hence, if security, reliability, extendability (to add support for future mail transfer protocols), or maintainability shall be improved, a redesign of \masqmail\ is the only sane way to go.
   1.521 +
   1.522 +%\person{Hafiz} adds: ``The major idea is that security cannot be retrofitted into an architecture.''\cite[page 64]{hafiz05}
   1.523 +
   1.524 +
   1.525 +
   1.526 +The most needed features---authentication and encryption---can be added to the current code base with changes in only few parts of the source. These changes should be made soon. Archiving of mail is another feature to add then. More complete logging coverage, reporting of unsafe environment, and fixing high risk security flaws are quality improvements to do. All this work should be done on basis of the current code.
   1.527 +
   1.528 +All other work depends on how the plans for \masqmail's future look like.
   1.529 +
   1.530 +What shall \masqmail\ be like, in, for instance, five years?
   1.531 +
   1.532 +Two ways of further development come to mind.
   1.533 +
   1.534 +First, stick to the old architecture and try to add features as possible. This approach needs less effort to be spent, because a working code is already present. Further development is only adding small increments to a exiting code base. But the further development goes, the larger is the work needed to add more functionality, and the more bugs will appear, caused by the increasing complexity. Quality of the software will decrease, because lacking of clear internal structure encourages further work to be quick fixes rather than good solutions.
   1.535 +
   1.536 +Second, the way of designing \masqmail\ from scratch and rebuilding it. A lot of time and work is required to do this. Additionally, a new design from scratch introduces new risks: Is the design really better? Was thought of everything? Will there come problems not foreseeable now? Starting from scratch also means a step back. Against these disadvantages stands the gain from the new design: Further development will be easier and probably faster, overall quality will be better and easier to keep up, and dead ends for further development are better avoidable.
   1.537 +
   1.538 +Essentially, the decision for one of the ways depends on the question whether \masqmail\ should remain what it is, then the first option seems to be the right one to choose. Or whether \masqmail\ should become a modern \mta\ which is able to expand to include new functionality, then the second option is to choose.
   1.539 +
   1.540 +Security, extendability, and the other quality properties appear to have also crucial importance in this decision. If they are required for future versions of \masqmail, then a new design is a must.
   1.541 +
   1.542 +\person{Graff} and \person{van Wyk} describe the situation well: ``[I]n today's world, your software is likely to have to operate in a very hostile security environment.'' \cite{graff03}. An old-fashioned \mta\ depends, for sure, on a dieing branch, called \name{trusted environments}. And nothing other than a fresh and better design will help to survive.
   1.543 +
   1.544 +
   1.545 +
   1.546 +1) on current code base
   1.547 +
   1.548 +2) wrappers, interposition
   1.549 +
   1.550 +3) new design
   1.551 +
   1.552 +
   1.553 +
   1.554 +
   1.555 +
   1.556 +\subsubsection*{A redesign from scratch}
   1.557  
   1.558  All this leads to the wish of a rewrite of \masqmail, using a modern, modular architecture, \emph{if} further features need to be added---features that require changes in \masqmail's structure. But a rewrite is also mandatory, if \masqmail\ should become a modern \MTA, with good quality properties.
   1.559  
   1.560 @@ -403,24 +462,6 @@
   1.561  
   1.562  \section{Result}
   1.563  
   1.564 -The most needed features---authentication and encryption---can be added to the current code base with changes in only few parts of the source. These changes should be made soon. Archiving of mail is another feature to add then. More complete logging coverage, reporting of unsafe environment, and fixing high risk security flaws are quality improvements to do. All this work should be done on basis of the current code.
   1.565 -
   1.566 -All other work depends on how the plans for \masqmail's future look like.
   1.567 -
   1.568 -What shall \masqmail\ be like, in, for instance, five years?
   1.569 -
   1.570 -Two ways of further development come to mind.
   1.571 -
   1.572 -First, stick to the old architecture and try to add features as possible. This approach needs less effort to be spent, because a working code is already present. Further development is only adding small increments to a exiting code base. But the further development goes, the larger is the work needed to add more functionality, and the more bugs will appear, caused by the increasing complexity. Quality of the software will decrease, because lacking of clear internal structure encourages further work to be quick fixes rather than good solutions.
   1.573 -
   1.574 -Second, the way of designing \masqmail\ from scratch and rebuilding it. A lot of time and work is required to do this. Additionally, a new design from scratch introduces new risks: Is the design really better? Was thought of everything? Will there come problems not foreseeable now? Starting from scratch also means a step back. Against these disadvantages stands the gain from the new design: Further development will be easier and probably faster, overall quality will be better and easier to keep up, and dead ends for further development are better avoidable.
   1.575 -
   1.576 -Essentially, the decision for one of the ways depends on the question whether \masqmail\ should remain what it is, then the first option seems to be the right one to choose. Or whether \masqmail\ should become a modern \mta\ which is able to expand to include new functionality, then the second option is to choose.
   1.577 -
   1.578 -Security, extendability, and the other quality properties appear to have also crucial importance in this decision. If they are required for future versions of \masqmail, then a new design is a must.
   1.579 -
   1.580 -\person{Graff} and \person{van Wyk} describe the situation well: ``[I]n today's world, your software is likely to have to operate in a very hostile security environment.'' \cite{graff03}. An old-fashioned \mta\ depends, for sure, on a dieing branch, called \name{trusted environments}. And nothing other than a fresh and better design will help to survive.
   1.581 -
   1.582  The suggested further development plan for \masqmail\ is:
   1.583  \begin{enumerate}
   1.584  \item The short time goal: Add the most needed features, being authentication and encryption, to the current code base. \item The long time goal: Design a new architecture that satisfies the requirements identified, especially the quality requirements. The implementation of this design shall then, after being usable and throughout tested, supersede the old \masqmail.