{"id":143,"date":"2019-06-02T23:15:13","date_gmt":"2019-06-02T22:15:13","guid":{"rendered":"https:\/\/blog.inplico.uk\/?p=143"},"modified":"2022-10-31T18:49:20","modified_gmt":"2022-10-31T18:49:20","slug":"roundcube","status":"publish","type":"post","link":"https:\/\/blog.inplico.uk\/?p=143","title":{"rendered":"Roundcube"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p><strong>Installation<\/strong><\/p>\n<pre class=\"lang:sh decode:true \">#apt-get -y install roundcube-pgsql roundcube-plugins<\/pre>\n<p>If you already have a postgresql server running with some default values then let the install wizard do its thing, it will ask you a few questions, install the database and install roundcube in \/var\/lib\/roundcube<\/p>\n<p>&nbsp;<\/p>\n<p>If you want to do things manually for some reason then :<\/p>\n<p><strong>Preliminary<\/strong><\/p>\n<p>As with postfixadmin it is better to configure the database prior to installing the software. Doing so is a very similar routine.<\/p>\n<pre class=\"lang:sh decode:true\">#createuser roundcube -DRSP -U postgres<\/pre>\n<p>Enter a password when prompted, then<\/p>\n<pre class=\"lang:sh decode:true \">#createdb roundcube -O roundcube -U postgres<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Remote postgresql server<\/strong><\/p>\n<p>If you are using a remote postgresql server then when it gets to the point where it wants you to install the database press [esc]. Now edit <strong>\/etc\/dbconfig-common\/roundcube.conf<\/strong><\/p>\n<p>The file should contain:<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">dbc_dbtype='pgsql'\r\ndbc_dbuser='roundcube'\r\ndbc_dbpass='MYPASSWORD'\r\ndbc_dbserver='fqdn.suffix\r\ndbc_dbport='5432'\r\nbc_dbname='roundcube'\r\ndbc_dbadmin='postgres'<\/pre>\n<p>Change the directives according to your configuration and save the file before running<\/p>\n<pre class=\"lang:sh decode:true \">#dpkg-reconfigure roundcube<\/pre>\n<p>Now if you follow the instructions in the wizard it should now create the tables.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Local postgresql server<\/strong><\/p>\n<p>If your postgresql server is running locally then follow the instructions given by the wizard.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Apache<\/strong><\/p>\n<p>Unlike postfixadmin where it really doesn\u2019t matter for the amount that it is used, I like to create a proper virtual host for webmail. We are going to create a virtual host called mail.fqdn.suffix.<\/p>\n<p>First navigate to \/etc\/apache2\/sites-available and create a file called mail.fqdn.suffix.conf (replace fqdn.suffix with your domain name)<\/p>\n<pre class=\"lang:sh decode:true\">#touch mail.fqdn.suffix.conf<\/pre>\n<p>Open the file with your editor and add the following<\/p>\n<pre class=\"lang:apache decode:true\">&lt;VirtualHost&gt; *:80&gt;\r\n    ServerName mail.fqdn.suffix\r\n    Redirect \"\/\" https:\/\/mail.fqdn.suffix\r\n&lt;\/VirtualHost&gt;\r\n\r\n&lt;IfModule mod_ssl.c&gt;\r\n\u00a0\u00a0 &lt;VirtualHost _default_:443&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Servername mail.fqdn.suffix\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ServerAdmin user@domain.suffix\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 SSLEngine on\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SSLCertificateFile \/etc\/ssl\/certs\/mailserver.pem\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SSLCertificateKeyFile \/etc\/ssl\/private\/mailserver.key\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Include \/etc\/roundcube\/apache.conf\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Alias \/ \/var\/lib\/roundcube\/\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;FilesMatch \"\\.(cgi|shtml|phtml|php)$\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SSLOptions +StdEnvVars\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0&lt;\/FilesMatch&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;Directory \/usr\/lib\/cgi-bin&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0SSLOptions +StdEnvVars\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;\/Directory&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;Location \"\/\"&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Order Deny,Allow\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Deny from all\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Allow from all\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Require all granted\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 &lt;\/Location&gt;\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 BrowserMatch \"MSIE [2-6]\" \\\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 nokeepalive ssl-unclean-shutdown \\\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 downgrade-1.0 force-response-1.0\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 BrowserMatch \"MSIE [17-9]\" ssl-unclean-shutdown\r\n\u00a0\u00a0 &lt;\/VirtualHost&gt;\r\n&lt;\/IfModule&gt;<\/pre>\n<p>You will need to adjust the Servername; ServerAdmin; SSLCertificateFile and SSLCertificateKeyFile directives to your own configuration although if you followed this guide, the SSL certificates directives should not need to be altered.<\/p>\n<p>You will note the \u201cInclude\u201d directive that points to <strong>\/etc\/roundcube\/apache.conf<\/strong>. apache.conf is where everything for roundcube is automatically configured during installation.<\/p>\n<p>Now all you need to do is enable the site and reload apache and you should then be able to navigate to the site in a browser.<\/p>\n<pre class=\"lang:sh decode:true \">#a2ensite mail.fqdn.suffix\r\n#service apache2 reload<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Configuration config.inc.php<\/strong><\/p>\n<p>On debian this resides in <strong>\/etc\/roundcube<\/strong>. Unlike previous iterations you now must configure the outgoing server correctly or you will get an <strong>error 250<\/strong> whenever you try and send an email and the mail logs are particularly unhelpful as they merely notify you of a connection being established and then disconnected.<\/p>\n<p>The trick is the hidden within the smtp_server directive, which must have the prefix tls:\/\/ if the server is configured to use STARTTLS<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">$config['smtp_server'] = 'tls:\/\/mail.myserver.com<\/pre>\n<p>&nbsp;<\/p>\n<p>You will note that the screen asks for a server as well as a username and password. In most cases this is not desirable so simply edit the \u201cdefault_host\u201d directive to set a default.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">$config['default_host'] = 'localhost';<\/pre>\n<p>&nbsp;<\/p>\n<p>Further down there is a list of plugins that Roundcube loads. The \u201carchive\u201d and \u201czipdownload\u201d plugins are proably already enabled. Add the \u201cmanagesieve\u201d plugin so that the setting looks like this:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">$config['plugins'] = array(\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \r\n    'archive',\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \r\n    'zipdownload',\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \r\n    'managesieve',\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0 \r\n);<\/pre>\n<p>If you need to switch on debugging then you can add the following to the file:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"php\">$config['debug'] = 1;\r\n$config['smtp_debug'] = true;<\/pre>\n<p>The log files in \/var\/log\/roundcube are then updated and may give you a little more information.<\/p>\n<p>There is also a further setting that allows a user to change their password however at the time of producing this guide I have not configured it to work with our configuration. If we want a user to change their password then we point them to the postfixadmin user logon section and they can do it from there<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">https:\/\/fqdn.suffix\/postfixadmin\/users<\/pre>\n<p>Next an optional setting. The default session lifetime in Roundcube is 10 minutes. That means if a user is not using the webmail interface for more than 10 minutes they will be logged out. I found that annoying and increased that timeout to one hour. To do that at the end of the config file add:<\/p>\n<pre class=\"lang:sh highlight:0 decode:true \">$config['session_lifetime'] = 60;<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Configuring the managesieve plugin<\/strong><\/p>\n<p>The \u201cmanagesieve\u201d plugin will allow your users to manage automatic rules to manage their email. These rules are stored on the server and will be run automatically. You need to configure this plugin though. A default configuration can be found at \u201c<strong>\/usr\/share\/roundcube\/plugins<\/strong><\/p>\n<p><strong>\/managesieve\/config.inc.php.dist<\/strong>\u201d on your system. Copy it to the location where Roundcube will look for it:<\/p>\n<pre class=\"lang:sh decode:true\">#cp \/usr\/share\/roundcube\/plugins\/managesieve\/config.inc.php.dist \/etc\/roundcube\/plugins\/managesieve\/config.inc.php<\/pre>\n<p>No further changes are required.<\/p>\n<p>You should now be able to log into a mailbox from roundcube to send and retrieve your emails; Don&#8217;t forget to add an &#8216;A&#8217; record to your DNS configuration if it does not already exist.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Installation #apt-get -y install roundcube-pgsql roundcube-plugins If you already have a postgresql server running with some default values then let the install wizard do its thing, it will ask you a few questions, install the database and install roundcube in \/var\/lib\/roundcube &nbsp; If you want to do things manually for some reason then : [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-143","post","type-post","status-publish","format-standard","hentry","category-debian-server"],"_links":{"self":[{"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=\/wp\/v2\/posts\/143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=143"}],"version-history":[{"count":3,"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=\/wp\/v2\/posts\/143\/revisions"}],"predecessor-version":[{"id":353,"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=\/wp\/v2\/posts\/143\/revisions\/353"}],"wp:attachment":[{"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.inplico.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}