Openwsman is a project intended to provide an open-source implementation of the Web Services Management specification (WS-Management) and to expose system management information on the Linux operating system using the WS-Management protocol. WS-Management is based on a suite of web services specifications and usage requirements that exposes a set of operations focused on and covers all system management aspects.
The openwsman project is maintained by Intel's Open-Source Technology Center.
This chapter deals with supported features and general architecture of openwsman.
Openwsman supports the CIM data model using a special plugin which handles a CIM classes in a generic way. The mapping of the CIM data into WS-Management resources happens on the fly using the CIM binding guidelines published by the DMTF.
Currently the following features are supported:
A special Selector is defined to indicate the CIM namespace of the resource or resources for which the message is intended.
<wsman:Selector Name=”__cimnamespace”>xs:anyURI</wsman:Selector>
Using the command line client, the namespace can be set using the namespace option, for example:
wsman enumerate http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem --port 8889 --username wsman -p secret -h somehost.example.com --namespace smash/ipmi
Client and server support all three polymorphism modes:
The following examples show the client request with the corresponding responses for !CIM_ComputerSystem. The example shows three providers with CIM_ComputerSystem derivative classes. The vendor namespaces are just examples and are not official.
In an implementation or environment supporting WS-Eveneting there are three actors:
The Event Sink subscribes an interest with the Event Source by operation contract, such as Subscribe. Event Source is responsible for controlling the information that Event
Sinks are interested in. The event sink can be the receiving end and the initiator of a subscription, however it is also possible that the subscription comes from a seperate component.
The Event Source can consist of two parts: Subscription Manager and Notification Manager. Subscription manager is responsible for managing a Subscription's
lifetime using operation contracts such as Unsubscribe, Renew and GetStatus while Notification Manager with the notification.
In this implementation openwsman acts as an Event Source, which is responsible for receiving a subscription from a subscriber and sending a notification to an event sink. As there are different events created by different applications in the real world, it is important to make this process as general as possible.
The solution is to put the specific eventing production in the plug-in part and intergrate shared WS-Eventing protocol process in the framework of openwsman. That is to say, the framework and plug-in act together to accomplish the process of WS-Eventing. This process model is shown below.
In this process model, the Subscribe, Unsubscribe and Renew Interfaces act together as the Subscription Manager. The Ack and Pull Interfaces are part of the Notification Manager from the point of view of the event sink.
When a subscription request is received, if it is a valid request, it will be saved in the subscription repository and in the memory at the same time and a response message will be returned with expiration time(if any) and corresponding subscription identifier. If it is not, an error message will be returned with causes.
Renew request message should include subscripton identifier which is returned by the subscription manager when subscription is made.
Unsubscribe request should include subscription identifier which is returned by the subscription manager when subscription is made.
There are mainly two reasons:
Although we have to decide one kind of repository in our implementation, the implementation should be designed extensible. That is, it should be changed easily if another kind of repository is considered.
To achieve this goal, callback functions are used. Fuction table of Subscription Repository operations will be registered in the __Soap object when the service finishes loading all plug-ins. The function table should include operations “load all subscriptions”, “get/update/save/delete a specific subscription”. Once the function table is registered, it can be used in the runtime late. If you want to implement a different repository, just change related subscriptions functions.
Related data structures are shown below:
typedef int (*SubscriptionOpInit) (char *, void *); typedef int (*SubscriptionOpFinalize) (char *, void *); typedef int (*SubscriptionOpSave) (char *, char *, char *); typedef int (*SubscriptionOpDelete) (char *, char *); typedef int (*SubscriptionOpGet)(char *, char *, char *); typedef int (*SubscriptionOpSearch) (char *, char *); typedef int (*SubscriptionOpUpdate)(char *, char *, char *); typedef int (*SubscriptionOpLoad) (char *, list_t *); struct __SubsRepositoryEntry { char *strdoc; char *uuid; }; typedef struct __SubsRepositoryEntry *SubsRepositoryEntryH; struct __SubsRepositoryOpSet{ SubscriptionOpLoad load_subscription; SubscriptionOpGet get_subscription; SubscriptionOpSave save_subscritption; SubscriptionOpUpdate update_subscription; SubscriptionOpDelete delete_subscription; };
And we also need to add two fields in the __Soap structure:
char *uri_subsRepository; //URI of repository SubsRepositoryOpSetH subscriptionOpSet; //Function talbe of Subscription Repository
If you want another repository, just change related subscription operations. In this implementation a subscription is saved in a file with the name of UUID returned by the Notification Manager.
Definitions of local Subscription Repository operations:
int LocalSubscriptionOpInit (char * uri_repository, void *opaqueData); int LocalSubscriptionOpFinalize(char * uri_repository, void *opaqueData); int LocalSubscriptionOpGet(char * uri_repository, char * uuid, char **subscriptionDoc); int LocalSubscriptionOpSearch(char * uri_repository, char * uuid); int LocalSubscriptionOpLoad (char * uri_repository, list_t * subscription_list); int LocalSubscriptionOpSave (char * uri_repository, char * uuid, char *subscriptionDoc); int LocalSubscriptionOpUpdate(char * uri_repository, char * uuid, char *expire); int LocalSubscriptionOpDelete (char * uri_repository, char * uuid);
Function tabre of local Subscription Repository operations:
struct __SubsRepositoryOpSet subscription_repository_op_set = {LocalSubscriptionOpInit, LocalSubscriptionOpFinalize, LocalSubscriptionOpLoad, LocalSubscriptionOpGet, LocalSubscriptionOpSearch, LocalSubscriptionOpSave, LocalSubscriptionOpUpdate, LocalSubscriptionOpDelete};
The Event Pool is responsible for events storage. All events except heatbeats generated by the service are put here before they are sent eventually. Notification Manager gets events from Event Pool, while Plug-in adds events to it.
A Notification defined in WS-Eventing can be a real event produced by the event source or a heartbeat event to be sent in a fixed interval. It is an obvious and reasonable idea to put the two functions in two separate threads. So the notification manager can be designed to consist of the notification manager and the heartbeat threads.
To decrease the memory footprintf, the implementation has a single notification manager thread for all notifications. The thread is created when the service is started. The notification mangager thread works for all notifications. It loops for ever until the service is stopped and detects whether there is an event. If an event is detected, a notification sender thread will be created to send the event to the event sink. The notification sender will quit after the send operation is finished. The notification manager is also responsible for subscriptions. If there is a subscription that is unsubscribed or expired, the notification manager will delete it from the memory. If the subscription is unsubscribed, the subscription data will also be deleted from the repository.
If heartbeat is requested in the “subscribe” message, a heartbeat event will be sent in a fixed interval if there is no event from the event source. The Heartbeat generator is also an independent loop thread strarted when the service launches. It generates all heartbeat events in the system. Like the notification manager thread, if there is a heartbeat event, the heartbeat generator will also create a notification sender to send the event to the event sink.
So the notification manager consists of a notification manager thread, a notification sender and the shared heartbeat generator.
Currently the only supported way to install openwsman is via source released on sourceforge. Some distributions already include or plan to include openwsman as a package where you would use the package installation manager to install openwsman and its depenedencies.
Most of the requirement are part of any modern Linux distribution and can be installed using the package installer that comes with your favorite Linux distribution. We recommend using recent Linux distribution as the project uses some recent features in the libraries.
The current version of openwsman uses the sfcc (Small Foortprint CIM Client) to connect to any CIMOM running on the same host using cimxml. This is not optimal and comes with some overhead, however the intention of the project is to initially support all CIMOMs and there is no common protocol or client interface that can be used to talk to all available CIMOMs.
We have tested with two CIMOMs and all other CIMOMs with cimxml support should also work, the CIMOMs we have tested with are:
Openwsman uses Subversion for Code version control. The Openwsman repository is hosted at Sourceforge and provides read only access to everyone and read/write access to developers. You can either view the repository online on Sourceforge or using this site which keeps an uptodate mirror of the SourceForge repository.
In order to access a Subversion repository, you must install a special piece of software called a Subversion client. Subversion clients are available for most any operating system.
This project's Sourceforge.net Subversion repository can be checked out through SVN with the following instruction set:
svn co https://openwsman.svn.sourceforge.net/svnroot/openwsman openwsman
(Warning: This is a generic Subversion checkout command which will pull all modules, tags and/or branches of the project. Please refer to project home page for specific SVN instructions, or use "Browse Repository" link; in most cases, you will want to add '/trunk' to the HTTPS URL above to check out only trunk (main development line)).
Information about accessing this Subversion repository may be found in our document titled Subversion (Version Control for Source Code).
Though Subversion repositories are most commonly accessed using a special piece of software called a Subversion client, we also provide a web-based interface to view Subversion repositories. Browsing the Subversion tree gives you a great view into the current status of this project's code. You may also view the complete history of any file in the repository.
After checking out the project from Subversion run
./bootstrap
in the Top directory and follow that by running
./configure <options>.
If you download a packaged version (a compressed tar), then there is no need to run ./autoconfiscate and you will be able to run the configuration script directly.
After all packages are installed, compile the source and install (make and then make install).
To be able to put the configuration files under /etc/openwsman, run the configure script with the --sysconfdir option using the value /etc. If this option is not used, the default will be under PREFIX (/usr/local/etc ).
This section describes installation of openwsman and the needed CIM packages to provide a complete stack. In this document and other documents we use Openwbem as an example. Openwsman however supports all CIMOMs providing a cim-xml interface. Openwbem with the OMC packages (OMC Project) provide a complete set of providers to manage both hardware and software, thus they provide a good example for different usage models of the WS-Management protocol.
Download the needed the RPMs for the distribution you are using. Currently we provide RPM packages for recent SUSE/Novell distributions in addition to FC4 and FC5.
The RPMs can be downloaded from the SuSE Build repository. The following RPM packages are needed:
Openwsman relies on a CIMOM as the back end for providing system information. Openwsman currently uses the SBLIM CIM client library which connects to major CIMOMs supporting cimxml or connects using a local interface to the SFC Broker.
While there is an added communication overhead using this library, the main purpose of the intial release of Openwsman is to implement the WS-Management specification. Later, better integration with CIMOMs is planned.
To get started, install a CIMOM with cimxml support and make sure it does support HTTP. For the authentication, make sure you follow one of the scnarios:
Once the CIMOM is up and running, make sure you can access the classes using a WBEM client (e.g. wbemcli from the SBLIM project or the python client from OMC). If the classes are accessible then you are ready to use openwsman with the CIMOM.
Because Openwsman can be used by multiple vendors, the configuration file provides a way to define the vendor specific namespaces and how they corrospond to the CIM classes provided in the CIMOM. See the section about the configuration file for more details.
This sections guides you through the configuration and initial setup of the openwsman service.
Openwsman uses an ini style configuration file for all components (server, client and plugins). Currently, the following options are supported
The example below shows a typical server configuration.
[server] port = 8889 #ssl_port = 8888 ssl_cert_file = /etc/openwsman/servercert.pem ssl_key_file = /etc/openwsman/serverkey.pem digest_password_file = /etc/openwsman/digest_auth.passwd basic_password_file = /etc/openwsman/simple_auth.passwd min_threads = 1 max_threads = 4 #use_digest is OBSOLETED, see below. # # Authentication backend for BASIC authentication. Default is to read a configuration file defined with 'basic_password_file' # #basic_authenticator = libwsman_pam_auth.so #basic_authenticator_arg = openwsman
The password files for BASIC and DIGEST can be created with the htpasswd and htdigest utilities. Both utilities usually come with Apache packages on Linux distributions.
The realm for openwsman has to be OPENWSMAN. An example password file for DIGEST with one entry:
wsman:OPENWSMAN:5a659df1ac36d2f4eb84092145532919
If both password files for basic and digest authentication are defined then both methods will be offered by the service. The client will automatically connect using the strongest authentication method.
Authentication plug-ins support only Basic authentication. DIGEST authentication support is only available using a password file created with htdigest or similar utilities.
Plain Text Plugins
Is the default plug-in used in Openwsman and provides access to a password file generated with htpasswd or similar utilities.
PAM Plugin
To activate PAM authentication, enable the PAM authentication plug-in the configuration file and provide the name of the PAM service. The service configuration has to be provided as a file in the /etc/pam.d directory and can for example have the following contents:
/etc/pam.d/openwsman:
#%PAM-1.0 auth required pam_unix2.so nullok auth required pam_nologin.so account required pam_unix2.so password required pam_pwcheck.so nullok password required pam_unix2.so nullok use_first_pass use_authtok session required pam_unix2.so none
[client] port = 8889 agent = openwsman 0.3.2
Until recently, the namespace in the resource URI (the part of the url before the class name) was very flexible. You could request something like that:
http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem (valid) and http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/Linux_ComputerSystem (invalid)
and both would work.
Now this does not work anymore. For CIM base classes you should use the DMTF namespace, for others you can specify the namespace in the configuration file. Depending on your CIM providers there might be no CIM/WSMan namespace available, so you can make something up, the list of namespaces I have as an example:
vendor_namespaces = OpenWBEM=http://schema.openwbem.org/wbem/wscim/1/cim-schema/2, Linux=http://sblim.sf.net/wbem/wscim/1/cim-schema/2, OMC=http://schema.omc-project.org/wbem/wscim/1/cim-schema/2, REEF=http:///reef.sblim.sf.net/wbem/wscim/1/cim-schema/2, CWS=http:///cws.sblim.sf.net/wbem/wscim/1/cim-schema/2
So the above Linux_ComputerSystem resource URI should actually be:
http://sblim.sf.net/wbem/wscim/1/cim-schema/2/Linux_ComputerSystem
[cim] default_cim_namespace = root/cimv2 # The following are in part fake namespaces for some publicly available CIM implementations. vendor_namespaces = OpenWBEM=http://schema.openwbem.org/wbem/wscim/1/cim-schema/2,Linux=http://sblim.sf.net/wbem/wscim/1/cim-schema/2,OMC=http://schema.omc-project.org/wbem/wscim/1/cim-schema/2
The server can run as a daemon, which would require root access; But it can be run in the foreground with debugging messages printed to stdout as well. This is the help output when you run the daemon:
# /usr/sbin/wsmand --help Usage: wsmand [Option...] WS-Management Server Help Options -?, --help Application Options -n, --no-plugins Do not load any plugins -S, --ssl Work through SSL port -d, --debug Start daemon in foreground and turn on debugging -s, --syslog=0-6 Set the verbosity of syslog output. -c, --config-file=<file> Alternate configuration file -p, --pid-file=<file> PID file
The command line client uses openwsman client interface and API to provide a utility for testing and accessing WS-Management information from the command line.
The command line utility uses the client interface of the openwsman library and supports all features accepted by service in addition to experiemntal feature currently not available in the Openwsman service (Fragment level transfer and Filtering).
To view all support options, run the client with the --help-all option.
The client requires an action, a resource uri and additional options to connect and authenticate with the server.
wsman [Option...] <action> <Resource Uri>
Note that the Identify request does not require any Resource Uri.
This HOWTO was to create a demo for MDC, see the slides for more information.
First, download the latest sfcbd source code from SBLIM project repository. The latest sfcbd has some bugs fixed which enables WS-Eventing features in OpenWSMAN to run smoothly. Compile it with indication enabled and install it in your system. It is assumed that you have an indication provider – 'libprocessIndication.so', a corresponding registry file – "processIndication.reg", and a MOF file (if it is necessary). The content of registry file is like the following:
[CIM_ProcessIndication] provider: CPUUsage location: processIndication type: indication namespace: root/cimv2
Steps to register a new indication provider in sfcbd are:
If the indication namespace is different from CIM namespace defined in openwsman.conf or what you specify in wsmancli through the option “--namespace”, add indication source namespace configuration in OpenWSMAN configuration file. For example, if default_cim_namespace = root/interop, then we should add another option “indication_source_namespace = root/cimv2” in cim section of openwsman.conf in this case.
Run wseventsink as an event sink. Utility wseventsink accepts incoming events and prints them to stdout. Default service path is /eventsink and port is 80.
Run command:
wsman subscribe http://schemas.dmtf.org/wbem/wscim/1/* -x "SELECT * FROM CIM_ProcessIndication" -D "http://schemas.microsoft.com/wbem/wsman/1/WQL" -Z http://127.0.0.1:80/eventsink --namespace=root/interop -r 600 -H 2 -u wsmantest -p wsmantest -h localhost -G push –R
We will see incoming events from wseventsink. If there is no real event from indication provider, heartbeat events will be sent every 2 seconds.
Run command:
wsman subscribe http://schemas.dmtf.org/wbem/wscim/1/* -x "SELECT * FROM CIM_ProcessIndication" -D "http://schemas.microsoft.com/wbem/wsman/1/WQL"; -Z http://127.0.0.1:80/eventsink --namespace=root/interop -r 600 -H 2 -u wsmantest -p wsmantest -h localhost -G pushwithack –R
We will see incoming real events and heartbeats from wseventsink. This delivery mode demands acknowledgement from event sink. If wseventsink is closed, this subscription will be terminated by openwsman when it cannot receive acknowledgment.
Run command:
wsman subscribe http://schemas.dmtf.org/wbem/wscim/1/* -x "SELECT * FROM CIM_ProcessIndication" -D "http://schemas.microsoft.com/wbem/wsman/1/WQL" –Z http://127.0.0.1:80/eventsink --namespace=root/interop -r 600 -H 2 -u wsmantest -p wsmantest -h localhost -G events –R
This delivery mode provides a way to deliver multiple events in a single SOAP event message. It also needs acknowledgement from event sink. The subscription will be terminated if Openwsman cannot receive acknowledgment of an event.
wsman subscribe http://schemas.dmtf.org/wbem/wscim/1/* -x "SELECT * FROM CIM_ProcessIndication" -D "http://schemas.microsoft.com/wbem/wsman/1/WQL" -Z http://127.0.0.1:80/eventsink --namespace=root/interop -r 600 -u wsmantest -p wsmantest -h localhost -G pull –R
This delivery mode borrows the wsen:Pull message to retrieve events from the logical queue. If the returned subscription response is like the following:
<s:envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration"> <s:header> <wsa:to>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:to> <wsa:action>http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse</wsa:action> <wsa:relatesto>uuid:1f557836-3ec7-1ec7-8002-6ae2ccb7d000</wsa:relatesto> <wsa:messageid>uuid:1f756cda-3ec7-1ec7-955e-6ae2ccb7d000</wsa:messageid> </s:header> <s:body> <wse:subscriberesponse> <wse:subscriptionmanager> <wsa:address>http://localhost:8889/wsman</wsa:address> <wsa:referenceparameters> <wse:identifier>uuid: 26dca9cb-3ec7-1ec7-8002-6ae2ccb7d000</wse:identifier> </wsa:referenceparameters> </wse:subscriptionmanager> <wse:expires>PT600.000000S</wse:expires> <wsen:enumerationcontext>uuid: 26dca9cb-3ec7-1ec7-8002-6ae2ccb7d000</wsen:enumerationcontext> </wse:subscriberesponse> </s:body> </s:envelope>
Then, corresponding command to pull events is shown below:
wsman pull <a href="http://schemas.dmtf.org/wbem/wscim/1/*" title="http://schemas.dmtf.org/wbem/wscim/1/*">http://schemas.dmtf.org/wbem/wscim/1/*</a> -U uuid:26dca9cb-3ec7-1ec7-8002-6ae2ccb7d000 -u wsmantest -p wsmantest -h localhost
If there is an event in the queue, the response will be like the following:
<s:envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:n1="http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/CIM_ProcessIndication"> <s:header> <wsa:action>http://schema.omc-project.org/wbem/wscim/1/cim-schema/2/CIM_ProcessIndication</wsa:action> <wsa:messageid>uuid:2782e580-3ec7-1ec7-8004-6ae2ccb7d000</wsa:messageid> <wsa:relatesto>uuid:2782ce67-3ec7-1ec7-8002-6ae2ccb7d000</wsa:relatesto> </s:header> <s:body> <wsen:pullresponse> <wsen:enumerationcontext>uuid:26dca9cb-3ec7-1ec7-8002-6ae2ccb7d000</wsen:enumerationcontext> <n1:cim_processindication> <n1:indicationidentifier> ChangeOfUsers </n1:indicationidentifier> <n1:indicationtime> </n1:indicationtime> <n1:classname> </n1:classname> </n1:cim_processindication> </wsen:pullresponse> </s:body> </s:envelope>
If there is no event in the queue, the response will be like:
<s:envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"> <s:header> <wsa:to>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:to> <wsa:action>http://schemas.dmtf.org/wbem/wsman/1/wsman/fault</wsa:action> <wsa:relatesto>uuid:3002e928-3ec7-1ec7-8002-6ae2ccb7d000</wsa:relatesto> <wsa:messageid>uuid:3002ffb9-3ec7-1ec7-8005-6ae2ccb7d000</wsa:messageid> </s:header> <s:body> <s:fault> <s:code> <s:value>s:Receiver</s:value> <s:subcode> <s:value>wsman:TimedOut</s:value> </s:subcode> </s:code> <s:reason> <s:text xml:lang="en">The operation has timed out.</s:text> </s:reason> </s:fault> </s:body> </s:envelope>
If the returned subscription Identifier is uuid: 26dca9cb-3ec7-1ec7-8002-6ae2ccb7d000, renew this subscription to 200 seconds.
wsman renew -i uuid: 26dca9cb-3ec7-1ec7-8002-6ae2ccb7d000 -r 200 -u wsmantest -p wsmantest -h localhost
If the returned subscription Identifier is uuid: 26dca9cb-3ec7-1ec7-8002-6ae2ccb7d000, renew this subscription to 200 seconds.
wsman unsubscribe -i uuid:569f6af6-3ec7-1ec7-8002-6ae2ccb7d000 --namespace=root/interop -u wsmantest -p wsmantest -h localhost
If the delivery mode of a subscription is “pushwithack” or “events”, no acknowledgement from event sink will cause it to be terminated
Windows Remote Management is one component of Windows Hardware Management features that manage server hardware locally and remotely.
winrm set winrm/config/client/auth @{Basic="true"}
winrm set winrm/config/client @{AllowUnencrypted="true"}
winrm set winrm/config/client @{TrustedHosts="192.168.1.100"}
Note: Replace the 192.168.1.100 with the host address of the server hosting the target OpenWSMAN service.
winrm quickconfig
winrm set winrm/config/service/auth @{Basic="true"}
winrm set winrm/config/service @{AllowUnencrypted="true"}
Verify the OpenWSMAN service is running on the target server. Run the following “winrm command” to test the connection:
winrm enumerate http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem -username:wsman -password:secret -r:143.166.157.213:8889/wsman -auth:basic
Output should look something like:
CIM_ComputerSystem Name = ZPB9K34 CreationClassName = CIM_ComputerSystem NameFormat = 'other' Dedicated = null ResetCapability = 1 PrimaryOwnerName = null PrimaryOwnerContact = null EnabledState = 2 OtherEnabledState = null RequestedState = 2 EnabledDefault = 2 TimeOfLastStateChange = null InstallDate = null OperationalStatus = null Status = null HealthState = 25 Caption = null Description ElementName = server1.domain.com