cf54502a10b16c985ea28db17885d377226b6145
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) 
Bernd Wurst Copyright year update

Bernd Wurst authored 6 years ago

5) Written 2008-2018 by schokokeks.org Hosting, namely
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

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']);
Bernd Wurst Speichere und zeige Serienn...

Bernd Wurst authored 8 years ago

34)   unset($_SESSION['clientcert_serial']);
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

35) }
36) 
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

Bernd Wurst authored 12 years ago

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

bernd authored 12 years ago

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

bernd authored 15 years ago

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

Bernd Wurst authored 8 years ago

54) <strong>Aussteller-DN:</strong> '.filter_input_general($_SESSION['clientcert_issuer']).'<br />
Bernd Wurst Speichere und zeige Start-...

Bernd Wurst authored 8 years ago

55) <strong>Seriennummer:</strong> '.filter_input_general($_SESSION['clientcert_serial']).'<br />
56) <strong>Gültigkeit:</strong> '.filter_input_general($_SESSION['clientcert_valid_from']).' bis '.filter_input_general($_SESSION['clientcert_valid_until']).'</div>
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

57) <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

58)   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>'));
59)   output('</div>');
60) }
61) 
62) 
Bernd Wurst bugfix: most users have mul...

Bernd Wurst authored 12 years ago

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

bernd authored 13 years ago

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

bernd authored 15 years ago

65) if ($certs != NULL) {
66)   output('<p>Sie haben bereits Zertifikate für den Zugang eingerichtet.</p>
67)   <ul>');
68)   foreach ($certs AS $cert) {
Bernd Wurst Speichere und zeige Start-...

Bernd Wurst authored 8 years ago

69)    	output('<li>'.$cert['dn'].' / Seriennummer '.$cert['serial'].' / '.'Gültig von '.$cert['valid_from'].' bis '.$cert['valid_until'].'<br /><em>ausgestellt von </em>'.$cert['issuer']);
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

70)     output('<br />'.internal_link('certsave', 'Dieses Zertifikat löschen', 'action=delete&id='.$cert['id']));
71)     output('</li>');
72)   }
73)   output('</ul>');
74) }
75) else
76) {
bernd Einige Dummheiten repariert...

bernd authored 14 years ago

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

bernd authored 15 years ago

78) }
79) 
bernd Bug im Client-Zertfikat-Man...

bernd authored 15 years ago

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

bernd authored 15 years ago

81) 
bernd Hinweis aus TLS-reneg-Probleme

bernd authored 14 years ago

82) addnew('../../certlogin/index.php', 'Neues Client-Zertifikat hinzufügen', 'record&backto='.$backurl);