added subnets of CHILD_SAs to xml interface

a first design of Managers IKE_SA list page
This commit is contained in:
Martin Willi
2007-09-14 14:07:30 +00:00
parent 15a9d460c0
commit c01f7bf989
36 changed files with 3402 additions and 426 deletions
+36 -1
View File
@@ -145,6 +145,41 @@ static void write_address(xmlTextWriterPtr writer, char *element, host_t *host)
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
*/
@@ -214,7 +249,7 @@ static void request_query_ikesa(xmlTextReaderPtr reader, xmlTextWriterPtr writer
children = ike_sa->create_child_sa_iterator(ike_sa);
while (children->iterate(children, (void**)&child_sa))
{
/* TODO: Children */
write_child(writer, child_sa);
}
children->destroy(children);
/* </childsalist> */
+5 -2
View File
@@ -3,7 +3,6 @@ ipsec_PROGRAMS = manager.fcgi
manager_fcgi_SOURCES = \
main.c manager.c manager.h gateway.h gateway.c database.h database.c \
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/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}
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
@@ -29,7 +29,7 @@ ipsec_templatesdir = ${ipsecdir}/templates
ipsec_templates_DATA = templates/header.cs templates/footer.cs
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_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_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 \
templates/auth/login.cs templates/auth/logout.cs \
templates/gateway/list.cs templates/status/ikesalist.cs
+22 -8
View File
@@ -51,6 +51,7 @@ static void login(private_auth_controller_t *this,
{
template_t *t = template_create("templates/auth/login.cs");
t->set(t, "action", "check");
t->set(t, "title", "Login");
t->render(t, response);
t->destroy(t);
}
@@ -65,7 +66,7 @@ static void check(private_auth_controller_t *this,
if (username && password &&
this->manager->login(this->manager, username, password))
{
response->redirect(response, "status/test");
response->redirect(response, "status/ikesalist");
}
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 (streq(name, "check")) return (controller_handler_t)check;
if (streq(name, "logout")) return (controller_handler_t)logout;
return NULL;
if (action)
{
if (streq(action, "login"))
{
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);
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->manager = (manager_t*)context;
+23 -17
View File
@@ -72,6 +72,7 @@ static void list(private_gateway_controller_t *this,
}
enumerator->destroy(enumerator);
t->set(t, "action", "select");
t->set(t, "title", "Choose gateway");
t->render(t, response);
t->destroy(t);
}
@@ -90,16 +91,7 @@ static void _select(private_gateway_controller_t *this,
return;
}
}
response->printf(response, "selecting dings 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");
response->printf(response, "selecting gateway failed: %s", id);
}
/**
@@ -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 (streq(name, "list")) return (controller_handler_t)list;
if (streq(name, "select")) return (controller_handler_t)_select;
return NULL;
if (!this->manager->logged_in(this->manager))
{
return response->redirect(response, "auth/login");
}
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
*/
@@ -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);
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->manager = (manager_t*)context;
-103
View File
@@ -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_ */
+54 -31
View File
@@ -53,9 +53,9 @@ static void ikesalist(private_status_controller_t *this,
{
char *str;
gateway_t *gateway;
xml_t *doc, *node;
enumerator_t *e1, *e2, *e3, *e4, *e5, *e6;
char *name, *value, *id, *section;
xml_t *node;
enumerator_t *e1, *e2, *e3, *e4, *e5, *e6, *e7, *e8;
char *name, *value, *id = "", *section;
gateway = this->manager->select_gateway(this->manager, 0);
str = gateway->request(gateway, "<message type=\"request\" id=\"1\">"
@@ -69,8 +69,8 @@ static void ikesalist(private_status_controller_t *this,
return;
}
doc = xml_create(str);
if (doc == NULL)
node = xml_create(str);
if (node == NULL)
{
response->printf(response, "parsing XML failed");
return;
@@ -78,7 +78,7 @@ static void ikesalist(private_status_controller_t *this,
template_t *t = template_create("templates/status/ikesalist.cs");
e1 = doc->children(doc);
e1 = node->children(node);
while (e1->enumerate(e1, &node, &name, &value))
{
if (streq(name, "message"))
@@ -116,6 +116,33 @@ static void ikesalist(private_status_controller_t *this,
}
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
{
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);
t->set(t, "title", "IKE SA overview");
t->render(t, response);
t->destroy(t);
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
*/
@@ -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->select_gateway(this->manager, 0) == NULL) return (controller_handler_t)selection;
if (streq(name, "ikesalist")) return (controller_handler_t)ikesalist;
return NULL;
if (!this->manager->logged_in(this->manager))
{
return response->redirect(response, "auth/login");
}
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);
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->manager = (manager_t*)context;
+16 -5
View File
@@ -59,13 +59,24 @@ struct controller_t {
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
* @return controllers handler
* Request URLs are parsed in the form
* 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.
*/
+14 -9
View File
@@ -146,6 +146,7 @@ static session_entry_t *session_entry_create(private_dispatcher_t *this)
entry->waiting = 1;
pthread_cond_init(&entry->cond, NULL);
entry->session = load_session(this);
entry->used = time(NULL);
return entry;
}
@@ -208,16 +209,19 @@ static void dispatch(private_dispatcher_t *this)
iterator = this->sessions->create_iterator_locked(this->sessions, &this->mutex);
while (iterator->iterate(iterator, (void**)&current))
{
if (sid && streq(current->session->get_sid(current->session), sid))
{
found = current;
found->waiting++;
}
else if (current->waiting == 0 &&
current->used + this->timeout > now)
/* check all sessions for timeout */
if (current->waiting == 0 &&
current->used < now - this->timeout)
{
iterator->remove(iterator);
session_entry_destroy(current);
continue;
}
if (!found && sid &&
streq(current->session->get_sid(current->session), sid))
{
found = current;
found->waiting++;
}
}
iterator->destroy(iterator);
@@ -319,7 +323,8 @@ static void destroy(private_dispatcher_t *this)
/*
* 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);
@@ -334,7 +339,7 @@ dispatcher_t *dispatcher_create(context_constructor_t constructor, void *param)
pthread_mutex_init(&this->mutex, NULL);
this->param = param;
this->fd = 0;
this->timeout = 180;
this->timeout = timeout;
FCGX_Init();
+6 -1
View File
@@ -40,6 +40,9 @@ struct dispatcher_t {
/**
* @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 param param to pass to constructor
*/
@@ -70,9 +73,11 @@ struct dispatcher_t {
* The context constructor is invoked to create a session context for
* each session.
*
* @param timeout session timeout
* @param constructor construction function for session context
* @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_ */
+10
View File
@@ -186,6 +186,15 @@ static void redirect(private_response_t *this, char *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
*/
@@ -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.add_cookie = (void(*)(response_t*, char *name, char *value))add_cookie;
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->req = request;
+7
View File
@@ -78,6 +78,13 @@ struct response_t {
* @param location location to redirect to
*/
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.
+11 -9
View File
@@ -91,7 +91,6 @@ static void process(private_session_t *this,
char *pos, *path, *controller, *action;
iterator_t *iterator;
bool handled = FALSE;
controller_handler_t handler;
controller_t *current;
if (this->sid == NULL)
@@ -126,12 +125,8 @@ static void process(private_session_t *this,
{
if (streq(current->get_name(current), controller))
{
handler = current->get_handler(current, action);
if (handler)
{
handler(current, request, response);
handled = TRUE;
}
current->handle(current, request, response, action, NULL, NULL, NULL, NULL);
handled = TRUE;
break;
}
}
@@ -140,8 +135,15 @@ static void process(private_session_t *this,
free(action);
if (!handled)
{
response->add_header(response, "Status", "400 Not Found");
response->printf(response, "<html><body><h1>Not Found</h1></body></html>\n");
if (this->controllers->get_first(this->controllers,
(void**)&current) == SUCCESS)
{
response->redirect(response, current->get_name(current));
}
else
{
response->printf(response, "No controllers loaded!\n");
}
}
}
+1 -1
View File
@@ -68,7 +68,7 @@ struct session_t {
/**
* @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);
+2
View File
@@ -66,6 +66,8 @@ static void render(private_template_t *this, response_t *response)
NEOERR* err;
CSPARSE *parse;
hdf_set_value(this->hdf, "base", response->get_base(response));
err = cs_init(&parse, this->hdf);
if (!err)
{
+4
View File
@@ -55,6 +55,10 @@ struct template_t {
/**
* @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
* @return rendered template string
*/
+8 -7
View File
@@ -25,12 +25,13 @@
#include "manager.h"
#include "database.h"
#include "controller/static_controller.h"
#include "controller/auth_controller.h"
#include "controller/status_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[])
{
@@ -44,14 +45,13 @@ int main (int arc, char *argv[])
return 1;
}
dispatcher = dispatcher_create((context_constructor_t)manager_create, database);
dispatcher->add_controller(dispatcher, static_controller_create, NULL);
dispatcher->add_controller(dispatcher, auth_controller_create, NULL);
dispatcher = dispatcher_create(SESSION_TIMEOUT,
(context_constructor_t)manager_create, database);
dispatcher->add_controller(dispatcher, status_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);
@@ -60,3 +60,4 @@ int main (int arc, char *argv[])
return 0;
}
+5 -3
View File
@@ -1,15 +1,17 @@
<?cs include:"templates/header.cs" ?>
<div align="center">
<form method="post" action="<?cs var:action ?>">
<table width="100%">
<table>
<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>
<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>
<td/><td><input type="submit" value="Login"/></td>
</tr>
</table>
</form>
</div>
<?cs include:"templates/footer.cs" ?>
+2
View File
@@ -1,2 +1,4 @@
</div>
</div>
</body>
</html>
+2
View File
@@ -1,4 +1,5 @@
<?cs include:"templates/header.cs" ?>
<div class="dialog">
<form method="post" action="<?cs var:action ?>">
<p>
<select name="gateway" size="1">
@@ -10,4 +11,5 @@
<input type="submit" value="Select"/>
<p>
</form>
</div>
<?cs include:"templates/footer.cs" ?>
+18 -2
View File
@@ -2,7 +2,23 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="static/stlye.css" />
<title>strongSwan management</title>
<title><?cs var:title ?> - strongSwan Manager</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>
<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">
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

+8
View File
@@ -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');}
);
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

+81 -147
View File
@@ -1,188 +1,122 @@
html {
height:100%;
width: auto;
margin:0;
padding:0;
}
body {
font-family: Verdana, Helvetica, sans-serif;
font-size: 12px;
width: 100%;
height:100%;
margin:0;
padding:0;
background-color: #EEEEEE;
font-family: Verdana, Helvetica, sans-serif;
font-size: .9em;
color: #230100;
background-color: #f7f4d3;
margin: 0;
}
h1 {
color: #203781;
font-size: 18px;
font-weight: bold;
.content {
text-align: center;
}
h2 {
color: #203781;
font-size: 17px;
font-weight: bold;
.content > * {
background-color: #e5bf5e;
border: solid 2px;
padding: .2em 1em .2em 1em;
margin: 1em;
text-align: left;
}
h3 {
color: #203781;
font-size: 16px;
font-weight: bold;
textarea, select, input {
background-color: #ffec9e;
border: 1px solid;
padding: 1px 3px 1px 3px;
}
h4 {
color: #203781;
font-size: 15px;
font-weight: bold;
}
p {
line-height: 1.2;
font-size: 11px;
.menu {
text-align: right;
background-color: #e5bf5e;
padding: 3px;
border-bottom: solid 2px;
}
a {
color: black;
font-size: 12px;
color: black;
text-decoration: none;
}
#headermain {
min-height: 100%;
background-color: white;
margin-left: 188px;
h1 {
margin-top: 1em;
}
/* ##### Header ##### */
#header {
width: 100%;
height: 30px;
background-color: #EEEEEE;
hr {
border: solid 1px;
}
.gatewayname{
padding-top: 5px;
padding-left: 30px;
font-size: 12px;
a img {
border: none;
}
/* ##### Left Side Bar ##### */
.expand {
}
.leftSideBar {
padding-top: 30px;
padding-left: 8px;
padding-right: 8px;
width: 170px;
.expand h1 {
font-size: 1em;
cursor: pointer;
margin: 0;
}
.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;
}
.leftSideBar .sideBarTitle {
color: black;
font-weight: bold;
font-size: 12px;
margin: 0.1ex 0 0.1ex 0;
.fright {
float: left;
}
.leftSideBar a {
color: #203781;
text-decoration: none;
display: block;
margin: 0;
padding: 0.8ex 1ex;
.cleft {
clear:left;
}
.leftSideBar a:hover {
color: black;
background-color: lightgrey;
text-decoration: none;
.cright {
clear:right;
}
/* ##### Main ##### */
#main {
padding-top: 10px;
padding-left: 30px;
color: black;
text-align: justify;
line-height: 1.5em;
.both {
clear:both;
}
/* ##### From Selection ##### */
.formbody {
background-color: white;
height: auto;
.drawing {
border-collapse:collapse
}
.formbox {
width: 492px;
margin-top: 100px;
margin-left: auto;
margin-right: auto;
border-color: #333;
border-width: 1px;
border-style: solid;
padding: 10px;
.drawing .images {
height: 100px;
}
.formselection {
background-color: #EEEEEE;
border-color: #333;
border-width: 1px;
border-style: solid;
.drawing .images td {
padding: 0px;
width: 100px;
}
.selection {
background-color: white;
border-color: #333;
border-style: solid;
margin-left: 12px;
margin-right: 4px;
border-width: 1px;
width: 400px;
.drawing tr .left {
text-align: left;
}
.drawing tr .right {
text-align: right;
}
.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;
}
+102 -33
View File
@@ -1,35 +1,104 @@
<?cs include:"templates/header.cs" ?>
<h1>List of IKE SA's</h1>
<table border="1">
<tr>
<td colspan="4"></td>
<td colspan="3">Local</td>
<td colspan="3">Remote</td>
<tr>
<tr>
<td>ID</td>
<td>Status</td>
<td>Role</td>
<td>Config</td>
<td>ID</td>
<td>Address</td>
<td>SPI</td>
<td>ID</td>
<td>Address</td>
<td>SPI</td>
<tr>
<?cs each:ikesa = ikesas ?>
<td><?cs name:ikesa ?></td>
<td><?cs var:ikesa.status ?></td>
<td><?cs var:ikesa.role ?></td>
<td><?cs var:ikesa.peerconfig ?></td>
<td><?cs var:ikesa.local.identification ?></td>
<td><?cs var:ikesa.local.address ?>:<?cs var:ikesa.local.port ?></td>
<td><?cs var:ikesa.local.spi ?></td>
<td><?cs var:ikesa.remote.identification ?></td>
<td><?cs var:ikesa.remote.address ?>:<?cs var:ikesa.remote.port ?></td>
<td><?cs var:ikesa.remote.spi ?></td>
<?cs /each ?>
</tr>
</table>
<?cs each:ikesa = ikesas ?>
<div class="expand" id="ikesa-<?cs name:ikesa ?>">
<h1>
<?cs name:ikesa ?>:
<span><?cs var:ikesa.local.identification ?></span> &lt;-&gt;
<span><?cs var:ikesa.remote.identification ?></span>
</h1>
<div>
<hr/>
<table class="drawing">
<tr>
<td>
</td>
<td class="left" colspan="2">
<?cs var:ikesa.local.identification ?>
</td>
<td>
</td>
<td class="right" colspan="2">
<?cs var:ikesa.remote.identification ?>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td class="center" colspan="3">
<?cs var:ikesa.local.spi ?>:<?cs var:ikesa.remote.spi ?>
</td>
<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" ?>