904b651c7dc557f880c8c8056ddb2f441b0b6eee
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) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

11) You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see
Bernd Wurst Added license tags for CC0,...

Bernd Wurst authored 12 years ago

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) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

29) if (isset($_GET['clear'])) {
30)     unset($_SESSION['clientcert_cert']);
31)     unset($_SESSION['clientcert_dn']);
32)     unset($_SESSION['clientcert_issuer']);
33)     unset($_SESSION['clientcert_serial']);
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

34) }
35) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

Bernd Wurst authored 12 years ago

37) if ($_SESSION['role'] & ROLE_SYSTEMUSER) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

38)     $username = $_SESSION['userinfo']['username'];
39)     if (isset($_SESSION['subuser'])) {
40)         $username = $_SESSION['subuser'];
41)     }
Bernd Wurst bugfix: most users have mul...

Bernd Wurst authored 12 years ago

42) } elseif ($_SESSION['role'] & ROLE_VMAIL_ACCOUNT) {
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

43)     $username = $_SESSION['mailaccount'];
bernd Ermögliche Client-Cert-Logi...

bernd authored 12 years ago

44) }
45) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

46) if (isset($_SESSION['clientcert_cert'])) {
47)     // FIXME: Es gibt keine Duplikaterkennung.
48)     global $menu;
49)     output('<div style="margin: 1em; padding: 1em; border: 2px solid green;">');
50)     output('<p>Es wurde folgendes Client-Zertifikat von Ihrem Browser gesendet:</p>
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

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

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

Bernd Wurst authored 8 years ago

53) <strong>Seriennummer:</strong> '.filter_input_general($_SESSION['clientcert_serial']).'<br />
54) <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

55) <p>Soll dieses Zertifikat für den Zugang für <strong>'.$username.'</strong> verwendet werden?</p>');
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

56)     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>'));
57)     output('</div>');
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

58) }
59) 
60) 
Bernd Wurst bugfix: most users have mul...

Bernd Wurst authored 12 years ago

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

bernd authored 13 years ago

62) $certs = get_certs_by_username($username);
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

63) if ($certs != null) {
64)     output('<p>Sie haben bereits Zertifikate für den Zugang eingerichtet.</p>
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

65)   <ul>');
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

66)     foreach ($certs as $cert) {
67)         output('<li>'.$cert['dn'].' / Seriennummer '.$cert['serial'].' / '.'Gültig von '.$cert['valid_from'].' bis '.$cert['valid_until'].'<br /><em>ausgestellt von </em>'.$cert['issuer']);
68)         output('<br />'.internal_link('certsave', 'Dieses Zertifikat löschen', 'action=delete&id='.$cert['id']));
69)         output('</li>');
70)     }
71)     output('</ul>');
72) } else {
73)     output('<p><em>Bisher sind keine Zertifikate für Ihren Zugang eingerichtet</em></p>');
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

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

bernd authored 15 years ago

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

bernd authored 15 years ago

77)