Rpc server class for cipux
version 3.4.0.9
use CipUX::RPC::Server;
Provides the functions for CipUX \s-1RPC\s0 server.
The CipUX rpc server is a generic abstract class, which can be used by other classes or scripts.
The following functions are implemented or supported by CipUX::RPC::Server.
Constructor, see new.
Destructor.
Constructor
Syntax:
my $cipux_rpc = CipUX::RPC::Server->new();
Check weather the login has access or not.
Return 1 if a ticket is \s-1OK\s0 otherwise 0;
Install signal_handler alias time to die.
Syntax:
$server->signal_handler({});
Answer Requests.
Syntax:
$server->answer_requests({ port=>8000, address=>'localhost', reuse=>0, proto=>'tcp', meth_hr=>TODO task_hr=>TODO });
Check the access for login to a task.
Check the access for login to the rpc_intern section.
Check the access for login to a \s-1CAT\s0 module.
Construct an error message.
Evaluate the access to login or a given user depending on the sub command (subcmd) of rpc_info or rpc_intern for one or more realms. Known realms are: task, cat_module, rpc_intern.
Check and update tasks entries.
Check and update \s-1CAT\s0 modules entries.
Log a given message to syslog.
Return the value for a given configuration variable.
List the rpc functions.
Start the \s-1RPC\s0 server.
Syntax:
$server->rpc_start({});
The function 'ping' is for testing the connection. It requires not to log in and no arguments. It returns '\s-1OK\s0'.
Return the CipUX version.
The function 'sum' is for testing the connection. It requires not to log in and 2 arguments. It returns the sum of the arguments as a hash reference with a single line.
Perform a login.
Perform a logout.
Check the ticket and if it is valid update and return a new ticket.
Return the Time To Live. Default 900 seconds.
Execute a CipUX::Task.
Execute a rpc_info sub-command.
task_access
Needs parameter: \s-1TASK\s0
task_access_survey
Needs parameter: \s-1TASK\s0 [\s-1TASK\s0] ...
cat_module_access
Needs parameter: \s-1MODULE\s0
cat_module_access_survey
Needs parameter: \s-1MODULE\s0 [\s-1MODULE\s0] ...
rpc_intern_access
Needs parameter: \s-1COMMAND\s0
rpc_intern_access_survey
Needs parameter: \s-1COMMAND\s0 [\s-1COMMAND\s0] ...
Execute a rpc_intern sub-command.
ttl
Prints current \s-1TTL\s0 in seconds
cat_module_cache_size
Prints current cat module cache size
rpc_intern_cache_size
Prints current rpc intern cache size
task_cache_size
Prints current task_cache_size of cache
user_task_access
Needs parameter: \s-1USER\s0 \s-1TASK\s0
user_task_access_survey
Needs parameter: $USER \s-1TASK\s0 [\s-1TASK\s0] ...
user_cat_module_access
Needs parameter: \s-1USER\s0 \s-1MODULE\s0
user_cat_module_access_survey
Needs parameter: \s-1USER\s0 \s-1MODULE\s0 [\s-1MODULE\s0] ...
user_rpc_intern_access
Needs parameter: \s-1USER\s0 \s-1COMMAND\s0
user_rpc_intern_access_survey
Needs parameter: \s-1USER\s0 \s-1COMMAND\s0 [\s-1COMMAND\s0] ...
flush_cache
Flush \s-1RPC\s0 server \s-1RBAC\s0 cache
All the following CipUX::Task methods are public. Public means that they could be executed remotely. Public means not that everybody can do this remotely.
There are two kinds of public functions:
(1) Functions without authorization
- login - ping - sum
(2) Every other function is available only after using 'login' function, with a uid as first parameter and a valid ticket as second parameter.
Examples (pseudo code):
- (reference to user list) = cipux_task_list_users( uid, ticket ); - (true|false) = logout( uid, ticket ); - (new ticket|false) = session( uid, ticket );
If the uid do not match, or the uid has not the authorization to use the function, or the group of the uid has not the authorization to use the function, or the ticket is expired, or the ticket is not valid the request will not be fulfilled.
In other words: if the uid match and has the right and the role also has the right and the ticket is valid and is not expired, the request will be executed.
To see real examples have a look at CipUX::RPC::Client client.
\s-1TODO\s0
Need no environment variables. But do need a configuration file. For example cipux-rpc.ini
Authen::Simple::PAM Authen::Simple::Password Carp CipUX::Task CipUX::RBAC::Simple Class::Std Data::Dumper English Frontier::Daemon Frontier::RPC2 List::MoreUtils Log::Log4perl Log::Dispatch POSIX Readonly Ticket::Simple
Not known.
Not known.
See the CipUX webpage and the manual at <http://www.cipux.org>
See the mailing list http://sympa.cipworx.org/wws/info/cipux-devel <http://sympa.cipworx.org/wws/info/cipux-devel>
Christian Kuelker <[email protected]>
Copyright (C) 2007 - 2010 by Christian Kuelker
This program is free software; you can redistribute it and/or modify it under the terms of the \s-1GNU\s0 General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but \s-1WITHOUT\s0 \s-1ANY\s0 \s-1WARRANTY\s0; without even the implied warranty of \s-1MERCHANTABILITY\s0 or \s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0. See the \s-1GNU\s0 General Public License for more details.
You should have received a copy of the \s-1GNU\s0 General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, \s-1MA\s0 02111-1307 \s-1USA\s0