Thursday, May 24, 2012

A basic DNS server in Windows 2008 R2

Alright, we will quickly stand up an instance of Domain Name System server in Windows 2008 R2. This is going to be an internal DNS server meant to be the master for all internal zones and hosts records. At this point, we are also not integrating this DNS with the Active Directory Domain Services. There will not be caching, no forwarding nor is it located in the DMZ. The DNS server could however support the access from the internal facing web tier through a forwarder.

Under Windows 2008 R2, majority of the services are exposed via a construct called 'Role'. Each role  encompasses one or more role services, and their corresponding database, collectively delivers a capability commonly required in an enterprise infrastructure. For example, the Remote Desktop Services role, comprised of a set of services such as Remote Desktop Session Host, Remote Desktop Gateway, Remote Desktop Web Access and others which can be optionally included.

In the case of DNS, the role contains only one role service, that is the Domain Name Service.

For the sake of completeness, first make sure we have assigned a static IP address to the Windows 2008 R2 server. If you server is multi homed, you need to ensure every network interface is configured with static IP address.

To install DNS server, we start with installing the DNS role using the Server Manager Management Console.

Steps to add DNS role in Windows 2008 R2
1) In the run menu, enter ServerManager.msc and press enter. A MMC (Microsoft Management Console) will be launched.


2) Under the 'Roles' node in the tree, click 'Add Role'.



3) Check the 'DNS Server' role and click 'Next'



4) If you want to learn more about DNS, read all text and links provided in this page. They are sufficient to provide a good overview of DNS offering in Windows 2008 R2 platform. Click 'Next' if you are in a hurry.




5) Click 'Install' and when the installation finish successfully, click on 'Close'.




6) You will see in the Server Manager console the installed role and the DNS server status.




After the DNS role is installed, you will be able to create a DNS zone that fits your administrative purpose. In our example, I will create a zone call web host zone and the TLD is lab.keinjuan.com.au.


7) Click on 'Go to DNS server' to further configure the service.


8) Expand the tree menu to get to the 'Forward Lookup Zones' leave. Right click and select the 'New Zone...' sub-menu. A wizard will show itself.



9) Click 'Next', select 'Primary Zone', and click 'Next' again to specify a zone name. You will have to make one up. For a flat namespace, not much thought is needed. I have chosen the following naming:

in.lab.keinjuan.org


Short explanation:
  • The 'in' part refers to 'internal' or my intranet.
  • The 'lab' indicates that this is part of my laboratory. I may have something in the future call 'kitch' for my kitchen appliances such as rice cooker, fridge and so forth. Or I will omit it for my real 'production' elements.
  • The 'keinjuan.org' is my unofficial domain name. Doesn't not exist on the internet, doesn't matter.



10) Accept the default 'Do not allow dynamic update'. We don't need that sophistication, we will add the DNS entries manually through the console.


11) Finally click on the 'Finish' button to start installation.


12) Upon the completion, the Server Manager console will display the status of the new DNS you have just created.



Lets add some A type records to resolve our iPlanet webserver and the global zone it resides in. The hostnames and their corrresponding IPv4 IP addresses are as follow:

13) Right click on the newly created forward lookup zone (in.lab.keinjuan.org)


14) In the dialog box, enter the host name in the 'Name' field, and the corresponding IP address in the 'IP address' field. If you enter an IPv4 IP address here, you will get a 'A' record, and a 'AAAA' record when you entered a valid IPv6 address.


I have configure a test IPv6 AAAA record and 2 'A' records for the Solaris global zone as well as the local zone.

15) Test your DNS server by querying the entries using nslookup command from the command prompt, in the DNS box itself. This does not require a connectivity to the hostname being queried at this point of time. Just make sure your DNS server entry in the IP configuration of your server is 127.0.0.1 (localhost).


The nslookup results for each records in the DNS.


