docs/diploma

annotate thesis/tex/4-MasqmailsFuture.tex @ 400:5254a119ad56

fixed all major trashing of the right margin
author meillo@marmaro.de
date Sat, 07 Feb 2009 23:47:34 +0100
parents a641bea7a087
children e57129f57faa
rev   line source
meillo@109 1 \chapter{\masqmail's present and future}
meillo@339 2 \label{chap:present-and-future}
meillo@93 3
meillo@381 4 This chapter identifies requirements for \masqmail. They are compared against the current code to see what is already fulfilled and what is missing. Then the outstanding work is ordered by relevance and are presented in a list of pending work tasks. The end of this chapter is the evaluation of the best development strategy to get the work done in order to achieve the requirements.
meillo@185 5
meillo@185 6
meillo@267 7 \section{The goal}
meillo@391 8 \index{development goal}
meillo@185 9
meillo@293 10 Before requirements can be identified and further development can be discussed, it is important to clearly specify the goal to achieve. This means: What shall \masqmail\ be like in, for instance, five years?
meillo@391 11 \index{masqmail!in five years}
meillo@185 12
meillo@293 13 Should \masqmail\ become more specific to a more narrow niche or rather become more general and move a bit out of its niche? Or should it even become a totally general \MTA\ like \sendmail, \exim, \qmail, and \postfix?
meillo@256 14
meillo@381 15 Becoming completely general seems to be no choice because the competitors are too many and they are already too strong. It would require a strong base of developers and superior features to establish. There also seems to be no need for another general purpose \MTA\ additional to those four programs. Thus the effort would most likely remain a try. \person{Venema} stated: ``It is becoming less and less likely that someone will write another full-featured Postfix or Sendmail \MTA\ \emph{from scratch} (100 kloc).'' \cite{venema:postfix-growth}. At least \masqmail\ is not going to try that.
meillo@391 16 \index{postfix!no second postfix}
meillo@256 17
meillo@381 18 \masqmail\ was intended to be a small ``real'' \MTA\ which covers the niche of managing the relay over several smart hosts. Small and resource friendly software is still important for workstations, home servers, and especially for embedded computers. Other software that focuses on the same niche is not known. Dial-up connections have become rare but mobile computers that move between different networks are popular. So, the niche is still present.
meillo@256 19
meillo@381 20 What has changed in general is the security that is needed for software. \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[page~33]{graff03}. Additionally they say: ``By definition, mail software processes information from potentially untrusted sources. Therefore, mail software must be written with great care, even when it runs with user privileges and even when it does not talk directly to a network.'' \cite[page~90]{graff03}. As \masqmail\ is mail software and trusted environments become rare, it is best for \masqmail\ to become a secure \MTA.
meillo@391 21 \index{hostile environment}
meillo@391 22 \index{security}
meillo@256 23
meillo@293 24 In summary, the goal for \masqmail\ is to stay in the current niche with respect to modern usage scenarios and to become a secure \MTA.
meillo@256 25
meillo@256 26
meillo@256 27
meillo@132 28
meillo@132 29
meillo@132 30
meillo@177 31 \section{Requirements}
meillo@219 32 \label{sec:mta-requirements}
meillo@146 33
meillo@267 34 This section identifies the requirements for \masqmail\ to reach the above defined goal. Most of the requirements will apply to modern \MTA{}s in general.
meillo@185 35
meillo@218 36
meillo@185 37
meillo@219 38 \subsection{Functional requirements}
meillo@327 39 \label{sec:functional-requirements}
meillo@391 40 \index{functional requirements}
meillo@146 41
meillo@396 42 Functional requirements are about the function of the software. They define what the program can do and in what way. The requirements are named ``\NAME{RF}'' for ``requirement, functional''.
meillo@219 43
meillo@219 44
meillo@393 45 \paragraph{\RF\,1: Incoming and outgoing channels}
meillo@339 46 \label{rf1}
meillo@381 47 \sendmail-compatible \MTA{}s must support at least two incoming channels: mail submitted using the \path{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}.
meillo@391 48 \index{incoming channels}
meillo@391 49 \index{sendmail!command}
meillo@219 50
meillo@381 51 \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 would lead 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.
meillo@391 52 \index{smtp}
meillo@219 53
meillo@219 54
meillo@378 55 Outgoing mail is commonly either sent using \SMTP, piped into local commands (for example \path{uucp}), or delivered locally by appending to a mailbox. Outgoing channels are similar for \qmail, \postfix, and \name{sendmail~X}: All of them have a module to send mail using \SMTP, and one for writing into a local mailbox.
meillo@391 56 \index{outgoing channels}
meillo@391 57 \index{uucp}
meillo@219 58
meillo@381 59 Local mail delivery is a job that uses root privilege to be able to switch to any user in order to write to his mailbox. It is possible to deliver without being root privilege, but delivery to user's home folders is not generally possible then. Thus even the modular \MTA{}s \qmail\ and \postfix\ use root privilege for this job. As mail delivery to local users is \emph{not} included in the basic job of an \MTA{} and introduces a lot of new complexity, why should the \MTA\ bother? In order to keep the system simple, reduce privilege, and to have programs that do one job well, the local delivery job should be handed over to a specialist: the \NAME{MDA}. \NAME{MDA}s know about the various mailbox formats and are aware of the problems of concurrent write access and the like. Hence passing the message, and the responsibility for it, over to an \NAME{MDA} seems to be best.
meillo@391 60 \index{local delivery}
meillo@219 61
meillo@232 62 This means an outgoing connection that pipes mail into local commands is required. To other outgoing channels applies what was already said about incoming channels.
meillo@219 63
meillo@232 64 \begin{figure}
meillo@232 65 \begin{center}
meillo@397 66 \includegraphics[scale=0.75]{fig/mta-channels.eps}
meillo@232 67 \end{center}
meillo@277 68 \caption{Required incoming and outgoing channels}
meillo@391 69 \index{figure!Required incoming and outgoing channels}
meillo@232 70 \label{fig:mta-channels}
meillo@232 71 \end{figure}
meillo@219 72
meillo@395 73 An overview on incoming and outgoing channels which are required for an \MTA, gives figure~\ref{fig:mta-channels}. The reader may want to compare this diagram with \masqmail's incoming and outgoing channels, which are depicted in figure~\ref{fig:masqmail-channels} on page~\pageref{fig:masqmail-channels}.
meillo@219 74
meillo@239 75 %fixme: write about submission (port 587)
meillo@219 76
meillo@219 77
meillo@219 78
meillo@219 79
meillo@393 80 \paragraph{\RF\,2: Mail queuing}
meillo@339 81 \label{rf2}
meillo@391 82 \index{mail queue}
meillo@381 83 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, even in some simple forwarders. The mail queue is essential for \masqmail, as \masqmail\ is intended 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.
meillo@391 84 \index{forwarder}
meillo@391 85 \index{non-permanent}
meillo@219 86
meillo@392 87 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 mail loss. An \MTA\ takes over responsibility for mail by 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.
meillo@391 88 \index{reliability}
meillo@219 89
meillo@219 90
meillo@219 91
meillo@219 92
meillo@393 93 \paragraph{\RF\,3: Header sanitizing}
meillo@339 94 \label{rf3}
meillo@391 95 \index{header sanitizing}
meillo@392 96 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.
meillo@391 97 \index{masqmail!online routes}
meillo@219 98
meillo@381 99 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, all containing the same mail message.
meillo@219 100
meillo@219 101
meillo@219 102
meillo@219 103
meillo@393 104 \paragraph{\RF\,4: Aliasing}
meillo@339 105 \label{rf4}
meillo@391 106 \index{aliases}
meillo@381 107 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 of 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.
meillo@219 108
meillo@219 109
meillo@219 110
meillo@219 111
meillo@393 112 \paragraph{\RF\,5: Route management}
meillo@339 113 \label{rf5}
meillo@391 114 \index{online routes}
meillo@378 115 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}.
meillo@219 116
meillo@219 117
meillo@219 118
meillo@219 119
meillo@393 120 \paragraph{\RF\,6: Authentication}
meillo@339 121 \label{rf6}
meillo@317 122 \label{requirement-authentication}
meillo@391 123 \index{auth}
meillo@317 124 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 also be wanted to refuse all connections to the \MTA\ except ones from a specific set of hosts.
meillo@391 125 \index{open relay}
meillo@391 126 \index{spam}
meillo@219 127
meillo@395 128 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 need 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} \cite{venema92}) before. The main advantage here is the minimal setup and maintenance work needed. This kind of access restriction is important to be implemented.
meillo@391 129 \index{access restriction}
meillo@219 130
meillo@316 131 This authentication based on \NAME{IP} addresses is impossible in situations where hosts with changing \NAME{IP} addresses, that are not part of a known sub net, need access. Then a authentication mechanism based on some \emph{secret} is required. Three common approaches exist:
meillo@334 132
meillo@285 133 \begin{enumerate}
meillo@392 134 \item \SMTP-after-\NAME{POP}: Uses authentication on the \NAME{POP} protocol to permit incoming \SMTP\ connections for a limited time afterwards. The variant \SMTP-after-\NAME{IMAP} exists, too.
meillo@392 135 \index{auth!smtp-after-pop}
meillo@232 136 \item \SMTP\ authentication: An extension to \SMTP. It allows to request authentication before mail is accepted. Here no helper protocols are needed.
meillo@391 137 \index{auth!smtp-auth}
meillo@381 138 \item Certificates: The identity of a user or a host is confirmed by certificates that are signed by trusted authorities. Certificates are closely related to encryption, they do normally satisfy both needs: encrypt the data transmission and identify the remote user/host.
meillo@391 139 \index{certificates}
meillo@285 140 \end{enumerate}
meillo@334 141
meillo@381 142 Static authentication is the preferred type for authenticating clients. It should be chosen if possible. This means if the \MTA\ resides within a trusted network or it is possible to define trusted network segments on basis of \NAME{IP} addresses, then static authentication is the best choice.
meillo@334 143
meillo@381 144 If the \MTA\ does its job in an untrusted network, if it can be expected that forged \NAME{IP} addresses will appear, or if mobile clients need access, then dynamic authentication should be used.
meillo@391 145 \index{untrusted environment}
meillo@334 146
meillo@392 147 Any combination is possible, too. For example, it is preferred to allow relay access only to authenticated users. Either clients in local networks which are authenticated by their \NAME{IP} addresses or remote clients that authenticate by a secret-based method.
meillo@334 148
meillo@381 149 Static authentication is simpler and requires less administration work but it has limitations. Dynamic authentication should be used if static authentication reaches its limits. At least one of the secret-based mechanisms should be supported.
meillo@219 150
meillo@219 151
meillo@219 152
meillo@393 153 \paragraph{\RF\,7: Encryption}
meillo@339 154 \label{rf7}
meillo@314 155 \label{requirement-encryption}
meillo@391 156 \index{enc}
meillo@381 157 Electronic mail is vulnerable to sniffing attacks, because in generic \SMTP\ all data transfer is unencrypted. The message's body, the header, and the envelope are all unencrypted. But also some authentication dialogs transfer plain text passwords (e.g.\ \NAME{PLAIN} and \NAME{LOGIN}). Hence encryption is throughout important.
meillo@391 158 \index{auth}
meillo@219 159
meillo@394 160 The common way to encrypt \SMTP\ dialogs is using \name{Transport Layer Security} (short: \NAME{TLS}, the successor of \NAME{SSL}). \NAME{TLS} encrypts the datagrams of the \name{transport layer}. This means it works below the application protocols and can be used with any of them \citeweb{wikipedia:tls}.
meillo@391 161 \index{tls}
meillo@391 162 \index{ssl}
meillo@219 163
meillo@381 164 Using secure tunnels that are provided by external programs should be preferred over including encryption into the application, because the application 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 would 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 this information reaches the \MTA. Authentication based on \NAME{IP} addresses and many spam prevention methods are useless then.
meillo@391 165 \index{secure tunnel}
meillo@391 166 \index{stunnel}
meillo@219 167
meillo@232 168 \begin{figure}
meillo@232 169 \begin{center}
meillo@397 170 \includegraphics[scale=0.75]{fig/stunnel.eps}
meillo@232 171 \end{center}
meillo@232 172 \caption{Using \name{stunnel} for incoming connections}
meillo@391 173 \index{figure!Using \name{stunnel} for incoming connections}
meillo@232 174 \label{fig:stunnel}
meillo@232 175 \end{figure}
meillo@219 176
meillo@366 177 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}. \RFC\,3207 ``\SMTP\ Service Extension for Secure \SMTP\ over Transport Layer Security'' shows this by not mentioning \NAME{SMTPS} on port 465. Also port 465 is not even reserved for \NAME{SMTPS} anymore \citeweb{iana:port-numbers}.
meillo@391 178 \index{smtps}
meillo@391 179 \index{starttls}
meillo@219 180
meillo@381 181 \NAME{STARTTLS}---defined in \RFC\,2487---is what \RFC\,3207 recommends to use for secure \SMTP. The connection then goes over port 25, but gets encrypted when the \NAME{STARTTLS} keyword is issued. Email depends on compatibility---only encryption methods that client and server support can be used. Hence it is best to act after the recommendations of the \RFC\ documents. This means \NAME{STARTTLS} encryption should be supported for incoming and for outgoing connections.
meillo@232 182
meillo@232 183
meillo@232 184
meillo@393 185 \paragraph{\RF\,8: Spam handling}
meillo@339 186 \label{rf8}
meillo@391 187 \index{spam}
meillo@381 188 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}.)
meillo@219 189
meillo@381 190 As spam is, by increasing the amount of mail messages, not just a nuisance for end users but also for the infrastructure---the \MTA{}s---they need to protect themselves.
meillo@219 191
meillo@381 192 Filtering spam can be done by either refusing it during the \SMTP\ dialog or by checking for spam after the mail was accepted and queued. Both ways have advantages and disadvantages, so modern \MTA{}s use them in combination.
meillo@391 193 \index{smtp!dialog}
meillo@219 194
meillo@381 195 Spam is usually identified by the results of a set of checks. Static rules, database querying (e.g.\ \NAME{DNS} blacklists \cite{cole07} \cite{levine08}), requesting special client behavior (e.g.\ \name{greylisting} \cite{harris03}, \name{hashcash} \cite{back02}), or statistical analysis (e.g.\ \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.
meillo@391 196 \index{dns blacklist}
meillo@391 197 \index{greylisting}
meillo@391 198 \index{hashcash}
meillo@391 199 \index{bayesian filter}
meillo@288 200
meillo@381 201 Doing some basic checks during the \SMTP\ dialog seems to be a must \cite[page~25]{eisentraut05}. Including these checks into the \MTA\ makes them fast to avoid \SMTP\ dialog timeouts. For modularity and reusability reasons internal interfaces to specialized modules seem to be best. \person{Raymond} says: ``Modularity (simple parts, clean interfaces) is a way to organize programs to make them simpler.'' \cite[chapter~1]{raymond03}.
meillo@391 202 \index{smtp!dialog}
meillo@391 203 \index{modularity}
meillo@219 204
meillo@381 205 More detailed checks after the message is queued should be done by external scanners. Interfaces to invoke them need to be defined. (See also the remarks about \name{amavis} in the next section.)
meillo@219 206
meillo@219 207
meillo@219 208
meillo@239 209
meillo@239 210
meillo@393 211 \paragraph{\RF\,9: Malware handling}
meillo@339 212 \label{rf9}
meillo@391 213 \index{malware}
meillo@381 214 Related to spam is malicious content (short: \name{malware}) like viruses, worms, and trojan horses. They, in contrast to spam, do not affect the \MTA\ itself, as they are in the mail's body. \MTA{}s that search for malware are equal to post offices that open letters to check if they contain something that could harm the recipient. This is not a mail transport job. But by many people the \MTA\ which is responsible for the recipient is seen to be at a good position to do this work, thus it is often done there. Though, it is nice to have interfaces to such scanners within the \MTA.
meillo@219 215
meillo@381 216 In any way should malware checking be performed by external programs that may be invoked by the \MTA. However, \NAME{MDA}s are better points to invoke content scanners.
meillo@391 217 \index{content scanner}
meillo@219 218
meillo@381 219 A popular email filter framework is \name{amavis} which integrates various spam and malware scanners. The common setup includes a receiving \MTA\ which sends mail to \name{amavis} using \SMTP, \name{amavis} processes the mail and sends it then to a second \MTA\ that does the outgoing transfer. (This setup with two \MTA\ instances is discussed in more detail in section~\ref{sec:current-code-security}.)
meillo@219 220
meillo@219 221
meillo@219 222
meillo@393 223 \paragraph{\RF\,10: Archiving}
meillo@339 224 \label{rf10}
meillo@391 225 \index{archiving}
meillo@381 226 Mail archiving and auditability become more important as email establishes as technology for serious business communication. Archiving is a must for companies in many countries. In the United States, the \name{Sarbanes-Oxley Act} \cite{sox} covers this topic.
meillo@334 227
meillo@381 228 It is a goal to have the ability to archive verbatim copies of every mail coming into and every mail going out of the system, with relation between them.
meillo@219 229
meillo@381 230 \postfix\ for example has a \name{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, like \qmail\ provides, is preferable. \qmail\ is able to save copies of all sent and received messages and additionally complete \SMTP\ dialogs \cite[page~12]{sill02}.
meillo@391 231 \index{smtp!dialog}
meillo@281 232
meillo@381 233 But if archiving is of high importance, a dedicated archiving solution is advisable, anyway.
meillo@219 234
meillo@219 235
meillo@219 236
meillo@219 237
meillo@219 238 \subsection{Non-functional requirements}
meillo@391 239 \index{non-functional requirement}
meillo@219 240
meillo@396 241 Now follows a list of non-functional requirements for \masqmail. These requirements specify the quality properties of a 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}. These non-functional requirements are named ``\NAME{RG}'' for ``requirement, general''.
meillo@146 242
meillo@146 243
meillo@393 244 \paragraph{\RG\,1: Security}
meillo@391 245 \index{security}
meillo@381 246 \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{compartmentalization}, as described in section~\ref{sec:discussion-mta-arch}.
meillo@391 247 \index{compartmentalization}
meillo@293 248
meillo@381 249 \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 be able to break \masqmail.
meillo@391 250 \index{masqmail!security}
meillo@177 251
meillo@259 252
meillo@393 253 \paragraph{\RG\,2: Reliability}
meillo@391 254 \index{reliability}
meillo@392 255 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 is a distributed system, one of the communication partners or the transport medium may crash at any time during mail transfer. Thus reliability is needed for mail transfer communication, too.
meillo@391 256 \index{mail loss}
meillo@177 257
meillo@392 258 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 no 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 acknowledgment and then handles the transfer. (2) The client reissues the transfer only if no acknowledgment was received. The server first handles the transfer and sends the acknowledgment afterwards. The first strategy does not need acknowledgments at all, however, it will lose mail if the second transfer fails, too.
meillo@189 259
meillo@381 260 Hence, mail transfer between two processes should use the strategy: The client reissues if it receives no acknowledgment. The server first handles the message and then sends the acknowledgment. This strategy only leads to duplicates if a crash happens in the time between the message is fully transferred to the server and the acknowledgment is received by the client. No mail will get lost.
meillo@391 261 \index{duplicates}
meillo@239 262
meillo@239 263
meillo@393 264 \paragraph{\RG\,3: Robustness}
meillo@391 265 \index{robustness}
meillo@381 266 Being robust means handling errors properly. Small errors may get corrected, large errors may kill a process. Killed processes should get 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}.
meillo@177 267
meillo@177 268
meillo@393 269 \paragraph{\RG\,4: Extendability}
meillo@391 270 \index{extendability}
meillo@392 271 \masqmail's architecture needs to be extendable to allow new features to be added afterwards. The reasons for this need are the changing requirements. New requirements will appear, like more efficient mail transfer of large messages or a final solution to the spam problem. Extendability is the ability of software to include new function with little work.
meillo@196 272
meillo@146 273
meillo@393 274 \paragraph{\RG\,5: Maintainability}
meillo@391 275 \index{maintainability}
meillo@381 276 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 all further work.
meillo@146 277
meillo@189 278
meillo@393 279 \paragraph{\RG\,6: Testability}
meillo@391 280 \index{testability}
meillo@395 281 Good testability make maintenance easier too, because functionality is directly verifiable when changes are done, thus removing the uncertainty. Modularized software makes testing easier, because parts can be tested without external influences. \person{Spinellis} sees testability as a sub-quality of maintainability \cite{spinellis06}.
meillo@189 282
meillo@189 283
meillo@393 284 \paragraph{\RG\,7: Performance}
meillo@391 285 \index{performance}
meillo@381 286 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, thus time performance is less important. \masqmail\ is not a program to be used on large servers, but on small devices. Thus more important for \masqmail\ will be energy and heat saving, maybe also system resources.
meillo@293 287
meillo@381 288 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}. Simplicity and clearness are of higher value.
meillo@293 289
meillo@146 290
meillo@146 291
meillo@393 292 \paragraph{\RG\,8: Availability}
meillo@391 293 \index{availability}
meillo@381 294 Availability is important for server programs. They must stay operational by blocking \name{denial of service} attacks and the like. Automated restarts into a clean state after fatal errors are also required.
meillo@146 295
meillo@146 296
meillo@393 297 \paragraph{\RG\,9: Portability}
meillo@391 298 \index{portability}
meillo@393 299 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. Portability among the various flavors of Unix systems is a goal for \masqmail, because these systems are the ones \MTA{}s usually run on. No special care needs to be taken for non-Unix platforms.
meillo@293 300
meillo@189 301
meillo@189 302
meillo@393 303 \paragraph{\RG\,10: Usability}
meillo@391 304 \index{usability}
meillo@395 305 Usability, not mentioned by \person{Hafiz} \cite{hafiz05} (he focuses on architecture) but by \person{Spinellis} \cite{spinellis06} and \person{Kan} \cite{kan03}, is a property which is 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; 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 the focus should be on the most common form of configuration: choosing one of several common setups.
meillo@185 306
meillo@185 307
meillo@185 308
meillo@185 309
meillo@293 310 \subsection{Architecture}
meillo@239 311 \label{sec:discussion-mta-arch}
meillo@391 312 \index{architecture}
meillo@187 313
meillo@396 314 \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 interface for authentication ``modules''. \sendmail\ provides now, with its \name{milter} interface, standardized connection channels to external modules. \masqmail\ has none of them---it is what \sendmail\ was in the beginning: a single large block.
meillo@391 315 \index{milter}
meillo@391 316 \index{masqmail!architecture}
meillo@161 317
meillo@381 318 Figure~\ref{fig:masqmail-arch} is a call graph generated from \masqmail's source code. It gives an impression of how interweaved the internals are. There are no compartments at all.
meillo@391 319 \index{masqmail!call graph}
meillo@391 320 \index{call graph}
meillo@161 321
meillo@161 322 \begin{figure}
meillo@161 323 \begin{center}
meillo@219 324 \vspace*{2ex}
meillo@397 325 \includegraphics[scale=0.75]{fig/callgraph.eps}
meillo@161 326 \end{center}
meillo@339 327 \caption{Internal structure of \masqmail, showed by a call graph. (Logging functions are ignored; test and \NAME{POP3} code is excluded.)}
meillo@391 328 \index{figure!Internal structure of \masqmail.}
meillo@161 329 \label{fig:masqmail-arch}
meillo@161 330 \end{figure}
meillo@161 331
meillo@378 332 \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}.
meillo@391 333 \index{security}
meillo@161 334
meillo@381 335 Every one of these programs is more modular, or became more modular over time, than \masqmail\ is. Modern requirements like spam protection and probable future requirements like 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}.
meillo@391 336 \index{modularity}
meillo@161 337
meillo@219 338 \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:
meillo@391 339 \index{compartmentalization}
meillo@381 340
meillo@163 341 \begin{quote}
meillo@218 342 A perfect example is the contrast between the feature envy early \sendmail\ architecture implemented as one process and the simple, modular architecture of \qmail. The security of \qmail\ comes from its compartmentalized simple processes that perform one task only and are therefore testable for security.
meillo@218 343 \hfill\cite[page 64]{hafiz05}
meillo@163 344 \end{quote}
meillo@200 345
meillo@381 346 Equal does \person{Dent} see the situation for \postfix: ``The modular architecture of Postfix forms the basis for much of its security.'' \cite[page 7]{dent04}.
meillo@391 347 \index{modularity}
meillo@161 348
meillo@381 349 Modularity is also needed to satisfy modern \MTA\ requirements in providing a clear interface to add functionality without increasing the overall complexity much.
meillo@381 350
meillo@381 351 Modularity is no direct requirement but a goal that has positive influence on important requirements like security, testability, extendability, maintainability, and not least simplicity. These quality properties then, on their part, make it easier to achieve the functional requirements.
meillo@391 352 \index{security}
meillo@239 353
meillo@242 354 Hence, aspiration for modularity, by compartmentalization, improves the overall quality and function of the software. It can be seen as an architectural requirement for a secure and modern \MTA.
meillo@239 355
meillo@239 356
meillo@239 357
meillo@239 358
meillo@288 359
meillo@288 360
meillo@288 361
meillo@288 362
meillo@288 363
meillo@288 364
meillo@239 365 \section{Fulfilled requirements}
meillo@239 366 \label{sec:fulfilled-requirements}
meillo@239 367
meillo@239 368 Here follows a description of how far the requirements are already fulfilled by \masqmail.
meillo@239 369
meillo@239 370
meillo@393 371 \paragraph{\RF\,1: In/out channels}
meillo@391 372 \index{incoming channels}
meillo@391 373 \index{outgoing channels}
meillo@393 374 The incoming and outgoing channels that \masqmail\ already has (depicted in figure~\ref{fig:masqmail-channels} on page \pageref{fig:masqmail-channels}) are the ones required for an \MTA{}s at the moment. Currently, support for other protocols seems not to be necessary, although new protocols and mailing concepts are likely to appear (see section~\ref{sec:email-trends}). As other protocols are not required today, \masqmail\ is regarded to fulfill \RF\,1. Without any support in \masqmail\ for adding further protocols, the best strategy is to delaying such work until the functionality is essential, anyway.
meillo@239 375
meillo@396 376 %fixme: << smtp submission >>
meillo@287 377
meillo@393 378 \paragraph{\RF\,2: Queuing}
meillo@391 379 \index{mail queue}
meillo@381 380 One single mail queue is used in \masqmail. It satisfies all current requirements.
meillo@239 381
meillo@393 382 \paragraph{\RF\,3: Header sanitizing}
meillo@391 383 \index{header sanitizing}
meillo@239 384 The envelope and mail headers are generated when the mail is put into the queue. The requirements are fulfilled.
meillo@239 385
meillo@393 386 \paragraph{\RF\,4: Aliasing}
meillo@391 387 \index{aliases}
meillo@381 388 Aliasing is done on delivery. All common kinds of aliases in the global aliases file are supported. So called \name{.forward} aliasing is not supported, but this is less common and seldom used.
meillo@239 389
meillo@393 390 \paragraph{\RF\,5: Route management}
meillo@391 391 \index{online routes}
meillo@381 392 Querying the name of the active route is done on delivery. Headers can get rewritten a second time then. This part does provide all the functionality required.
meillo@239 393
meillo@393 394 \paragraph{\RF\,6: Authentication}
meillo@391 395 \index{auth}
meillo@392 396 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 hosts 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.
meillo@391 397 \index{auth!smtp-after-pop}
meillo@391 398 \index{auth!smtp-auth}
meillo@239 399
meillo@393 400 \paragraph{\RF\,7: Encryption}
meillo@391 401 \index{enc}
meillo@381 402 Similar is the situation for encryption which is also only available for outgoing channels; here a tunnel application, like \name{openssl}, is needed. A secure tunnel can be created to send mail trough. State-of-the-art, however, is using \NAME{STARTTLS}, but this 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 crypt between the secure connection to the remote host and the plain connection to the \MTA. Unfortunately, this suffers from the problem explained on page \pageref{fig:stunnel} in figure~\ref{fig:stunnel}. Anyway, it would still be no \NAME{STARTTLS} support.
meillo@391 403 \index{secure tunnel}
meillo@239 404
meillo@393 405 \paragraph{\RF\,8: Spam handling}
meillo@391 406 \index{spam!handling}
meillo@381 407 \masqmail\ 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 in between. 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 good to separate different work with clear interfaces. But the need of two instances of the same \MTA, with doubled setup, makes it rather a work-around. Better is to have this data flow respected in the \MTA\ design, like it was done in \postfix. Anyway, the more important part of spam handling, for sure, is done during the \SMTP\ dialog by completely refusing unwanted mail.
meillo@239 408
meillo@393 409 \paragraph{\RF\,9: Malware handling}
meillo@391 410 \index{malware!handling}
meillo@381 411 For malware handling applies nearly the same as for spam handling, except that all checks are done after mail is accepted. The possible setup is the same with the two \MTA\ instances and the filter in between. \masqmail\ does support such a setup, but not in a nice way.
meillo@239 412
meillo@393 413 \paragraph{\RF\,10: Archiving}
meillo@391 414 \index{archiving}
meillo@381 415 There is currently no way for archiving every message that does through \masqmail.
meillo@239 416
meillo@239 417
meillo@239 418
meillo@393 419 \paragraph{\RG\,1: Security}
meillo@391 420 \index{security}
meillo@381 421 \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 attacks. In environments where untrusted components or persons have access to \masqmail, its security is too low. Its author states that \masqmail\ ``is not designed to'' such usage \citeweb{masqmail:homepage2}. This is a clear indicator for being careful. Issues like high memory consumption, low performance, and denial-of-service attacks---things not regarded by design---may cause serious problems. In any way, a security report that confirms \masqmail's security level is missing.
meillo@391 422 \index{masqmail!security}
meillo@259 423
meillo@392 424 \masqmail\ uses conditional compilation to exclude unneeded functionality from the executable at compile time. Excluding code means excluding all bugs and weaknesses within this code, too. Excluding unused code is a good concept to improve security.
meillo@391 425 \index{conditional compilation}
meillo@239 426
meillo@393 427 \paragraph{\RG\,2: Reliability}
meillo@391 428 \index{reliability}
meillo@381 429 Its reliability is also not good enough. Situations where only one part of a sent message was removed from the queue and the other part remained as garbage, showed off \citeweb{debian:bug245882}. Problems with large mail messages in conjunction with small bandwidth were also reported \citeweb{debian:bug216226}. Fortunately, lost email was no big problem yet, but \person{Kurth} warns:
meillo@391 430 \index{masqmail!bugs}
meillo@381 431
meillo@163 432 \begin{quote}
meillo@239 433 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.
meillo@239 434 \hfill\citeweb{masqmail:homepage2}
meillo@163 435 \end{quote}
meillo@381 436
meillo@396 437 In summary: Current reliability needs to be improved. Implementing a state machine can help here.
meillo@161 438
meillo@393 439 \paragraph{\RG\,3: Robustness}
meillo@391 440 \index{robustness}
meillo@381 441 The logging behavior of \masqmail\ is good, although it does not cover the whole code. 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.
meillo@239 442
meillo@393 443 \paragraph{\RG\,4: Extendability}
meillo@391 444 \index{extendability}
meillo@381 445 \masqmail's extendability is very poor. This is a general problem of monolithic software, but can though be provided with high effort. \exim\ is an example for good extendability in a monolithic program.
meillo@239 446
meillo@393 447 \paragraph{\RG\,5: Maintainability}
meillo@391 448 \index{maintainability}
meillo@381 449 The maintainability of \masqmail\ is equivalent to other software of similar kind. Missing modularity and therefore more complexity makes the maintainer's work harder. Conditional compilation might be good for security, but \name{ifdef}s scattered throughout the source code is a pain for maintenance. In summary is \masqmail's maintainability bearable, like in average Free Software projects.
meillo@239 450
meillo@288 451
meillo@287 452
meillo@393 453 \paragraph{\RG\,6: Testability}
meillo@391 454 \index{testability}
meillo@381 455 The testability suffers from missing modularity, too. Testing program parts is hard to do. Nevertheless, it is done by compiling parts of the source to two special test programs: One tests reading input from a socket, the other tests constructing messages and sending it directly. Neither is designed for automated testing of source parts, they are rather to help the programmer during development.
meillo@239 456
meillo@381 457 Two additional scripts exist to send a set of mails to differend kinds of recipients. They can be used for automated testing, but both check only the function of the whole system, not its parts.
meillo@391 458 \index{test program}
meillo@339 459
meillo@293 460
meillo@393 461 \paragraph{\RG\,7: Performance}
meillo@391 462 \index{performance}
meillo@239 463 The performance---efficiency---of \masqmail\ is good enough for its target field of operation, where this is a minor goal.
meillo@239 464
meillo@393 465 \paragraph{\RG\,8: Availability}
meillo@391 466 \index{availability}
meillo@239 467 This applies equal to availability. Hence no further work needs to be done her.
meillo@239 468
meillo@393 469 \paragraph{\RG\,9: Portability}
meillo@391 470 \index{portability}
meillo@391 471 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. Thus, the portability is already good.
meillo@391 472 \index{masqmail!supported systems}
meillo@239 473
meillo@293 474
meillo@393 475 \paragraph{\RG\,10: Usability}
meillo@391 476 \index{usability}
meillo@381 477 The usability is very good, from the administrator's point of view. \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 \MUA. Configuration could be eased even more by providing configuration generators that enable \masqmail\ to be used 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.
meillo@391 478 \index{out-of-the-box usage}
meillo@239 479
meillo@239 480
meillo@239 481
meillo@239 482
meillo@239 483
meillo@239 484 \section{Work to do}
meillo@239 485
meillo@381 486 After the requirements for modern \MTA{}s were identified in section~\ref{sec:mta-requirements} and \masqmail's features were compared against them in section~\ref{sec:fulfilled-requirements}, here the pending work is identified. Table~\ref{tab:requirements} lists all requirements with importance and the work that is needed to achieve them. The column ``Focus'' shows the attention a work task should get. The focus depends on the task's importance and the amount of work it includes.
meillo@239 487
meillo@239 488 \begin{table}
meillo@239 489 \begin{center}
meillo@271 490 \input{tbl/requirements.tbl}
meillo@239 491 \end{center}
meillo@239 492 \caption{Importance of and pending work for requirements}
meillo@391 493 \index{table!Importance of and pending work for requirements}
meillo@242 494 \label{tab:requirements}
meillo@239 495 \end{table}
meillo@239 496
meillo@381 497 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 need to be in focus. In contrast should small, low importance work tasks receive few attention. Here the focus for a task 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.
meillo@239 498
meillo@381 499 The functional requirements that receive highest attention are \RF\,6 (authentication), \RF\,7 (encryption), and \RF\,8 (spam handling). Of the non-functional requirements, \RG\,1 (security), \RG\,2 (reliability), and \RG\,4 (extendability), rank highest.
meillo@391 500 \index{requirements!ranking}
meillo@239 501
meillo@381 502 These tasks are presented in more detail in a todo list, now. The list is sorted by focus and then by importance.
meillo@239 503
meillo@239 504
meillo@393 505 \subsubsection*{\TODO\,1: Encryption (\RF\,7)}
meillo@391 506 \index{enc}
meillo@381 507 Encryption is chosen for number one as it is essential to provide privacy. Using \NAME{STARTTLS} for encryption is definitely needed and should be added first; encrypted data transfer is hardly possible without support for it.
meillo@288 508
meillo@239 509
meillo@393 510 \subsubsection*{\TODO\,2: Authentication (\RF\,6)}
meillo@391 511 \index{auth}
meillo@381 512 Authentication of incoming \SMTP\ connections is also highly needed and should be added second. It is important to restrict access and to prevent relaying. For workstations and local networks, this has only medium importance and address-based authentication is sufficient in most times. But secret-based authentication is mandatory to receive mail from the Internet. Additionally it is a guard against spam.
meillo@288 513
meillo@239 514
meillo@393 515 \subsubsection*{\TODO\,3: Security (\RG\,1)}
meillo@391 516 \index{security}
meillo@392 517 \masqmail's security is bad, thus the program is forced into a limited field of operation. This field of operation even shrinks as security becomes more important and networking and interaction increases. Secure and trusted environment become rare, thus improving security is an important thing to do. The focus should be on adding compartments to split \masqmail\ into separate modules. (See section~\ref{sec:discussion-mta-arch}.) Furthermore, \masqmail's security should be tested throughout to get a definitive view how good it really is and where the weak spots are.
meillo@391 518 \index{modularity}
meillo@239 519
meillo@239 520
meillo@393 521 \subsubsection*{\TODO\,4: Reliability (\RG\,2)}
meillo@391 522 \index{reliability}
meillo@381 523 Reliability is also to improve. It is a key quality property for an \MTA, and not good enough in \masqmail. Reliability is strong related to the queue, thus improvements there are favorable. Applying ideas of \name{crash-only software} \cite{candea03} will be a good step. \person{Candea} and \person{Fox} see in killing the process the best way to stop a running program. Doing so inevitably demands for good reliability of the queue, and the start up process inevitably demands for good recovery. Those critical situations for reliability are nothing special anymore, they are common. Hence they are regularly tested and will definitely work.
meillo@391 524 \index{crash-only software}
meillo@288 525
meillo@239 526
meillo@393 527 \subsubsection*{\TODO\,5: Spam handling (\RF\,8)}
meillo@391 528 \index{spam!handling}
meillo@381 529 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. Configuration guides for a setup of two \masqmail\ instances with a spam scanner in between should be written. And at least a basic kind of spam prevention during the \SMTP\ dialog should be implemented.
meillo@239 530
meillo@241 531
meillo@393 532 \subsubsection*{\TODO\,6: Extendability (\RG\,4)}
meillo@391 533 \index{extendability}
meillo@381 534 \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 into various source files. Some functional parts can be included or excluded by conditional compilation. But the \name{ifdef}s are scattered through all the code. This situation needs to be improved by collecting related function into single places that interact through clear interfaces with other parts. Also should these interfaces allow efficient adding of further functionality.
meillo@391 535 \index{conditional compilation}
meillo@254 536
meillo@239 537
meillo@239 538
meillo@239 539
meillo@239 540
meillo@239 541
meillo@239 542
meillo@239 543
meillo@239 544
meillo@239 545
meillo@239 546 \section{Ways for further development}
meillo@391 547 \index{development strategies}
meillo@239 548
meillo@293 549 Knowing what needs to be done is only one part, the other is deciding \emph{how} to do it by focusing on a global development strategy.
meillo@293 550
meillo@293 551
meillo@293 552 \subsection{Possibilities}
meillo@293 553
meillo@316 554 Further development of software can always go three different ways:
meillo@241 555 \begin{enumerate}
meillo@391 556 \item Improve the current code base. (S\,1)
meillo@391 557 \item Add wrappers or interposition filters. (S\,2)
meillo@391 558 \item Redesign the software from scratch and rebuild it. (S\,3)
meillo@241 559 \end{enumerate}
meillo@239 560
meillo@381 561 The first two strategies base on the available source code and can be applied in combination. The third strategy splits from the old code base and starts over again. Wrappers and interposition filters would be outright included into a new architecture; they are a subset of a new design. Of course, parts of existing code can be used in a new design if appropriate.
meillo@391 562 \index{wrapper}
meillo@391 563 \index{interposition filter}
meillo@239 564
meillo@241 565
meillo@393 566 The requirements are now regarded, each on its own, and are linked to the development strategy that is preferred to reach each specific requirement. If some requirement is well achievable by using different strategies then it is linked to all of them. Implementing encryption (\TODO\,1) and authentication (\TODO\,2), for example, are limited to a narrow region in the code. Such features are addable to the current code base without much problem. In contrast can quality properties like reliability (\TODO\,4), extendability (\TODO\,6), and maintainability hardly be added to code afterwards---if at all. Security (\TODO\,3) is improvable in a new design, of course, but also with wrappers or interposition filters.
meillo@293 567
meillo@381 568 This linking of requirements to the strategies is shown in table~\ref{tab:strategies}. The requirements are ordered by their focus.
meillo@241 569
meillo@241 570 \begin{table}
meillo@241 571 \begin{center}
meillo@271 572 \input{tbl/strategies.tbl}
meillo@241 573 \end{center}
meillo@241 574 \caption{Development strategies and their suitability for requirements}
meillo@391 575 \index{figure!Development strategies and their suitability for requirements}
meillo@241 576 \label{tab:strategies}
meillo@241 577 \end{table}
meillo@241 578
meillo@239 579
meillo@381 580 Next, the best strategy for further development needs to be discovered. Therefore a score for each strategy is obtained by summing up the focus points of each requirement for which a strategy is preferred. Only positive focus points are regarded, with each plus symbol counting one. Requirements with negative focus are not regarded because they are already or nearly reached; the view here is on outstanding work.
meillo@267 581
meillo@381 582 Strategy 1 (Improve current code) has a score of 9 points. Strategy 2 (Wrappers and interposition filters) has a score of 7 points. Strategy 3 (A new design) scores on top with 17 points. S\,1 and S\,2 can be used in combination; the combined score is 13 points. Thus strategy 3 ranges first, followed by the combination of strategy 1 and 2.
meillo@267 583
meillo@381 584 This leads to the conclusion that S\,3 (A new design) is probably the best strategy for further development.
meillo@381 585
meillo@392 586 But this result respects only the view on requirements and their relevance. Other factors like development effort and risks are important to think about, too. These issues are discussed in the following sections, comparing S\,3 against the combination S\,1+2.
meillo@267 587
meillo@267 588
meillo@267 589
meillo@267 590
meillo@267 591
meillo@267 592
meillo@267 593
meillo@267 594
meillo@293 595 \subsection{Discussion}
meillo@323 596 \label{sec:discussion-further-devel}
meillo@267 597
meillo@267 598
meillo@296 599 \subsubsection*{Quality improvements}
meillo@391 600 \index{quality improvement}
meillo@239 601
meillo@392 602 Most quality properties can hardly be added afterwards. Hence, if reliability, extendability, or maintainability shall be improved, a redesign of \masqmail\ is the best way to take. The wish to improve quality, inevitably point towards a modular architecture. Modularity with internal and external interfaces is highly preferred from the architectural point of view (see section~\ref{sec:discussion-mta-arch}). The need for further features, especially ones that require changes in \masqmail's structure, support the decision for a new design, too. Hence a rewrite is favored if \masqmail\ should become a modern \MTA\ with good quality properties.
meillo@391 603 \index{modularity}
meillo@288 604
meillo@288 605
meillo@241 606
meillo@293 607 \subsubsection*{Security}
meillo@391 608 \index{security}
meillo@261 609
meillo@293 610 Similar is the situation for security. Security comes from good design, explain \person{Graff} and \person{van Wyk}:
meillo@381 611
meillo@241 612 \begin{quote}
meillo@241 613 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.
meillo@241 614 %
meillo@241 615 %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.
meillo@241 616 \hfill\cite[page 55]{graff03}
meillo@241 617 \end{quote}
meillo@391 618 \index{good design}
meillo@241 619
meillo@296 620 They also suggest to add wrappers and interposition filters \emph{around} applications, but more as repair techniques if it is not possible to design security \emph{into} a software the first way \cite[pages~71--72]{graff03}.
meillo@391 621 \index{wrapper}
meillo@391 622 \index{interposition filter}
meillo@241 623
meillo@381 624 \person{Hafiz} adds: ``The major idea is that security cannot be retrofitted \emph{into} an architecture.'' \cite[page 64, (emphasis added)]{hafiz05}.
meillo@391 625 \index{security!retrofitted}
meillo@241 626
meillo@241 627
meillo@241 628
meillo@241 629
meillo@293 630 \subsubsection*{Effort estimation}
meillo@391 631 \index{effort estimation}
meillo@293 632
meillo@293 633 Although a strategy might lead to the best result, one may choose another one if the required effort is too high. The effort for a redesign and rebuild is estimated now.
meillo@293 634
meillo@293 635 \person{Wheeler}'s program \name{sloccount} calculates following estimations for \masqmail's code base as of version 0.2.21 (excluding library code):
meillo@391 636 \index{masqmail!development effort}
meillo@293 637
meillo@293 638 \codeinput{input/masqmail-sloccount.txt}
meillo@293 639
meillo@391 640 The development costs in money are not relevant for a Free Software project with volunteer developers, but the development time is. About 24 man-months are estimated. The current code base was written almost completely by \person{Oliver Kurth} within four years in his spare time. This means he needed around twice as much time. Of course, he programmed as a volunteer developer not as an employee with eight work-hours per day.
meillo@293 641
meillo@392 642 Given the assumptions that (1) an equal amount of code needs to be produced for a new designed \masqmail, (2) a third of the existing code can be reused plus concepts and knowledge, and (3) development speed is like \person{Kurth}'s, then it would take between two and three years for one programmer to produce a redesigned new \masqmail\ with the same features that \masqmail\ now has. Less time would be needed if a simpler architecture allows faster development, better testing, and less bugs. Of course, more developers would speed it up, too.
meillo@293 643
meillo@293 644
meillo@293 645
meillo@293 646
meillo@293 647 \subsubsection*{Risks}
meillo@391 648 \index{risks}
meillo@293 649
meillo@381 650 The gained result of a new design might still outweigh the development effort. But risks are something more to consider.
meillo@293 651
meillo@293 652 A redesign and rewrite of software from scratch is hard. It takes time to design a new architecture, which then must prove that it is as good as expected. As well is much time and work needed to implement the design, test it, fix bugs, and so on. If flaws in the design appear during prototype implementation, it is necessary to start again.
meillo@293 653
meillo@381 654 Such a redesign can fail at many points and it is long time unclear if the result is really better than the code that already exists. Even if the new code is working like expected, it is still not matured.
meillo@293 655
meillo@296 656 One thing is clear: Doing a redesign and rebuild \emph{is} a risky decision.
meillo@293 657
meillo@293 658
meillo@293 659
meillo@293 660 \subsubsection*{Existing code is precious}
meillo@391 661 \index{existing code}
meillo@293 662
meillo@296 663 If a new design needs much effort and additionally is a risk, what about the existing code base then?
meillo@293 664
meillo@381 665 Adding new functionality to an existing code base seems to be a secure and cheap strategy. The existing code is known to work and features can often be added in small increments. Risks like wasted effort if a new design fails are hardly existent, and the faults in the current design are already made and most probably fixed.
meillo@293 666
meillo@396 667 Functionality that is hard to add incrementally into the application, like support for new protocols, may be addable to the outside. \masqmail\ can be secured to a huge amount by guarding it with wrappers that block attackers \cite[page~71]{graff03}. Spam and malware scanners can be included by running two instances of \masqmail. All those methods base on the current code which they can indirectly improve.
meillo@391 668 \index{wrapper}
meillo@391 669 \index{extendability}
meillo@293 670
meillo@296 671 The required effort is probably under one third of a new design and work directly shows results. These are strong arguments against a new design.
meillo@293 672
meillo@293 673
meillo@296 674
meillo@293 675
meillo@293 676 \subsubsection*{Repairing}
meillo@391 677 \index{reparing}
meillo@293 678
meillo@392 679 Besides these advantages of existing code, one must not forget that further work on it is often repair work. Small bug fixes are not the problem, but adding something for which the software originally was not designed, will cause problems. Such work often destroys the clear concepts of the software, especially in interweaved monolithic code.
meillo@293 680
meillo@381 681 \person{Doug McIlroy}, a person with important influence on Unix especially by inventing the Unix pipe, demands: ``To do a new job, build afresh rather than complicate old programs by adding new features.'' \cite{mcilroy78}.
meillo@293 682
meillo@381 683 Repair strategies are useful, but only in the short-time view and in times of trouble. If the future is bright, however, one does best by investing into a software. As shown in section~\ref{sec:market-analysis-conclusion}, the future for \MTA{}s is bright. This means it is time to invest into a redesign with the intension to build up a more modern product.
meillo@381 684
meillo@381 685 In the author's view is \masqmail\ already needing this redesign since about 2003 when the old design was still quite suitable \dots\ it already delayed too long.
meillo@391 686 \index{masqmail!redesign}
meillo@293 687
meillo@296 688 %Clinging to much to existing code will be no help, it is an indicator for fear. Having the courage to through bad code away to make it better, shows the view forward.
meillo@296 689
meillo@392 690 Anyway, further development on base of current code needs to improve the quality properties, too. Some quality requirements can be satisfied by adding wrappers or interposition filters to the outside. For those is the development effort approximately equal to a solution with a new design. But for adding quality requirements like extendability or maintainability which affect the source code throughout, the effort does increase with exponential rate as development proceeds. In case these properties get not improved, development will likely come to a dead end sooner or later.
meillo@391 691 \index{quality improvement}
meillo@293 692
meillo@293 693
meillo@293 694
meillo@293 695
meillo@293 696
meillo@293 697 \subsubsection*{A guard against dead ends}
meillo@391 698 \index{dead ends}
meillo@293 699
meillo@296 700 A new design does protect against such dead ends.
meillo@293 701
meillo@400 702 Changing requirements are one possible dead end if the software does not evolve with them. A famous example is \sendmail; it had an almost monopoly for a long time. But when security became important, \sendmail\ was only repaired instead of the problem sources---its insecure design---would have been removed. Thus security problems reappeared and over the years \sendmail's market share shrank as more secure \MTA{}s became available. \sendmail's reaction to the new requirements, in form of \name{sendmail~X} and \name{MeTA1}, came much to late---the users already switched to other \MTA{}s.
meillo@391 703 \index{sendmail}
meillo@293 704
meillo@400 705 Redesigning a software as requirements change helps keeping it alive.
meillo@391 706 \index{redesign}
meillo@381 707
meillo@400 708 The knowledge of \person{Heraclitus}, a Greek philosopher, shall be an inspriation: ``Nothing endures but change.''
meillo@400 709
meillo@393 710 Another danger is the dead end of complexity which is likely to appear by constant work on the same code base. It is even more likely if the code base has a monolithic architecture. A good example for simplicity is \qmail\ which consists of small independent modules, each with only about one thousand lines of code. Such simple code makes it obvious to understand what it does. The \name{suckless} project \citeweb{suckless.org} for example advertises such a philosophy of small and simple software by following the thoughts of the Unix inventors \cite{kernighan84} \cite{kernighan99}. Simple, small, and clear code avoids complexity and is thus also a strong prerequisite for security.
meillo@391 711 \index{suckless}
meillo@293 712
meillo@293 713
meillo@293 714
meillo@293 715
meillo@293 716
meillo@293 717 \subsubsection*{Modularity}
meillo@391 718 \index{modularity}
meillo@293 719
meillo@392 720 The avoidance of dead ends is essential for further development on current code, too. Hence it is mandatory to refactor the existing code base sooner or later. Most important is the intention to modularize it, as modularity improves many quality properties, eases further development, and essentially improves security.
meillo@293 721
meillo@400 722 One example how modular structure makes it easy to add further functionality is described by \person{Sill}: He says that integrating the \name{amavis} filter framework into the \qmail\ system can be done by simply renaming the \path{qmail-queue} module to \path{qmail-queue-real} and then renaming the \path{amavis} executable to \path{qmail-queue} \cite[section~12.7.1]{sill02}. Nothing more in the \qmail\ system needs to be changed. This is a very admirable ability which is only possible in a modular system that consists of independent executables.
meillo@391 723 \index{modularity}
meillo@293 724
meillo@381 725 This thesis showed several times that modularity is a key property for good software design. Modularity can hardly be retrofitted into software, hence development on base of current code will need a throughout restructuring too, to modularize the source code. Thus a new design is similar to such a throughout refactoring, except the dependence on current code.
meillo@293 726
meillo@293 727
meillo@293 728
meillo@293 729
meillo@293 730
meillo@293 731
meillo@296 732 \subsubsection*{Function versus quality}
meillo@391 733 \index{quality improvement}
meillo@293 734
meillo@381 735 Remarkable is the distribution of functional and non-functional requirements to the strategies. The strategies for current code (S\,1+2) have a functional to non-functional ratio of 10 to 3. The new design strategy (S\,3) has a ratio of 5 to 12.
meillo@293 736
meillo@381 737 This classifies current code to be better suited for adding functionality, and a new design to be better suited for quality improvements. Both strategies need to improve function as well as quality, however, the focus of the strategy is determined by this difference.
meillo@293 738
meillo@381 739 Easier work is likely to be done earlier in Free Software projects than hard work. Thus, by choosing S\,1+2 volunteer developers tend to implement function first and delay quality improvements, no matter what the suggested order of the work tasks is. S\,3, in contrast, would benefit early quality improvements and later function improvements. This is real-life experience from Free Software development.
meillo@293 740
meillo@293 741
meillo@293 742
meillo@293 743
meillo@293 744
meillo@293 745
meillo@297 746 \subsubsection*{Break Even}
meillo@391 747 \index{Break Even}
meillo@293 748
meillo@396 749 It is important to keep the time dimension in mind. This includes the separation into a short-time and a long-time view. The short-time view shall cover between two and four years, here. The long-time view is the following time.
meillo@293 750
meillo@381 751 In the short-time view, the effort for improving the existing code is much smaller than the effort for a new design plus improvements. But to have similar quality properties at the end of the short-time frame, a version that is based on current code will probably require nearly as much effort as a new designed version will take. For all further development afterwards, the new design will scale well while the old code will require exponential more work.
meillo@391 752 \index{existing code}
meillo@296 753
meillo@381 754 In the long-time view, a restructuring for modularity is necessary anyway. The question is, when it should be done: Right at the start in a new design, or later as restructuring work.
meillo@293 755
meillo@318 756 %fixme: define exactly, be clear: what does ``break even'' here mean
meillo@293 757
meillo@293 758
meillo@293 759
meillo@293 760 \subsubsection*{The problem with ``good enough''}
meillo@391 761 \index{good enough}
meillo@293 762
meillo@381 763 The decision for later restructuring is problematic. Functionality is often more wanted than quality, thus more function is preferred over better quality, as quality is still ``good enough''. But it might be still ``good enough'' the next time, and the time after that one, and so on.
meillo@241 764
meillo@381 765 Quality improvement is no popular work, but it is required to avoid dead ends. As more code increases the work that needs to be done for quality and modularity improvements, it is better to do these improvements early. Afterwards, all further development will profit from it.
meillo@391 766 \index{quality improvement}
meillo@254 767
meillo@396 768 If some design is bad, it should get replaced by a sane solution.
meillo@254 769
meillo@396 770 \person{Doug McIlroy} gives valuable advice for these situations: ``Don't hesitate to throw away the clumsy parts and rebuild them.'' \cite{mcilroy78}.
meillo@254 771
meillo@396 772 Though, making such a cut is hard, especially if the bad design is still \dots\ ``good enough''.
meillo@345 773
meillo@254 774
meillo@254 775
meillo@254 776
meillo@254 777
meillo@297 778 \subsubsection*{Good software, good feelings}
meillo@391 779 \index{good feeling}
meillo@254 780
meillo@381 781 One last argument shall be added. This one is more common to Free Software but can also be found in non-free software.
meillo@254 782
meillo@381 783 Free Software ``sells'' if it has a good user base. For example: Although \qmail\ is somehow outdated and its author has not released any new version since about ten years, \qmail\ still has a very strong user base and community.
meillo@391 784 \index{qmail}
meillo@254 785
meillo@381 786 Good concepts, sound design, and a sane philosophy gives users good feelings for the software and faith in it. They become interested in using it and to contribute. In contrast do constant repaire work and reappearance of weaknesses leave a bad feeling.
meillo@254 787
meillo@381 788 The motivation of most volunteer developers is their wish to do good work with the goal to create good software. Projects that follow admirable plans towards a good product will motivate volunteers to help. More helpers can get the 2,5 man-years for a new design in less absolute time done. Additionally is a good developers base the best start for a good user base, and users define a software's value.
meillo@391 789 \index{motivation}
meillo@241 790
meillo@267 791
meillo@267 792
meillo@267 793
meillo@267 794
meillo@267 795
meillo@267 796
meillo@267 797
meillo@241 798 \section{Result}
meillo@241 799
meillo@381 800 This chapter identified the requirements for a modern and secure \masqmail, and the outstanding work to achieve them. Their importance and the required work for them lead to a focus ranking, which resulted in an ordered list of pending work tasks. Afterwards possible development strategies to control the work process were compared and discussed.
meillo@296 801
meillo@381 802 Strategy 3 (A new design) is slightly preferred over the combination of strategy 1 (Improve existing code) and 2 (Add wrappers and interposition filters), from the requirement's point of view.
meillo@296 803
meillo@381 804 The discussion afterwards did generally support the new design strategy. But some arguments stood against it. These were:
meillo@391 805 \index{development strategy}
meillo@239 806
meillo@293 807 \begin{enumerate}
meillo@391 808 \item The development time and effort
meillo@391 809 \item The time delay until new features can be added
meillo@391 810 \item The risk of failure
meillo@293 811 \end{enumerate}
meillo@239 812
meillo@297 813 The first two arguments are only relevant for the short-time view, because both will become \emph{support arguments} for the new design, once the Break Even point is reached.
meillo@239 814
meillo@381 815 The third argument, the risk, remains. There are risks in every investment. Taking no risks means remaining the same, which eventually means, drifting towards a dead end in a world that does change.
meillo@239 816
meillo@239 817
meillo@316 818 With respect to the current situation, the suggested further development plan for \masqmail\ is split into a short-time plan and a long-time plan:
meillo@391 819 \index{development goal}
meillo@196 820
meillo@219 821 \begin{enumerate}
meillo@391 822 \item The short-time plan: Add the most needed features, namely encryption, authentication, and security wrappers, to the current code base.
meillo@391 823 \item The long-time plan: Design a new architecture that satisfies the modern requirements, especially the quality requirements.
meillo@219 824 \end{enumerate}
meillo@196 825
meillo@381 826 The background thought for this development plan is to first do the most needed stuff on the existing code to keep it usable. This satisfies the urgent needs and removes the time pressure from the development of the new design. After this is done, a new designed \masqmail\ should be developed from scratch. This is the work for the future. It shall, after it is usable and throughout tested, supersede the old \masqmail.
meillo@196 827
meillo@381 828 The basics of this development idea can be described as: Recurrent development of a new design from scratch, while the old version is still in use and gets repaired.
meillo@196 829
meillo@381 830 Hence a modern design will inherit an old one in periodic intervals. This is a very future-proof concept that combines the best of short-term and long-term planning. The price to pay is only the increased work, which gets covered by volunteers that \emph{want} to do it.
meillo@391 831 \index{motivation}
meillo@219 832
meillo@297 833