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@267
|
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@267
|
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\ are?
|
meillo@256
|
11
|
meillo@267
|
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 the competitors. There seems to be no need for another general purpose \MTA\ amoung those four programs. Thus it 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@256
|
13
|
meillo@267
|
14 \masqmail\ was intended to be small and to cover the niche of managing 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 niche of managing relay over several smart hosts is not known. Dial-up connections have become rare but mobile computers moving 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@267
|
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@232
|
47 %todo: 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@232
|
96 One thing to avoid is being an \name{open relay}. Open relays allow to relay mail from everywhere to everywhere. This is a source of spam. The solution is restricting relay\footnote{Relaying is passing mail, that is not from and not for the own system, through it.} access. It may be also wanted to refuse all connections to the \MTA\ except ones from a specific set of hosts.
|
meillo@219
|
97
|
meillo@232
|
98 Several ways to restrict access are available. The most simple one is restriction by the \NAME{IP} address. No extra complexity is added this way, but the \NAME{IP} addresses have to be static or within known ranges. This approach is often used to allow relaying for local nets. The access check can be done by the \MTA\ or by a guard (e.g.\ \NAME{TCP} \name{Wrappers}) before. The main advantage here is the minimal setup and maintainence work needed. This kind of access restriction is important to be implemented.
|
meillo@219
|
99
|
meillo@232
|
100 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 subnet, need access. Then a authentication mechanism based on some \emph{secret} is required. Three common approaches exist:
|
meillo@285
|
101 \begin{enumerate}
|
meillo@232
|
102 \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
|
103 \item \SMTP\ authentication: An extension to \SMTP. It allows to request authentication before mail is accepted. Here no helper protocols are needed.
|
meillo@232
|
104 \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: \NAME{SSL} tunnels encrypt the data transmission and allow to identify the remote user/host by his certificate.
|
meillo@285
|
105 \end{enumerate}
|
meillo@232
|
106 At least one of the secret-based mechanisms should be supported.
|
meillo@219
|
107
|
meillo@219
|
108
|
meillo@219
|
109
|
meillo@239
|
110 \paragraph{\RF7: Encryption}
|
meillo@232
|
111 Electronic mail is vulnerable to sniffing attacks, because in generic \SMTP\ all data transfer is unencrypted. Unencrypted is the message's content, the email addresses in header and envelope, but also authentication dialogs that transfer plain text passwords (e.g.\ \NAME{PLAIN} and \NAME{LOGIN}). Hence encryption is important.
|
meillo@219
|
112
|
meillo@219
|
113 The common way to encrypt \SMTP\ dialogs is using \name{Transport Layer Security} (short: \TLS, successor of \NAME{SSL}). \TLS\ encrypts the datagrams of the \name{transport layer}. This means it works below the application protocols and can be used by any of them \citeweb{wikipedia:tls}.
|
meillo@219
|
114
|
meillo@239
|
115 Using secure tunnels, that are provided by external applications, is prefered because the \MTA\ needs not to bother with encryption then. Outgoing \SMTP\ connections can get encrypted using a secure tunnel, created by an external application (like \name{openssl}). But incoming connections can not use external secure tunnels, because the remote \NAME{IP} address is hidden then; all connections appear to come from localhost instead. Figure \ref{fig:stunnel} depicts the situation of using an application like \name{stunnel} for incoming connections. The connection to port 25 comes from localhost, and that is the information the \MTA\ gets. Authentication based on \NAME{IP} addresses and many spam prevention methods are useless then.
|
meillo@219
|
116
|
meillo@232
|
117 \begin{figure}
|
meillo@232
|
118 \begin{center}
|
meillo@232
|
119 \includegraphics[scale=0.75]{img/stunnel.eps}
|
meillo@232
|
120 \end{center}
|
meillo@232
|
121 \caption{Using \name{stunnel} for incoming connections}
|
meillo@232
|
122 \label{fig:stunnel}
|
meillo@232
|
123 \end{figure}
|
meillo@219
|
124
|
meillo@239
|
125 To provide encrypted incoming channels, the \MTA\ could implement encryption and listen on a port that is dedicated to encrypted \SMTP\ (\NAME{SMTPS}). This approach would be possible, but it is deprecated in favor for \NAME{STARTTLS}. \RFC3207 ``\SMTP\ Service Extension for Secure \SMTP\ over Transport Layer Security'' shows this in not mentioning \NAME{SMTPS} on port 465. Also port 465 is not even reserved for \NAME{SMTPS} anymore \citeweb{iana:port-numbers}.
|
meillo@219
|
126
|
meillo@239
|
127 \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.
|
meillo@232
|
128
|
meillo@239
|
129 \NAME{STARTTLS} encryption should be supported.
|
meillo@232
|
130
|
meillo@232
|
131
|
meillo@232
|
132
|
meillo@239
|
133 \paragraph{\RF8: Spam prevention}
|
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@239
|
136 As spam is not just a nuisance for end users, but also for the infrastructure---the \mta{}s---by increasing the amount of mail messages, \MTA{}s need to protect themselves.
|
meillo@219
|
137
|
meillo@239
|
138 Filtering spam can be done in two ways: Refusing spam during the \SMTP\ dialog or checking for spam after the mail was accepted and queued. Both ways have advantages and disadvantages, so modern \MTA{}s use them in combination. Spam is identified by the results of a set of checks. Static rules, querying databases (\NAME{DNS} blacklists \cite{cole07} \cite{levine08}), requesting special client behavior (\name{greylisting} \cite{harris03}, \name{hashcash} \cite{back02}), or statistical analysis (\name{bayesian filters} \cite{graham02}) are checks that may be used. Running more checks leads to better results, but takes more system resources and more time.
|
meillo@219
|
139
|
meillo@239
|
140 Doing some basic checks during the \SMTP\ dialog seems to be a must \cite[page~25]{eisentraut05}. They should best be included into the \MTA, because they need to be fast to avoid \SMTP\ dialog timeouts. Internal interfaces to specialized modules seem to be best.
|
meillo@219
|
141
|
meillo@239
|
142 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
|
143
|
meillo@219
|
144
|
meillo@219
|
145
|
meillo@239
|
146
|
meillo@239
|
147
|
meillo@287
|
148 \paragraph{\RF9: Malware handling}
|
meillo@225
|
149 Related to spam is malicious content (short: \name{malware}) like viruses, worms, trojan horses. They, in contrast to spam, do not affect the \MTA\ itself, as they are in the mail's body. \MTA{}s searching for malware is equal to real world's post offices opening letters to check if they contain something that could harm the recipient. This is not a mail transport job. But the \MTA\ responsible for the recipient seems to be at a good position to do this work, so it is often done there.
|
meillo@219
|
150
|
meillo@219
|
151 In any way should malware checking be performed by external programs that may be invoked by the \mta. But using mail deliver agents, like \name{procmail}, are better suited locations to invoke content scanners.
|
meillo@219
|
152
|
meillo@287
|
153 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.
|
meillo@219
|
154
|
meillo@219
|
155
|
meillo@219
|
156
|
meillo@239
|
157 \paragraph{\RF10: Archiving}
|
meillo@219
|
158 Mail archiving and auditability become more important as email establishes as technology for serious business communication. The ability to archive verbatim copies of every mail coming into and every mail going out of the system, with relation between them, appears to be a goal to achieve.
|
meillo@219
|
159
|
meillo@225
|
160 \postfix\ for example has a \texttt{always\_bcc} feature, to send a copy of every outgoing mail to a definable recipient. At least this functionality should be given, although a more complete approach is preferable.
|
meillo@219
|
161
|
meillo@281
|
162 \qmail\ is able to save copies of all sent and received messages and additionally complete \SMTP\ dialogs \cite[page~12]{sill02}.
|
meillo@281
|
163
|
meillo@277
|
164 << refer to SOX >> %fixme
|
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@239
|
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{compartementalization}, as described in section \ref{sec:discussion-mta-arch}. \masqmail\ needs to be secure enough for its target field of operation. \masqmail\ is targeted to workstations and private networks, with explicit warning to not use it on permanent online hosts \citeweb{masqmail:homepage2}. But as non-permanent online connections and trustable environments become rare, \masqmail's security should be so good, that it is usable with permanent online connections and in unsafe environments. For example should mails with bad content not break \masqmail.
|
meillo@177
|
178
|
meillo@287
|
179 << conditional compilation >>
|
meillo@177
|
180
|
meillo@259
|
181
|
meillo@239
|
182 \paragraph{\RG2: Reliability}
|
meillo@239
|
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 tranfer. Thus reliability is needed for mail transfer communication too.
|
meillo@177
|
184
|
meillo@239
|
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 acknowledgement, then handles the transfer. (2) The client reissues the transfer only if no acknowledgement was received; the server first handles the transfer and sends the acknowledgement afterwards. The first strategy does not need acknowledgements at all, however, it will lose mail if the second transfer fails too.
|
meillo@189
|
186
|
meillo@239
|
187 Hence, mail transfer between two processes must use the strategy: The client reissues if it receives no acknowledgement; the server first handles the message and then sends the acknowledgement. This strategy only leads to duplicates if a crash happens in the time between the message is fully transfered to the server and the acknowlegement is received by the client. No mail will get lost.
|
meillo@239
|
188
|
meillo@287
|
189 << DB as queue >>
|
meillo@287
|
190
|
meillo@287
|
191 << exactly one copy of a message at one time >>
|
meillo@239
|
192
|
meillo@239
|
193 \paragraph{\RG3: Robustness}
|
meillo@219
|
194 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
|
195
|
meillo@177
|
196
|
meillo@239
|
197 \paragraph{\RG4: Extendability}
|
meillo@219
|
198 \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
|
199
|
meillo@146
|
200
|
meillo@239
|
201 \paragraph{\RG5: Maintainability}
|
meillo@219
|
202 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
|
203
|
meillo@287
|
204 << conditional compilation >>
|
meillo@287
|
205
|
meillo@189
|
206
|
meillo@239
|
207 \paragraph{\RG6: Testability}
|
meillo@225
|
208 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
|
209
|
meillo@189
|
210
|
meillo@239
|
211 \paragraph{\RG7: Performance}
|
meillo@196
|
212 Also called ``efficiency''. Efficient software requires few time and few resources. The merge of communication hardware and its move from service providers to homes and to mobile devices, demand smaller and more resource-friendly software. The amount of mail will be lower, even if much more mail will be sent. More important will be the energy consumption and heat emission. These topics increased in relevance during the past years and they are expected to become more central.
|
meillo@146
|
213
|
meillo@146
|
214
|
meillo@239
|
215 \paragraph{\RG8: Availability}
|
meillo@225
|
216 Availability is important for server programs. They must stay operational by blocking \name{denial of service} attacks and the like.
|
meillo@146
|
217
|
meillo@146
|
218
|
meillo@239
|
219 \paragraph{\RG9: Portability}
|
meillo@225
|
220 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.
|
meillo@189
|
221
|
meillo@189
|
222
|
meillo@239
|
223 \paragraph{\RG10: Usability}
|
meillo@219
|
224 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
|
225
|
meillo@185
|
226
|
meillo@185
|
227
|
meillo@185
|
228
|
meillo@242
|
229 \subsection{Thoughts about architecture}
|
meillo@239
|
230 \label{sec:discussion-mta-arch}
|
meillo@187
|
231
|
meillo@242
|
232 %todo: 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@287
|
247 \caption{Internal structure of \masqmail, showed by a call graph}
|
meillo@161
|
248 \label{fig:masqmail-arch}
|
meillo@161
|
249 \end{figure}
|
meillo@161
|
250
|
meillo@225
|
251 \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
|
252
|
meillo@239
|
253 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
|
254
|
meillo@219
|
255 \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
|
256 \begin{quote}
|
meillo@218
|
257 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
|
258 \hfill\cite[page 64]{hafiz05}
|
meillo@163
|
259 \end{quote}
|
meillo@219
|
260 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
|
261
|
meillo@200
|
262 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
|
263
|
meillo@242
|
264 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
|
265
|
meillo@242
|
266 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
|
267
|
meillo@277
|
268 %fixme: explain: why are compartments and interfaces so good?
|
meillo@239
|
269
|
meillo@239
|
270
|
meillo@239
|
271
|
meillo@239
|
272 \section{Fulfilled requirements}
|
meillo@239
|
273 \label{sec:fulfilled-requirements}
|
meillo@239
|
274
|
meillo@239
|
275 Here follows a description of how far the requirements are already fulfilled by \masqmail.
|
meillo@239
|
276
|
meillo@239
|
277
|
meillo@239
|
278 \paragraph{\RF1: In/out channels}
|
meillo@239
|
279 \masqmail's incoming and outgoing channels are the ones required for an \MTA{}s at the moment. They are depicted in figure \ref{fig:masqmail-in-out} on page \pageref{fig:masqmail-in-out}. This is all what is currently needed. But new protocols and mailing concepts are likely to appear (see section \ref{sec:electronic-mail}). \masqmail\ has no support for adding further protocols. Thus modifications at many places in the source are needed to add them though. Today, support for further protocols is not needed, so \masqmail\ is regarded to fulfill \RF1, but the probable future need should be kept in mind.
|
meillo@239
|
280
|
meillo@287
|
281 << smtp submission >>
|
meillo@287
|
282
|
meillo@239
|
283 \paragraph{\RF2: Queueing}
|
meillo@239
|
284 One single mail queue is used in \masqmail; it satisfies all current requirements.
|
meillo@239
|
285
|
meillo@287
|
286 << persistence: DB >>
|
meillo@287
|
287
|
meillo@239
|
288 \paragraph{\RF3: Header sanitizing}
|
meillo@239
|
289 The envelope and mail headers are generated when the mail is put into the queue. The requirements are fulfilled.
|
meillo@239
|
290
|
meillo@239
|
291 \paragraph{\RF4: Aliasing}
|
meillo@239
|
292 Aliasing is done on delivery. All common kinds of aliases in the global aliases file are supported. \name{.forward} aliasing is not, but this is less common and seldom used.
|
meillo@239
|
293
|
meillo@287
|
294 \paragraph{\RF5: Route management}
|
meillo@239
|
295 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
|
296
|
meillo@239
|
297 \paragraph{\RF6: Authentication}
|
meillo@239
|
298 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
|
299
|
meillo@239
|
300 \paragraph{\RF7: Encryption}
|
meillo@239
|
301 Similar is the situation for encryption which is also only available for outgoing channels; here a wrapper application like \name{openssl} is needed. This creates a secure tunnel to send mail trough, but state-of-the-art is using \NAME{STARTTLS}, which is not supported. For incoming channels, no encryption is available. The only possible setup to provide encryption of incoming channels is using an application like \name{stunnel} to translate between the secure connection to the remote host and the \MTA. Unfortunately, this suffers from the problem explained in section \ref{sec:FIXME} and figure \ref{fig:stunnel}. Anyway, this would still be no \NAME{STARTTLS} support.
|
meillo@239
|
302
|
meillo@239
|
303 \paragraph{\RF8: Spam handling}
|
meillo@239
|
304 \masqmail\ nowadays does not provide special support for spam filtering. Spam prevention by not accepting spam during the \SMTP\ dialog is not possible at all. Spam filtering is only possible by using two \masqmail\ instances with an external spam filter inbetween. The mail flow is from the receiving \MTA\ instance, which accepts mail, to the filter application that processes and possible modifies it, to the second \MTA\ which is responsible for further delivery of the mail. This is a concept that works in general. And it is a good concept in principle to separate work with clear interfaces. But the need of two instances of the same \MTA (each for only half of the job) with doubled setup, is more a work-around. Best is to have this data flow respected in the \MTA\ design, like in \postfix. But the more important part of spam handling, for sure, is done during the \SMTP\ dialog in completely refusing unwanted mail.
|
meillo@239
|
305
|
meillo@239
|
306 \paragraph{\RF9: Malware handling}
|
meillo@239
|
307 For malware handling applies nearly the same, except all checks are done after mail is accepted. So the possible setup is the same with the two \MTA\ instances and the filter inbetween. \masqmail\ does support such a setup, but not in a nice way.
|
meillo@239
|
308
|
meillo@239
|
309 \paragraph{\RF10: Archiving}
|
meillo@239
|
310 There is currently no way of archiving every message going through \masqmail.
|
meillo@239
|
311
|
meillo@239
|
312
|
meillo@239
|
313 %Non-functional requirements are not so easy to be marked as fulfilled or not. Instead they are discussed here.
|
meillo@239
|
314
|
meillo@239
|
315 \paragraph{\RG1: Security}
|
meillo@259
|
316 \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
|
317 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
|
318
|
meillo@287
|
319 << conditional compilation >>
|
meillo@239
|
320
|
meillo@239
|
321 \paragraph{\RG2: Reliability}
|
meillo@239
|
322 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
|
323 \begin{quote}
|
meillo@239
|
324 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
|
325 \hfill\citeweb{masqmail:homepage2}
|
meillo@163
|
326 \end{quote}
|
meillo@239
|
327 In summary: Current reliability needs to be improved.
|
meillo@239
|
328 %fixme: state machine
|
meillo@161
|
329
|
meillo@287
|
330 << persistence: db >>
|
meillo@287
|
331
|
meillo@239
|
332 \paragraph{\RG3: Robustness}
|
meillo@239
|
333 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@239
|
334
|
meillo@239
|
335 \paragraph{\RG4: Extendability}
|
meillo@239
|
336 \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
|
337
|
meillo@239
|
338 \paragraph{\RG5: Maintainability}
|
meillo@239
|
339 The maintainability of \masqmail\ is equivalent to other software of similar kind. Missing modularity and therefore more complexity makes the maintainer's work harder. In summary is \masqmail's maintainability bearable, like in average Free Software projects.
|
meillo@239
|
340
|
meillo@287
|
341 << conditional compilation >>
|
meillo@287
|
342
|
meillo@239
|
343 \paragraph{\RG6: Testability}
|
meillo@287
|
344 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
|
345
|
meillo@239
|
346 \paragraph{\RG7: Performance}
|
meillo@239
|
347 The performance---efficiency---of \masqmail\ is good enough for its target field of operation, where this is a minor goal.
|
meillo@239
|
348
|
meillo@239
|
349 \paragraph{\RG8: Availability}
|
meillo@239
|
350 This applies equal to availability. Hence no further work needs to be done her.
|
meillo@239
|
351
|
meillo@239
|
352 \paragraph{\RG9: Portability}
|
meillo@239
|
353 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
|
354
|
meillo@239
|
355 \paragraph{\RG10: Usability}
|
meillo@239
|
356 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}.
|
meillo@239
|
357
|
meillo@239
|
358
|
meillo@239
|
359
|
meillo@242
|
360 \paragraph{Modularity}
|
meillo@242
|
361 Modularity---the important architectural goal---is currently not existent in \masqmail's code. The whole source is interweaved.
|
meillo@242
|
362
|
meillo@242
|
363
|
meillo@242
|
364
|
meillo@239
|
365
|
meillo@239
|
366
|
meillo@239
|
367
|
meillo@239
|
368 \section{Work to do}
|
meillo@239
|
369
|
meillo@239
|
370 After the requirements for modern \mta{}s were identified in section \ref{sec:mta-requirements} and \masqmail's features were set against them in section \ref{sec:fulfilled-requirements}, here the the work that is left to do is identified. Table \ref{tab:requirements} lists all requirements with importance and the work needed to achieve them. The attention a work task should receive---the focus---depends on its importance and the amount of work it includes.
|
meillo@239
|
371
|
meillo@239
|
372 \begin{table}
|
meillo@239
|
373 \begin{center}
|
meillo@271
|
374 \input{tbl/requirements.tbl}
|
meillo@239
|
375 \end{center}
|
meillo@239
|
376 \caption{Importance of and pending work for requirements}
|
meillo@242
|
377 \label{tab:requirements}
|
meillo@239
|
378 \end{table}
|
meillo@239
|
379
|
meillo@239
|
380 The importance is ranked from `-{}-' (not important) to `++' (very important). The pending work is ranked from `-{}-' (nothing) to `++' (very much). Large work tasks with high importance need to receive much attention, they are in focus. In contrast should small low importance work receive few attention. Here the attention/focus a task should get is calculated by summing up the importance and the pending work with equal weight. Normally, tasks with high focus are the ones of high priority and should be done first.
|
meillo@239
|
381
|
meillo@239
|
382 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
|
383
|
meillo@241
|
384 These tasks are presented in more detail now. They are sorted in the suggested order to work on them..
|
meillo@239
|
385
|
meillo@239
|
386
|
meillo@239
|
387 \subsubsection*{\TODO1: Encryption (\RF7)}
|
meillo@241
|
388 Encryption is chosen first, as it is essential to providing privacy. Encryption by using \NAME{STARTTLS} is definitely needed and should be added soon. Without support for it, encrypted email transfer is hardly possible.
|
meillo@239
|
389
|
meillo@241
|
390 \subsubsection*{\TODO2: Authentication (\RF6)}
|
meillo@241
|
391 Authentication of incoming \SMTP\ connections also needed and should be added soon. It is important for restricting access 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.
|
meillo@239
|
392
|
meillo@239
|
393 \subsubsection*{\TODO3: Security (\RG1)}
|
meillo@241
|
394 \masqmail's security is bad, thus the program is forced into a limited field of operation. The field of operation even shrinks, as security becomes more important and networking and interaction increases. Save and trusted environment become rare.
|
meillo@239
|
395
|
meillo@241
|
396 Compartementalization, ref secure coding, postfix ...
|
meillo@241
|
397
|
meillo@241
|
398 Improving security is an important thing to do. Especially, \masqmail's security should be tested throughout to get a definitive view how good it really is and where the weak spots are.
|
meillo@239
|
399
|
meillo@239
|
400 \subsubsection*{\TODO4: Reliability (\RG2)}
|
meillo@241
|
401 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 startup inevitably demands for good recovery. The critical situations for reliability are nothing special anymore, they are common. Hence they are regulary tested and will definately work.
|
meillo@242
|
402 % persistence, database
|
meillo@239
|
403
|
meillo@241
|
404 \subsubsection*{\TODO5: Spam handling (\RF8)}
|
meillo@241
|
405 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.
|
meillo@239
|
406
|
meillo@241
|
407
|
meillo@241
|
408 \subsubsection*{\TODO6: Extendability (\RG4)}
|
meillo@241
|
409 Extendability does suffer from the monolithic architecture and is nearly impossible to improve without changing the programs structure. This property can hardly be retrofitted into software. Extendability is expected become important in the future as new protocols need to be supported.
|
meillo@241
|
410
|
meillo@254
|
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 defining symbols at compile time. Adding maildir support, means giving the option \verb+--enable-maildir+ to the \path{configure} call. This preserves the concerning code to get removed by the preprocessor. Unfortunately the \verb+#ifdef+s are scattered through all the source, leading to a code that is hard to read.
|
meillo@254
|
412 %fixme: refer to ifdef-considered-harmful ?
|
meillo@254
|
413
|
meillo@239
|
414
|
meillo@239
|
415
|
meillo@239
|
416
|
meillo@239
|
417 \subsubsection*{Further \NAME{TODO}s}
|
meillo@239
|
418
|
meillo@239
|
419 Support for other protocols than \SMTP\ seems not to be necessary at the moment. Adding such support will need lots of work in many parts of \masqmail. Hence delaying this work until the support becomes mandatory, appears to be the best strategy. This way work can be saved if some protocols never become popular.
|
meillo@239
|
420
|
meillo@239
|
421 Archiving again is preferred to be implemented soon. It does not require much work, but enables all kinds of statistical analysis.
|
meillo@239
|
422
|
meillo@239
|
423 Performance is a property that is nice to have. But as performance improvements are in contrast to many other quality properties (reliability, maintainability, usability, capability \cite[page~5]{kan03}), jeopardizing these to gain some more performance should not be done. \person{Kernighan} and \person{Pike} state clear: ``[T]he first principle of optimization is \emph{don't}.''\cite[page~165]{kernighan99}. \masqmail\ is not a program to be used on large servers, but on small devices. Thus important for \masqmail\ could be energy and heat saving, maybe also system resources, but not performance. Anyway, simplicity and clearness are of higher value.
|
meillo@239
|
424
|
meillo@239
|
425 Portability among the various flavors of \unix\ systems is a goal, because these systems are the ones \MTA{}s run on usually. Portability problems with non-\unix\ platforms are primary expected to come from file systems lacking required features. But no special care should be taken here.
|
meillo@242
|
426 % unix fs on windows
|
meillo@239
|
427
|
meillo@239
|
428 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@242
|
429 % masqmail as portable app?
|
meillo@239
|
430
|
meillo@239
|
431
|
meillo@239
|
432
|
meillo@239
|
433
|
meillo@239
|
434
|
meillo@239
|
435
|
meillo@239
|
436 \section{Ways for further development}
|
meillo@239
|
437
|
meillo@241
|
438 Futher development of software can always go three different ways:
|
meillo@241
|
439 \begin{enumerate}
|
meillo@241
|
440 \item[S1:] Improve the current code base.
|
meillo@241
|
441 \item[S2:] Add wrappers or interposition filters.
|
meillo@241
|
442 \item[S3:] Redesign the software from scratch and rebuild it.
|
meillo@241
|
443 \end{enumerate}
|
meillo@239
|
444
|
meillo@267
|
445 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 then be outright included into the new architecture. Parts of existing old code could be used if appropriate.
|
meillo@239
|
446
|
meillo@241
|
447
|
meillo@241
|
448 The requirements are now regarded, each on its own. Each one is linked to the development strategy that is prefered to reach the specific requirement. Some requirements may be well achievable by using different strategies, so they are linked to all of them. The order of the requirements in the list depend on their level of focus. This linking of strategies to the requirements is shown in table \ref{tab:strategies}.
|
meillo@241
|
449
|
meillo@241
|
450 \begin{table}
|
meillo@241
|
451 \begin{center}
|
meillo@271
|
452 \input{tbl/strategies.tbl}
|
meillo@241
|
453 \end{center}
|
meillo@241
|
454 \caption{Development strategies and their suitability for requirements}
|
meillo@241
|
455 \label{tab:strategies}
|
meillo@241
|
456 \end{table}
|
meillo@241
|
457
|
meillo@239
|
458
|
meillo@267
|
459 Next, the best strategy for further development needs to be discovered.
|
meillo@267
|
460
|
meillo@267
|
461 Implementing \TODO1 encryption and \TODO2 authentication, 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 does adding support for mail processing interfaces to external programs (\TODO5) or support for new protocols require a lot of effort. Changes in many parts of the source code are required. If such large features are needed, it is best to redesign the program's structure and rebuild it.
|
meillo@267
|
462
|
meillo@267
|
463 It is a bad idea to implement large retro-fitted features into software that is critical about security and reliability, like \MTA{}s. Worse if these features need changes in the program's structure, like adding mail scanning interfaces (\TODO5) would do. Quality properties, like security (\TODO3) and reliability (\TODO3), as well as extendability (\TODO6) and maintainability, can hardly be added afterwards---if at all.
|
meillo@267
|
464
|
meillo@267
|
465
|
meillo@267
|
466 A score for each strategy is obtained by summing up the focus points of each requirement for which a strategy is prefered. Herefore only positive focus points are regarded, with each plus symbol counting one. (Respecting negative focus points also leads to a similar result.)
|
meillo@267
|
467
|
meillo@267
|
468 Strategy 1 (Improve current code), gets a score of 9 points. Strategy 2 (Wrappers and interposition filters) has a score of 7 points. And strategy 3 (A new design) scores on top with 17 points. As \St1 and \St2 may be used in combination, a combined score is important to calculate. The combination has in total 13 points, but it is still beaten by \St3.
|
meillo@267
|
469
|
meillo@267
|
470 This leads to the conclusion, that S3 (A new design) is probably the best strategy for further development. But this conclusion respects only the view on requirements and their relevance. Other factors like development effort and risks are important to respect too. These issues are discussed in the following sections.
|
meillo@267
|
471
|
meillo@267
|
472
|
meillo@267
|
473
|
meillo@267
|
474
|
meillo@267
|
475
|
meillo@267
|
476 \subsubsection*{S3: A new design from scratch}
|
meillo@267
|
477
|
meillo@267
|
478 A program's structure is primary its architecture. Which is the most influencing design decision, and has the greatest impact on the program's future capabilities. The architecture defines what the program can do, and how it can be used. If the architecture does not fit to the requirements, development will reach a dead end \dots\ further work then will make everything worse. The only good solution is to change the architecture, which, sadly but most likely, means a redesign from scratch.
|
meillo@239
|
479
|
meillo@241
|
480 Quality properties, like security (\TODO3) and reliability (\TODO3), as well as extendability (\TODO6) and maintainability, can hardly be added afterwards---if at all. Only structural changes will improve them. Hence, if security, reliability, extendability (to add support for future mail transfer protocols), or maintainability shall be improved, a redesign of \masqmail\ is the only sane way to go.
|
meillo@241
|
481
|
meillo@241
|
482 However, a redesign and rewrite of software from scratch is hard. It takes time to design a new architecture, which then must prove it is secure and reliable. 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. Thus the gain of a new design must overweight the effort needed.
|
meillo@241
|
483
|
meillo@241
|
484 \person{Wheeler}'s program \name{sloccount} calculates following estimations for \masqmail's code base as of version 0.2.21 (excluding library code):
|
meillo@261
|
485
|
meillo@277
|
486 \codeinput{input/masqmail-sloccount.txt}
|
meillo@261
|
487
|
meillo@248
|
488 The development cost is 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 employee with eight work-hours per day.
|
meillo@241
|
489
|
meillo@241
|
490 Given the assumptions that (1) an equal amount of code needs to be produced for a new \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 to have 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.
|
meillo@241
|
491
|
meillo@241
|
492
|
meillo@241
|
493
|
meillo@254
|
494 ---
|
meillo@254
|
495
|
meillo@254
|
496 on venema: ``there'll be no second postfix'':
|
meillo@254
|
497
|
meillo@254
|
498 Yes there will be one, when postfix becomes obsolete, and this day will come as requirements change. See sendmail for example: it had nearly the whole market ... and now it's dying. sendmail once also thought it would be the number 1, forever.
|
meillo@254
|
499
|
meillo@254
|
500 cf. Tanenbaum vs. Linux: It was too early. Linux' time has not ended, but it will some day.
|
meillo@254
|
501
|
meillo@254
|
502 anyway, masqmail is not intended to become a second postfix. It's more inteded to become a second qmail, but with a differend target field.
|
meillo@254
|
503
|
meillo@241
|
504
|
meillo@241
|
505 ---
|
meillo@241
|
506
|
meillo@241
|
507
|
meillo@241
|
508 Remarkable is the distribution of the score points between functional and non-functional requirements. S1 (Improve current code) gets most points from functional requirements. Thus it is the best strategy to improve them. S3 (New design), in contrast, scores high for non-functional requirements. Thus it is best chosen to improve the software's quality. S2 (Wrappers and interposition filters) is balanced.
|
meillo@241
|
509
|
meillo@241
|
510
|
meillo@241
|
511
|
meillo@241
|
512 %\subsubsection*{The need for structural changes}
|
meillo@239
|
513
|
meillo@239
|
514 %\person{Hafiz} adds: ``The major idea is that security cannot be retrofitted into an architecture.''\cite[page 64]{hafiz05}
|
meillo@239
|
515
|
meillo@241
|
516 ---
|
meillo@239
|
517
|
meillo@239
|
518
|
meillo@241
|
519
|
meillo@241
|
520
|
meillo@241
|
521
|
meillo@241
|
522
|
meillo@241
|
523
|
meillo@267
|
524 \textbf{A redesign from scratch}
|
meillo@241
|
525
|
meillo@241
|
526 Security comes from good design, as \person{Graff} and \person{van Wyk} explain:
|
meillo@241
|
527 \begin{quote}
|
meillo@241
|
528 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
|
529 %
|
meillo@241
|
530 %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
|
531 \hfill\cite[page 55]{graff03}
|
meillo@241
|
532 \end{quote}
|
meillo@241
|
533
|
meillo@241
|
534 All this leads to the wish of a rewrite of \masqmail, using a modern, modular architecture, \emph{if} further features need to be added---features that require changes in \masqmail's structure. But a rewrite is also mandatory, if \masqmail\ should become a modern \MTA, with good quality properties.
|
meillo@241
|
535
|
meillo@241
|
536
|
meillo@267
|
537 \textbf{Further reasons for a new design}
|
meillo@241
|
538
|
meillo@254
|
539 impressing simplicity of qmail: only about 1000 SLOC per file (= about one module). It's obvious what it does. cf. suckless.org
|
meillo@241
|
540
|
meillo@241
|
541
|
meillo@254
|
542 do not try to safe obsolete stuff. This will not work (see sendmail).
|
meillo@241
|
543
|
meillo@254
|
544 It is often done in commercial software, when it's about making money. Free software with volunteer programmers in contrast care about good software..
|
meillo@254
|
545
|
meillo@254
|
546 If the design is bad, one should never hesitate to abandonne obsolete stuff and build it from scratch. (cf. makefiles and tab).
|
meillo@254
|
547
|
meillo@254
|
548 But making a cut is hard, as it is still ``good enough''.
|
meillo@254
|
549
|
meillo@254
|
550
|
meillo@254
|
551 ---
|
meillo@254
|
552
|
meillo@254
|
553 repair strategies is only useful in the short time view and for hard times. but if the future is bright, one must invest. here it means redesigning to build up a more modern product. cf. ch02: the future is bright!
|
meillo@254
|
554
|
meillo@254
|
555 Masqmail should have been redesigned in 2002 or so, when the old design was still quite suitable ... it already delayed too long.
|
meillo@254
|
556
|
meillo@254
|
557 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@254
|
558
|
meillo@254
|
559 ---
|
meillo@254
|
560
|
meillo@254
|
561 repairing leaves a worse feeling. Free Software ``sells'' if it has a good userbase. Although qmail is somehow outdated and its author has released no new version since about 10 years, qmail has a very strong userbase and community.
|
meillo@254
|
562
|
meillo@254
|
563 Good design, concepts and philosophy gives users good feelings and faith for the software. They become interested in using it and to contribute.
|
meillo@254
|
564
|
meillo@254
|
565
|
meillo@254
|
566
|
meillo@254
|
567 The goal is good software. The wish to do good work is the motivation volunteers have. Work plans that lead to a good product will motivate volunteers to help with it. Hence more helpers may make the 2,5 man years for the new design, even become less absolute time than, few helping people that try to improve the existing code.
|
meillo@241
|
568
|
meillo@241
|
569
|
meillo@241
|
570
|
meillo@267
|
571 \subsubsection*{S\,1 and S\,2: Improve old code and add wrappers}
|
meillo@267
|
572
|
meillo@267
|
573
|
meillo@267
|
574 FIXME
|
meillo@267
|
575
|
meillo@267
|
576
|
meillo@267
|
577
|
meillo@267
|
578
|
meillo@267
|
579
|
meillo@267
|
580
|
meillo@267
|
581
|
meillo@267
|
582
|
meillo@267
|
583
|
meillo@241
|
584 \section{Result}
|
meillo@241
|
585
|
meillo@239
|
586 The most needed features---authentication and encryption---can be added to the current code base with changes in only few parts of the source. These changes should be made soon. Archiving of mail is another feature to add then. More complete logging coverage, reporting of unsafe environment, and fixing high risk security flaws are quality improvements to do. All this work should be done on basis of the current code.
|
meillo@239
|
587
|
meillo@239
|
588 All other work depends on how the plans for \masqmail's future look like.
|
meillo@239
|
589
|
meillo@239
|
590 What shall \masqmail\ be like, in, for instance, five years?
|
meillo@239
|
591
|
meillo@239
|
592 Two ways of further development come to mind.
|
meillo@239
|
593
|
meillo@239
|
594 First, stick to the old architecture and try to add features as possible. This approach needs less effort to be spent, because a working code is already present. Further development is only adding small increments to a exiting code base. But the further development goes, the larger is the work needed to add more functionality, and the more bugs will appear, caused by the increasing complexity. Quality of the software will decrease, because lacking of clear internal structure encourages further work to be quick fixes rather than good solutions.
|
meillo@239
|
595
|
meillo@239
|
596 Second, the way of designing \masqmail\ from scratch and rebuilding it. A lot of time and work is required to do this. Additionally, a new design from scratch introduces new risks: Is the design really better? Was thought of everything? Will there come problems not foreseeable now? Starting from scratch also means a step back. Against these disadvantages stands the gain from the new design: Further development will be easier and probably faster, overall quality will be better and easier to keep up, and dead ends for further development are better avoidable.
|
meillo@239
|
597
|
meillo@239
|
598 Essentially, the decision for one of the ways depends on the question whether \masqmail\ should remain what it is, then the first option seems to be the right one to choose. Or whether \masqmail\ should become a modern \mta\ which is able to expand to include new functionality, then the second option is to choose.
|
meillo@239
|
599
|
meillo@239
|
600 Security, extendability, and the other quality properties appear to have also crucial importance in this decision. If they are required for future versions of \masqmail, then a new design is a must.
|
meillo@239
|
601
|
meillo@239
|
602 \person{Graff} and \person{van Wyk} describe the situation well: ``[I]n today's world, your software is likely to have to operate in a very hostile security environment.'' \cite{graff03}. An old-fashioned \mta\ depends, for sure, on a dieing branch, called \name{trusted environments}. And nothing other than a fresh and better design will help to survive.
|
meillo@239
|
603
|
meillo@239
|
604
|
meillo@239
|
605
|
meillo@196
|
606
|
meillo@219
|
607 The suggested further development plan for \masqmail\ is:
|
meillo@219
|
608 \begin{enumerate}
|
meillo@225
|
609 \item The short time goal: Add the most needed features, being authentication and encryption, to the current code base. \item The long time goal: Design a new architecture that satisfies the requirements identified, especially the quality requirements. The implementation of this design shall then, after being usable and throughout tested, supersede the old \masqmail.
|
meillo@219
|
610 \end{enumerate}
|
meillo@196
|
611
|
meillo@219
|
612 This plan is similar to the change from \sendmail\ to \name{sendmail X}/\name{MeTA1}, except the \sendmail\ change was much too late.
|
meillo@196
|
613
|
meillo@219
|
614 The following chapter is about the work on the current code base, to reach the short time goals. The chapter afterwards then introduces a new, modern design for future versions of \masqmail.
|
meillo@196
|
615
|
meillo@219
|
616
|
meillo@219
|
617 %The plan is to first do the most needed stuff on the old design to make it still usable; then design a new version from scratch, for the future.
|