C:\Users\Administrator.DC-PRIM>nslookup websvr-g01.in.lab.keinjuan.org
Server:  localhost
Address:  127.0.0.1

Name:    websvr-g01.in.lab.keinjuan.org
Address:  192.168.1.2

C:\Users\Administrator.DC-PRIM>nslookup websvr01.in.lab.keinjuan.org
Server:  localhost
Address:  127.0.0.1

Name:    websvr01.in.lab.keinjuan.org
Address:  192.168.1.3

C:\Users\Administrator.DC-PRIM>nslookup anIPv6Host.in.lab.keinjuan.org
Server:  localhost
Address:  127.0.0.1

Name:    anIPv6Host.in.lab.keinjuan.org
Address:  2001:db8:85a3::8a2e:370:7334


You can also create a reverse lookup zone for the PTR record so you can lookup the hostname by IP address. Play with it.

That is all. In the next article we will look at hooking up the websvr-g01 and websvr01 to this DNS server and browser the webserver using the hostname from the DNS server.

Cheers,


Friday, May 11, 2012

iPlanet in a Solaris 11 zone (Express installation)

Update: iPlanet 7.0.15 is now available for download. The file name is 145844-08.zip. The unzip instruction will be slightly different from what described here.

In the previous article I wrote about creating a Solaris 11 zone. This article will explain the steps to install iPlanet Web Server 7.0.14 in the zone.

1) Obtain a copy of iPlanet Web Server from Oracle website, the file name is Oracle-iPlanet-Web-Server-7.0.14-solaris-x86.zip. Get the update 14 here. Save the downloaded file into a directory that is accessible from the non-global zone. Best way is to place the file into a NFS share that can be accessed from the non-global zone.
2) Login to the local zone as non-root and copy the file into a temp folder.

admin@websvr01:~$ scp admin@192.168.1.2:~/Oracle-iPlanet-Web-Server-7.0.14-solaris-x86.zip .
The authenticity of host '192.168.1.2 (192.168.1.2)' can't be established.
RSA key fingerprint is cf:b0:3d:35:a5:be:4a:57:0b:4a:5e:64:94:96:66:1e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.2' (RSA) to the list of known hosts.
Password:
Oracle-iPlanet-Web-S 100% |*****************************|   160 MB    00:06   
admin@websvr01:~$



3) Unzip the file. You may need to perform unzip twice because the setup executable is inside a zip file after the first unzip.

admin@websvr01:~$ pwd
/home/admin
admin@websvr01:~$ ls
Oracle-iPlanet-Web-Server-7.0.14-solaris-x86.zip

admin@websvr01:~$ unzip Oracle-iPlanet-Web-Server-7.0.14-solaris-x86.zip 
Archive:  Oracle-iPlanet-Web-Server-7.0.14-solaris-x86.zip
   creating: 145844-07/
 extracting: 145844-07/Oracle-iPlanet-Web-Server-7.0.14-solaris-x86.zip  
  inflating: 145844-07/README.145844-07  
  inflating: 145844-07/LEGAL_LICENSE.TXT  
  inflating: 145844-07/145844-07.html  
admin@websvr01:~$ 
admin@websvr01:~$ ls
145844-07
Oracle-iPlanet-Web-Server-7.0.14-solaris-x86.zip
admin@websvr01:~$ cd 145844-07/
admin@websvr01:~/145844-07$ unzip Oracle-iPlanet-Web-Server-7.0.14-solaris-x86.zip 
admin@websvr01:~/145844-07$ ls -la
total 329601
drwxr-xr-x   4 admin    staff         10 May 11 21:36 .
drwxr-xr-x   4 admin    staff          7 May 11 21:33 ..
-rw-r--r--   1 admin    staff       8640 Feb 19 17:25 145844-07.html
-r--r--r--   1 admin    staff      18775 Sep 18  2010 LEGAL_LICENSE.TXT
drwxr-xr-x   2 admin    staff          3 Feb 14 17:08 Legal
-rwxr-xr-x   1 admin    staff    168513779 Feb 14 22:42 Oracle-iPlanet-Web-Server-7.0.14-solaris-x86.zip
-rw-r--r--   1 admin    staff       6758 Feb 19 17:25 README.145844-07
-rw-r--r--   1 admin    staff        786 Feb 14 17:08 README.txt
drwxr-xr-x   3 admin    staff         15 Feb 14 18:27 WebServer
-rwxr-xr-x   1 admin    staff      34304 Feb 14 17:08 setup
admin@websvr01:~/145844-07$ 


