diff options
author | Ermal Luçi <eri@pfsense.org> | 2010-03-10 19:51:37 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2010-03-10 19:51:37 +0000 |
commit | 4cd437f2d9dc62e5c12aab36d91980bb703c8086 (patch) | |
tree | 43932c4b08ccf930515f5093998f52f0663959ea /usr/local/www/wizards/openvpn_wizard.inc | |
parent | 66f773b43317205c102702acbdc9d39c5a3e0e0e (diff) | |
download | pfsense-4cd437f2d9dc62e5c12aab36d91980bb703c8086.zip pfsense-4cd437f2d9dc62e5c12aab36d91980bb703c8086.tar.gz |
Add openvpn server wizard.
Diffstat (limited to 'usr/local/www/wizards/openvpn_wizard.inc')
-rw-r--r-- | usr/local/www/wizards/openvpn_wizard.inc | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/usr/local/www/wizards/openvpn_wizard.inc b/usr/local/www/wizards/openvpn_wizard.inc new file mode 100644 index 0000000..7ec7cfa --- /dev/null +++ b/usr/local/www/wizards/openvpn_wizard.inc @@ -0,0 +1,133 @@ +<?php + +function step2_submitphpaction() { + if ($_POST['authtype'] == "local") { + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=3"); + exit; + } else if ($_POST['authtype'] == "ldap") { + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=1"); + exit; + } else if ($_POST['authtype'] == "radius") { + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=2"); + exit; + } +} + +function step3_stepbeforeformdisplay() { + global $pkg; + + $fields =& $pkg['step'][1]['fields']['field']; + + $authlist = auth_get_authserver_list(); + + $fields[2]['options']['option'] = array(); + foreach ($authlist as $i => $auth) { + if ($auth['type'] != "ldap") + continue; + $opts = array(); + $opts['name'] = $auth['name']; + $opts['value'] = $auth['name']; + $fields[2]['options']['option'][] = $opts; + } +} + +function step3_submitphpaction() { + if (!$_POST['uselist'] && empty($_POST['authserv'])) { + $message = "Please choose an authentication server or create a new one."; + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=1&message={$message}"); + exit; + } else if (!$_POST['uselist'] && !empty($_POST['authserv'])) { + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=3"); + exit; + } + + if (empty($_POST['name']) || empty($_POST['ip']) || empty($_POST['port']) || + empty($_POST['transport']) || empty($_POST['scope']) || empty($_POST['authscope']) || empty($_POST['nameattr'])) { + $message = "Please enter all information for authentication server."; + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=1&message={$message}"); + exit; + } + +} + +function step4_stepbeforeformdisplay() { + global $pkg; + + $fields =& $pkg['step'][2]['fields']['field']; + + $authlist = auth_get_authserver_list(); + + $fields[2]['options']['option'] = array(); + foreach ($authlist as $i => $auth) { + if ($auth['type'] != "radius") + continue; + $opts = array(); + $opts['name'] = $auth['name']; + $opts['value'] = $auth['name']; + $fields[2]['options']['option'][] = $opts; + } +} + +function step4_submitphpaction() { + if ($_POST['uselist'] == "yes" && !empty($_POST['authserv'])) { + $message = "Please choose an authentication server or create a new one."; + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=2&message={$message}"); + exit; + } else if (!$_POST['uselist'] && !empty($_POST['authserv'])) { + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=3"); + exit; + } + + if (empty($_POST['name']) || empty($_POST['ip']) || empty($_POST['port']) || + empty($_POST['passowrd'])) { + $message = "Please enter all information for authentication server."; + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=2&message={$message}"); + exit; + } + +} + +function step5_submitphpaction() { + if ($_POST['uselist'] == "yes" && !empty($_POST['certca'])) { + $message = "Please choose an certificate authority or create a new one."; + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=3&message={$message}"); + exit; + } else if (!$_POST['uselist'] && !empty($_POST['certca'])) { + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=4"); + exit; + } + + if (empty($_POST['name']) || empty($_POST['keylength']) || empty($_POST['lifetime']) || + empty($_POST['country']) || empty($_POST['state']) || empty($_POST['city']) || + empty($_POST['organization']) || empty($_POST['email']) || empty($_POST['cn'])) { + $message = "Please enter all information for the new CA authority."; + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=3&message={$message}"); + exit; + } + +} + +function step6_submitphpaction() { + if ($_POST['uselist'] == "yes" && !empty($_POST['cert'])) { + $message = "Please choose an certificate or create a new one."; + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=4&message={$message}"); + exit; + } else if (!$_POST['uselist'] && !empty($_POST['cert'])) { + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=5"); + exit; + } + + if (empty($_POST['name']) || empty($_POST['keylength']) || empty($_POST['lifetime']) || + empty($_POST['country']) || empty($_POST['state']) || empty($_POST['city']) || + empty($_POST['organization']) || empty($_POST['email']) || empty($_POST['cn'])) { + $message = "Please enter all information for the new certificate."; + header("Location:wizard.php?xml=openvpn_wizard.xml&stepid=4&message={$message}"); + exit; + } + +} + +function step7_submitphpaction() { + +} +?> |