docs/diploma

annotate thesis/tex/4-MasqmailsFuture.tex @ 323:82496704f747

added labels
author meillo@marmaro.de
date Thu, 22 Jan 2009 21:51:19 +0100
parents 426ad56236ce
children d13bddf0f994
rev   line source
meillo@109 1 \chapter{\masqmail's present and future}
meillo@93 2
meillo@267 3 This chapter identifies requirements for \masqmail\ which 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 a list of tasks to do is created. 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 4
meillo@185 5
meillo@267 6 \section{The goal}
meillo@185 7
meillo@293 8 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@185 9
meillo@293 10 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 11
meillo@293 12 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 seems to be no need for another general purpose \MTA\ additional to those four programs. Thus the effort would most likely die 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@256 13
meillo@293 14 \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 15
meillo@267 16 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.'' 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~33, page~90]{graff03}. As \masqmail\ is mail software and trusted environments become rare, it is best for \masqmail\ to become a secure \MTA.
meillo@256 17
meillo@293 18 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 19
meillo@256 20
meillo@256 21
meillo@132 22
meillo@132 23
meillo@132 24
meillo@177 25 \section{Requirements}
meillo@219 26 \label{sec:mta-requirements}
meillo@146 27
meillo@267 28 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 29
meillo@218 30
meillo@185 31
meillo@219 32 \subsection{Functional requirements}
meillo@146 33
meillo@232 34 Functional requirements are about the function of the software. They define what the program can do and in what way.
meillo@232 35 %fixme: add ref
meillo@239 36 The requirements are named ``\NAME{RF}'' for ``requirement, functional''.
meillo@219 37
meillo@219 38
meillo@239 39 \paragraph{\RF1: Incoming and outgoing channels}
meillo@232 40 \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}.
meillo@219 41
meillo@232 42 \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.
meillo@219 43
meillo@219 44
meillo@232 45 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@219 46
meillo@318 47 %fixme: is the def of MTA: transfer between machines, or transfer between users?
meillo@232 48 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 it. 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@219 49
meillo@232 50 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 51
meillo@232 52 \begin{figure}
meillo@232 53 \begin{center}
meillo@232 54 \includegraphics[scale=0.75]{img/mta-channels.eps}
meillo@232 55 \end{center}
meillo@277 56 \caption{Required incoming and outgoing channels}
meillo@232 57 \label{fig:mta-channels}
meillo@232 58 \end{figure}
meillo@219 59
meillo@232 60 An overview on in and outgoing channels required for an \MTA, gives figure \ref{fig:mta-channels}.
meillo@219 61
meillo@239 62 %fixme: write about submission (port 587)
meillo@219 63
meillo@219 64
meillo@219 65
meillo@219 66
meillo@239 67 \paragraph{\RF2: Mail queuing}
meillo@287 68 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 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.
meillo@219 69
meillo@219 70 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.
meillo@219 71
meillo@219 72
meillo@219 73
meillo@219 74
meillo@239 75 \paragraph{\RF3: Header sanitizing}
meillo@219 76 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@219 77
meillo@225 78 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.
meillo@219 79
meillo@219 80
meillo@219 81
meillo@219 82
meillo@239 83 \paragraph{\RF4: Aliasing}
meillo@225 84 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.
meillo@219 85
meillo@219 86
meillo@219 87
meillo@219 88
meillo@287 89 \paragraph{\RF5: Route management}
meillo@232 90 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 91
meillo@219 92
meillo@219 93
meillo@219 94
meillo@239 95 \paragraph{\RF6: Authentication}
meillo@317 96 \label{requirement-authentication}
meillo@317 97 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@219 98
meillo@317 99 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}) before. The main advantage here is the minimal setup and maintenance work needed. This kind of access restriction is important to be implemented.
meillo@219 100
meillo@316 101 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@285 102 \begin{enumerate}
meillo@232 103 \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@232 104 \item \SMTP\ authentication: An extension to \SMTP. It allows to request authentication before mail is accepted. Here no helper protocols are needed.
meillo@317 105 \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 allow to identify the remote user/host by his certificate.
meillo@285 106 \end{enumerate}
meillo@232 107 At least one of the secret-based mechanisms should be supported.
meillo@219 108
meillo@219 109
meillo@219 110
meillo@239 111 \paragraph{\RF7: Encryption}
meillo@314 112 \label{requirement-encryption}
meillo@288 113 Electronic mail is vulnerable to sniffing attacks, because in generic \SMTP\ all data transfer is unencrypted. The message's body, the header, and envelope are all unencrypted, but also authentication dialogs that transfer plain text passwords (e.g.\ \NAME{PLAIN} and \NAME{LOGIN}). Hence encryption is throughout important.
meillo@219 114
meillo@288 115 The common way to encrypt \SMTP\ dialogs is using \name{Transport Layer Security} (short: \TLS, the 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 with any of them \citeweb{wikipedia:tls}.
meillo@219 116
meillo@316 117 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@219 118
meillo@232 119 \begin{figure}
meillo@232 120 \begin{center}
meillo@232 121 \includegraphics[scale=0.75]{img/stunnel.eps}
meillo@232 122 \end{center}
meillo@232 123 \caption{Using \name{stunnel} for incoming connections}
meillo@232 124 \label{fig:stunnel}
meillo@232 125 \end{figure}
meillo@219 126
meillo@288 127 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 by not mentioning \NAME{SMTPS} on port 465. Also port 465 is not even reserved for \NAME{SMTPS} anymore \citeweb{iana:port-numbers}.
meillo@219 128
meillo@288 129 \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. 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 130
meillo@232 131
meillo@232 132
meillo@288 133 \paragraph{\RF8: Spam handling}
meillo@219 134 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 135
meillo@288 136 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 137
meillo@288 138 Filtering spam can be done by either refusing spam 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@219 139
meillo@288 140 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.
meillo@288 141
meillo@316 142 Doing some basic checks during the \SMTP\ dialog seems to be a must \cite[page~25]{eisentraut05}. Including them into the \MTA\ makes them fast to avoid \SMTP\ dialog timeouts. For modularity and risibility reasons internal interfaces to specialized modules seem to be best.
meillo@219 143
meillo@239 144 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.)
meillo@219 145
meillo@219 146
meillo@219 147
meillo@239 148
meillo@239 149
meillo@287 150 \paragraph{\RF9: Malware handling}
meillo@288 151 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 by many people the \MTA\ which is responsible for the recipient is seen to be at a good position to do this work, so it is often done there.
meillo@219 152
meillo@288 153 In any way should malware checking be performed by external programs that may be invoked by the \mta. But \NAME{MDA}s are better points to invoke content scanners.
meillo@219 154
meillo@288 155 A popular email filter framework is \name{amavis} which integrates various spam and malware scanners. The common setup includes a receiving \MTA\ which sends it to \name{amavis} using \SMTP, \name{amavis} processes the mail and sends it then to a second \MTA\ that does the outgoing transfer. Having interfaces to such scanners is nice to have, though. (This setup with two \MTA\ instances is discussed in more detail in section \ref{sec:double-mta-setup}).
meillo@219 156
meillo@219 157
meillo@219 158
meillo@239 159 \paragraph{\RF10: Archiving}
meillo@293 160 Mail archiving and auditability become more important as email establishes as technology for serious business communication. It is also a must for companies in many countries. << SOX >> %fixme: cite SOX
meillo@293 161 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.
meillo@219 162
meillo@288 163 \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, 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@281 164
meillo@219 165
meillo@219 166
meillo@219 167
meillo@219 168
meillo@219 169 \subsection{Non-functional requirements}
meillo@219 170
meillo@225 171 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}.
meillo@185 172 %fixme: refer to ch01 and ch02
meillo@239 173 These non-functional requirements are named ``\NAME{RG}'' for ``requirement, general''.
meillo@146 174
meillo@146 175
meillo@239 176 \paragraph{\RG1: Security}
meillo@316 177 \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@293 178
meillo@293 179 \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.
meillo@177 180
meillo@259 181
meillo@239 182 \paragraph{\RG2: Reliability}
meillo@316 183 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 transfer. Thus reliability is needed for mail transfer communication too.
meillo@177 184
meillo@316 185 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 acknowledgment, 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 186
meillo@316 187 Hence, mail transfer between two processes must 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@239 188
meillo@239 189
meillo@239 190 \paragraph{\RG3: Robustness}
meillo@219 191 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}.
meillo@177 192
meillo@177 193
meillo@239 194 \paragraph{\RG4: Extendability}
meillo@219 195 \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.
meillo@196 196
meillo@146 197
meillo@239 198 \paragraph{\RG5: Maintainability}
meillo@219 199 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.
meillo@146 200
meillo@189 201
meillo@239 202 \paragraph{\RG6: Testability}
meillo@225 203 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.
meillo@189 204
meillo@189 205
meillo@239 206 \paragraph{\RG7: Performance}
meillo@293 207 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 208
meillo@293 209 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 210
meillo@146 211
meillo@146 212
meillo@239 213 \paragraph{\RG8: Availability}
meillo@225 214 Availability is important for server programs. They must stay operational by blocking \name{denial of service} attacks and the like.
meillo@146 215
meillo@146 216
meillo@239 217 \paragraph{\RG9: Portability}
meillo@293 218 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, because these systems are the ones \MTA{}s run on usually. No special care needs to be taken for non-\unix\ platforms.
meillo@293 219
meillo@189 220
meillo@189 221
meillo@239 222 \paragraph{\RG10: Usability}
meillo@219 223 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.
meillo@185 224
meillo@298 225 %fixme: << masqmail as portable app? >>
meillo@185 226
meillo@185 227
meillo@185 228
meillo@293 229 \subsection{Architecture}
meillo@239 230 \label{sec:discussion-mta-arch}
meillo@187 231
meillo@318 232 %fixme: what's this section to do with requirements?
meillo@242 233
meillo@225 234 \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
meillo@219 235 \sendmail\ provides now, with its \name{milter} interface, standardized connection channels to external modules.
meillo@188 236 \masqmail\ has none of them; it is what \sendmail\ was in the beginning: a single large block.
meillo@161 237
meillo@239 238 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.
meillo@219 239 %fixme: what is included, what not?
meillo@161 240
meillo@161 241 \begin{figure}
meillo@161 242 \begin{center}
meillo@219 243 \vspace*{2ex}
meillo@256 244 %\includegraphics[scale=0.75]{img/callgraph.eps}
meillo@256 245 \includegraphics[scale=0.75]{img/masqmail-3-omitlog5.eps}
meillo@161 246 \end{center}
meillo@293 247 \caption{Internal structure of \masqmail, showed by a call graph. (Logging functions are excluded.)}
meillo@293 248 %fixme: what else is excluded
meillo@161 249 \label{fig:masqmail-arch}
meillo@161 250 \end{figure}
meillo@161 251
meillo@225 252 \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@161 253
meillo@239 254 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}.
meillo@161 255
meillo@219 256 \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@163 257 \begin{quote}
meillo@218 258 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 259 \hfill\cite[page 64]{hafiz05}
meillo@163 260 \end{quote}
meillo@219 261 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@200 262
meillo@200 263 Modularity is also needed to satisfy modern \MTA\ requirements, in providing a clear interface to add functionality without increasing the overall complexity much.
meillo@161 264
meillo@242 265 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 achieving the functional requirements easier.
meillo@239 266
meillo@242 267 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 268
meillo@277 269 %fixme: explain: why are compartments and interfaces so good?
meillo@239 270
meillo@239 271
meillo@239 272
meillo@288 273
meillo@288 274
meillo@288 275
meillo@288 276
meillo@288 277
meillo@288 278
meillo@239 279 \section{Fulfilled requirements}
meillo@239 280 \label{sec:fulfilled-requirements}
meillo@239 281
meillo@239 282 Here follows a description of how far the requirements are already fulfilled by \masqmail.
meillo@239 283
meillo@239 284
meillo@239 285 \paragraph{\RF1: In/out channels}
meillo@298 286 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. Support for other protocols seems not to be necessary at the moment, although new protocols and mailing concepts are likely to appear (see section \ref{sec:email-trends}). Today, other protocols are not needed, so \masqmail\ is regarded to fulfill \RF1. But as \masqmail\ has no support for adding further protocols, delaying the work to support them until they are widely used, appears to be the best strategy anyway.
meillo@239 287
meillo@288 288 << smtp submission >> %fixme
meillo@287 289
meillo@316 290 \paragraph{\RF2: Queuing}
meillo@239 291 One single mail queue is used in \masqmail; it satisfies all current requirements.
meillo@239 292
meillo@288 293 << persistence: DB >> %fixme
meillo@287 294
meillo@239 295 \paragraph{\RF3: Header sanitizing}
meillo@239 296 The envelope and mail headers are generated when the mail is put into the queue. The requirements are fulfilled.
meillo@239 297
meillo@239 298 \paragraph{\RF4: Aliasing}
meillo@298 299 Aliasing is done on delivery. All common kinds of aliases in the global aliases file are supported. So called \name{.forward} aliasing is not, but this is less common and seldom used.
meillo@239 300
meillo@287 301 \paragraph{\RF5: Route management}
meillo@239 302 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.
meillo@239 303
meillo@239 304 \paragraph{\RF6: Authentication}
meillo@239 305 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.
meillo@239 306
meillo@239 307 \paragraph{\RF7: Encryption}
meillo@298 308 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 on page \pageref{fig:stunnel} in figure \ref{fig:stunnel}. Anyway, this would still be no \NAME{STARTTLS} support.
meillo@239 309
meillo@239 310 \paragraph{\RF8: Spam handling}
meillo@316 311 \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 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 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.
meillo@239 312
meillo@239 313 \paragraph{\RF9: Malware handling}
meillo@316 314 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 in between. \masqmail\ does support such a setup, but not in a nice way.
meillo@239 315
meillo@239 316 \paragraph{\RF10: Archiving}
meillo@239 317 There is currently no way of archiving every message going through \masqmail.
meillo@239 318
meillo@239 319
meillo@239 320
meillo@239 321 \paragraph{\RG1: Security}
meillo@259 322 \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.
meillo@259 323 Its author states it ``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, is a security report missing that confirms \masqmail's security level.
meillo@259 324
meillo@316 325 \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@239 326
meillo@239 327 \paragraph{\RG2: Reliability}
meillo@239 328 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:
meillo@163 329 \begin{quote}
meillo@239 330 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 331 \hfill\citeweb{masqmail:homepage2}
meillo@163 332 \end{quote}
meillo@239 333 In summary: Current reliability needs to be improved.
meillo@239 334 %fixme: state machine
meillo@161 335
meillo@239 336 \paragraph{\RG3: Robustness}
meillo@239 337 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.
meillo@318 338 %fixme: rule of robustness, rule of repair
meillo@239 339
meillo@239 340 \paragraph{\RG4: Extendability}
meillo@239 341 \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.
meillo@239 342
meillo@239 343 \paragraph{\RG5: Maintainability}
meillo@288 344 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 maintainability. In summary is \masqmail's maintainability bearable, like in average Free Software projects.
meillo@239 345
meillo@288 346
meillo@287 347
meillo@239 348 \paragraph{\RG6: Testability}
meillo@287 349 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. %fixme: what are the names? what do they test?
meillo@239 350
meillo@293 351 This kind of testing is only clean-room testing, so .... %fixme
meillo@298 352 % XXX
meillo@293 353
meillo@239 354 \paragraph{\RG7: Performance}
meillo@239 355 The performance---efficiency---of \masqmail\ is good enough for its target field of operation, where this is a minor goal.
meillo@239 356
meillo@239 357 \paragraph{\RG8: Availability}
meillo@239 358 This applies equal to availability. Hence no further work needs to be done her.
meillo@239 359
meillo@239 360 \paragraph{\RG9: Portability}
meillo@239 361 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.
meillo@239 362
meillo@293 363
meillo@239 364 \paragraph{\RG10: Usability}
meillo@293 365 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}. But 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.
meillo@239 366
meillo@239 367
meillo@239 368
meillo@239 369
meillo@239 370
meillo@239 371 \section{Work to do}
meillo@239 372
meillo@288 373 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 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 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 374
meillo@239 375 \begin{table}
meillo@239 376 \begin{center}
meillo@271 377 \input{tbl/requirements.tbl}
meillo@239 378 \end{center}
meillo@239 379 \caption{Importance of and pending work for requirements}
meillo@242 380 \label{tab:requirements}
meillo@239 381 \end{table}
meillo@239 382
meillo@288 383 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 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 384
meillo@239 385 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.
meillo@239 386
meillo@288 387 These tasks are presented in more detail in an list of work tasks now. The list is sorted by focus and then by importance.
meillo@239 388
meillo@239 389
meillo@239 390 \subsubsection*{\TODO1: Encryption (\RF7)}
meillo@288 391 Encryption is chosen for number one as it is essential to provide privacy. Encryption by using \NAME{STARTTLS} is definitely needed and should be added first. Encrypted data transfer is hardly possible without support for it.
meillo@288 392
meillo@239 393
meillo@241 394 \subsubsection*{\TODO2: Authentication (\RF6)}
meillo@288 395 Authentication of incoming \SMTP\ connections is also needed and should be added second. It is important to restrict access and to prevent relaying. For workstations and local networks, it 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 396
meillo@239 397
meillo@239 398 \subsubsection*{\TODO3: Security (\RG1)}
meillo@288 399 \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. Save 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}.) Further more should \masqmail's security be tested throughout to get a definitive view how good it really is and where the weak spots are.
meillo@239 400
meillo@239 401
meillo@239 402 \subsubsection*{\TODO4: Reliability (\RG2)}
meillo@316 403 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. The critical situations for reliability are nothing special anymore, they are common. Hence they are regularly tested and will definitely work.
meillo@288 404
meillo@239 405
meillo@241 406 \subsubsection*{\TODO5: Spam handling (\RF8)}
meillo@316 407 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 using the approach 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 408
meillo@241 409
meillo@241 410 \subsubsection*{\TODO6: Extendability (\RG4)}
meillo@288 411 \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 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@254 412
meillo@239 413
meillo@239 414
meillo@239 415
meillo@239 416
meillo@239 417
meillo@239 418
meillo@239 419
meillo@239 420
meillo@239 421
meillo@239 422 \section{Ways for further development}
meillo@239 423
meillo@293 424 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 425
meillo@293 426
meillo@293 427 \subsection{Possibilities}
meillo@293 428
meillo@316 429 Further development of software can always go three different ways:
meillo@241 430 \begin{enumerate}
meillo@241 431 \item[S1:] Improve the current code base.
meillo@241 432 \item[S2:] Add wrappers or interposition filters.
meillo@241 433 \item[S3:] Redesign the software from scratch and rebuild it.
meillo@241 434 \end{enumerate}
meillo@239 435
meillo@293 436 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. Also parts of existing code can be used in a new design if appropriate.
meillo@239 437
meillo@241 438
meillo@316 439 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 (\TODO1) and authentication (\TODO2), 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 (\TODO4), extendability (\TODO6), and maintainability hardly be added to code afterwards---if at all. Security (\TODO3) is addable in a new design, of course, but also with wrappers or interposition filters.
meillo@293 440
meillo@293 441 This linking of strategies to the requirements is shown in table \ref{tab:strategies}. The requirements are ordered by their focus.
meillo@241 442
meillo@241 443 \begin{table}
meillo@241 444 \begin{center}
meillo@271 445 \input{tbl/strategies.tbl}
meillo@241 446 \end{center}
meillo@241 447 \caption{Development strategies and their suitability for requirements}
meillo@241 448 \label{tab:strategies}
meillo@241 449 \end{table}
meillo@241 450
meillo@239 451
meillo@316 452 Next, the best strategy for further development needs to be discovered. Therefore a score for each strategy is obtained now by summing up the focus points of each requirement for which a strategy is preferred. Therefore 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, but the view here is on outstanding work. %(Respecting negative focus points leads to a similar result.)
meillo@267 453
meillo@293 454 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. \St1 and \St2 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 455
meillo@293 456 This leads to the conclusion, that S3 (A new design) is probably the best strategy for further development. 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 \St3 against the combination \St1+2.
meillo@267 457
meillo@267 458
meillo@267 459
meillo@267 460
meillo@267 461
meillo@267 462
meillo@267 463
meillo@267 464
meillo@293 465 \subsection{Discussion}
meillo@323 466 \label{sec:discussion-further-devel}
meillo@267 467
meillo@267 468
meillo@296 469 \subsubsection*{Quality improvements}
meillo@239 470
meillo@316 471 Most quality properties can hardly be added to a software 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@288 472
meillo@288 473
meillo@241 474
meillo@293 475 \subsubsection*{Security}
meillo@261 476
meillo@293 477 Similar is the situation for security. Security comes from good design, explain \person{Graff} and \person{van Wyk}:
meillo@241 478 \begin{quote}
meillo@241 479 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 480 %
meillo@241 481 %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 482 \hfill\cite[page 55]{graff03}
meillo@241 483 \end{quote}
meillo@241 484
meillo@296 485 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@241 486
meillo@316 487 \person{Hafiz} adds: ``The major idea is that security cannot be retrofitted \emph{into} an architecture.'' \cite[page 64]{hafiz05} (emphasis added).
meillo@241 488
meillo@241 489
meillo@241 490
meillo@241 491
meillo@293 492 \subsubsection*{Effort estimation}
meillo@293 493
meillo@293 494 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 495
meillo@293 496 \person{Wheeler}'s program \name{sloccount} calculates following estimations for \masqmail's code base as of version 0.2.21 (excluding library code):
meillo@293 497
meillo@293 498 \codeinput{input/masqmail-sloccount.txt}
meillo@293 499
meillo@296 500 The development costs in money are not relevant for a \freesw\ 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 501
meillo@293 502 Given the assumptions that (1) an equal amount of code needs to be produced for a new designed \masqmail, (2) a third of 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 503
meillo@293 504
meillo@293 505
meillo@293 506
meillo@293 507 \subsubsection*{Risks}
meillo@293 508
meillo@316 509 The gained result might still outweighs the development effort. But risks are something more to consider.
meillo@293 510
meillo@293 511 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 512
meillo@296 513 Such a redesign can fail at many points and it is for long unclear if the result is really better than the code that is already existent. Even if the new code is working like expected, it is still not matured.
meillo@293 514
meillo@296 515 One thing is clear: Doing a redesign and rebuild \emph{is} a risky decision.
meillo@293 516
meillo@293 517
meillo@293 518
meillo@293 519 \subsubsection*{Existing code is precious}
meillo@293 520
meillo@296 521 If a new design needs much effort and additionally is a risk, what about the existing code base then?
meillo@293 522
meillo@296 523 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 524
meillo@296 525 And functionality that is hard to add incrementally into the application, like support for new protocols, may be addable by ``translation programs'' to the outside. \masqmail\ can be secured to a huge amount by guarding it with wrappers that block attackers. 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@293 526
meillo@296 527 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 528
meillo@293 529
meillo@296 530
meillo@293 531
meillo@293 532 \subsubsection*{Repairing}
meillo@293 533
meillo@296 534 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 for are problems. Such work often destroys the clear concepts of the software, especially in interweaved monolithic code.
meillo@293 535
meillo@296 536 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, currently. This means it is time to invest into a redesigning to build up a more modern product.
meillo@293 537
meillo@296 538 In the author's view is \masqmail\ already needing a redesign since about 2003 when the old design was still quite suitable \dots\ it already delayed too long.
meillo@293 539
meillo@296 540 %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 541
meillo@296 542 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 from 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@293 543
meillo@293 544
meillo@293 545
meillo@293 546
meillo@293 547
meillo@293 548 \subsubsection*{A guard against dead ends}
meillo@293 549
meillo@296 550 A new design does protect against such dead ends.
meillo@293 551
meillo@318 552 Changing requirements are one possible dead end if the software does not evolve with them. A famous example is \sendmail, which had an almost monopoly for a long time. But when security became important \sendmail\ was only repaired instead of removing the problem sources---its insecure design. 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. Redesigning a software as requirements change helps keeping it alive. % fixme: add quote: ``one thing surely remains: change'' (something like that)
meillo@293 553
meillo@296 554 Another danger is the dead end of complexity which is likely to appear by constantly working 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. %fixme: proof
meillo@316 555 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@293 556
meillo@293 557
meillo@293 558
meillo@293 559
meillo@293 560
meillo@293 561 \subsubsection*{Modularity}
meillo@293 562
meillo@316 563 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 it improves many quality requirements, eases further development, and essentially improves security.
meillo@293 564
meillo@296 565 One example how modular structure makes it easy to add further functionality: \person{Sill} describes that integrating the \name{amavis} filter framework into the \qmail\ system can be done by renaming the \name{qmail-queue} module to \name{qmail-queue-real} and renaming the \name{amavis} to \name{qmail-queue} \cite[section~12.7.1]{sill02}. Nothing more in the \qmail\ system needs to be changed. This is a very admirable approach, but only possible in a modular system that consists of independent executables.
meillo@293 566
meillo@296 567 This thesis showed several times that modularity is the key property for good software design. This property 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 without depending on current code.
meillo@293 568
meillo@293 569
meillo@293 570
meillo@293 571
meillo@293 572
meillo@293 573
meillo@296 574 \subsubsection*{Function versus quality}
meillo@293 575
meillo@296 576 Remarkable is the distribution of functional and non-functional requirements to the strategies. The strategies for current code (\St1+2) have a functional to non-functional ratio of 10 to 3. The new design strategy (\St3) has a ratio of 5 to 12.
meillo@293 577
meillo@296 578 This leaves 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, but the difference determines the focus of the strategy.
meillo@293 579
meillo@318 580 Easier work is likely to be done earlier in Free Software projects than hard work. Thus by choosing \St1+2 volunteer developers tend to implement function first and delay quality improvements, no matter what the suggested order is. \St3 in contrast would benefit early quality improvements and later function improvements. This is real-life experience in Free Software development.
meillo@293 581
meillo@293 582
meillo@293 583
meillo@293 584
meillo@293 585
meillo@293 586
meillo@297 587 \subsubsection*{Break Even}
meillo@293 588
meillo@296 589 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. The long-time view is the following time. % fixme: find sources!
meillo@293 590
meillo@316 591 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 \masqmail\ that is based on current code will probably require nearly as much effort as a new designed \masqmail\ will take. For all further development afterwards, the new design will scale well while the old code will require exponential more work.
meillo@296 592
meillo@296 593 In the long-time view, a restructuring for modularity is necessary anyway. The question is, when to do it: Right at the start in a new design, or later in some restructuring.
meillo@293 594
meillo@318 595 %fixme: define exactly, be clear: what does ``break even'' here mean
meillo@293 596
meillo@293 597
meillo@293 598
meillo@293 599 \subsubsection*{The problem with ``good enough''}
meillo@293 600
meillo@316 601 The decision for later restructuring is problematic. Functionality is often more wanted than quality, so further 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 602
meillo@314 603 Quality improving 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 profits from it.
meillo@254 604
meillo@296 605 Also if some design is bad one should never hesitate to erase it and rebuild it in a sane way.
meillo@254 606
meillo@296 607 However, making such a cut is hard, especially if the bad design is still ``good enough''.
meillo@254 608
meillo@254 609
meillo@254 610
meillo@254 611
meillo@254 612
meillo@297 613 \subsubsection*{Good software, good feelings}
meillo@254 614
meillo@296 615 One last argument shall be added. It is more common for Free Software but can be seen in non-free software too.
meillo@254 616
meillo@296 617 Free Software ``sells'' if it has a good user base. Although \qmail\ is somehow outdated and its author has released no new version since about 10 years, \qmail\ still has a very strong user base and community.
meillo@254 618
meillo@296 619 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 does constantly repairing and reappearing weaknesses leave a bad feeling.
meillo@254 620
meillo@316 621 The motivation most volunteer developers have is their wish of doing good work to create software of value. Projects that follow admire able plans towards a good product will motivate volunteers to help with it. 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@241 622
meillo@267 623
meillo@267 624
meillo@267 625
meillo@267 626
meillo@267 627
meillo@267 628
meillo@267 629
meillo@241 630 \section{Result}
meillo@241 631
meillo@316 632 This chapter identified the requirements and the outstanding work to achieve them. Their importance and the required work on them lead to a focus ranking among the requirements, which resulted in a list of tasks to do. Afterwards possible development strategies to control the work process were compared and discussed.
meillo@296 633
meillo@316 634 Strategy 3 (A new design) is slightly preferred over the combination of strategy 1 (Improve existing code) and 2 (Add wrappers and interposition filters) in regard of the requirements.
meillo@296 635
meillo@297 636 The discussion afterwards did generally support the new design strategy. But some arguments stand against it. These are:
meillo@239 637
meillo@293 638 \begin{enumerate}
meillo@297 639 \item The development time and effort
meillo@297 640 \item The time delay until new features can be added
meillo@297 641 \item The risks for failure
meillo@293 642 \end{enumerate}
meillo@239 643
meillo@297 644 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 645
meillo@316 646 The third argument, the risks, remain. There are risk in every investment. Taking no risks means remaining the same, means drifting towards a dead end in a world that does change.
meillo@239 647
meillo@239 648
meillo@316 649 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@196 650
meillo@219 651 \begin{enumerate}
meillo@297 652 \item The short-time plan: Add the most needed features, being encryption, authentication, and security wrappers, to the current code base.
meillo@297 653 \item The long-time plan: Design a new architecture that satisfies the modern requirements especially the quality requirements.
meillo@219 654 \end{enumerate}
meillo@196 655
meillo@318 656 The background thought 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 657
meillo@318 658 The basic idea is, regularly developing a new design from scratch while the current version is still in use and gets repaired. Hence a modern design will inherit an old one in regular intervals. This is a very future-proof concept that combines the best of both worlds. The price to pay is only the increased work which gets covered by volunteers that \emph{want} to do it.
meillo@196 659
meillo@219 660
meillo@297 661
meillo@297 662 %fixme: move that sentence to the beginning of the next chapter?
meillo@297 663 The following chapter describes approaches and techniques for the work on the current code base, and it introduces ideas and plans for a new, modern \MTA\ design the next generation of \masqmail.
meillo@297 664
meillo@297 665
meillo@297 666
meillo@297 667
meillo@297 668 %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 then is to change the architecture, which, sadly but most likely, means a redesign from scratch.
meillo@297 669
meillo@297 670 %This plan is similar to the change from \sendmail\ to \name{sendmail X}/\name{MeTA1}, except the \sendmail\ change was much too late.
meillo@297 671