We are going to install the web server with 'admin' user rather than the 'root'. Run the setup and accept all default answers, the only thing you need to specify is the admin server password. The installer will detect if you have an X11 environment to bring up the GUI otherwise it will fall back to the console mode. So don't bother specify any command-line option for the setup command.



admin@websvr01:~/145844-07$ ./setup

Welcome to the Oracle iPlanet Web Server 7.0.14 installation wizard.

Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
Other names may be trademarks of their respective owners.

You will be asked to specify preferences that determine how Oracle iPlanet Web
Server 7.0.14 is installed and configured.

The installation program pauses as questions are presented so you can read the
information and make your choice. When you are ready to continue, press Enter
(Return on some keyboards).

Some questions require that you provide more detailed information. Some
questions also display default values in brackets []. For example, yes is the
default answer to the following question:

   Are you sure? [yes]

To accept the default, press Enter.

To provide a different answer, type the information at the command prompt and
then press Enter.

Hit enter to continue, accept default value for the Installation Directory, which will be /home/{user}/oracle/webserver7. At the Select Type of Installation, press enter to accept Express installation option. Accept the default Administrator user name [admin] and proceed to specify your password for this web server Administrator account. Accept the default [yes] when asked to install the server components. Hit Enter again to start installing.

When the progress indicator hits 100%, your installation is complete.

Installing Oracle iPlanet Web Server
|-1%--------------25%-----------------50%-----------------75%--------------100%|
Installation Successful.

Refer to the installation log file at:
/home/admin/oracle/webserver7/setup/install.log for more details.

Next Steps:

- You can access the Administration Console by accessing the following URL:
https://websvr01:8989
admin@websvr01:~/145844-07$ 


Try accessing https://websvr01:8989 you should see the Web Server Admin Console login screen.


Try logging in using the credential you created during installation; User Name=admin and Password=yourpassword you should see the configuration main screen.


The installation procedure has actually created an instance of a virtual server called 'websvr01' (or your hostname), but would not start it. You need to start it if you want to see how it look for the virtual server.

To start the virtual server, either use command line:

admin@websvr01:~$ cd ~/oracle/webserver7/https-websvr01/bin/
admin@websvr01:~/oracle/webserver7/https-websvr01/bin$ ./startserv 
Oracle iPlanet Web Server 7.0.14 B02/13/2012 21:44
info: CORE5076: Using [Java HotSpot(TM) Server VM, Version 1.6.0_24] from [Sun Microsystems Inc.]
info: HTTP3072: http-listener-1: http://websvr01:8080 ready to accept requests
info: CORE3274: successful server startup
admin@websvr01:~/oracle/webserver7/https-websvr01/bin$ 

Or through the admin console, go to the configuration->instance tab and start the server there.


Browse to the http://websvr01:8080 you should see your new shiny iPlanet landing page.


Well that is it, an iPlanet (formerly Sun Java Web Server) installed in a Solaris 11 zone.

Cheers,

Thursday, May 10, 2012

Bare Minimal Solaris 11 Zone

Creation and administration of local zones on Solaris 11 has become simpler since its public release in Solaris 10. This short article demonstrates the minimal steps required to create your own zone(s) in a global-zone.

1 Create the zone
First what you need is a running Solaris 11 installation, either on VMware, VirtualBox or running on native hardware. I used Oracle VirtualBox in this demonstration.

