{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "\n",
       "\n",
       "\n",
       "\n",
       "\n"
      ],
      "text/plain": [
       ""
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import graphviz\n",
    "\n",
    "a = \"\"\"\n",
    "digraph mailu {\n",
    "    label = \"Mailu\";\n",
    "    fontname = \"arial\";\n",
    "    \n",
    "    node [shape = box; fontname = \"arial\"; fontsize = 8; style = filled; color = \"#d3edea\";];\n",
    "    splines = \"compound\";\n",
    "    // node [shape = \"box\"; fontsize = \"10\";];\n",
    "    edge [fontsize = \"8\";];\n",
    "    \n",
    "    # Components\n",
    "    internet [label = \"Internet\";];\n",
    "    front [label = \"Front\";];\n",
    "    admin [label = \"Admin\";];\n",
    "    smtp [label = \"SMTP\";];\n",
    "    redis [label = \"Redis\";];\n",
    "    antispam [label = \"Antispam\";];\n",
    "    antivirus [label = \"Anti-Virus\";];\n",
    "    imap [label = \"IMAP\";];\n",
    "    webdav [label = \"WebDAV\";];\n",
    "    webmail [label = \"Webmail\";];\n",
    "    fetchmail [label = \"Fetchmail\";];\n",
    "    oletools [label = \"Oletools\"];\n",
    "    fts_attachments [label = \"Tika\"];\n",
    "    \n",
    "    # Front from internet\n",
    "    internet -> front [label = \"80/tcp\";];\n",
    "    internet -> front [label = \"443/tcp\";];\n",
    "    internet -> front [label = \"25/tcp\";];\n",
    "    internet -> front [label = \"465/tcp\";];\n",
    "    internet -> front [label = \"587/tcp\";];\n",
    "    internet -> front [label = \"110/tcp\";];\n",
    "    internet -> front [label = \"995/tcp\";];\n",
    "    internet -> front [label = \"143/tcp\";];\n",
    "    internet -> front [label = \"993/tcp\";];\n",
    "    internet -> front [label = \"4190/tcp\";];\n",
    "    \n",
    "    front -> front [label = \"8008/tcp\";];\n",
    "    front -> front [label = \"8000/tcp\";];\n",
    "    front -> admin [label = \"8080/tcp\";];\n",
    "    front -> imap [label = \"4190/tcp\";];\n",
    "    front -> imap [label = \"143/tcp\";];\n",
    "    front -> imap [label = \"110/tcp\";];\n",
    "    front -> smtp [label = \"25/tcp\";];\n",
    "    front -> smtp [label = \"10025/tcp\";];\n",
    "    front -> webmail [label = \"80/tcp\";];\n",
    "    front -> antispam [label = \"11334/tcp\";];\n",
    "    front -> webdav [label = \"5232/tcp\";];\n",
    "    \n",
    "    smtp -> admin [label = \"8080/tcp\";];\n",
    "    smtp -> front [label = \"2525/tcp\";];\n",
    "    smtp -> antispam [label = \"11332/tcp\";];\n",
    "    \n",
    "    imap -> admin [label = \"8080/tcp\";];\n",
    "    imap -> antispam [label = \"11334/tcp\";];\n",
    "    imap -> front [label = \"25/tcp\";];\n",
    "    imap -> fts_attachments [label = \"9998/tcp\";];\n",
    "    \n",
    "    webmail -> front [label = \"14190/tcp\";];\n",
    "    webmail -> front [label = \"10025/tcp\";];\n",
    "    webmail -> front [label = \"10143/tcp\";];\n",
    "    \n",
    "    admin -> redis [label = \"6379/tcp\";];\n",
    "    admin -> imap [label = \"2525/tcp\";];\n",
    "    \n",
    "    antispam -> redis [label = \"6379/tcp\";];\n",
    "    antispam -> admin [label = \"80/tcp\";];\n",
    "    antispam -> oletools [label = \"11343/tcp\";];\n",
    "    antispam -> antivirus [label = \"3310/tcp\";];\n",
    "    \n",
    "    fetchmail -> admin [label = \"8080/tcp\"]\n",
    "    fetchmail -> front [label = \"25/tcp\"]\n",
    "    fetchmail -> front [label = \"2525/tcp\"]\n",
    "    #\n",
    "    # those don't need internet:\n",
    "    # oletools\n",
    "    # fts_attachments\n",
    "    # redis\n",
    "}\n",
    "\"\"\"\n",
    "\n",
    "dot = graphviz.Source(a)\n",
    "dot\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}