354c05a4ddd678c49bcbba458bffa7d13482139a
Bernd Wurst allow setup of 2FA when log...

Bernd Wurst authored 3 years ago

1) <?php
2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

5) Written by schokokeks.org Hosting, namely
Bernd Wurst allow setup of 2FA when log...

Bernd Wurst authored 3 years ago

6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

9) This code is published under a 0BSD license.
Bernd Wurst allow setup of 2FA when log...

Bernd Wurst authored 3 years ago

10) 
11) 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.
12) */
13) 
14) require_once('totp.php');
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

15) require_role([ROLE_MAILACCOUNT, ROLE_VMAIL_ACCOUNT]);
Bernd Wurst allow setup of 2FA when log...

Bernd Wurst authored 3 years ago

16) 
17) title("Zwei-Faktor-Anmeldung am Webmailer");
18) 
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

19) output('<p>Sie können bei ' . config('company_name') . ' den Zugang zum Webmailer mit einem Zwei-Faktor-Prozess mit abweichendem Passwort schützen.</p>
Bernd Wurst allow setup of 2FA when log...

Bernd Wurst authored 3 years ago

20) <p>Dieses System schützt Sie vor mitgelesenen Tastatureingaben in nicht vertrauenswürdiger Umgebung z.B. in einem Internet-Café.</p>
21) <p>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 <strong>TOTP-Einmalcodes nach RFC 6238</strong> erzeugt. Beispiele dafür sind <a href="https://code.google.com/p/google-authenticator/">Google-Authenticator</a> oder <a href="http://f-droid.org/repository/browse/?fdfilter=motp&fdid=org.cry.otp&fdpage=1">mOTP</a>. Meist ist dies ein Smartphone mit einer entsprechenden App.</p>
22) <p><strong>Beachten Sie:</strong> Die Zwei-Faktor-Anmeldung funktioniert nur für Webmail und bei diesem Webinterface, beim Login via IMAP wird weiterhin 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 Webmail-Passwort festlegen.</p>
23) ');
24) 
25) 
26) require_once('modules/email/include/hasaccount.php');
27) require_once('modules/email/include/vmail.php');
28) 
29) $username = $_SESSION['mailaccount'];
30) $id = account_has_totp($username);
31) 
32) 
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

33) output('<h3>Zwei-Faktor-Anmeldung für ' . htmlspecialchars($username) . '</h3>
Bernd Wurst allow setup of 2FA when log...

Bernd Wurst authored 3 years ago

34) <div style="margin-left: 2em;">');
35) if ($id) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

36)     output(addnew('delete', 'Zwei-Faktor-Anmeldung für dieses Postfach abschalten', 'id=' . $id, 'style="background-image: url(' . $prefix . 'images/delete.png); color: red;"'));
Bernd Wurst allow setup of 2FA when log...

Bernd Wurst authored 3 years ago

37) } else {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

38)     output(addnew('setup', 'Zwei-Faktor-Anmeldung für dieses Postfach aktivieren', 'username=' . urlencode($username)));