Command line interface to cipux storage abstraction layer
version 3.4.0.2
(1) cipux_storage_client -h (2) cipux_storage_client [OPT] -t get_value -s <TYPE> -o <OBJ> -y <ATTR> [-y <ATTR>] (3) cipux_storage_client [OPT] -t get_all_values -s <TYPE> -y <ATTR> [-y <ATTR>] (4) cipux_storage_client [OPT] -t set_value [-r] -s <TYPE> -o <OBJ> -y <ATTR> -v <VAL> cipux_storage_client [OPT] -t set_value -a -s <TYPE> -o <OBJ> -y <ATTR> -v <VAL> cipux_storage_client [OPT] -t set_value [-r] -s <TYPE> -o <OBJ> -y <ATTR=VAL> [-y <ATTR=VAL>] cipux_storage_client [OPT] -t set_value -a -s <TYPE> -o <OBJ> -y <ATTR=VAL> [-y <ATTR=VAL>] cipux_storage_client [OPT] -t set_value -d -s <TYPE> -o <OBJ> -y <ATTR> [-y <ATTR>] cipux_storage_client [OPT] -t set_value -e -s <TYPE> -o <OBJ> -y <ATTR> (5) cipux_storage_client [OPT] -t set_all_values [-r] -s <TYPE> -y <ATTR> -v <VAL> cipux_storage_client [OPT] -t set_all_values -a -s <TYPE> -y <ATTR> -v <VAL> cipux_storage_client [OPT] -t set_all_values [-r] -s <TYPE> -y <ATTR=VAL> [-y <ATTR=VAL>] cipux_storage_client [OPT] -t set_all_values -a -s <TYPE> -y <ATTR=VAL> [-y <ATTR=VAL>] cipux_storage_client [OPT] -t set_all_values -d -s <TYPE> -y <ATTR> [-y <ATTR>] (6) cipux_storage_client [OPT] -t add_node -s <TYPE> -o <OBJ> -x <ATTR=VAL> [-x <ATTR=VAL>] (7) cipux_storage_client [OPT] -t delete_node -s <TYPE> -o <OBJ> (8) cipux_storage_client [OPT] -t rename_node -s <TYPE> -o <OBJ> -v <VAL> abbreviations: OBJ = OBJECT, ATTR = ATTRIBUTE, VAL = VALUE, OPT = OPTIONS
Options for all commands:
-c | --cfg : cipux-storage-access.conf -D | --debug [<LEVEL>] : print debug messages for developers -h | --help : print help (this message + options) -p | --pretty : nice boxed output -V | --version : print only version --verbose : print more messages
Options for some commands:
-a | --add : rather add then replace a value -d | --del : delete the value of the attribute -e | --erase : delete the attribute -l | --list : lists configuration scopes, can be used for --type -o | --object : LDAP object leaf -r | --replace : replace a value, default behaviour -s | --storage_type : configuration type -t | --storage_task : action to perform -v | --value : value to be set -x | --mattrvalue : multiple LDAP attributes, please see description -y | --attrvalue : LDAP attribute, please see description
cipux_storage_client
-t or -h
cipux_storage_client -t get_value
-s <TYPE> -o <OBJ> -y <ATTR>
cipux_storage_client -t get_all_values
-s <TYPE> -y <ATTR>
cipux_storage_client -t set_value
-s <TYPE> -o <OBJ> -y <ATTR>
cipux_storage_client -t set_all_values
-s <TYPE> -y <ATTR> -v <VAL>
cipux_storage_client -t add_node
-s <TYPE> -o <OBJ> -x <ATTR=VAL>
cipux_storage_client -t delete_node
-s <TYPE> -o <OBJ>
cipux_storage_client -t rename_node
-s <TYPE> -o <OBJ> -v <VAL>
Same as option --add.
This adds a value where possible rather then replace a value.
This can be used to specify the attribute by --attrvalue <ATTRIBUTE> Or it can be used to specify the attribute and the value --attrvalue <ATTRIBUTE>=<VALUE> Of course it can also be use together with --value option to specify the attribute and the value like this: --attrvalue <ATTRIBUTE> --value <VALUE>
Same as option --debug.
Same as option --del.
This deletes the attribute from the object where possible.
Same as option --erase
Deletes the \s-1LDAP\s0 attribute of a given object. This will delete also all content of this attribute. If the an object has multible values for that attribute all values will be removed. If this is option is set, it will trigger --delete command line option automatically.
Same as option --help
Prints brief help message.
This is option have to be use if a \s-1LDAP\s0 object has to be created. Unlike --attrvalue this option requires always an attribute and a value. Therefore only this syntax is possible: --mattrvalue <ATTRIBUTE>=<VALUE> The reason for this is to be able to gave the user exact hints when he try to create a object but forget the value. The 'm' stands for multiple. So it is possible to give the option several times.
Same as option --object
This option is used to specify the object on which the command is operating. Make sure you choose the right object. Of course this will also fail when the object is not fetchable with (in the objects list of) --storage_type.
Same as option --pretty.
On command which produce an output, this option can be used to draw a fancy box around the output.
Same as option --replace.
For some command this is the default option. It replace the value of a given attribute with a new value.
Same as option --storage_type.
Name fo the action that can be performed. Valid actions are: get_all_values set_all_values add_node get_value set_value list delete_node rename_node
This option defines the 'type of the object' the command is operating with. A 'type of object' is a certain set of objects with common attributes. For example all \s-1POSIX\s0 account objects. You can easily define new types of objects in the configuration file. The default location of this file is /etc/cipux/cipux-storage-structure.conf.
Same as --storage_task.
Same as option --version.
Prints the version and exits.
Not implemented jet.
Same as option --list
Lists all object scopes. The object scopes are red from the configuration file. The default location of the configuration file is /usr/share/cipux/etc/cipux-storage.perl. One object type is needed for the --storage_type option.
Same as option --verbose.
On some commands this is use to provide a value for an object or an attribute.
Same as option --mattrvalue.
Same as option --attrvalue.
This is the command line client for CipUX::Storage. It can be used to get modify or delete CipUX storage objects.
cipux_storage_client -t get_value cipux_storage_client -t set_value cipux_storage_client -t get_all_values cipux_storage_client -t set_all_values cipux_storage_client -t add_node cipux_storage_client -t rename_node cipux_storage_client -t delete_node
Retrieve one or more \s-1LDAP\s0 values for every given attribute of a given object.
Retrieve one or more \s-1LDAP\s0 values for every given attribute of all objects in a given object type.
(1) You can add values with cipux_storage_client -t set_value.
cipux_storage_client -t set_value -s all_group_node -e memberUid -o testgroup -v login -a
But this make only a difference for \s-1LDAP\s0 attributes which can be there more then one time.
cipux_storage_client -t set_value -s all_group_node -e memberUid -o testgroup -v login1 -a cipux_storage_client -t set_value -s all_group_node -e memberUid -o testgroup -v login2 -a
This will result:
memberUid: login1 memberUid: login2
Where as the following lines have a different result:
cipux_storage_client -t set_value -s all_group_node -e groupType -o testgruppe -v public -a
The resulting exception:
attribute 'groupType' cannot have multiple values at ./cipux_storage_client -t set_value line 369
In this case you have to remove the -a option from your line or use -r.
(2) The default behavior is to replace values. Values can be replaces with:
cipux_storage_client -t set_value -s all_group_node -e groupType -o testgruppe -v private
or
cipux_storage_client -t set_value -s all_group_node -e groupType -o testgruppe -v private -r
This will replace the existing value with the new one.
But be aware (!), if you have 3 members in a group, for example:
memberUid: login1 memberUid: login2 memberUid: login3
after command the command:
cipux_storage_client -t set_value -s all_group_node -e memberUid -o testgroup -v login4
you will have only one member!
memberUid: login4
Therefor the default behavior is to replace all but one value. The replace and not the add is the default behavior, because it there are more single attributes in \s-1LDAP\s0 and therefor the probability of failure will be less if replace is the default behavior.
(3) Also \s-1LDAP\s0 attributes can be deleted. If you have 2 memberUid's for example the delete operation will led to an exception:
modify/delete: memberUid: no such value at ./cipux_storage_client -t set_value line 369
So to delete all (!) member you have to do two \s-1LDAP\s0 operations:
cipux_storage_client -t set_value -s all_group_node -e memberUid -o testgroup -v login -r cipux_storage_client -t set_value -s all_group_node -e memberUid -o testgroup -v login -d
Where as the value from -v is not important.
Set all \s-1LDAP\s0 values of a given object and attribute.
Adds an \s-1LDAP\s0 node.
\s-1SYNOPIS\s0
cipux_storage_client -t add_node -s <TYPE> -o <NAME> -x <ATTR>=<VALUE> [-x <ATTR>=<VALUE> ...]
Usage example
cipux_storage_client -t add_node -s cipux_room -o test1 -x objectClass=room -x objectClass=cipuxRoom -x cn=test1
If you do not provide cn=NAME for example, you will get the following exception:
EXCEPTION mandatory attr [cn] is missing! Please provide -x or --mattrvalue command line option! Example: -x cn=<VALUE>
To add a user node (not a complete user account!) this will create a half user account named testuser:
cipux_storage_client -t add_node -s cipux_account.user -o testuser -x cipuxFirstname=test -x cipuxLastname=user -x objectClass=cipuxAccount -x objectClass=posixAccount -x objectClass=shadowAccount -x uid=testuser -x cn=testuser -x cipuxCreationDate=2007-10-26 -x uidNumber=20000 -x gidNumber=20000 -x homeDirectory=/home/testuser -x objectClass=imapUser -x mailMessageStore=/tmp -D 129
Of course this is just an example. It is not a good idea to give /tmp as mail storage directory or use a static uidNumber. But this or a similar command can be user to test the \s-1LDAP\s0 layer.
The rename command sets upon the Net::LDAP command modrdn. And due to the fact that simply rename a \s-1LDAP\s0 dn is not hole task of renaming an \s-1LDAP\s0 leaf the command can rename only certain \s-1LDAP\s0 objects.
It can for example rename a cipuxConfiguration \s-1LDAP\s0 leaf. Before renaming it looks basically like this:
dn: cn=testconfig,ou=Configuration,ou=CipUX,dc=nodomain cipuxVariable: testvalue cn: testconfig objectClass: top objectClass: cipuxConfiguration
If you now issue the command:
cipux_storage_client -t rename_node -s cipux_configuration -o testconfig -v myconfig
You will get
dn: cn=myconfig,ou=Configuration,ou=CipUX,dc=nodomain cipuxVariable: testvalue cn: testconfig cn: myconfig objectClass: top objectClass: cipuxConfiguration
You noticed the 'cn' has doubled, since \s-1LDAP\s0 expect a corresponding 'cn' in this \s-1LDAP\s0 object? There for this configuration has now two names. It should be difficult to crate now a new 'testconfig'. You have to delete 'cn: testconfig' attribute and value before you can create a new 'testconfig'. Because this is rather confusing, you should avoid renaming where possible. Deleting an object and recreate it is a safer way.
Deletes a given \s-1LDAP\s0 node.
\s-1TODO\s0
\s-1TODO\s0
/usr/share/cipux/etc/cipux_storage.perl
CipUX::Storage::Client
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) 2008 - 2009 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