Thu, 04 Oct 2012 20:30:05 +0200
Correct out of date build configuration, porting to Solaris 11 network
link infrastructure and new libpcap logic. This additionally allows for
device drivers in subdirectories of /dev. Correct packaged nmap
personalities and signatures to work out of the box. Finally, hack
arpd logic to properly close sockets and quit on TERM by repeating
signaling in the run command script. Sadly, all this fails to correct
the run time behaviour of honeyd which fails to bind to the IP layer.
michael@428 | 1 | |
michael@428 | 2 | =pod |
michael@428 | 3 | |
michael@428 | 4 | =head1 NAME |
michael@428 | 5 | |
michael@428 | 6 | B<openpkg register> - OpenPKG Registry Command-Line Client |
michael@428 | 7 | |
michael@428 | 8 | =head1 SYNOPSIS |
michael@428 | 9 | |
michael@428 | 10 | B<register> [-u|--user=<user|token>] [-l|--link=<token>] [I<-d|--desc=<text>>] |
michael@428 | 11 | [-m|--mode=fake|post|wipe] [I<-a|--args=<args>>] |
michael@428 | 12 | [I<--plat=<text>>] [I<--orel=<text>>] [I<--uuid=<file>>] |
michael@428 | 13 | [I<--conf=<file>>] [I<--prep=<file>>] [I<--tran=<file>>] |
michael@428 | 14 | [I<--util=<file>>] [--data=<tag>[,<tag>...]] |
michael@428 | 15 | [I<-P|--preparation>] [I<-T|--transaction>] |
michael@428 | 16 | [I<-U|--utilization>] [I<-C|--convenience>] |
michael@428 | 17 | [I<-I|--interaction>] |
michael@428 | 18 | [I<-v|--verbose>] [I<-h|--help>] |
michael@428 | 19 | |
michael@428 | 20 | B<register> -S|--printstatus |
michael@428 | 21 | |
michael@428 | 22 | B<register> -R|--rewriteurls [I<url> ...] |
michael@428 | 23 | |
michael@428 | 24 | =head1 DESCRIPTION |
michael@428 | 25 | |
michael@428 | 26 | B<openpkg register> is the Command-Line Client the OpenPKG Registry. It is |
michael@428 | 27 | used by administrators to register an instance with the OpenPKG Registry for |
michael@428 | 28 | later association. |
michael@428 | 29 | |
michael@428 | 30 | After association, B<openpkg register> can be used for repetitive |
michael@428 | 31 | reregistrations which update the heartbeat of the instance on the Registry |
michael@428 | 32 | server, avoiding premature depature from the database. It is assumed that |
michael@428 | 33 | every instance will be reregistered daily. Dormant |
michael@428 | 34 | instances might be discarded from the Registry, revoking their access to |
michael@428 | 35 | additional resources. |
michael@428 | 36 | |
michael@428 | 37 | =head1 PRIMARY OPERATIONS |
michael@428 | 38 | |
michael@428 | 39 | The following primary operations are available: |
michael@428 | 40 | |
michael@428 | 41 | =over 4 |
michael@428 | 42 | |
michael@428 | 43 | =item B<-h>, B<--help> |
michael@428 | 44 | |
michael@428 | 45 | Display brief usage message. |
michael@428 | 46 | |
michael@428 | 47 | =item B<-v>, B<--verbose> |
michael@428 | 48 | |
michael@428 | 49 | Display progress information during data posting. |
michael@428 | 50 | |
michael@428 | 51 | =item B<-P>, B<--preparation> |
michael@428 | 52 | |
michael@428 | 53 | Execute the primary operation "preparation". |
michael@428 | 54 | Creates registry data for one request and dumps it stdout |
michael@428 | 55 | in XML format. That request can be filtered and piped into |
michael@428 | 56 | the transaction phase or it can be copied and pasted into the |
michael@428 | 57 | XMLdump CGI facility manually. |
michael@428 | 58 | A copy of the output of the last run is also saved to the C<${REGISTRY_PREP}> file. |
michael@428 | 59 | |
michael@428 | 60 | =item B<-T>, B<--transaction> |
michael@428 | 61 | |
michael@428 | 62 | Execute the primary operation "transaction". |
michael@428 | 63 | Reads registry data with one request from stdin, executes |
michael@428 | 64 | the transaction and writes registry data with one or more |
michael@428 | 65 | responses to stdout in XML format. |
michael@428 | 66 | Depending on the mode of operation, the transaction might be an actual |
michael@428 | 67 | transport to the XMLdump CGI facility or a fake activity which complements the |
michael@428 | 68 | manual preparation. |
michael@428 | 69 | A copy of the output of the last run is also saved to the C<${REGISTRY_TRAN}> file. |
michael@428 | 70 | |
michael@428 | 71 | =item B<-U>, B<--utilization> |
michael@428 | 72 | |
michael@428 | 73 | Execute the primary operation "utilization". |
michael@428 | 74 | Reads registry data with one response from stdin and updates the local |
michael@428 | 75 | registry information. |
michael@428 | 76 | Depending on the mode of operation, the utilization might be an actual |
michael@428 | 77 | processing of a transaction response or a fake activity which complements the |
michael@428 | 78 | manual transaction. |
michael@428 | 79 | Anyway, this step finalizes the registration process and makes the instance |
michael@428 | 80 | assume it has been properly registered. This status can be printed. URL |
michael@428 | 81 | rewriting is activated. |
michael@428 | 82 | A copy of the output of the last run is also saved to the C<${REGISTRY_UTIL}> file. |
michael@428 | 83 | |
michael@428 | 84 | =item B<-C>, B<--convenience> |
michael@428 | 85 | |
michael@428 | 86 | Execute the primary operation "convenience". |
michael@428 | 87 | This executes the three primary operations "preparation", "transaction" and |
michael@428 | 88 | "utilization" in that order and pipes data through this chain. |
michael@428 | 89 | |
michael@428 | 90 | =item B<-I>, B<--interaction> |
michael@428 | 91 | |
michael@428 | 92 | Execute the primary operation "interaction". |
michael@428 | 93 | Like "convenience" but user is interactively asked for information. This is |
michael@428 | 94 | the easiest way to do registration but it is not meat to be automated. |
michael@428 | 95 | |
michael@428 | 96 | =item B<-S>, B<--printstatus> |
michael@428 | 97 | |
michael@428 | 98 | If the instance has been registered, information about the registration is printed in a |
michael@428 | 99 | format suitable for shell evaluation and return code is true. |
michael@428 | 100 | Otherwise nothing is printed and return code is false. |
michael@428 | 101 | |
michael@428 | 102 | =item B<-R>, B<--rewriteurls> [I<url> ...] |
michael@428 | 103 | |
michael@428 | 104 | If the instance has been registered, the given URLs are rewritten to prepend |
michael@428 | 105 | user:pass information before hostnames below the openpkg.(org|net|com) |
michael@428 | 106 | domains. Note the username is is UUID_REGISTRY and the password is the |
michael@428 | 107 | concatenation of UUID_INSTANCE and UUID_PLATFORM from the |
michael@428 | 108 | PREFIX/etc/openpkg/uuid file. Both informations are not meant to be used for |
michael@428 | 109 | traditional authentication, they are merly statistical information. |
michael@428 | 110 | Otherwise the URLs are returned verbatim. |
michael@428 | 111 | |
michael@428 | 112 | =back |
michael@428 | 113 | |
michael@428 | 114 | =head1 STANDARD OPTIONS |
michael@428 | 115 | |
michael@428 | 116 | Standard options are typically used to automate registration (not |
michael@428 | 117 | association). |
michael@428 | 118 | |
michael@428 | 119 | =over 4 |
michael@428 | 120 | |
michael@428 | 121 | =item B<-m>, B<--mode> fake|post|wipe |
michael@428 | 122 | |
michael@428 | 123 | Overrides C<${REGISTRY_MODE}> variable in C<${REGISTRY_CONF}> file. |
michael@428 | 124 | Has no default and is a manadatory setting. |
michael@428 | 125 | |
michael@428 | 126 | In B<post> mode, transactions are carried out using real network connectivity. |
michael@428 | 127 | The "preparation" step creates a XMLdump and writes it into the |
michael@428 | 128 | C<${REGISTRY_PREP}> file. The "transaction" step posts it to the DropXML form |
michael@428 | 129 | using a HTTP request. The response coming back from Registration server is |
michael@428 | 130 | also in XML format and is saved to C<${REGISTRY_TRAN}> file. The |
michael@428 | 131 | "utilization" step processes this response and writes the final results to the |
michael@428 | 132 | C<${REGISTRY_UTIL}> file. |
michael@428 | 133 | |
michael@428 | 134 | In B<fake> mode, no network connectivity takes place. |
michael@428 | 135 | The "prepararation" step creates a XMLdump and writes it into the |
michael@428 | 136 | C<${REGISTRY_PREP}> file. The "transaction" step is a fake only. It assumes a |
michael@428 | 137 | successful response from the Registration server and saves it to |
michael@428 | 138 | C<${REGISTRY_TRAN}> file. The "utilization" step processes this response and |
michael@428 | 139 | writes the final results to the C<${REGISTRY_UTIL}> file. |
michael@428 | 140 | I<Note>: fake mode is meant as a way to register instances which cannot or must |
michael@428 | 141 | not post data directly to the Registration server. |
michael@428 | 142 | |
michael@428 | 143 | In B<wipe> mode, the registration is wiped out locally. The status is reset |
michael@428 | 144 | and URL rewriting is disabled. |
michael@428 | 145 | I<Note>: the registration server is not contacted, the instace must be removed |
michael@428 | 146 | manually using the web interface. |
michael@428 | 147 | I<Note>: wiping registration is highly recommended as a precursor action of |
michael@428 | 148 | cloning activities. |
michael@428 | 149 | |
michael@428 | 150 | =item B<-a>, B<--args> "arg [arg ...]" |
michael@428 | 151 | |
michael@428 | 152 | Overrides C<${REGISTRY_ARGS}> variable in C<${REGISTRY_CONF}> file. |
michael@428 | 153 | Complements the mode and is specific to it. |
michael@428 | 154 | Defaults to "http://registry.openpkg.org/register" which is the official registry of the OpenPKG Project. |
michael@428 | 155 | This default is useful for "post" mode. |
michael@428 | 156 | |
michael@428 | 157 | =item B<-u>, B<--user> I<user|token> |
michael@428 | 158 | |
michael@428 | 159 | Overrides C<${REGISTRY_USER}> variable in C<${REGISTRY_CONF}> file. |
michael@428 | 160 | Indicates the registry user which will find this registration in his arrival queue. |
michael@428 | 161 | The user can also specified as a token which is enabled for use as "user". |
michael@428 | 162 | If the token is also enabled for "assoc" the registered instance is immediately associated |
michael@428 | 163 | to the user with no need for the user to visit the web interface. |
michael@428 | 164 | This information in submitted via the "registry_user" attribute of the XML request. |
michael@428 | 165 | Retrieves default online from http://openpkg.org/go/autoregister and is a manadatory setting. |
michael@428 | 166 | |
michael@428 | 167 | =item B<-l>, B<--link> I<token> |
michael@428 | 168 | |
michael@428 | 169 | Overrides C<${REGISTRY_LINK}> variable in C<${REGISTRY_CONF}> file. |
michael@428 | 170 | Indicates the registry user which will find this registration linked to his token. |
michael@428 | 171 | The link must be specified as a token which is enabled for use as "link". |
michael@428 | 172 | If a user token is used and the link token is also enabled for "assoc" then the registered instance |
michael@428 | 173 | is immediately associated to the user with no need for the user to visit the web interface. |
michael@428 | 174 | This information in submitted via the "registry_link" attribute of the XML request. |
michael@428 | 175 | Has no default and is an optional setting. |
michael@428 | 176 | Be aware that linked users see the same information about an instance as the associated user |
michael@428 | 177 | can find on his "association" page but they cannot alter or delete information. |
michael@428 | 178 | |
michael@428 | 179 | =item B<-d>, B<--desc> I<description> |
michael@428 | 180 | |
michael@428 | 181 | Overrides C<${REGISTRY_DESC}> variable in C<${REGISTRY_CONF}> file. |
michael@428 | 182 | Indicates a human readable description of the instance. |
michael@428 | 183 | This information in submitted via the "registry_desc" attribute of the XML request. |
michael@428 | 184 | It appears in the "description" column on the "association" page of the web form and can be edited on the server side. |
michael@428 | 185 | Defaults to "openpkg://${FQDN}${PREFIX}" |
michael@428 | 186 | |
michael@428 | 187 | =back |
michael@428 | 188 | |
michael@428 | 189 | =head1 ADVANCED OPTIONS |
michael@428 | 190 | |
michael@428 | 191 | Advanced options can be enganged to tailor and fully automate a registration |
michael@428 | 192 | (not association). |
michael@428 | 193 | |
michael@428 | 194 | =over 4 |
michael@428 | 195 | |
michael@428 | 196 | =item B<--plat> |
michael@428 | 197 | |
michael@428 | 198 | Overrides C<${REGISTRY_PLAT}> variable in C<${REGISTRY_CONF}> file. |
michael@428 | 199 | Indicates the platform. Concatenated information from CPU architecture (arch) and Operating System (os). |
michael@428 | 200 | This information in submitted via the "registry_plat" attribute of the XML request. |
michael@428 | 201 | Defaults to "%{l_platform -p}", e.g. "ix86-freebsd6.1" |
michael@428 | 202 | |
michael@428 | 203 | =item B<--orel> |
michael@428 | 204 | |
michael@428 | 205 | Overrides C<${REGISTRY_VERS}> variable in C<${REGISTRY_CONF}> file. |
michael@428 | 206 | Indicates the OpenPKG release. |
michael@428 | 207 | This information in submitted via the "registry_orel" attribute of the XML request. |
michael@428 | 208 | Defaults to "%{l_openpkg_release}", e.g. "OpenPKG-CURRENT", "OpenPKG-2-STABLE", "OpenPKG-2.5", |
michael@428 | 209 | |
michael@428 | 210 | =item B<--uuid> |
michael@428 | 211 | |
michael@428 | 212 | Overrides C<${REGISTRY_UUID}> variable in C<${REGISTRY_CONF}> file. |
michael@428 | 213 | Indicates the UUID file of the instance. |
michael@428 | 214 | This information in submitted via the "uuid_registry", "uuid_instance" and "uuid_platform" attributes of the XML request. |
michael@428 | 215 | Defaults to F<${PREFIX}/etc/openpkg/uuid> |
michael@428 | 216 | |
michael@428 | 217 | =item B<--conf> |
michael@428 | 218 | |
michael@428 | 219 | Overrides C<${REGISTRY_CONF}> variable from previous C<${REGISTRY_CONF}> file. Processing |
michael@428 | 220 | of the current configuration file is aborted immediately with all variables |
michael@428 | 221 | read so far kept. THe new configuration file is read in immediately and |
michael@428 | 222 | processing continues there. This works similar to an include but is more |
michael@428 | 223 | primitive as it does not allow nesting, only chaining. |
michael@428 | 224 | Defaults to F<${PREFIX}/etc/openpkg/register.conf> |
michael@428 | 225 | |
michael@428 | 226 | =item B<--prep> |
michael@428 | 227 | |
michael@428 | 228 | Overrides C<${REGISTRY_PREP}> variable in C<${REGISTRY_CONF}> file. |
michael@428 | 229 | File to save a copy of the output from the "preparation" step. |
michael@428 | 230 | Defaults to F<${PREFIX}/etc/openpkg/register.prep> |
michael@428 | 231 | |
michael@428 | 232 | =item B<--tran> |
michael@428 | 233 | |
michael@428 | 234 | Overrides C<${REGISTRY_TRAN}> variable in C<${REGISTRY_CONF}> file. |
michael@428 | 235 | File to save a copy of the output from the "transaction" step. |
michael@428 | 236 | Defaults to F<${PREFIX}/etc/openpkg/register.tran> |
michael@428 | 237 | |
michael@428 | 238 | =item B<--util> |
michael@428 | 239 | |
michael@428 | 240 | Overrides C<${REGISTRY_UTIL}> variable in C<${REGISTRY_CONF}> file. |
michael@428 | 241 | File to save a copy of the output from the "utilization" step. |
michael@428 | 242 | Defaults to F<${PREFIX}/etc/openpkg/register.util> |
michael@428 | 243 | |
michael@428 | 244 | =item B<--data> |
michael@428 | 245 | |
michael@428 | 246 | Overrides C<${REGISTRY_DATA}> variable in C<${REGISTRY_CONF}> file. |
michael@428 | 247 | Comma separated list of tags to prepare. Available tags are "request", |
michael@428 | 248 | "package" and "provides". The "request" refers to the whole thing and |
michael@428 | 249 | is mandatory. The "package" includes name-version-release information |
michael@428 | 250 | for all installed packages and "provides" adds more details required to |
michael@428 | 251 | capture package options. For details see OPENPKG_PREP below. |
michael@428 | 252 | Defaults to "request,package,provides" |
michael@428 | 253 | |
michael@428 | 254 | =back |
michael@428 | 255 | |
michael@428 | 256 | =head1 FILES |
michael@428 | 257 | |
michael@428 | 258 | The following files are used by B<openpkg register>: |
michael@428 | 259 | |
michael@428 | 260 | =over 4 |
michael@428 | 261 | |
michael@428 | 262 | =item OPENPKG_UUID=F<${PREFIX}/etc/openpkg/uuid> |
michael@428 | 263 | |
michael@428 | 264 | UUID_REGISTRY="..." |
michael@428 | 265 | UUID_INSTANCE="..." |
michael@428 | 266 | UUID_PLATFORM="..." |
michael@428 | 267 | |
michael@428 | 268 | =item OPENPKG_CONF=F<${PREFIX}/etc/openpkg/register.conf> |
michael@428 | 269 | |
michael@428 | 270 | Format suitable for shell evaluation. Interactive mode appends remarked date |
michael@428 | 271 | and current settings for reuse as new defaults for future runs. Can be preset |
michael@428 | 272 | to customize or automate registration. |
michael@428 | 273 | |
michael@428 | 274 | =item OPENPKG_PREP=F<${PREFIX}/etc/openpkg/register.prep> |
michael@428 | 275 | |
michael@428 | 276 | <?xml version="1.0" encoding="iso-8859-1" standalone="no"?> |
michael@428 | 277 | <!DOCTYPE registry |
michael@428 | 278 | PUBLIC "-//OpenPKG//DTD OpenPKG Registry 0.0.1//EN" |
michael@428 | 279 | "http://registry.openpkg.org/registry.dtd" []> |
michael@428 | 280 | <registry> |
michael@428 | 281 | <request id="..." |
michael@428 | 282 | registry_user="me@example.com" |
michael@428 | 283 | registry_desc="openpkg://rm0.openpkg.net/openpkg-dev" |
michael@428 | 284 | registry_plat="ix86-freebsd6.1" |
michael@428 | 285 | registry_orel="OpenPKG-CURRENT" |
michael@428 | 286 | uuid_registry="..." |
michael@428 | 287 | uuid_instance="..." |
michael@428 | 288 | uuid_platform="..." |
michael@428 | 289 | /> |
michael@428 | 290 | <package id="..." name="ssmtp" version="2.61" release="20050608"> |
michael@428 | 291 | <provides name="ssmtp::with_ssl" flag="=" version="no"/> |
michael@428 | 292 | <provides name="MTA" flag="" version=""/> |
michael@428 | 293 | <provides name="ssmtp" flag="=" version="2.61-20050608"/> |
michael@428 | 294 | </package> |
michael@428 | 295 | </registry> |
michael@428 | 296 | |
michael@428 | 297 | The XML request starts with <?xml version ...> and <!DOCTYPE registry ...> |
michael@428 | 298 | headers followed by a <registry> container. The request is inside a <request> |
michael@428 | 299 | tag. Successful submission into the XMLdump form requires the headers and |
michael@428 | 300 | exactly one container. It is possible to merge multiple requests into a single |
michael@428 | 301 | container manually or otherwise and submit them all at once. |
michael@428 | 302 | |
michael@428 | 303 | =item OPENPKG_TRAN=F<${PREFIX}/etc/openpkg/register.tran> |
michael@428 | 304 | |
michael@428 | 305 | <?xml version="1.0" encoding="iso-8859-1" standalone="no"?> |
michael@428 | 306 | <!DOCTYPE registry |
michael@428 | 307 | PUBLIC "-//OpenPKG//DTD OpenPKG Registry 0.0.1//EN" |
michael@428 | 308 | "http://registry.openpkg.org/registry.dtd" []> |
michael@428 | 309 | <registry> |
michael@428 | 310 | <response id="..." done="yes">openpkg://rm0.openpkg.net/openpkg-dev</response> |
michael@428 | 311 | </registry> |
michael@428 | 312 | |
michael@428 | 313 | The XML response starts with <?xml version ...> and <!DOCTYPE registry ...> |
michael@428 | 314 | headers followed by a <registry> container. The response is inside a <request> |
michael@428 | 315 | tag. The data carried in the tag comes from the "description" column on the |
michael@428 | 316 | "association" page of the web form and can be edited on the server side. |
michael@428 | 317 | |
michael@428 | 318 | =item OPENPKG_UTIL=F<${PREFIX}/etc/openpkg/register.util> |
michael@428 | 319 | |
michael@428 | 320 | REGISTRY_DBID="..." |
michael@428 | 321 | REGISTRY_DONE="yes" |
michael@428 | 322 | REGISTRY_RESP="openpkg://foo.example.com/my/openpkg/prefix" |
michael@428 | 323 | |
michael@428 | 324 | =back |
michael@428 | 325 | |
michael@428 | 326 | =head1 EXAMPLES |
michael@428 | 327 | |
michael@428 | 328 | # su - openpkg-mop |
michael@428 | 329 | $ openpkg register --printstatus |
michael@428 | 330 | REGISTRY_DBID="..." |
michael@428 | 331 | REGISTRY_DONE="yes" |
michael@428 | 332 | REGISTRY_RESP="openpkg://foo.example.com/my/openpkg/prefix" |
michael@428 | 333 | $ openpkg register --printstatus >/dev/null && echo "Yup" |
michael@428 | 334 | Yup |
michael@428 | 335 | $ eval `openpkg register --printstatus`; echo DONE=$REGISTRY_DONE |
michael@428 | 336 | DONE=yes |
michael@428 | 337 | $ openpkg register --mode=wipe |
michael@428 | 338 | $ openpkg register --printstatus || echo "Nope" |
michael@428 | 339 | Nope |
michael@428 | 340 | $ openpkg register --user=thl@openpkg.net --mode=post |
michael@428 | 341 | REGISTRY_DBID="...." |
michael@428 | 342 | REGISTRY_DONE="yes" |
michael@428 | 343 | REGISTRY_RESP="openpkg://foo.example.com/my/openpkg/prefix" |
michael@428 | 344 | $ openpkg register --printstatus >/dev/null && echo "Yup" |
michael@428 | 345 | Yup |
michael@428 | 346 | $ openpkg register --rewriteurls http://download.openpkg.org/foo/bar |
michael@428 | 347 | ftp://...:...@download.openpkg.org/foo/bar |
michael@428 | 348 | |
michael@428 | 349 | =head1 SEE ALSO |
michael@428 | 350 | |
michael@428 | 351 | bash(1), C<openpkg man uuid>, C<http://registry.openpkg.org/> |
michael@428 | 352 | |
michael@428 | 353 | =head1 AUTHOR |
michael@428 | 354 | |
michael@428 | 355 | Thomas Lotterer E<lt>thl@openpkg.orgE<gt> |
michael@428 | 356 | |
michael@428 | 357 | =cut |
michael@428 | 358 |