838077f18b71321a685c84329342e6a711d22d09
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

1) <?php
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

2) /*
3) This file belongs to the Webinterface of schokokeks.org Hosting
4) 
5) Written 2008-2012 by schokokeks.org Hosting, namely
6)   Bernd Wurst <bernd@schokokeks.org>
7)   Hanno Böck <hanno@schokokeks.org>
8) 
9) To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty.
10) 
11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see 
12) http://creativecommons.org/publicdomain/zero/1.0/
13) 
14) 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.
15) */
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

16) 
17) require_once('inc/base.php');
18) require_once('x509.php');
19) 
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

20) require_role(array(ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT));
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

21) 
bernd Benutze überall title() sta...

bernd authored 13 years ago

22) title('Anmeldung über Client-Zertifikat');
23) output('<p>Sie können Sie an diesem Webinterface wahlweise auch über ein SSL-Client-Zertifikat anmelden. Dazu muss das gewünschte Zertifikat <em>vorher</em> in Ihrem Browser installiert werden und kann dann hier hinzugefügt werden.</p>
bernd Typo

bernd authored 15 years ago

24) <p>Wenn Sie ein Zertifikat mit der entsprechenden Funktion unten auf dieser Seite hinzufügen, wird Sie Ihr Browser fragen, welches Zertifikat verwendet werden soll. Sollte Ihr Browser nicht fragen, ist entweder kein Zertifikat im Browser installiert oder Sie haben Ihren Browser auf <em>Niemals fragen</em> (o.Ä.) eingestellt.</p>
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

25) ');
26) 
27) 
28) 
29) if (isset($_GET['clear']))
30) {
31)   unset($_SESSION['clientcert_cert']);
32)   unset($_SESSION['clientcert_dn']);
33)   unset($_SESSION['clientcert_issuer']);
34) }
35) 
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

36) $username = NULL;
Bernd Wurst bugfix: most users have mul...

Bernd Wurst authored 12 years ago

37) if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

38)   $username = $_SESSION['userinfo']['username'];
Bernd Wurst bugfix: missing brackets

Bernd Wurst authored 12 years ago

39)   if (isset($_SESSION['subuser'])) {
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

40)     $username = $_SESSION['subuser'];
Bernd Wurst bugfix: missing brackets

Bernd Wurst authored 12 years ago

41)   }
Bernd Wurst bugfix: most users have mul...

Bernd Wurst authored 12 years ago

42) } elseif ($_SESSION['role'] & ROLE_VMAIL_ACCOUNT) {
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

43)   $username = $_SESSION['mailaccount'];
44) }
45) 
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

46) if (isset($_SESSION['clientcert_cert']))
47) {
48)   // FIXME: Es gibt keine Duplikaterkennung.
49)   global $menu;
50)   output('<div style="margin: 1em; padding: 1em; border: 2px solid green;">');
51)   output('<p>Es wurde folgendes Client-Zertifikat von Ihrem Browser gesendet:</p>
52) <div style="margin-left: 2em;"><strong>DN:</strong> '.filter_input_general($_SESSION['clientcert_dn']).'<br />
53) <strong>Aussteller-DN:</strong> '.filter_input_general($_SESSION['clientcert_issuer']).'</div>
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

54) <p>Soll dieses Zertifikat für den Zugang für <strong>'.$username.'</strong> verwendet werden?</p>');
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

55)   output(html_form('clientcert_add', 'certsave.php', 'action=new', '<p><input type="submit" name="submit" value="Ja, dieses Zertifikat einrichten" /> &#160; '.internal_link('cert', 'Nein', 'clear').'</p>'));
56)   output('</div>');
57) }
58) 
59) 
Bernd Wurst bugfix: most users have mul...

Bernd Wurst authored 12 years ago

60) DEBUG($username);
bernd Cert-Login geht jetztauch m...

bernd authored 13 years ago

61) $certs = get_certs_by_username($username);
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

62) if ($certs != NULL) {
63)   output('<p>Sie haben bereits Zertifikate für den Zugang eingerichtet.</p>
64)   <ul>');
65)   foreach ($certs AS $cert) {
66)    	output('<li>'.$cert['dn'].'<br /><em>ausgestellt von </em>'.$cert['issuer']);
67)     output('<br />'.internal_link('certsave', 'Dieses Zertifikat löschen', 'action=delete&id='.$cert['id']));
68)     output('</li>');
69)   }
70)   output('</ul>');
71) }
72) else
73) {
bernd Einige Dummheiten repariert...

bernd authored 14 years ago

74)   output('<p><em>Bisher sind keine Zertifikate für Ihren Zugang eingerichtet</em></p>');
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

75) }
76) 
bernd Bug im Client-Zertfikat-Man...

bernd authored 15 years ago

77) $backurl = 'go/index/cert';
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

78) 
bernd Hinweis aus TLS-reneg-Probleme

bernd authored 14 years ago

79) addnew('../../certlogin/index.php', 'Neues Client-Zertifikat hinzufügen', 'record&backto='.$backurl);
80) output('
81) <div class="error"><strong>Hinweis:</strong><br />
hanno neue warnmeldung, tls reneg...

hanno authored 14 years ago

82) Sie benötigen für den Login per Zertifikat einen Browser, der die so genannte
83) TLS-Renegotiation nach dem Standard RFC 5746 unterstützt. Firefox kann dies
84) ab Version 3.6.2.
85) <a href="http://www.phonefactor.com/sslgap/ssl-tls-authentication-patches">Hier</a>
86) finden Sie weitere Informationen zur Unterstützung in anderen Browsern.
87) </div>');
bernd Hinweis aus TLS-reneg-Probleme

bernd authored 14 years ago

88)