added subnets of CHILD_SAs to xml interface
a first design of Managers IKE_SA list page
@@ -145,6 +145,41 @@ static void write_address(xmlTextWriterPtr writer, char *element, host_t *host)
|
|||||||
xmlTextWriterEndElement(writer);
|
xmlTextWriterEndElement(writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* write a list of traffic_selector_t
|
||||||
|
*/
|
||||||
|
static void write_ts(xmlTextWriterPtr writer, linked_list_t *list)
|
||||||
|
{
|
||||||
|
iterator_t *iterator;
|
||||||
|
traffic_selector_t *ts;
|
||||||
|
|
||||||
|
iterator = list->create_iterator(list, TRUE);
|
||||||
|
while (iterator->iterate(iterator, (void**)&ts))
|
||||||
|
{
|
||||||
|
xmlTextWriterStartElement(writer, "net");
|
||||||
|
xmlTextWriterWriteAttribute(writer, "type",
|
||||||
|
ts->get_type(ts) == TS_IPV4_ADDR_RANGE ? "ipv4" : "ipv6");
|
||||||
|
xmlTextWriterWriteFormatString(writer, "%R", ts);
|
||||||
|
xmlTextWriterEndElement(writer);
|
||||||
|
}
|
||||||
|
iterator->destroy(iterator);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* write a child_sa_t
|
||||||
|
*/
|
||||||
|
static void write_child(xmlTextWriterPtr writer, child_sa_t *child)
|
||||||
|
{
|
||||||
|
xmlTextWriterStartElement(writer, "childsa");
|
||||||
|
xmlTextWriterStartElement(writer, "local");
|
||||||
|
write_ts(writer, child->get_traffic_selectors(child, TRUE));
|
||||||
|
xmlTextWriterEndElement(writer);
|
||||||
|
xmlTextWriterStartElement(writer, "remote");
|
||||||
|
write_ts(writer, child->get_traffic_selectors(child, FALSE));
|
||||||
|
xmlTextWriterEndElement(writer);
|
||||||
|
xmlTextWriterEndElement(writer);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* process a ikesalist query request message
|
* process a ikesalist query request message
|
||||||
*/
|
*/
|
||||||
@@ -214,7 +249,7 @@ static void request_query_ikesa(xmlTextReaderPtr reader, xmlTextWriterPtr writer
|
|||||||
children = ike_sa->create_child_sa_iterator(ike_sa);
|
children = ike_sa->create_child_sa_iterator(ike_sa);
|
||||||
while (children->iterate(children, (void**)&child_sa))
|
while (children->iterate(children, (void**)&child_sa))
|
||||||
{
|
{
|
||||||
/* TODO: Children */
|
write_child(writer, child_sa);
|
||||||
}
|
}
|
||||||
children->destroy(children);
|
children->destroy(children);
|
||||||
/* </childsalist> */
|
/* </childsalist> */
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ ipsec_PROGRAMS = manager.fcgi
|
|||||||
manager_fcgi_SOURCES = \
|
manager_fcgi_SOURCES = \
|
||||||
main.c manager.c manager.h gateway.h gateway.c database.h database.c \
|
main.c manager.c manager.h gateway.h gateway.c database.h database.c \
|
||||||
controller/auth_controller.c controller/auth_controller.h \
|
controller/auth_controller.c controller/auth_controller.h \
|
||||||
controller/static_controller.c controller/static_controller.h \
|
|
||||||
controller/status_controller.c controller/status_controller.h \
|
controller/status_controller.c controller/status_controller.h \
|
||||||
controller/gateway_controller.c controller/gateway_controller.h
|
controller/gateway_controller.c controller/gateway_controller.h
|
||||||
|
|
||||||
@@ -21,6 +20,7 @@ lib/template.h lib/template.c lib/dict.h lib/dict.c lib/xml.h lib/xml.c lib/enum
|
|||||||
libappserv_la_LDFLAGS = -lstrongswan -lfcgi -lpthread -lneo_cs -lneo_utl ${xml_LIBS}
|
libappserv_la_LDFLAGS = -lstrongswan -lfcgi -lpthread -lneo_cs -lneo_utl ${xml_LIBS}
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/manager/lib -I/usr/include/ClearSilver ${xml_CFLAGS}
|
INCLUDES = -I$(top_srcdir)/src/libstrongswan -I$(top_srcdir)/src/manager/lib -I/usr/include/ClearSilver ${xml_CFLAGS}
|
||||||
|
AM_CFLAGS = -rdynamic -DIPSECDIR=\"${ipsecdir}\" -DIPSEC_PIDDIR=\"${piddir}\"
|
||||||
|
|
||||||
ipsec_DATA = sqlite.db
|
ipsec_DATA = sqlite.db
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ ipsec_templatesdir = ${ipsecdir}/templates
|
|||||||
ipsec_templates_DATA = templates/header.cs templates/footer.cs
|
ipsec_templates_DATA = templates/header.cs templates/footer.cs
|
||||||
|
|
||||||
ipsec_templates_authdir = ${ipsec_templatesdir}/auth
|
ipsec_templates_authdir = ${ipsec_templatesdir}/auth
|
||||||
ipsec_templates_auth_DATA = templates/auth/login.cs templates/auth/logout.cs
|
ipsec_templates_auth_DATA = templates/auth/login.cs
|
||||||
|
|
||||||
ipsec_templates_gatewaydir = ${ipsec_templatesdir}/gateway
|
ipsec_templates_gatewaydir = ${ipsec_templatesdir}/gateway
|
||||||
ipsec_templates_gateway_DATA = templates/gateway/list.cs
|
ipsec_templates_gateway_DATA = templates/gateway/list.cs
|
||||||
@@ -37,6 +37,9 @@ ipsec_templates_gateway_DATA = templates/gateway/list.cs
|
|||||||
ipsec_templates_statusdir = ${ipsec_templatesdir}/status
|
ipsec_templates_statusdir = ${ipsec_templatesdir}/status
|
||||||
ipsec_templates_status_DATA = templates/status/ikesalist.cs
|
ipsec_templates_status_DATA = templates/status/ikesalist.cs
|
||||||
|
|
||||||
|
ipsec_templates_staticdir = ${ipsec_templatesdir}/static
|
||||||
|
ipsec_templates_static_DATA = templates/static/style.css templates/static/script.js
|
||||||
|
|
||||||
EXTRA_DIST = sqlite.db templates/header.cs templates/footer.cs \
|
EXTRA_DIST = sqlite.db templates/header.cs templates/footer.cs \
|
||||||
templates/auth/login.cs templates/auth/logout.cs \
|
templates/auth/login.cs templates/auth/logout.cs \
|
||||||
templates/gateway/list.cs templates/status/ikesalist.cs
|
templates/gateway/list.cs templates/status/ikesalist.cs
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ static void login(private_auth_controller_t *this,
|
|||||||
{
|
{
|
||||||
template_t *t = template_create("templates/auth/login.cs");
|
template_t *t = template_create("templates/auth/login.cs");
|
||||||
t->set(t, "action", "check");
|
t->set(t, "action", "check");
|
||||||
|
t->set(t, "title", "Login");
|
||||||
t->render(t, response);
|
t->render(t, response);
|
||||||
t->destroy(t);
|
t->destroy(t);
|
||||||
}
|
}
|
||||||
@@ -65,7 +66,7 @@ static void check(private_auth_controller_t *this,
|
|||||||
if (username && password &&
|
if (username && password &&
|
||||||
this->manager->login(this->manager, username, password))
|
this->manager->login(this->manager, username, password))
|
||||||
{
|
{
|
||||||
response->redirect(response, "status/test");
|
response->redirect(response, "status/ikesalist");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -89,14 +90,27 @@ static char* get_name(private_auth_controller_t *this)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of controller_t.get_handler
|
* Implementation of controller_t.handle
|
||||||
*/
|
*/
|
||||||
static controller_handler_t get_handler(private_auth_controller_t *this, char *name)
|
static void handle(private_auth_controller_t *this,
|
||||||
|
request_t *request, response_t *response, char *action)
|
||||||
{
|
{
|
||||||
if (streq(name, "login")) return (controller_handler_t)login;
|
if (action)
|
||||||
if (streq(name, "check")) return (controller_handler_t)check;
|
{
|
||||||
if (streq(name, "logout")) return (controller_handler_t)logout;
|
if (streq(action, "login"))
|
||||||
return NULL;
|
{
|
||||||
|
return login(this, request, response);
|
||||||
|
}
|
||||||
|
else if (streq(action, "check"))
|
||||||
|
{
|
||||||
|
return check(this, request, response);
|
||||||
|
}
|
||||||
|
else if (streq(action, "logout"))
|
||||||
|
{
|
||||||
|
return logout(this, request, response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response->redirect(response, "auth/login");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,7 +129,7 @@ controller_t *auth_controller_create(context_t *context, void *param)
|
|||||||
private_auth_controller_t *this = malloc_thing(private_auth_controller_t);
|
private_auth_controller_t *this = malloc_thing(private_auth_controller_t);
|
||||||
|
|
||||||
this->public.controller.get_name = (char*(*)(controller_t*))get_name;
|
this->public.controller.get_name = (char*(*)(controller_t*))get_name;
|
||||||
this->public.controller.get_handler = (controller_handler_t(*)(controller_t*,char*))get_handler;
|
this->public.controller.handle = (void(*)(controller_t*,request_t*,response_t*,char*,char*,char*,char*,char*))handle;
|
||||||
this->public.controller.destroy = (void(*)(controller_t*))destroy;
|
this->public.controller.destroy = (void(*)(controller_t*))destroy;
|
||||||
|
|
||||||
this->manager = (manager_t*)context;
|
this->manager = (manager_t*)context;
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ static void list(private_gateway_controller_t *this,
|
|||||||
}
|
}
|
||||||
enumerator->destroy(enumerator);
|
enumerator->destroy(enumerator);
|
||||||
t->set(t, "action", "select");
|
t->set(t, "action", "select");
|
||||||
|
t->set(t, "title", "Choose gateway");
|
||||||
t->render(t, response);
|
t->render(t, response);
|
||||||
t->destroy(t);
|
t->destroy(t);
|
||||||
}
|
}
|
||||||
@@ -90,16 +91,7 @@ static void _select(private_gateway_controller_t *this,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
response->printf(response, "selecting dings failed: %s", id);
|
response->printf(response, "selecting gateway failed: %s", id);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* redirect to authentication login
|
|
||||||
*/
|
|
||||||
static void login(private_gateway_controller_t *this,
|
|
||||||
request_t *request, response_t *response)
|
|
||||||
{
|
|
||||||
response->redirect(response, "auth/login");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,16 +103,30 @@ static char* get_name(private_gateway_controller_t *this)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of controller_t.get_handler
|
* Implementation of controller_t.handle
|
||||||
*/
|
*/
|
||||||
static controller_handler_t get_handler(private_gateway_controller_t *this, char *name)
|
static void handle(private_gateway_controller_t *this,
|
||||||
|
request_t *request, response_t *response, char *action)
|
||||||
{
|
{
|
||||||
if (!this->manager->logged_in(this->manager)) return (controller_handler_t)login;
|
if (!this->manager->logged_in(this->manager))
|
||||||
if (streq(name, "list")) return (controller_handler_t)list;
|
{
|
||||||
if (streq(name, "select")) return (controller_handler_t)_select;
|
return response->redirect(response, "auth/login");
|
||||||
return NULL;
|
}
|
||||||
|
if (action)
|
||||||
|
{
|
||||||
|
if (streq(action, "list"))
|
||||||
|
{
|
||||||
|
return list(this, request, response);
|
||||||
|
}
|
||||||
|
else if (streq(action, "select"))
|
||||||
|
{
|
||||||
|
return _select(this, request, response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response->redirect(response, "gateway/list");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of controller_t.destroy
|
* Implementation of controller_t.destroy
|
||||||
*/
|
*/
|
||||||
@@ -137,7 +143,7 @@ controller_t *gateway_controller_create(context_t *context, void *param)
|
|||||||
private_gateway_controller_t *this = malloc_thing(private_gateway_controller_t);
|
private_gateway_controller_t *this = malloc_thing(private_gateway_controller_t);
|
||||||
|
|
||||||
this->public.controller.get_name = (char*(*)(controller_t*))get_name;
|
this->public.controller.get_name = (char*(*)(controller_t*))get_name;
|
||||||
this->public.controller.get_handler = (controller_handler_t(*)(controller_t*,char*))get_handler;
|
this->public.controller.handle = (void(*)(controller_t*,request_t*,response_t*,char*,char*,char*,char*,char*))handle;
|
||||||
this->public.controller.destroy = (void(*)(controller_t*))destroy;
|
this->public.controller.destroy = (void(*)(controller_t*))destroy;
|
||||||
|
|
||||||
this->manager = (manager_t*)context;
|
this->manager = (manager_t*)context;
|
||||||
|
|||||||
@@ -1,103 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file static_controller.c
|
|
||||||
*
|
|
||||||
* @brief Implementation of static_controller_t.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2007 Martin Willi
|
|
||||||
* Hochschule fuer Technik Rapperswil
|
|
||||||
*
|
|
||||||
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "static_controller.h"
|
|
||||||
#include "../manager.h"
|
|
||||||
#include "../gateway.h"
|
|
||||||
|
|
||||||
#include <template.h>
|
|
||||||
|
|
||||||
#include <library.h>
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct private_static_controller_t private_static_controller_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* private data of the task manager
|
|
||||||
*/
|
|
||||||
struct private_static_controller_t {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* public functions
|
|
||||||
*/
|
|
||||||
static_controller_t public;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* manager instance
|
|
||||||
*/
|
|
||||||
manager_t *manager;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* serve style.css
|
|
||||||
*/
|
|
||||||
static void style(private_static_controller_t *this,
|
|
||||||
request_t *request, response_t *response)
|
|
||||||
{
|
|
||||||
template_t *t = template_create("templates/static/style.css");
|
|
||||||
response->set_content_type(response, "text/css");
|
|
||||||
t->render(t, response);
|
|
||||||
t->destroy(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of controller_t.get_name
|
|
||||||
*/
|
|
||||||
static char* get_name(private_static_controller_t *this)
|
|
||||||
{
|
|
||||||
return "static";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of controller_t.get_handler
|
|
||||||
*/
|
|
||||||
static controller_handler_t get_handler(private_static_controller_t *this, char *name)
|
|
||||||
{
|
|
||||||
if (streq(name, "style.css")) return (controller_handler_t)style;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of controller_t.destroy
|
|
||||||
*/
|
|
||||||
static void destroy(private_static_controller_t *this)
|
|
||||||
{
|
|
||||||
free(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* see header file
|
|
||||||
*/
|
|
||||||
controller_t *static_controller_create(context_t *context, void *param)
|
|
||||||
{
|
|
||||||
private_static_controller_t *this = malloc_thing(private_static_controller_t);
|
|
||||||
|
|
||||||
this->public.controller.get_name = (char*(*)(controller_t*))get_name;
|
|
||||||
this->public.controller.get_handler = (controller_handler_t(*)(controller_t*,char*))get_handler;
|
|
||||||
this->public.controller.destroy = (void(*)(controller_t*))destroy;
|
|
||||||
|
|
||||||
this->manager = (manager_t*)context;
|
|
||||||
|
|
||||||
return &this->public.controller;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file static_controller.h
|
|
||||||
*
|
|
||||||
* @brief Interface of static_controller_t.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2007 Martin Willi
|
|
||||||
* Hochschule fuer Technik Rapperswil
|
|
||||||
*
|
|
||||||
* 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. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
||||||
*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef STATIC_CONTROLLER_H_
|
|
||||||
#define STATIC_CONTROLLER_H_
|
|
||||||
|
|
||||||
|
|
||||||
#include <controller.h>
|
|
||||||
|
|
||||||
typedef struct static_controller_t static_controller_t;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Static controller, serves static files.
|
|
||||||
*/
|
|
||||||
struct static_controller_t {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements controller_t interface.
|
|
||||||
*/
|
|
||||||
controller_t controller;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Create a static_controller controller instance.
|
|
||||||
*/
|
|
||||||
controller_t *static_controller_create(context_t *context, void *param);
|
|
||||||
|
|
||||||
#endif /* STATIC_CONTROLLER_H_ */
|
|
||||||
@@ -53,9 +53,9 @@ static void ikesalist(private_status_controller_t *this,
|
|||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
gateway_t *gateway;
|
gateway_t *gateway;
|
||||||
xml_t *doc, *node;
|
xml_t *node;
|
||||||
enumerator_t *e1, *e2, *e3, *e4, *e5, *e6;
|
enumerator_t *e1, *e2, *e3, *e4, *e5, *e6, *e7, *e8;
|
||||||
char *name, *value, *id, *section;
|
char *name, *value, *id = "", *section;
|
||||||
|
|
||||||
gateway = this->manager->select_gateway(this->manager, 0);
|
gateway = this->manager->select_gateway(this->manager, 0);
|
||||||
str = gateway->request(gateway, "<message type=\"request\" id=\"1\">"
|
str = gateway->request(gateway, "<message type=\"request\" id=\"1\">"
|
||||||
@@ -69,8 +69,8 @@ static void ikesalist(private_status_controller_t *this,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
doc = xml_create(str);
|
node = xml_create(str);
|
||||||
if (doc == NULL)
|
if (node == NULL)
|
||||||
{
|
{
|
||||||
response->printf(response, "parsing XML failed");
|
response->printf(response, "parsing XML failed");
|
||||||
return;
|
return;
|
||||||
@@ -78,7 +78,7 @@ static void ikesalist(private_status_controller_t *this,
|
|||||||
|
|
||||||
template_t *t = template_create("templates/status/ikesalist.cs");
|
template_t *t = template_create("templates/status/ikesalist.cs");
|
||||||
|
|
||||||
e1 = doc->children(doc);
|
e1 = node->children(node);
|
||||||
while (e1->enumerate(e1, &node, &name, &value))
|
while (e1->enumerate(e1, &node, &name, &value))
|
||||||
{
|
{
|
||||||
if (streq(name, "message"))
|
if (streq(name, "message"))
|
||||||
@@ -116,6 +116,33 @@ static void ikesalist(private_status_controller_t *this,
|
|||||||
}
|
}
|
||||||
e6->destroy(e6);
|
e6->destroy(e6);
|
||||||
}
|
}
|
||||||
|
else if (streq(name, "childsalist"))
|
||||||
|
{
|
||||||
|
e6 = node->children(node);
|
||||||
|
while (e6->enumerate(e6, &node, &name, &value))
|
||||||
|
{
|
||||||
|
if (streq(name, "childsa"))
|
||||||
|
{
|
||||||
|
e7 = node->children(node);
|
||||||
|
while (e7->enumerate(e7, &node, &name, &value))
|
||||||
|
{
|
||||||
|
if (streq(name, "local") ||
|
||||||
|
streq(name, "remote"))
|
||||||
|
{
|
||||||
|
section = name;
|
||||||
|
e8 = node->children(node);
|
||||||
|
while (e8->enumerate(e8, &node, &name, &value))
|
||||||
|
{
|
||||||
|
t->setf(t, "ikesas.%s.childsas.%s.%s=%s", id, section, name, value);
|
||||||
|
}
|
||||||
|
e8->destroy(e8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e7->destroy(e7);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e6->destroy(e6);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
t->setf(t, "ikesas.%s.%s=%s", id, name, value);
|
t->setf(t, "ikesas.%s.%s=%s", id, name, value);
|
||||||
@@ -135,29 +162,12 @@ static void ikesalist(private_status_controller_t *this,
|
|||||||
}
|
}
|
||||||
e1->destroy(e1);
|
e1->destroy(e1);
|
||||||
|
|
||||||
|
t->set(t, "title", "IKE SA overview");
|
||||||
t->render(t, response);
|
t->render(t, response);
|
||||||
t->destroy(t);
|
t->destroy(t);
|
||||||
free(str);
|
free(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* redirect to authentication login
|
|
||||||
*/
|
|
||||||
static void login(private_status_controller_t *this,
|
|
||||||
request_t *request, response_t *response)
|
|
||||||
{
|
|
||||||
response->redirect(response, "auth/login");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* redirect to gateway selection
|
|
||||||
*/
|
|
||||||
static void selection(private_status_controller_t *this,
|
|
||||||
request_t *request, response_t *response)
|
|
||||||
{
|
|
||||||
response->redirect(response, "gateway/list");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of controller_t.get_name
|
* Implementation of controller_t.get_name
|
||||||
*/
|
*/
|
||||||
@@ -167,14 +177,27 @@ static char* get_name(private_status_controller_t *this)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of controller_t.get_handler
|
* Implementation of controller_t.handle
|
||||||
*/
|
*/
|
||||||
static controller_handler_t get_handler(private_status_controller_t *this, char *name)
|
static void handle(private_status_controller_t *this,
|
||||||
|
request_t *request, response_t *response, char *action)
|
||||||
{
|
{
|
||||||
if (!this->manager->logged_in(this->manager)) return (controller_handler_t)login;
|
if (!this->manager->logged_in(this->manager))
|
||||||
if (this->manager->select_gateway(this->manager, 0) == NULL) return (controller_handler_t)selection;
|
{
|
||||||
if (streq(name, "ikesalist")) return (controller_handler_t)ikesalist;
|
return response->redirect(response, "auth/login");
|
||||||
return NULL;
|
}
|
||||||
|
if (this->manager->select_gateway(this->manager, 0) == NULL)
|
||||||
|
{
|
||||||
|
return response->redirect(response, "gateway/list");
|
||||||
|
}
|
||||||
|
if (action)
|
||||||
|
{
|
||||||
|
if (streq(action, "ikesalist"))
|
||||||
|
{
|
||||||
|
return ikesalist(this, request, response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return response->redirect(response, "status/ikesalist");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -193,7 +216,7 @@ controller_t *status_controller_create(context_t *context, void *param)
|
|||||||
private_status_controller_t *this = malloc_thing(private_status_controller_t);
|
private_status_controller_t *this = malloc_thing(private_status_controller_t);
|
||||||
|
|
||||||
this->public.controller.get_name = (char*(*)(controller_t*))get_name;
|
this->public.controller.get_name = (char*(*)(controller_t*))get_name;
|
||||||
this->public.controller.get_handler = (controller_handler_t(*)(controller_t*,char*))get_handler;
|
this->public.controller.handle = (void(*)(controller_t*,request_t*,response_t*,char*,char*,char*,char*,char*))handle;
|
||||||
this->public.controller.destroy = (void(*)(controller_t*))destroy;
|
this->public.controller.destroy = (void(*)(controller_t*))destroy;
|
||||||
|
|
||||||
this->manager = (manager_t*)context;
|
this->manager = (manager_t*)context;
|
||||||
|
|||||||
@@ -59,12 +59,23 @@ struct controller_t {
|
|||||||
char* (*get_name)(controller_t *this);
|
char* (*get_name)(controller_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the controllers handler function for an action name.
|
* @brief Handle a HTTP request for that controller.
|
||||||
*
|
*
|
||||||
* @param name name of the action
|
* Request URLs are parsed in the form
|
||||||
* @return controllers handler
|
* controller_name/p1/p2/p3/p4/p5 with a maximum of 5 parameters. Each
|
||||||
|
* parameter not found in the request URL is set to NULL.
|
||||||
|
*
|
||||||
|
* @param request HTTP request
|
||||||
|
* @param response HTTP response
|
||||||
|
* @param p1 first parameter
|
||||||
|
* @param p2 second parameter
|
||||||
|
* @param p3 third parameter
|
||||||
|
* @param p4 forth parameter
|
||||||
|
* @param p5 fifth parameter
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
controller_handler_t (*get_handler)(controller_t *this, char *name);
|
void (*handle)(controller_t *this, request_t *request, response_t *response,
|
||||||
|
char *a1, char *a2, char *a3, char *a4, char *a5);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroy the controller instance.
|
* @brief Destroy the controller instance.
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ static session_entry_t *session_entry_create(private_dispatcher_t *this)
|
|||||||
entry->waiting = 1;
|
entry->waiting = 1;
|
||||||
pthread_cond_init(&entry->cond, NULL);
|
pthread_cond_init(&entry->cond, NULL);
|
||||||
entry->session = load_session(this);
|
entry->session = load_session(this);
|
||||||
|
entry->used = time(NULL);
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@@ -208,16 +209,19 @@ static void dispatch(private_dispatcher_t *this)
|
|||||||
iterator = this->sessions->create_iterator_locked(this->sessions, &this->mutex);
|
iterator = this->sessions->create_iterator_locked(this->sessions, &this->mutex);
|
||||||
while (iterator->iterate(iterator, (void**)¤t))
|
while (iterator->iterate(iterator, (void**)¤t))
|
||||||
{
|
{
|
||||||
if (sid && streq(current->session->get_sid(current->session), sid))
|
/* check all sessions for timeout */
|
||||||
{
|
if (current->waiting == 0 &&
|
||||||
found = current;
|
current->used < now - this->timeout)
|
||||||
found->waiting++;
|
|
||||||
}
|
|
||||||
else if (current->waiting == 0 &&
|
|
||||||
current->used + this->timeout > now)
|
|
||||||
{
|
{
|
||||||
iterator->remove(iterator);
|
iterator->remove(iterator);
|
||||||
session_entry_destroy(current);
|
session_entry_destroy(current);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!found && sid &&
|
||||||
|
streq(current->session->get_sid(current->session), sid))
|
||||||
|
{
|
||||||
|
found = current;
|
||||||
|
found->waiting++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iterator->destroy(iterator);
|
iterator->destroy(iterator);
|
||||||
@@ -319,7 +323,8 @@ static void destroy(private_dispatcher_t *this)
|
|||||||
/*
|
/*
|
||||||
* see header file
|
* see header file
|
||||||
*/
|
*/
|
||||||
dispatcher_t *dispatcher_create(context_constructor_t constructor, void *param)
|
dispatcher_t *dispatcher_create(int timeout, context_constructor_t constructor,
|
||||||
|
void *param)
|
||||||
{
|
{
|
||||||
private_dispatcher_t *this = malloc_thing(private_dispatcher_t);
|
private_dispatcher_t *this = malloc_thing(private_dispatcher_t);
|
||||||
|
|
||||||
@@ -334,7 +339,7 @@ dispatcher_t *dispatcher_create(context_constructor_t constructor, void *param)
|
|||||||
pthread_mutex_init(&this->mutex, NULL);
|
pthread_mutex_init(&this->mutex, NULL);
|
||||||
this->param = param;
|
this->param = param;
|
||||||
this->fd = 0;
|
this->fd = 0;
|
||||||
this->timeout = 180;
|
this->timeout = timeout;
|
||||||
|
|
||||||
FCGX_Init();
|
FCGX_Init();
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ struct dispatcher_t {
|
|||||||
/**
|
/**
|
||||||
* @brief Register a controller to the dispatcher.
|
* @brief Register a controller to the dispatcher.
|
||||||
*
|
*
|
||||||
|
* The first controller added serves as default controller. Client's
|
||||||
|
* get redirected to it if no other controller matches.
|
||||||
|
*
|
||||||
* @param constructor constructor function to the conntroller
|
* @param constructor constructor function to the conntroller
|
||||||
* @param param param to pass to constructor
|
* @param param param to pass to constructor
|
||||||
*/
|
*/
|
||||||
@@ -70,9 +73,11 @@ struct dispatcher_t {
|
|||||||
* The context constructor is invoked to create a session context for
|
* The context constructor is invoked to create a session context for
|
||||||
* each session.
|
* each session.
|
||||||
*
|
*
|
||||||
|
* @param timeout session timeout
|
||||||
* @param constructor construction function for session context
|
* @param constructor construction function for session context
|
||||||
* @param param parameter to supply to context constructor
|
* @param param parameter to supply to context constructor
|
||||||
*/
|
*/
|
||||||
dispatcher_t *dispatcher_create(context_constructor_t constructor, void *param);
|
dispatcher_t *dispatcher_create(int timeout,
|
||||||
|
context_constructor_t constructor, void *param);
|
||||||
|
|
||||||
#endif /* DISPATCHER_H_ */
|
#endif /* DISPATCHER_H_ */
|
||||||
|
|||||||
@@ -186,6 +186,15 @@ static void redirect(private_response_t *this, char *location)
|
|||||||
*location == '/' ? "" : "/", location);
|
*location == '/' ? "" : "/", location);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of response_t.get_base.
|
||||||
|
*/
|
||||||
|
static char* get_base(private_response_t *this)
|
||||||
|
{
|
||||||
|
return FCGX_GetParam("SCRIPT_NAME", this->req->envp);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of response_t.destroy
|
* Implementation of response_t.destroy
|
||||||
*/
|
*/
|
||||||
@@ -210,6 +219,7 @@ response_t *response_create(FCGX_Request *request)
|
|||||||
this->public.set_content_type = (void(*)(response_t*, char *type))set_content_type;
|
this->public.set_content_type = (void(*)(response_t*, char *type))set_content_type;
|
||||||
this->public.add_cookie = (void(*)(response_t*, char *name, char *value))add_cookie;
|
this->public.add_cookie = (void(*)(response_t*, char *name, char *value))add_cookie;
|
||||||
this->public.redirect = (void(*)(response_t*, char *location))redirect;
|
this->public.redirect = (void(*)(response_t*, char *location))redirect;
|
||||||
|
this->public.get_base = (char*(*)(response_t*))get_base;
|
||||||
this->public.destroy = (void(*)(response_t*))destroy;
|
this->public.destroy = (void(*)(response_t*))destroy;
|
||||||
|
|
||||||
this->req = request;
|
this->req = request;
|
||||||
|
|||||||
@@ -79,6 +79,13 @@ struct response_t {
|
|||||||
*/
|
*/
|
||||||
void (*redirect)(response_t *this, char *location);
|
void (*redirect)(response_t *this, char *location);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the base path of the application.
|
||||||
|
*
|
||||||
|
* @return base path
|
||||||
|
*/
|
||||||
|
char* (*get_base)(response_t *this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Destroy a response_t.
|
* @brief Destroy a response_t.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -91,7 +91,6 @@ static void process(private_session_t *this,
|
|||||||
char *pos, *path, *controller, *action;
|
char *pos, *path, *controller, *action;
|
||||||
iterator_t *iterator;
|
iterator_t *iterator;
|
||||||
bool handled = FALSE;
|
bool handled = FALSE;
|
||||||
controller_handler_t handler;
|
|
||||||
controller_t *current;
|
controller_t *current;
|
||||||
|
|
||||||
if (this->sid == NULL)
|
if (this->sid == NULL)
|
||||||
@@ -126,12 +125,8 @@ static void process(private_session_t *this,
|
|||||||
{
|
{
|
||||||
if (streq(current->get_name(current), controller))
|
if (streq(current->get_name(current), controller))
|
||||||
{
|
{
|
||||||
handler = current->get_handler(current, action);
|
current->handle(current, request, response, action, NULL, NULL, NULL, NULL);
|
||||||
if (handler)
|
handled = TRUE;
|
||||||
{
|
|
||||||
handler(current, request, response);
|
|
||||||
handled = TRUE;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,8 +135,15 @@ static void process(private_session_t *this,
|
|||||||
free(action);
|
free(action);
|
||||||
if (!handled)
|
if (!handled)
|
||||||
{
|
{
|
||||||
response->add_header(response, "Status", "400 Not Found");
|
if (this->controllers->get_first(this->controllers,
|
||||||
response->printf(response, "<html><body><h1>Not Found</h1></body></html>\n");
|
(void**)¤t) == SUCCESS)
|
||||||
|
{
|
||||||
|
response->redirect(response, current->get_name(current));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response->printf(response, "No controllers loaded!\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ struct session_t {
|
|||||||
/**
|
/**
|
||||||
* @brief Create a session.
|
* @brief Create a session.
|
||||||
*
|
*
|
||||||
* @param context user defined session context instance
|
* @param context user defined session context instance
|
||||||
*/
|
*/
|
||||||
session_t *session_create(context_t *context);
|
session_t *session_create(context_t *context);
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ static void render(private_template_t *this, response_t *response)
|
|||||||
NEOERR* err;
|
NEOERR* err;
|
||||||
CSPARSE *parse;
|
CSPARSE *parse;
|
||||||
|
|
||||||
|
hdf_set_value(this->hdf, "base", response->get_base(response));
|
||||||
|
|
||||||
err = cs_init(&parse, this->hdf);
|
err = cs_init(&parse, this->hdf);
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ struct template_t {
|
|||||||
/**
|
/**
|
||||||
* @brief Render a template to a response object.
|
* @brief Render a template to a response object.
|
||||||
*
|
*
|
||||||
|
* The render() function additionally sets a clearsilver variable "base"
|
||||||
|
* which points to the root of the web application and allows to point to
|
||||||
|
* other targets without to worry about path location.
|
||||||
|
*
|
||||||
* @param response response to render to
|
* @param response response to render to
|
||||||
* @return rendered template string
|
* @return rendered template string
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,12 +25,13 @@
|
|||||||
|
|
||||||
#include "manager.h"
|
#include "manager.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "controller/static_controller.h"
|
|
||||||
#include "controller/auth_controller.h"
|
#include "controller/auth_controller.h"
|
||||||
#include "controller/status_controller.h"
|
#include "controller/status_controller.h"
|
||||||
#include "controller/gateway_controller.h"
|
#include "controller/gateway_controller.h"
|
||||||
|
|
||||||
#define DBFILE "/usr/local/libexec/ipsec/sqlite.db"
|
#define DBFILE IPSECDIR "/sqlite.db"
|
||||||
|
#define SESSION_TIMEOUT 180
|
||||||
|
#define THREADS 10
|
||||||
|
|
||||||
int main (int arc, char *argv[])
|
int main (int arc, char *argv[])
|
||||||
{
|
{
|
||||||
@@ -44,14 +45,13 @@ int main (int arc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatcher = dispatcher_create((context_constructor_t)manager_create, database);
|
dispatcher = dispatcher_create(SESSION_TIMEOUT,
|
||||||
|
(context_constructor_t)manager_create, database);
|
||||||
dispatcher->add_controller(dispatcher, static_controller_create, NULL);
|
|
||||||
dispatcher->add_controller(dispatcher, auth_controller_create, NULL);
|
|
||||||
dispatcher->add_controller(dispatcher, status_controller_create, NULL);
|
dispatcher->add_controller(dispatcher, status_controller_create, NULL);
|
||||||
dispatcher->add_controller(dispatcher, gateway_controller_create, NULL);
|
dispatcher->add_controller(dispatcher, gateway_controller_create, NULL);
|
||||||
|
dispatcher->add_controller(dispatcher, auth_controller_create, NULL);
|
||||||
|
|
||||||
dispatcher->run(dispatcher, 10);
|
dispatcher->run(dispatcher, THREADS);
|
||||||
|
|
||||||
dispatcher->waitsignal(dispatcher);
|
dispatcher->waitsignal(dispatcher);
|
||||||
|
|
||||||
@@ -60,3 +60,4 @@ int main (int arc, char *argv[])
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
<?cs include:"templates/header.cs" ?>
|
<?cs include:"templates/header.cs" ?>
|
||||||
|
<div align="center">
|
||||||
<form method="post" action="<?cs var:action ?>">
|
<form method="post" action="<?cs var:action ?>">
|
||||||
<table width="100%">
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Username</td><td><input type="text" name="username" value="" size="25" /></td>
|
<td>Username</td><td><input type="text" name="username" size="25" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Password</td><td><input type="password" name="password" value="" size="25" /></td>
|
<td>Password</td><td><input type="password" name="password" size="25" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td/><td><input type="submit" value="Login"/></td>
|
<td/><td><input type="submit" value="Login"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
<?cs include:"templates/footer.cs" ?>
|
<?cs include:"templates/footer.cs" ?>
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<?cs include:"templates/header.cs" ?>
|
<?cs include:"templates/header.cs" ?>
|
||||||
|
<div class="dialog">
|
||||||
<form method="post" action="<?cs var:action ?>">
|
<form method="post" action="<?cs var:action ?>">
|
||||||
<p>
|
<p>
|
||||||
<select name="gateway" size="1">
|
<select name="gateway" size="1">
|
||||||
@@ -10,4 +11,5 @@
|
|||||||
<input type="submit" value="Select"/>
|
<input type="submit" value="Select"/>
|
||||||
<p>
|
<p>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
<?cs include:"templates/footer.cs" ?>
|
<?cs include:"templates/footer.cs" ?>
|
||||||
|
|||||||
@@ -2,7 +2,23 @@
|
|||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" type="text/css" href="static/stlye.css" />
|
<title><?cs var:title ?> - strongSwan Manager</title>
|
||||||
<title>strongSwan management</title>
|
<link rel="stylesheet" type="text/css" href="<?cs var:base ?>/static/style.css" />
|
||||||
|
<script type="text/javascript" src="<?cs var:base ?>/static/jquery.js" />
|
||||||
|
<script type="text/javascript" src="<?cs var:base ?>/static/script.js" />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
<div class="fleft">
|
||||||
|
<a href="<?cs var:base ?>/status/ikesalist">
|
||||||
|
<img class="fleft" src="<?cs var:base ?>/static/strongswan.png"/>
|
||||||
|
</a>
|
||||||
|
<h1>strongSwan Manager</h1>
|
||||||
|
<h2><?cs var:title ?></h2>
|
||||||
|
</div>
|
||||||
|
<div class="menu">
|
||||||
|
| <a href="<?cs var:base ?>/gateway/list">Select Gateway</a>
|
||||||
|
| <a href="<?cs var:base ?>/auth/logout">Logout</a>
|
||||||
|
</div>
|
||||||
|
<hr class="cleft"/>
|
||||||
|
<div class="center">
|
||||||
|
<div class="content">
|
||||||
|
|||||||
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 316 B |
|
After Width: | Height: | Size: 4.9 KiB |
@@ -0,0 +1,8 @@
|
|||||||
|
|
||||||
|
$(function(){
|
||||||
|
$(".expand > div").hide();
|
||||||
|
$(".expand > h1").toggle(
|
||||||
|
function(){$(this).parent(".expand").find("div").slideDown('fast');},
|
||||||
|
function(){$(this).parent(".expand").find("div").slideUp('fast');}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
After Width: | Height: | Size: 19 KiB |
@@ -1,188 +1,122 @@
|
|||||||
html {
|
|
||||||
height:100%;
|
|
||||||
width: auto;
|
|
||||||
margin:0;
|
|
||||||
padding:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font-family: Verdana, Helvetica, sans-serif;
|
font-family: Verdana, Helvetica, sans-serif;
|
||||||
font-size: 12px;
|
font-size: .9em;
|
||||||
width: 100%;
|
color: #230100;
|
||||||
height:100%;
|
background-color: #f7f4d3;
|
||||||
margin:0;
|
margin: 0;
|
||||||
padding:0;
|
|
||||||
background-color: #EEEEEE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h1 {
|
.content {
|
||||||
color: #203781;
|
text-align: center;
|
||||||
font-size: 18px;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
.content > * {
|
||||||
color: #203781;
|
background-color: #e5bf5e;
|
||||||
font-size: 17px;
|
border: solid 2px;
|
||||||
font-weight: bold;
|
padding: .2em 1em .2em 1em;
|
||||||
|
margin: 1em;
|
||||||
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
h3 {
|
textarea, select, input {
|
||||||
color: #203781;
|
background-color: #ffec9e;
|
||||||
font-size: 16px;
|
border: 1px solid;
|
||||||
font-weight: bold;
|
padding: 1px 3px 1px 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h4 {
|
.menu {
|
||||||
color: #203781;
|
text-align: right;
|
||||||
font-size: 15px;
|
background-color: #e5bf5e;
|
||||||
font-weight: bold;
|
padding: 3px;
|
||||||
}
|
border-bottom: solid 2px;
|
||||||
|
|
||||||
p {
|
|
||||||
line-height: 1.2;
|
|
||||||
font-size: 11px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
color: black;
|
color: black;
|
||||||
font-size: 12px;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
#headermain {
|
h1 {
|
||||||
min-height: 100%;
|
margin-top: 1em;
|
||||||
background-color: white;
|
|
||||||
margin-left: 188px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ##### Header ##### */
|
hr {
|
||||||
|
border: solid 1px;
|
||||||
#header {
|
|
||||||
width: 100%;
|
|
||||||
height: 30px;
|
|
||||||
background-color: #EEEEEE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.gatewayname{
|
a img {
|
||||||
padding-top: 5px;
|
border: none;
|
||||||
padding-left: 30px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ##### Left Side Bar ##### */
|
.expand {
|
||||||
|
}
|
||||||
|
|
||||||
.leftSideBar {
|
.expand h1 {
|
||||||
padding-top: 30px;
|
font-size: 1em;
|
||||||
padding-left: 8px;
|
cursor: pointer;
|
||||||
padding-right: 8px;
|
margin: 0;
|
||||||
width: 170px;
|
}
|
||||||
|
|
||||||
|
.expand h1 span {
|
||||||
|
margin-left: 2em;
|
||||||
|
margin-right: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.left {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlight {
|
||||||
|
}
|
||||||
|
|
||||||
|
.fleft {
|
||||||
|
margin-right: 2em;
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.leftSideBar .sideBarTitle {
|
.fright {
|
||||||
color: black;
|
float: left;
|
||||||
font-weight: bold;
|
|
||||||
font-size: 12px;
|
|
||||||
margin: 0.1ex 0 0.1ex 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.leftSideBar a {
|
.cleft {
|
||||||
color: #203781;
|
clear:left;
|
||||||
text-decoration: none;
|
|
||||||
display: block;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0.8ex 1ex;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.leftSideBar a:hover {
|
.cright {
|
||||||
color: black;
|
clear:right;
|
||||||
background-color: lightgrey;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ##### Main ##### */
|
.both {
|
||||||
|
clear:both;
|
||||||
#main {
|
|
||||||
padding-top: 10px;
|
|
||||||
padding-left: 30px;
|
|
||||||
color: black;
|
|
||||||
text-align: justify;
|
|
||||||
line-height: 1.5em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ##### From Selection ##### */
|
.drawing {
|
||||||
|
border-collapse:collapse
|
||||||
.formbody {
|
|
||||||
background-color: white;
|
|
||||||
height: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.formbox {
|
.drawing .images {
|
||||||
width: 492px;
|
height: 100px;
|
||||||
margin-top: 100px;
|
|
||||||
margin-left: auto;
|
|
||||||
margin-right: auto;
|
|
||||||
border-color: #333;
|
|
||||||
border-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
padding: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.formselection {
|
.drawing .images td {
|
||||||
background-color: #EEEEEE;
|
padding: 0px;
|
||||||
border-color: #333;
|
width: 100px;
|
||||||
border-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.selection {
|
.drawing tr .left {
|
||||||
background-color: white;
|
text-align: left;
|
||||||
border-color: #333;
|
}
|
||||||
border-style: solid;
|
.drawing tr .right {
|
||||||
margin-left: 12px;
|
text-align: right;
|
||||||
margin-right: 4px;
|
|
||||||
border-width: 1px;
|
|
||||||
width: 400px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
|
||||||
font-size: 12px;
|
|
||||||
font-weight: bold;
|
|
||||||
width: 50px;
|
|
||||||
border-color: #333;
|
|
||||||
border-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
background-color: lightgrey;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ##### Tables ##### */
|
|
||||||
|
|
||||||
th {
|
|
||||||
padding-right: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
td {
|
|
||||||
padding-right: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ##### Lists ##### */
|
|
||||||
|
|
||||||
ul {
|
|
||||||
list-style: None;
|
|
||||||
padding-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
li {
|
|
||||||
padding-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ##### Labels ##### */
|
|
||||||
|
|
||||||
label {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
@@ -1,35 +1,104 @@
|
|||||||
<?cs include:"templates/header.cs" ?>
|
<?cs include:"templates/header.cs" ?>
|
||||||
<h1>List of IKE SA's</h1>
|
<?cs each:ikesa = ikesas ?>
|
||||||
<table border="1">
|
<div class="expand" id="ikesa-<?cs name:ikesa ?>">
|
||||||
<tr>
|
<h1>
|
||||||
<td colspan="4"></td>
|
<?cs name:ikesa ?>:
|
||||||
<td colspan="3">Local</td>
|
<span><?cs var:ikesa.local.identification ?></span> <->
|
||||||
<td colspan="3">Remote</td>
|
<span><?cs var:ikesa.remote.identification ?></span>
|
||||||
<tr>
|
</h1>
|
||||||
<tr>
|
<div>
|
||||||
<td>ID</td>
|
<hr/>
|
||||||
<td>Status</td>
|
<table class="drawing">
|
||||||
<td>Role</td>
|
<tr>
|
||||||
<td>Config</td>
|
<td>
|
||||||
<td>ID</td>
|
</td>
|
||||||
<td>Address</td>
|
<td class="left" colspan="2">
|
||||||
<td>SPI</td>
|
<?cs var:ikesa.local.identification ?>
|
||||||
<td>ID</td>
|
</td>
|
||||||
<td>Address</td>
|
<td>
|
||||||
<td>SPI</td>
|
</td>
|
||||||
<tr>
|
<td class="right" colspan="2">
|
||||||
<?cs each:ikesa = ikesas ?>
|
<?cs var:ikesa.remote.identification ?>
|
||||||
<td><?cs name:ikesa ?></td>
|
</td>
|
||||||
<td><?cs var:ikesa.status ?></td>
|
<td>
|
||||||
<td><?cs var:ikesa.role ?></td>
|
</td>
|
||||||
<td><?cs var:ikesa.peerconfig ?></td>
|
</tr>
|
||||||
<td><?cs var:ikesa.local.identification ?></td>
|
<tr>
|
||||||
<td><?cs var:ikesa.local.address ?>:<?cs var:ikesa.local.port ?></td>
|
<td>
|
||||||
<td><?cs var:ikesa.local.spi ?></td>
|
</td>
|
||||||
<td><?cs var:ikesa.remote.identification ?></td>
|
<td>
|
||||||
<td><?cs var:ikesa.remote.address ?>:<?cs var:ikesa.remote.port ?></td>
|
</td>
|
||||||
<td><?cs var:ikesa.remote.spi ?></td>
|
<td class="center" colspan="3">
|
||||||
<?cs /each ?>
|
<?cs var:ikesa.local.spi ?>:<?cs var:ikesa.remote.spi ?>
|
||||||
</tr>
|
</td>
|
||||||
</table>
|
<td>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr class="images">
|
||||||
|
<td>
|
||||||
|
<?cs each:net = ikesa.childsas.local ?>
|
||||||
|
<p><?cs var:net ?></p>
|
||||||
|
<?cs /each ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?cs if:ikesa.role == "initiator" ?>
|
||||||
|
<img title="Local host is the initiator" src="<?cs var:base ?>/static/client-left.png"></img>
|
||||||
|
<?cs else ?>
|
||||||
|
<img title="Local host is the responder" src="<?cs var:base ?>/static/gateway-left.png"></img>
|
||||||
|
<?cs /if ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?cs if:ikesa.local.nat == "true" ?>
|
||||||
|
<img title="Local host is behind a NAT router" src="<?cs var:base ?>/static/router.png"></img>
|
||||||
|
<?cs else ?>
|
||||||
|
<img title="Local host is not NATed" src="<?cs var:base ?>/static/pipe.png"></img>
|
||||||
|
<?cs /if ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?cs if:ikesa.status == "established" ?>
|
||||||
|
<img title="IKE connection <?cs var:ikesa.status ?>" src="<?cs var:base ?>/static/pipe-good.png"></img>
|
||||||
|
<?cs else ?>
|
||||||
|
<img title="IKE connection in state <?cs var:ikesa.status ?>" src="<?cs var:base ?>/static/pipe-bad.png"></img>
|
||||||
|
<?cs /if ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?cs if:ikesa.remote.nat == "true" ?>
|
||||||
|
<img title="Remote host is behind a NAT router" src="<?cs var:base ?>/static/router.png"></img>
|
||||||
|
<?cs else ?>
|
||||||
|
<img title="Remote host is the responder" src="<?cs var:base ?>/static/pipe.png"></img>
|
||||||
|
<?cs /if ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?cs if:ikesa.role == "responder" ?>
|
||||||
|
<img title="Remote host is the initiator" src="<?cs var:base ?>/static/client-right.png"></img>
|
||||||
|
<?cs else ?>
|
||||||
|
<img title="Remote host is the responder" src="<?cs var:base ?>/static/gateway-right.png"></img>
|
||||||
|
<?cs /if ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?cs each:net = ikesa.childsas.remote ?>
|
||||||
|
<p><?cs var:net ?></p>
|
||||||
|
<?cs /each ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td class="left" colspan="2">
|
||||||
|
<?cs var:ikesa.local.address ?>:<?cs var:ikesa.local.port ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td class="right" colspan="2">
|
||||||
|
<?cs var:ikesa.remote.address ?>:<?cs var:ikesa.remote.port ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?cs /each ?>
|
||||||
<?cs include:"templates/footer.cs" ?>
|
<?cs include:"templates/footer.cs" ?>
|
||||||
|
|||||||