1 The server uses a protocol provided by libassuan to communicate with a client.
2 An OK response is returned when a command succeeds or ERR along with an error
3 code and description, if not. When a command requests data for retrieval
4 (e.g., GET) the output is prefixed with D then a single SPACE then the actual
5 data followed by an OK response. Read the libassuan docs for more info about
12 OPEN <filename> [<key>]
13 Opens <filename> using <key>. If file is not found on the file-system, then
14 a new document will be created. If the file is found, it is looked for in
15 the file cache for an existing key. When found, the existing key will be
16 used for decryption. You can also open another file using the same
21 Writes the XML document to disk. The file written to is the file that was
22 opened using the OPEN command. If <key> is not specified then the
23 currently cached key will be used. If the file is a new file or the file
24 isn't found in the file cache, <key> is required.
28 An OK response is returned if the specified file is in the file cache.
31 CLEARCACHE [<filename>]
32 Clears a file cache entry. This will forget the timeout and key for all or
36 CACHETIMEOUT <seconds> <filename>
37 Specify the number of seconds the specified file will be cached. -1 will
38 keep the cache entry forever, 0 will require the key each time the OPEN or
39 SAVE commands are used. Also see the "cache_timeout" configuration option.
42 LIST [[!]element[<TAB>[!]element[...]]]
43 If no element path is given then a list of root elements is returned with
44 the data response code. If given, then all reachable elements for the
45 specified element path are returned. Each element in the path is prefixed
46 with the literal '!' character when the element contains no "target"
47 attribute (See THE TARGET ATTRIBUTE below).
49 If only a single element is specified and without the literal '!' prefix,
50 both the literal element tree and the element target (if any) tree will be
54 REALPATH [!]element[<TAB>[!]element[...]]
55 Resolves all "target" attributes of the specified element path and returns
56 the result with a data response.
59 STORE [!]element[[<TAB>[!]element[...]]<TAB>[content]]
60 Creates a new element tree or modifies the content of an existing element
61 path. If only a single element is specified, a new root element is
62 created. Otherwise, elements are TAB delimited and the content will be set
63 to the last TAB delimited argument. If no content is specified after the
64 last TAB then the content for the last specified element will be removed
65 or the content will be empty when creating a new element.
67 The only restriction of element names is that they not begin with a
68 punctuation character (the literal '!' character is an exception) or digit
69 and not contain any whitespace. There is no whitespace between the TAB
70 delimited elements. It is recommended that the value be base 64 encoded to
71 prevent libXML and pwmd parsing errors.
73 PWMD reads the element path from the client via the Assuan INQUIRE
74 protocol response. The STORE command is sent by itself without arguments,
75 then the server responds with INQUIRE. The client then sends the element
76 path prefixed by a "D " data response. When finished, the client
77 sends "END" on an empty line. This is needed so an element path and value
78 can be more than 1000 bytes long, the Assuan protocol line limit.
81 DELETE [!]element[<TAB>[!]element[...]]
82 Removes an element tree from the specified element path.
85 GET [!]element[<TAB>[!]element[...]]
86 Retrieves the content of the specified element path. The data is returned
90 ATTR SET|GET|DELETE|LIST [<attribute>] [!]<arg1> [!][arg2]
91 ATTR SET attribute [!]element[<TAB>[!]element[...]] attribute_value
92 Stores or updates an attribute value to an element path.
94 ATTR DELETE attribute [!]element[<TAB>[!]element[...]]
95 Removes an attribute from an element path.
97 ATTR LIST [!]element[<TAB>[!]element[...]]
98 Gets a list of attributes from an element path.
100 ATTR GET attribute [!]element[<TAB>[!]element[...]]
101 Gets the value of an attribute from an element path.
103 The "name" attribute (case sensitive) cannot be removed with ATTR DELETE
104 if the element path is only a root element. Although it can be SET to
105 change the root element name.
107 Also see THE TARGET ATTRIBUTE below.
111 Shows the in memory XML document with indenting.
114 GETCONFIG <parameter>
115 Returns the value of a pwmd configuration variable with a data response.
116 If no file is open then the default value will be returned. The "key" and
117 "key_file" variables are ignored.
121 Closes the connection. Use the SAVE command before this command as any
122 changes will be lost.
125 If a command fails then the ERR response is returned followed by a protocol
126 error code and description. See src/pwmd_error.h or libpwmd/libpwmd.h for
132 Some commands send a status message to the client when successful or as a
133 progress indicator. Status messages begin with a KEYWORD (see below) followed
134 by the status description. What messages are sent, and how often, depend on
135 configuration settings:
138 --------------------------------
158 KEYWORD OUTPUT FORMAT
159 ---------------------------------
160 CACHE <slots used> <slots available>
161 ENCRYPT <iterations so far>
162 DECRYPT <iterations so far>
163 COMPRESS <bytes so far> <total bytes>
164 DECOMPRESS <bytes so far> <total bytes>
165 LOCKED When another thread owns the file/key cache lock,
166 this is sent once and the thread blocks until the
167 lock can be obtained and the command completes.
172 There is a special attribute "target" (case sensitive) that can be set with
173 ATTR SET. The value of this attribute is an element path somewhere else in the
176 ATTR SET target [!]element[<TAB>[!]element[..]] [!]element[<TAB>[!]element[..]]
177 arg1^^^^^^^^^^^^^^^^^^^^^^^^ arg2^^^^^^^^^^^^^^^^^^^^^^^^
179 If the element path of the "target" attribute (arg1) doesn't exist, it is
180 created. This is the only time the ATTR command will create elements.
182 When a protocol command requests <arg1> as the element path, the remaining
183 elements after the element with the "target" attribute will be appended to
184 <arg2>. This is useful if you have elements that share the same data. If the
185 target is modified, the other elements "pointing" to the target will have the
186 same content. To get the real or literal element and ignore any "target"
187 attributes, prefix an element with a '!' character. Here's an example:
191 C> D host1<TAB>username<TAB>original username
196 C> D host2<TAB>smtp<TAB>username<TAB>someuser
199 C> ATTR SET target host1<TAB>username host2<TAB>smtp<TAB>username
202 Now host1's "target" attribute will be used:
204 C> GET host1<TAB>username
208 If you want host1's username, prefix the element of the "target" attribute
211 C> GET host1<TAB>!username
212 S> D original username
215 The target value (arg2) element can also have a "target" attribute:
217 C> ATTR SET target new_account host1
219 C> GET new_account<TAB>username
223 The value of the "target" attribute may also be prefixed with a '!' to set the
224 target to the actual element path and not a target of the element path:
226 C> ATTR DELETE target !new_account
228 C> ATTR SET target new_account<TAB>username host1<TAB>!username
230 C> GET new_account<TAB>username
231 S> D original username
234 The "target" attribute is considered for all commands that support an element
235 path. If the target element has been renamed or deleted afterwards, the
238 Clients should be careful of creating target loops. See the "recursion_depth"
239 configuration parameter for details.
242 XML DOCUMENT STRUCTURE
243 ----------------------
244 When importing an XML data file with the -I command line option, the document
245 should have the following DTD:
247 <?xml version="1.0"?>
249 <!ELEMENT accounts (account*)>
250 <!ATTLIST account name CDATA #REQUIRED>
253 "accounts" is the document root element while each root element mentioned in
254 the protocol commands use the "account" element. So if you have a root element
255 "isp" to be shown with the LIST command ("LIST isp"), the document structure
264 The DUMP command can be useful to show the current document structure.
267 Questions, bugs or feature requests can be sent to Ben Kibbey