Roundcube admin login

Dieser Commit ist enthalten in:
Balázs Kovács 2020-11-10 11:40:00 +01:00
Ursprung f8b456f375
Commit 430b09144d

Datei anzeigen

@ -152,3 +152,62 @@ $MAILCOW_APPS = array(
);
...
````
### Let admins log into Roundcube without password
First, install plugin [dovecot_impersonate](https://github.com/corbosman/dovecot_impersonate/) and add Roundcube as an app (see above).
Edit `mailcow.conf` and add the following:
```
# Allow admins to log into Roundcube as email user (without any password)
# Roundcube with plugin dovecot_impersonate must be installed first
ALLOW_ADMIN_EMAIL_LOGIN_ROUNDCUBE=y
```
Edit `docker-compose.override.yml` and crate/extend the section for `php-fpm-mailcow`:
```yml
version: '2.1'
services:
postfix-mailcow:
environment:
- ALLOW_ADMIN_EMAIL_LOGIN_ROUNDCUBE=${ALLOW_ADMIN_EMAIL_LOGIN_ROUNDCUBE:-n}
```
Edit `data/web/js/site/mailbox.js` and the following code after [`if (ALLOW_ADMIN_EMAIL_LOGIN) { ... }`](https://github.com/mailcow/mailcow-dockerized/pull/3849/commits/1c873a83b5e6b1714512b2dc79ff81b26af3ef79#diff-aac7eb6ff52acc8698ff9bcc71c313cbc5bbbe501c3eb1b8bc658ef97fb9d4c1)
```php
if (ALLOW_ADMIN_EMAIL_LOGIN_ROUNDCUBE) {
item.action += '<a href="/rc-auth.php?login=' + encodeURIComponent(item.username) + '" class="login_as btn btn-xs btn-primary" target="_blank"><span class="glyphicon glyphicon-envelope"></span> Roundcube</a>';
}
```
Edit `data/web/mailbox.php` and add this code to the bottom of the [javascript section](https://github.com/mailcow/mailcow-dockerized/pull/3849/commits/1c873a83b5e6b1714512b2dc79ff81b26af3ef79#diff-312fb7af69e284eca2fd573cdf2e4c3d04b6cd93fc5eb0e4dcdc6c199afd0aba):
```php
<script type='text/javascript'>
<?php
// ...
$ALLOW_ADMIN_EMAIL_LOGIN_ROUNDCUBE = (preg_match(
"/^(yes|y)+$/i",
$_ENV["ALLOW_ADMIN_EMAIL_LOGIN_ROUNDCUBE"]
)) ? "true" : "false";
echo "var ALLOW_ADMIN_EMAIL_LOGIN_ROUNDCUBE = " . $ALLOW_ADMIN_EMAIL_LOGIN_ROUNDCUBE . ";\n";
?>
</script>
```
Copy the contents of the following files from this [Snippet](https://gitlab.com/-/snippets/2038244):
* `data/web/inc/lib/RoundcubeAutoLogin.php`
* `data/web/rc-auth.php`
Finally, restart mailcow
```
docker-compose down
docker-compose up -d
```