Log in with the id you created during the Solaris 11 installation. su to root as you may need more than a root role to complete the creation of a zone.

In its simplest form, a zone can be had with the following command:

# zonecfg -z webzone01 "create;set zonepath=/zones/webzone01;exit"

1.1 sub-commands explained

create: This creates a Solaris 11 zone called 'webzone01'

set zonepath=/zones/webzone01: This specifies the storage of the zone in a ZFS pool visible to the global zone.

exit: Exits the zonecfg configuration mode (and finishes up).

There are other configurations involved during zone creation. See man zonecfg (1M).

1.2 List the newly created zone

# zoneadm list -cv


  ID NAME             STATUS     PATH                           BRAND    IP   
   0 global           running    /                              solaris  shared
   - webzone01        configured /zones/webzone01               solaris  excl 
See man zoneadm (1M) for more infomation.

1.2 The resultant 'webzone01' zone
Use the following command to inpect the configuration of the newly created zone.

# zonecfg -z webzone01 info

zonename: webzone01
zonepath: /zones/webzone01
brand: solaris
autoboot: false
bootargs:
file-mac-profile:
pool:
limitpriv:
scheduling-class:
ip-type: exclusive
hostid:
fs-allowed:
anet:
 linkname: net0
 lower-link: auto
 allowed-address not specified
 configure-allowed-address: true
 defrouter not specified
 allowed-dhcp-cids not specified
 link-protection: mac-nospoof
 mac-address: random
 mac-prefix not specified
 mac-slot not specified
 vlan-id not specified
 priority not specified
 rxrings not specified
 txrings not specified
 mtu not specified
 maxbw not specified
 rxfanout not specified

The highlighted fields are those we specified during creation, the rest are default values. The 'anet' and 'ip-type' resource types deserve another article of explanation. I will write about it later.

Now you should have a zone in the 'configured' state. In summary, the typical state transition for a zone from its creation to its deletion can be depicted as follow. See man zoneadm (1M) for more information.

configured --> installed --> running
     |             |
incomplete        down
     |             |
configured        installed

2 Install the zone
Before install a zone, make sure that you have the IPS repository is configured. The zoneadm requires package from the IPS for zone installation. See this article for setting up a local IPS repository. Alternatively, you can mount the ISO image sol-11-1111-repo-full.iso directly and set-up the publisher to point directly to the file location.

# zoneadm -z webzone01 install

A ZFS file system has been created for this zone.
Progress being logged to /var/log/zones/zoneadm.20120509T131933Z.webzone01.install
       Image: Preparing at /zones/webzone01/root.

 Install Log: /system/volatile/install.3582/install_log
 AI Manifest: /tmp/manifest.xml.LCaG.g
  SC Profile: /usr/share/auto_install/sc_profiles/enable_sci.xml
    Zonename: webzone01
Installation: Starting ...

              Creating IPS image
              Installing packages from:
                  solaris
                      origin:  http://localhost:1008/solaris/5253829a2447d746e843a409669e9ab0ad8bf9f0/
DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                              167/167 32062/32062  175.8/175.8

PHASE                                        ACTIONS
Install Phase                            44313/44313 

PHASE                                          ITEMS
Package State Update Phase                   167/167 
Image State Update Phase                         2/2 
Installation: Succeeded

        Note: Man pages can be obtained by installing pkg:/system/manual

 done.

        Done: Installation completed in 229.231 seconds.


  Next Steps: Boot the zone, then log into the zone console (zlogin -C)

              to complete the configuration process.

Log saved in non-global zone as /zones/webzone01/root/var/log/zones/zoneadm.20120509T131933Z.webzone01.install

Read the stdout carefully to ensure no error has occurred. Proceed with booting up the zone and complete the configuration as instructed.

3 Booting up
This step is accomplished with the following command

# zoneadm -z webzone01 boot

