smeserver-openvpn-bridge/root/etc/e-smith/web/functions/openvpnbridge

374 lines
11 KiB
Plaintext
Raw Permalink Normal View History

#! /usr/bin/perl -wT
# vim: ft=xml:
#----------------------------------------------------------------------
# heading : Configuration
# description : OpenVPN-Bridge
# navigation : 6000 6750
#
#----------------------------------------------------------------------
# copyright (C) 2008 Berteaud Daniel
#
# 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; either version 2 of the License, or
# (at your option) any later version.
#
# 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#----------------------------------------------------------------------
use strict;
use esmith::FormMagick;
use esmith::ConfigDB;
use esmith::FormMagick::Panel::openvpnbridge;
my $fm = esmith::FormMagick::Panel::openvpnbridge->new();
my $q = $fm->{cgi};
$fm->display();
__DATA__
<form
title="FORM_TITLE"
header="/etc/e-smith/web/common/head.tmpl"
footer="/etc/e-smith/web/common/foot.tmpl">
<page name="FIRST"
pre-event="print_status_message()">
<field
type="literal"
id="first_desc"
value="">
<description>DESC_FIRST_PAGE</description>
</field>
<field
type="literal"
id="current_status"
display=""
value="get_status()">
<label>LABEL_STATUS</label>
</field>
<field
type="literal"
id="current_link_status"
display=""
value="print_link_status()">
<label>LINK</label>
</field>
<field
type="literal"
id="current_auth_type"
display=""
value="get_auth_type()">
<label>LABEL_AUTH_TYPE</label>
</field>
<field
type="literal"
id="current_ip_pool"
display=""
value="get_ip_pool()">
<label>LABEL_IP_POOL</label>
</field>
<field
type="literal"
id="current_crt_status"
display=""
value="print_crt_not_ready_warning()">
<label>LABEL_CRT_STATUS</label>
</field>
<field
type="literal"
id="current_hmac_status"
display=""
value="get_hmac_status()">
<label>LABEL_HMAC</label>
</field>
<field
type="literal"
id="current_cipher_status"
display=""
value="get_cipher_status()">
<label>LABEL_CIPHER</label>
</field>
<subroutine src="print_section_bar()" />
<subroutine src="print_custom_button('DESC_RULE_BUTTON','RULES_PAGE')"/>
<subroutine src="print_custom_button('SHOW_SAMPLE_CONFIG','DISPLAY_CLIENT_CONF_PAGE')"/>
<subroutine src="print_custom_button('DESC_SHOW_CLIENTS_BUTTON','SHOW_CLIENTS_PAGE')"/>
<subroutine src="print_section_bar()" />
<subroutine src="print_custom_button('DESC_CONFIG_BUTTON','CONFIG_PAGE')"/>
<subroutine src="print_custom_button('DESC_CRT_CONFIG_BUTTON','CRT_CONFIG_PAGE')" />
</page>
<page name="CONFIG_PAGE"
pre-event="print_status_message()"
post-event="apply_settings()">
<field
type="literal"
id="first_desc"
value="">
<description>DESC_CONFIG_PAGE</description>
</field>
<field type="select"
id="status"
options="'enabled' => 'ENABLED', 'disabled' => 'DISABLED'"
value="get_prop('status')">
<label>LABEL_STATUS</label>
<description>DESC_STATUS</description>
</field>
<field type="select"
id="auth_type"
options="'CrtOnly' => 'CRT_ONLY', 'CrtWithPass' => 'CRT_WITH_PASS'"
value="get_prop('userAuth')">
<label>LABEL_AUTH_TYPE</label>
<description>DESC_AUTH_TYPE</description>
</field>
<field type="text"
id="start_pool"
value="get_prop('startPool')"
validation="ip_is_in_local_net, not_in_dhcp_range">
<label>LABEL_START_POOL</label>
<description>DESC_START_POOL</description>
</field>
<field type="text"
id="end_pool"
value="get_prop('endPool')"
validation="ip_is_in_local_net, not_in_dhcp_range">
<label>LABEL_END_POOL</label>
<description>DESC_END_POOL</description>
</field>
<field type="select" id="hmac" options="get_digests_options()" value="get_current_hmac()">
<description>DESC_HMAC</description>
<label>LABEL_HMAC</label>
</field>
<field type="select" id="cipher" options="get_ciphers_options()" value="get_current_cipher()">
<description>DESC_CIPHER</description>
<label>LABEL_CIPHER</label>
</field>
<subroutine src="print_button('SAVE')" />
</page>
// Règles
// Page d'accueil, liste des certificats
<page name="RULES_PAGE"
pre-event="print_status_message">
<field
type="literal"
id="desc_rules_page"
value="">
<description>DESC_RULES_PAGE</description>
</field>
<subroutine
src="print_custom_button(
'DESC_ADD_RULE_BUTTON',
'CREATE_OR_MODIFY_RULE_PAGE'
)"
/>
<field
type="literal"
id="desc_rules"
value="">
<description>DESC_RULES</description>
</field>
<subroutine src="print_rules()" />
</page>
// Ajout ou modif d'une règle
<page name="CREATE_OR_MODIFY_RULE_PAGE"
pre-event="turn_off_buttons()"
post-event="create_or_modify_rule()">
<field
type="literal"
id="desc_add_rule"
value="">
<description>DESC_ADD_OR_MODIFY_PAGE</description>
</field>
<subroutine src="print_common_name_field()" />
<field type="text"
id="comment">
<label>COMMENT</label>
<description>DESC_COMMENT</description>
</field>
<field type="text"
id="reserved_ip"
validation="ip_is_in_local_net_or_blank, not_in_dhcp_range">
<label>LABEL_RESERVED_IP</label>
<description>DESC_RESERVED_IP</description>
</field>
<field type="select"
id="gw_redirection"
options="'enabled' => 'ENABLED', 'disabled' => 'DISABLED'" >
<label>LABEL_GW_REDIRECTION</label>
<description>DESC_GW_REDIRECTION</description>
</field>
<field type="select"
id="access"
options="'allowed' => 'ALLOWED', 'denied' => 'DENIED'" >
<label>ACCESS</label>
<description>DESC_ACCESS</description>
</field>
<subroutine src="print_button('SAVE')"/>
</page>
// Révocation d'un certificat client
<page name="REMOVE_RULE_PAGE"
pre-event="turn_off_buttons()"
post-event="remove_rule()">
<field type="literal"
id="desc_remove_rule"
value="">
<description>DESC_REMOVE_PAGE</description>
</field>
<subroutine src="print_rule_to_remove()" />
</page>
// Display de la config
<page name="DISPLAY_CLIENT_CONF_PAGE">
<subroutine src="turn_off_buttons()" />
<field type="literal"
id="desc_create_client_conf"
value="">
<description>DESC_DISPLAY_CLIENT_CONF</description>
</field>
<subroutine src="print_client_config()" />
</page>
// Configuration initiale
// CA
<page name="CRT_CONFIG_PAGE"
pre-event="turn_off_buttons()"
post-event="write_pem()">
<field type="literal"
id="desc_initial_config"
value="">
<description>DESC_CRT_CONFIG_PAGE</description>
</field>
<field type="text"
id="crl_url"
size="60"
value="get_prop('CrlUrl')"
validation="is_url">
<label>LABEL_CRL_URL</label>
<description>DESC_CRL_URL</description>
</field>
<field type="textarea"
id="ca_pem"
rows="15"
cols="70"
value="read_pem('cacert.pem')">
<label>LABEL_CA_PEM</label>
<description>DESC_CA_PEM</description>
</field>
<field type="textarea"
id="crt_pem"
rows="15"
cols="70"
value="read_pem('cert.pem')">
<label>LABEL_CRT_PEM</label>
<description>DESC_CRT_PEM</description>
</field>
<field type="textarea"
id="key_pem"
rows="15"
cols="70"
value="read_pem('key.pem')">
<label>LABEL_KEY_PEM</label>
<description>DESC_KEY_PEM</description>
</field>
<field type="textarea"
id="dhpar_pem"
rows="15"
cols="70"
value="read_pem('dh.pem')">
<label>LABEL_DH_PEM</label>
<description>DESC_DH_PEM</description>
</field>
<field type="textarea"
id="ta_pem"
rows="15"
cols="70"
value="read_pem('takey.pem')">
<label>LABEL_TA_PEM</label>
<description>DESC_TA_PEM</description>
</field>
<subroutine src="print_button('SAVE')" />
</page>
// Clients connectés
<page name="SHOW_CLIENTS_PAGE"
pre-event="print_status_message()">
<description>DESC_CONNECTED_CLIENTS_PAGE</description>
<subroutine
src="print_custom_button(
'REFRESH',
'SHOW_CLIENTS_PAGE'
)"
/>
<subroutine src="print_clients_table()" />
</page>
// Déconnecter un client
<page name="CLIENT_DISCONNECT_PAGE"
pre-event="turn_off_buttons()"
post-event="disconnect_client()">
<field type="literal"
id="desc_client_disconnect"
value="">
<description>DESC_CLIENT_DISCONECT_PAGE</description>
</field>
<subroutine src="print_client_to_disconnect()" />
</page>
</form>