\documentclass[10pt,landscape,a4paper]{article}
\usepackage[left=0pt,top=0pt,right=0pt,bottom=0pt]{geometry}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8x]{inputenc}
\usepackage{ae}
\usepackage{tikz}
\usetikzlibrary{arrows,shadows,positioning,calc,fit,fadings}

\newcommand{\machine}[2][]{
  \begin{pgfonlayer}{background}
    \node[fill=yellow!20, rounded corners, draw=black!50, dashed,
          fit=#2,inner sep=7pt,
          label=below:\texttt{#1}] {};
    \end{pgfonlayer}
}


\thispagestyle{empty}
\begin{document}

\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}

\tikzstyle{service}=[draw, fill=blue!20,
                     text width=5em, text centered,
                     minimum height=2.5em,
                     drop shadow]
\tikzstyle{what}  = [sloped,font=\footnotesize]
\tikzstyle{proto} = [sloped,font=\footnotesize\ttfamily]
\tikzstyle{port}  = [sloped,font=\tiny\ttfamily]

\tikzstyle{TODO} = [draw=red]

\centering
\vspace*{\fill}
\begin{tikzpicture}

  \begin{scope}[node distance=5pt]
    % The member's machine
    \node (IMAP-client)[service]                        {IMAP client};
    \node (SMTP-client)[service] [above=of IMAP-client] {SMTP client};
    \node (web-browser)[service] [below=of IMAP-client] {Web browser};
    \machine[\textnormal{Your machine}]{ (SMTP-client) (IMAP-client) (web-browser) }
  \end{scope}

  \begin{scope}[xshift=8cm, node distance=2cm and 2cm, on grid]
    % mistral
    \node (o) {};
    \node (LDAP-producer)   [service] [above right=of o] {LDAP server};
    \node (SMTP-server-IMAP)[service] [above left=of o]  {SMTP server};
    \node (IMAP-server)     [service] [below left=of o]  {IMAP server};
    \node (mailboxes)       [service] [below right=of o] {Mailboxes};
    \machine[mistral]{ (IMAP-server) (LDAP-producer) (mailboxes) }
  \end{scope}

  \begin{scope}[xshift=8cm, yshift=-7cm]
    % harvey
    \node (webmail)[service] {Webmail};
    \machine[harvey]{ (webmail) }
  \end{scope}

  \begin{scope}[xshift=8cm, yshift=7cm, node distance=2cm and 2cm, on grid]
    % luxemburg, elefant
    \node (o) {};
    \node (SMTP-server)  [service] [left=of o]  {SMTP server};
    \node (LDAP-consumer)[service] [right=of o] {LDAP replicate};
    \machine[luxemburg\textnormal{,} elefant]{ (SMTP-server) (LDAP-consumer) }
  \end{scope}

  \begin{scope}[xshift=16cm, node distance=1.25cm, on grid]
    % gnu
    \node (o) {};
    \node (MSA)[service] [above=of o] {MSA};
    \node (MTA)[service] [below=of o] {MTA};
    \machine[gnu]{ (MSA) (MTA) }
  \end{scope}

  \path[use as bounding box]
    (current bounding box.north east) -- (current bounding box.south west);

  \begin{pgfonlayer}{background}
     \draw[->] (IMAP-server)
            .. controls +(30:2cm) and +(-120:2cm) ..
               (LDAP-producer)
         node[pos=0.5,above,proto] {LDAP}
         node[pos=0.5,below,what]  {auth. bind}
         node[pos=0.92,above,port] {389};

     \draw[->] (IMAP-client.east)
            .. controls +(1.5cm,0) and +(-1.5cm,0) ..
               (IMAP-server.west)
         node[pos=0.5,above,proto] {IMAPS}
         node[pos=0.5,below,what]  {\texttt{getmail}}
         node[pos=0.95,above,port] {993};

     \draw[->] (web-browser.south)
            .. controls +(0,-4cm) and +(-3.5cm,0) ..
               (webmail.west)
         node[pos=0.5,above,proto] {HTTPS}
         node[pos=0.97,above,port] {443};

     \draw[->] (webmail.north)
            .. controls +(0,1.5cm) and +(0,-1.5cm) ..
               (IMAP-server.south)
         node[pos=0.5,above,proto] {IMAPS}
         node[pos=0.94,above,port] {993};

     \draw[->] (webmail.30)
            .. controls +(30:8cm) and +(0,-2.5cm) ..
               (LDAP-producer.south)
         node[pos=0.5,above,proto] {LDAP \textnormal{(over \texttt{SSH})}}
         node[pos=0.15,above,what] {auth. bind to}
         node[pos=0.15,below,what] {change password}
         node[pos=0.96,above,port] {389};

     \draw[->] (MSA) edge
         node[above,proto]        {ESMTP}
         node[pos=0.9,below,port] {25}
               (MTA);

     \draw[->] (MSA.west)
            .. controls +(-2cm,0) and +(2cm,0) ..
               (LDAP-producer.east)
         node[pos=0.5,above,proto] {LDAP \textnormal{(over \texttt{SSH})}}
         node[pos=0.5,below,what]  {auth. bind}
         node[pos=0.96,below,port] {389};

     \draw[->,TODO] (SMTP-client.north)
            .. controls +(0,5cm) and +(-5cm,0) ..
               ($0.5*(SMTP-server)+0.5*(LDAP-consumer)+(0,1.5cm)$)
         node[pos=1,above,proto] {ESMTPSA}
         node[pos=1,below,what]  {\texttt{sendmail}}
            .. controls +(5cm,0) and +(0,5cm) ..
              (MSA.north)
         node[pos=0.99,above,port] {587};

     \draw[->] (SMTP-server) edge
         node[above,proto] {LDAPI}
         node[below,what]  {virtual lookups}
               (LDAP-consumer);

     \draw[->] (SMTP-server-IMAP) edge
         node[above,proto] {LDAPI}
         node[below,what]  {virtual lookups}
               (LDAP-producer);

     \draw[->] (SMTP-server) edge
         node[above,proto]         {ESMTP \textnormal{(over \texttt{SSH})}}
         node[pos=0.96,below,port] {25}
               (SMTP-server-IMAP);

    \draw[->] (SMTP-server-IMAP) edge
        node[below,what] {\texttt{deliver}}
              (IMAP-server);

    \draw[->] (IMAP-server) edge
        node[below,what] {read, write}
              (mailboxes);

     \draw[->] (LDAP-consumer.south)
            .. controls +(0,-1.5cm) and +(0,1.5cm) ..
               (LDAP-producer.north)
         node[pos=0.5,above,proto] {LDAP \textnormal{(over \texttt{SSH})}}
         node[pos=0.5,below,what]  {\texttt{syncrepl}}
         node[pos=0.95,above,port] {389};

     \draw[->,TODO] (webmail.east)
            .. controls +(3.5cm,0) and +(0,-4cm) ..
               (MTA.south)
       node[pos=0.5,above,proto] {ESMTPS}
       node[pos=0.5,below,what]  {\texttt{sendmail}}
       node[pos=0.97,above,port] {25};

     \draw[->,path fading=west]
               ($(SMTP-server.west)+(-5cm,2cm)$)
            .. controls +(2cm,0) and +(-2cm,0) ..
               (SMTP-server.west);
     \draw[dashed,path fading=east]
               ($(SMTP-server.west)+(-5cm,2cm)$)
            .. controls +(2cm,0) and +(-2cm,0) ..
               (SMTP-server.west);
     \path ($(SMTP-server.west)+(-5cm,2cm)$)
            .. controls +(2cm,0) and +(-2cm,0) ..
               (SMTP-server.west)
       node[pos=0.5,above,proto] {ESMTP}
       node[pos=0.97,above,port] {25};

     \draw[path fading=east,TODO]
               (MTA.east)
            .. controls +(2cm,0) and +(0,2cm) ..
               ($(MTA.east)+(2cm,-5cm)$);
     \draw[->,dashed,path fading=west,TODO]
               (MTA.east)
            .. controls +(2cm,0) and +(0,2cm) ..
               ($(MTA.east)+(2cm,-5cm)$)
       node[pos=0.5,above,proto] {ESMTP}
       node[pos=0.97,above,port] {25};
  \end{pgfonlayer}

\end{tikzpicture}
\vspace*{\fill}

\end{document}
