Hanno Böck This code is published under a 0BSD license. Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code. */ require_once('totp.php'); require_role(ROLE_SYSTEMUSER); title("Zwei-Faktor-Anmeldung am Webmailer"); output('

Sie können bei '.config('company_name').' den Zugang zum Webmailer mit einem Zwei-Faktor-Prozess mit abweichendem Passwort schützen.

Dieses System schützt Sie vor mitgelesenen Tastatureingaben in nicht vertrauenswürdiger Umgebung z.B. in einem Internet-Café.

Beim Zwei-Faktor-Prozess müssen Sie zum Login ein festes Webmail-Passwort und zusätzlich ein variabler Code, den beispielsweise Ihr Smartphone erzeugen kann, eingeben. Da sich dieser Code alle 30 Sekunden ändert, kann ein Angreifer sich nicht später mit einem abgehörten Passwort noch einmal anmelden. Zum Erzeugen des Einmal-Codes benötigen Sie ein Gerät, das TOTP-Einmalcodes nach RFC 6238 erzeugt. Beispiele dafür sind Google-Authenticator oder mOTP. Meist ist dies ein Smartphone mit einer entsprechenden App.

Beachten Sie: Die Zwei-Faktor-Anmeldung funktioniert nur für Webmail, beim Login via IMAP wird weiterhin nur das Passwort Ihres Postfachs benötigt. Damit dieses Passwort von einem Angreifer nicht mitgelesen werden kann, müssen Sie zur Zwei-Faktor-Anmeldung unbedingt ein separates Passwort festlegen.

Fügen Sie Zwei-Faktor-Anmeldung zu Ihren bestehenden Postfächern hinzu

'); require_once('modules/email/include/hasaccount.php'); require_once('modules/email/include/vmail.php'); if (! (user_has_accounts() || count(get_vmail_accounts())>0)) { output('

Bisher haben Sie kein Postfach. Bitte erstellen sie zunächst ein Postfach.

'); } else { /* VMAIL */ $domains = get_vmail_domains(); $vmail_accounts = get_vmail_accounts(); $sorted_by_domains = []; foreach ($vmail_accounts as $account) { if ($account['password'] == '') { continue; } if (array_key_exists($account['domain'], $sorted_by_domains)) { array_push($sorted_by_domains[$account['domain']], $account); } else { $sorted_by_domains[$account['domain']] = [$account]; } } DEBUG($sorted_by_domains); if (count($sorted_by_domains) > 0) { foreach ($sorted_by_domains as $accounts_on_domain) { if (count($sorted_by_domains) > 2) { output('

'.$accounts_on_domain[0]['domainname'].'

'); } foreach ($accounts_on_domain as $this_account) { $username = $this_account['local'].'@'.$this_account['domainname']; output('

'.$username.'

'); $id = account_has_totp($username); if ($id) { output(addnew('delete', 'Zwei-Faktor-Anmeldung für dieses Postfach abschalten', 'id='.$id, 'style="background-image: url('.$prefix.'images/delete.png); color: red;"')); } else { output(addnew('setup', 'Zwei-Faktor-Anmeldung für dieses Postfach aktivieren', 'username='.urlencode($username))); } output('
'); } } } /* Mailaccounts */ require_once('modules/email/include/mailaccounts.php'); $accounts = mailaccounts($_SESSION['userinfo']['uid']); if (count($accounts) > 0) { if (count($sorted_by_domains) > 0) { output('

IMAP/POP3-Accounts

'); } foreach ($accounts as $acc) { if ($acc['mailbox']) { output('

'.$acc['account'].'

'); $username = $acc['account']; $id = account_has_totp($username); if ($id) { output(addnew('delete', 'Zwei-Faktor-Anmeldung für dieses Postfach abschalten', 'id='.$id, 'style="background-image: url('.$prefix.'images/delete.png); color: red;"')); } else { output(addnew('setup', 'Zwei-Faktor-Anmeldung für dieses Postfach aktivieren', 'username='.urlencode($username))); } output('
'); } } } }