The boot process should be quick. I have not researched how a booting process can fail, if you don't see anything in stderr then your booting process has probably gone well.

A non-persistent vnic (most likely to be named after the name and interface name of your zone; example: webzone01/net0) will be created for you when the system booted so you don't need to worry about that for now. The vnic will be delete after the zone shuts down. We will explore the relationship between vnic's and zone in another article.

4 Configure the zone
Login to the zone by using this command

# zlogin -C webzone01
[Connected to zone 'webzone01' console]

You will be presented with the configuration screen as you would the global zone. Follow the steps and complete the configuration. It is a normal production practice to assign an IP address to the zone so it resides in the same subnet as the global zone. This reduces the network administration chore.



Configure the network manually. A static IP address for a web server is good for you. Don't worry about the /29 subnet, use anything you like.



No DNS for now, will be covered in another article when we hook this machine up to a Windows 2008 R2 DNS server.



Hit F2 to apply the configuration!

Upon completing the steps above, you will be presented with a login screen.

Exiting System Configuration Tool. Log is available at:

/var/tmp/install/sysconfig.log

Hostname: websvr01

May 10 00:03:27 websvr01 sendmail[7721]: My unqualified host name (websvr01) unknown; sleeping for retry
May 10 00:03:27 websvr01 sendmail[7724]: My unqualified host name (websvr01) unknown; sleeping for retry

Login using the id you supplied in one of the configuration step, perform a 'uname -a' you should see this

websvr01 console login: admin
Password:
Oracle Corporation      SunOS 5.11      11.0    November 2011
admin@websvr01:~$ uname -a
SunOS websvr01 5.11 11.0 i86pc i386 i86pc
admin@websvr01:~$

Try the ipadm and dladm command and you shall see the plumbing all done for you.

Alright, that's all for now, in the next article we will install iPlanet web server into this brand new zone.

Cheers,

Thursday, May 3, 2012

TIBCO BW Parse CSV with Header & Footer

This will be a quick post to answer a question from a reader on how to parse a CSV file with typical header and footer rows.

The original post is here.

Intuitively, there are 3 parts in such kind of file i.e. the header, the payload and the footer. Each of these parts needs to be parsed differently mainly because they may have either different number of fields, different delimiter, and so forth. As usual, there would be more than one solution to a given problem, the decision will really depend on your circumstances, so pick what you like and discard what you think isn't applicable.

Quick summary of steps.

In TIBCO BW Designer, define the following data formats:

1) Header format
2) Row Format (for the payload)
3) Footer format; and
4) Wholefile (for the entire file, its sole purpose is for row counting)

I created a master XSD (pictured below) to aid the creation of the first 3 data format.

Create a process as follow.

Brief descriptions of the process activities:

1) The first 'Parse Data' is for counting, hence 'ForCounting' is the name. Its sole purpose of existence is to count the total number of rows in the input file.
2) 'Parse Header', as the name suggest, parse the first row, directly from the input file (now specified as an input parameter in the 'start' activity). The assumption is that the first row is always the header.
3) 'Parse Data', parses the payload body of the directly input file. It uses the counter function that counts the number of rows in the output of  'Parse Data' activity. It starts parsing from row #2 and stops at row # [Totalrows -3]. Work the math, it is tricky.
4) 'Parse Footer' as the name suggested parses the last row of the direct file to give you the footer.
5) The 'Render XML' activity assembles all the parts together to form an XML output that complies to a given predefined XSD. See XSD picture above.

Future improvements:

1) Error handling to check if the file is empty so the position index won't go negative
2) Loop optimization for better performance when handling large file
3) To handle multi-row headers/footers, not sure how useful this feature could be :-)
4) Add your polling mechanism...throw in a semaphore mechanism to ensure only completed input files are polled...

That is it. I told you it was quick. Get the entire TIBCO Designer project file here, feel free to play with it and your feedback is always welcomed.

Cheers,