diff options
Diffstat (limited to 'base/tps/apache/cgi-bin/so')
-rwxr-xr-x | base/tps/apache/cgi-bin/so/Enroll.html | 138 | ||||
-rwxr-xr-x | base/tps/apache/cgi-bin/so/enroll.cgi | 193 | ||||
-rwxr-xr-x | base/tps/apache/cgi-bin/so/index.cgi | 48 |
3 files changed, 379 insertions, 0 deletions
diff --git a/base/tps/apache/cgi-bin/so/Enroll.html b/base/tps/apache/cgi-bin/so/Enroll.html new file mode 100755 index 000000000..3d2fa6daa --- /dev/null +++ b/base/tps/apache/cgi-bin/so/Enroll.html @@ -0,0 +1,138 @@ +<!-- --- BEGIN COPYRIGHT BLOCK --- + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + + Copyright (C) 2009 Red Hat, Inc. + All rights reserved. + --- END COPYRIGHT BLOCK --- --> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<link rel=stylesheet href="/esc/so/style.css" type="text/css"> + +<title>Enrollment</title> +</head> +<script type="text/JavaScript" src="/esc/so/util.js"> +</script> + +<script type="text/javascript"> +<!-- +function UserSelectRowByKeyID(keyType, keyID) +{ + DoCoolKeySetConfigValue("Operation-" + keyID, + "http://$host:$port/nk_service"); + DoCoolKeySetConfigValue("TokenType-" + keyID, "userKey"); + SelectRowByKeyID(keyType, keyID); +} + +function UserOnDoneInitializeBindingTable() +{ + var arr = GetAvailableCOOLKeys(); + var i; + for (i=0; i < arr.length; i++) + { + var keyType = arr[i][0]; + var keyID = arr[i][1]; + var keyStatus = GetStatusForKeyID(keyType, keyID); + UserSelectRowByKeyID(keyType, keyID); + } +} + +function UserOnCOOLKeyStateError() +{ + toggleAjaxProgress('ajax-pb', 'off'); +} + + +function toggleAjaxProgress(id, i) +{ + var e = document.getElementById(id); + if (i == 'off') { + e.style.display = 'none'; + } else { + e.style.display = 'block'; + } +} + +function UserOnCOOLKeyStatusUpdate(data) +{ + var progress = document.getElementById("progress"); + + if(progress) + progress.innerHTML = data + "%"; +} + +// --> +</script> + +<body onload="InitializeBindingTable();" onunload=cleanup()> + +<progressmeter id="progress-id" hidden="true" align = "center"/> +<table width="100%" class="logobar"> + <tr> + <td> +<!--<img alt="" src="/pki/esc/so/images/logo.gif"> --> + </td> + <td align = "center"> + <p class="headerText">Security Officer Enrollment</p> + </td> + </tr> +</table> + <div id="pb" style="display:none;"> + <table id="BindingTable" width="200px"align="center"> + <tr id="HeaderRow"> + </tr> + </table> + </div> + <p class="bodyText">You have plugged in your smartcard! After answering a few easy questions, you will be able to enroll the smartcard for the Security Officer user. + </p> + <p class="bodyText"> + Now we would like you to identify yourself. + </p> + <table> + <tr> + <td><p >LDAP User ID: </p></td> + <td> </td> + <td><input type="text" id="snametf" value=""></td> + <td> </td> + <td><p>LDAP Password: </p></td> + <td> </td> + <td><input type="password" id="snamepwd" value=""></td> + </tr> + + </table> + + <p class="bodyText"> Before you can use your smartcard, you will need a password to protect it.</p> + <table> + <tr> + <td><p >Password:</p></td> + <td><input type="password" id="pintf" name="pintf" value=""></td> + + <td><p >Re-Enter Password:</p></td> + <td><input type="password" id="reenterpintf" name="reenterpintf" value=""></td> + </table> + <br> + <div id="ajax-pb" style="display:none;"> + <img src="/pki/esc/so/images/indicator.gif"> + <h2 id="progress" name="progress" value="0%" ></h2> + </table> + </div> + + <table width="100%"> + <tr> + <td align="right"> + <input type="button" id="enrollbtn" name="enrollbtn" value="Enroll My Smartcard" onClick="toggleAjaxProgress('ajax-pb','on');DoEnrollCOOLKey();"> + </td> + </tr> + </table> +</body></html> diff --git a/base/tps/apache/cgi-bin/so/enroll.cgi b/base/tps/apache/cgi-bin/so/enroll.cgi new file mode 100755 index 000000000..148cd78c0 --- /dev/null +++ b/base/tps/apache/cgi-bin/so/enroll.cgi @@ -0,0 +1,193 @@ +#! /usr/bin/perl -w +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +######################################################################## +# +# Script: esc.cgi +# Author: Kin Blas () +# Date: 12/19/2003 +# +# CGI.pm Docs: +# +# http://stein.cshl.org/WWW/software/CGI/ +# +######################################################################## + +[REQUIRE_CFG_PL] + +use CGI; + +my $port = get_port(); +my $host = get_host(); +my $secure_port = get_secure_port(); + +$gQuery = new CGI; + +$gQueryAction = "default"; +$gQueryOverrideAction = "default"; + +@gCookieNames = ("ascScreenName", + "ascSubscriptionType", + "ascBindings"); + +$gQueryAction = $gQuery->param("action") if (defined $gQuery->param("action")); + +$gQueryOverrideAction = $gQuery->param("override_action") + if (defined $gQuery->param("override_action")); + +if ($gQueryOverrideAction ne "default") +{ + $gQueryAction = $gQueryOverrideAction; +} + +######################################################################## +# +# If no action was provided, we default to showing our +# admin page! +# +# http://www.foo.com/esc.cgi +# +######################################################################## + +if ($gQueryAction eq "default") +{ + GenerateEnrollmentPage(); + exit 0; +} + + + +sub ExitError +{ + my($str) = @_; + print $gQuery->header(), $gQuery->start_html(), $str, $gQuery->end_html(); + exit 0; +} + +sub GetScreenName +{ + my $sn = ""; + + if (defined $gQuery->param("screenname")) + { + $sn = $gQuery->param("screenname"); + } else { + $sn = "default"; + } + + return $sn; +} + +sub GetKeyType +{ + my $keyType = 0; + + if (defined $gQuery->param("keytype")) + { + $keyType = $gQuery->param("keytype"); + } + + return $keyType; +} + +sub GetKeyID +{ + my $keyID = ""; + + if (defined $gQuery->param("keyid")) + { + $keyID = $gQuery->param("keyid"); + } + + return $keyID; +} + +sub GetKeyLabelArg +{ + my $keyLabel = ""; + + if (defined $gQuery->param("keylabel")) + { + $keyLabel = $gQuery->param("keylabel"); + } + + return $keyLabel; +} + +sub HaveScreenName +{ + return 1 if (GetScreenName() ne ""); + return 0; +} + +sub IsSubscriber +{ + my $subType = $gUserObj{'SUBSCRIPTION'}; + return 1 if ($subType eq "HouseKey" || $subType eq "NetKey"); + + return 0; +} + +sub GetNextAction +{ + my($nextActn) = "default"; + + if (defined $gQuery->param('nextaction')) + { + $nextActn = $gQuery->param('nextaction'); + } + elsif (defined $gQuery->param('action')) + { + $nextActn = $gQuery->param('action'); + } + + return $nextActn; +} + +sub GenerateEnrollmentPage +{ + my ($l); + + ExitError("Failed to load enrollment page!") if (!open(ENROLL_FILE, "< Enroll.html")); + + print $gQuery->header(); + + while ($l = <ENROLL_FILE>) + { + if ($l =~ /<!-- *SECURECOOL_SCREENNAME *-->/) + { + my $sn = GetScreenName(); + $l =~ s/<!-- *SECURECOOL_SCREENNAME *-->/$sn/g; + print $l; + } + else + { + $l =~ s/\$host/$host/g; + $l =~ s/\$port/$port/g; + $l =~ s/\$secure_port/$secure_port/g; + + print $l; + } + } + + close(ENROLL_FILE); +} diff --git a/base/tps/apache/cgi-bin/so/index.cgi b/base/tps/apache/cgi-bin/so/index.cgi new file mode 100755 index 000000000..7b3f2c68d --- /dev/null +++ b/base/tps/apache/cgi-bin/so/index.cgi @@ -0,0 +1,48 @@ +#!/usr/bin/perl +# +# --- BEGIN COPYRIGHT BLOCK --- +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +# +# Copyright (C) 2007 Red Hat, Inc. +# All rights reserved. +# --- END COPYRIGHT BLOCK --- +# +# +# +# +print "Content-type: text/xml\n\n"; +print "<\?xml version=\"1.0\" encoding=\"UTF-8\"\?>"; +print "<ServiceInfo>"; +print "<IssuerName>"; +print "Fedora Project"; # Vendor +print "</IssuerName>\n"; +print "<Services>"; +print "<Operation>"; +print "http://[SERVER_NAME]:[PORT]/nk_service"; +print "</Operation>"; +print "<UI>"; +print "http://[SERVER_NAME]:[PORT]/cgi-bin/so/enroll.cgi"; +print "</UI>"; +print "<EnrolledTokenBrowserURL>"; +print "</EnrolledTokenBrowserURL>"; +print "<EnrolledTokenURL>"; +print "http://[SERVER_NAME]:[PORT]/cgi-bin/sow/welcome.cgi"; +print "</EnrolledTokenURL>"; +print "<TokenType>"; +print "soKey"; +print "</TokenType>"; +print "</Services>"; +print "</ServiceInfo>"; |