354c05a4ddd678c49bcbba458bffa7d13482139a
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) 
Hanno Böck Change license from CC0 to...

Hanno Böck authored 1 year ago

5) Written 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) 
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 Added license tags for CC0,...

Bernd Wurst authored 12 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) */
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

13) 
14) require_once('inc/base.php');
15) require_once('x509.php');
16) 
Hanno Böck Codingstyle PSR12 + array s...

Hanno Böck authored 2 years ago

17) require_role([ROLE_SYSTEMUSER, ROLE_SUBUSER, ROLE_VMAIL_ACCOUNT]);
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

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

bernd authored 13 years ago

19) title('Anmeldung über Client-Zertifikat');
20) 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

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

22) ');
23) 
24) 
25) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

bernd authored 15 years ago

31) }
32) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

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

Bernd Wurst authored 12 years ago

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

Hanno authored 5 years ago

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

Bernd Wurst authored 12 years ago

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

Hanno authored 5 years ago

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

bernd authored 12 years ago

41) }
42) 
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

43) if (isset($_SESSION['clientcert_cert'])) {
44)     // FIXME: Es gibt keine Duplikaterkennung.
45)     global $menu;
46)     output('<div style="margin: 1em; padding: 1em; border: 2px solid green;">');
47)     output('<p>Es wurde folgendes Client-Zertifikat von Ihrem Browser gesendet:</p>
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

48) <div style="margin-left: 2em;"><strong>DN:</strong> ' . filter_output_html($_SESSION['clientcert_dn']) . '<br />
49) <strong>Aussteller-DN:</strong> ' . filter_output_html($_SESSION['clientcert_issuer']) . '<br />
50) <strong>Seriennummer:</strong> ' . filter_output_html($_SESSION['clientcert_serial']) . '<br />
51) <strong>Gültigkeit:</strong> ' . filter_output_html($_SESSION['clientcert_valid_from']) . ' bis ' . filter_output_html($_SESSION['clientcert_valid_until']) . '</div>
52) <p>Soll dieses Zertifikat für den Zugang für <strong>' . $username . '</strong> verwendet werden?</p>');
53)     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>'));
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

54)     output('</div>');
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

55) }
56) 
57) 
Bernd Wurst bugfix: most users have mul...

Bernd Wurst authored 12 years ago

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

bernd authored 13 years ago

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

Hanno authored 5 years ago

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

bernd authored 15 years ago

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

Hanno authored 5 years ago

63)     foreach ($certs as $cert) {
Hanno Böck Spaces between string conca...

Hanno Böck authored 6 months ago

64)         output('<li>' . filter_output_html($cert['dn'] . ' / Seriennummer ' . $cert['serial'] . ' / ' . 'Gültig von ' . $cert['valid_from'] . ' bis ' . $cert['valid_until']) . '<br />');
65)         output('<em>ausgestellt von </em>' . filter_output_html($cert['issuer']));
66)         output('<br />' . internal_link('certsave', 'Dieses Zertifikat löschen', 'action=delete&id=' . $cert['id']));
Hanno Fix coding style with php-c...

Hanno authored 5 years ago

67)         output('</li>');
68)     }
69)     output('</ul>');
70) } else {
71)     output('<p><em>Bisher sind keine Zertifikate für Ihren Zugang eingerichtet</em></p>');
bernd Login via Client-Zertifikat...

bernd authored 15 years ago

72) }
73) 
bernd Bug im Client-Zertfikat-Man...

bernd authored 15 years ago

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

bernd authored 15 years ago

75)