Setting wadm options in rcfile

WS7.0 CLI : How to avoid typing options repeatedly?



Sun Java System Web Server 7.0 has a robust Command Line Interface which can be used to administer the many configs and instances on the server. This command line tool or executable is called wadm which is present in <server-install-root>/bin. To avoid typing the common options such as user, password etc for every command, the option can either be set as an environment variable in the shell invoking wadm or within the wadm shell . The shell variable name is obtained as wadm_option. If the option has a hyphen ("-"), it should be replaced with an underscore ("_").

eg)
If option : user
shell variable name
: wadm_user

If option  : key-type
shell variable name : wadm_key_type

How ???
1) create rcfile .wadmrc to set the shell variables
2) use set /unset commands within the wadm shell

Note: Options supplied directly on the command line will take precedence over the shell variables.



For example if you want to  execute the  CLI create-selfsigned-cert:


CLI Usage:

create-selfsigned-cert [--echo=true] [--prompt=false] [--verbose=true] [--token=name] [--org-unit=unit] [--locality=place] [--state=name] [--validity=num of months] [--org=org] [--country=name] [--key-type=(rsa|ecc)] [--key-size=size] [--curve=curvename] --config=name --server-name=name --nickname=nickname


If you want the org and country same for all the certificates you create, your rcfile should look like this:

<server-root>/bin>> vi .wadmrc

set wadm_password adminadmin
set wadm_org SUN
set wadm_country US

--------------------------------------------------------------------------------------------------------------------------------


Now, to execute the CLI, enter the wadm prompt as:
./wadm --user=admin --port=8888 --rcfile=.wadmrc

And execute CLI:
wadm>create-selfsigned-cert --config=config1 --server-name=server1 --nickname=cert1
wadm>create-selfsigned-cert --config=config1 --server-name=server2 --nickname=cert2

You need not specify the options org and  country again. These certificates will be created with org=SUN and country=US. This can be verified using certutil or viewed from the Administration GUI.

<server-install-root>/bin# ./certutil -L -d <server-install-root>/admin-server/config-store/config1/config -n cert1
Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number:
            00:82:7e:c1:aa
        Signature Algorithm: PKCS #1 MD5 With RSA Encryption
        Issuer: "CN=server1,O=SUN,C=US"
        Validity:
            Not Before: Wed May 17 06:30:13 2006
            Not After : Thu Aug 17 06:30:13 2006
        Subject: "CN=server1,O=SUN,C=US"
        Subject Public Key Info:
            Public Key Algorithm: PKCS #1 RSA Encryption
         .
         .
         .
         .
         .
         .
         .

wadm>set wadm_org JWS
wadm>create-selfsigned-cert --config=config1 --server-name=server3 --nickname=cert3

Here, cert3 gets created with org=JWS and not SUN. Use unset wadm_org to remove this setting.

wadm>create-selfsigned-cert --config=config1 --server-name=server4 --org=WS --nickname=cert4

Here, cert4 gets created with org=WS.

ie, Precedence is in the following order :
Option in the command itself >>>  set/unset commands in wadm shell >>> rcfile


To know more about SJSWS7.0 Administration, see I.K's blog


Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

dee

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today