How to install CAM on global zone ONLY

Download the cam application from SUN site first. Then extract it. Then go to the utils dir and modify the following files and replace the word pkgadd with pkgadd -G and the word patchadd with patchadd -G

install_csm_pkg.ksh
install_firmware_pkg.ksh
install_pkg.ksh
install_patch.ksh

Then run the following command from app’s dir and that is all
./RunMe.bin -c

Posted in cam, solaris | 1 Comment

How to delete a message from qmail queue

Stop the qmail-send first.

svc -d /service/qmail-send

Wait till it goes down. It can take really long time to go down, if your qmail queue is busy

while ! svstat /service/qmail-send | grep ': down'
do
echo "Not down yet!"
sleep 5
done

It will exit out as soon as it is down

Now use `qmqtool‘ to delete your message from queue

qmqtool -d -f 'spammer@spamsite.com'

Now go ahead start the qmail-send back on

svc -u /service/qmail-send

That’s all.

Posted in qmail | 1 Comment

How to find cpu cores on a system

kstat -pm cpu_info | grep brand

That will tell you if a system is dual core or not

Posted in solaris | Leave a comment

How to enable remote access to Sun Java Web Console

svccfg -s svc:/system/webconsole setprop options/tcp_listen = true
svcadm refresh svc:/system/webconsole
Posted in solaris | Leave a comment

How to concatenate multiple PDF files into one

You will need Ghostscript installed in your compter. Then just run the following command

gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf in3.pdf ...

Posted in misc, pdf | Leave a comment

How to fix Secure HTTP between RT and Qmail

This morning I found out that our company mail server, using qmail, is failing to communicate through secure http to ticket system, using RT

So, I logged into out mail server to verify the mail server to ticket server communication setup

cat /var/qmail/alias/.qmail-help

|822field x-spam-status | egrep -iw yes >/dev/null && exit 100 || exit 0
|822field from | egrep -i “MAILER-DAEMON|POSTMASTER|ABUSE” >/dev/null && exit 100 || exit 0
|822field to | egrep -i “MAILER-DAEMON|POSTMASTER|ABUSE” >/dev/null && exit 100 || exit 0
|822field cc | egrep -i “MAILER-DAEMON|POSTMASTER|ABUSE” >/dev/null && exit 100 || exit 0
|822field return-path | egrep -i “MAILER-DAEMON|POSTMASTER|ABUSE” >/dev/null && exit 100 || exit 0
|/opt/rt3/bin/rt-mailgate –queue help –action correspond –url https://ticket.company.net 2>/dev/null || exit 111

That means any mail goes to help@company.net will eventually use
rt-mailgate to make a secure http connection to the ticket system and create a ticket.

So the first thing that could go wrong is the mail server failing to receive the mail. To double check that I went ahead and send an email from my computer to help@company.net and checked the log on the smtp side.

tail -f /var/log/qmail/smtpd/current | tai64nlocal

I noticed the smtp server received the email based on the following line in the log

2007-08-20 18:29:44.718444500 tcpserver: ok 22971 smtp.company.net:1.2.3.4:25 NO_REVERSE_DNS:2.3.4.5::60738

Where 1.2.3.4 is the company smtp server IP and 2.3.4.5 is my computer sending the email. And it says OK. So we are good on smtp side. Now if you know qmail, you know that this mail then will be handed over eventually to qmail-local alias.

To verify that the mail did not fail on its way to the qmail-local I tried to look at the qmail send log

tail -f /var/log/qmail/current | tai64nlocal

And I see deferal in the delivery for the email that I sent to help@company.ent

2007-08-20 09:03:25.432989500 delivery 1804118: deferral:

Usually you should see a message right after the deferral: to explain why it is deferred like the followings i.e.:

2007-08-20 09:04:01.774745500 delivery 1804142: deferral: Sorry,_I_wasn’t_able_to_establish_an_SMTP_connection._(#4.4.1)/

2007-08-20 09:03:21.451940500 delivery 1804099: deferral: 4.4.8.50_does_not_like_recipient./Remote_host_said:_450_<blah
@blah.com>:_User_unknown_in_local_recipient_table/Giving_up_on_4.4.8.50./

But this time there is no message after deferral:. So I am still clueless as to why it is being deferred instead of being a delivered successfully. Well at least I know that mail is trying to make through. So the next possible point where mail could fail is at the rt-mailgate. If you are not sure why, look at the beginning of the article which shows how the communication is setup in the .qmail-help file

To troubleshoot if rt-mailgate is working I decided to run it in debug mode and send some garbage to it to see how it responds

echo this is a test | /opt/rt3/bin/rt-mailgate –queue help –action correspond –url https://ticket.company.net –debug

I see few lines of error with Crypt::SSLeay module. One of its library that is depending on openssl is failing to load. Why? looks like the openssl library itself changed to a newer version. It might have happend during ssh package upgrade which is very picky about the openssl library version. So that means either openssl library needs to be downgraded to a lower version to match the version Crypt::SSLeay, which probably will break ssh, OR recompile Crypt::SSLeay

I decided to just recompile Crypt::SSLeay and point to new openssl library during compile. I called CPAN to install Crypt::SSLeay module. When it rains it pours. The perl module is failing to compile with default CPAN install method. It is looking for openssl/ssh.h header file under /usr/local/ssl/include/openssl. So instead of using CPAN install command I used CPAN look command which let me compile the module manually from source. I then modified the include variable INC in the Makefile (run perl Makefile.PL first) and replaced include path from /usr/local/ssl/include/openssl to /usr/local/ssl/include. That is pretty much the only hack I needed to do during manul make. After that I did a re make and make install and now I have a fresh new Crypt::SSLeay. To make sure that fixed the rt-mailgate, I feeded some garbage, like before, to it and I got a ok and a Ticket number. Eeehaa secure http communication between mail server and ticket system have been restored and the day is saved!

Posted in qmail, RT | Leave a comment

How does NFS mount work

This is a direct quote fromĀ  http://docs.sun.com/app/docs/doc/816-4555/6maoquib7?a=view

The following description applies to NFS version 3 mounts. The NFS version 4 mount process does not include the portmap service nor does it include the MOUNT protocol.

When a client needs to mount a file system from a server, the client must obtain a file handle from the server. The file handle must correspond to the file system. This process requires that several transactions occur between the client and the server. In this example, the client is attempting to mount /home/terry from the server. A snoop trace for this transaction follows.

client -> server PORTMAP C GETPORT prog=100005 (MOUNT) vers=3 proto=UDP
server -> client PORTMAP R GETPORT port=33492
client -> server MOUNT3 C Null
server -> client MOUNT3 R Null
client -> server MOUNT3 C Mount /export/home9/terry
server -> client MOUNT3 R Mount OK FH=9000 Auth=unix
client -> server PORTMAP C GETPORT prog=100003 (NFS) vers=3 proto=TCP
server -> client PORTMAP R GETPORT port=2049
client -> server NFS C NULL3
server -> client NFS R NULL3
client -> server NFS C FSINFO3 FH=9000
server -> client NFS R FSINFO3 OK
client -> server NFS C GETATTR3 FH=9000
server -> client NFS R GETATTR3 OK

In this trace, the client first requests the mount port number from the portmap service on the NFS server. After the client receives the mount port number (33492), that number is used to test the availability of the service on the server. After the client has determined that a service is running on that port number, the client then makes a mount request. When the server responds to this request, the server includes the file handle for the file system (9000) being mounted. The client then sends a request for the NFS port number. When the client receives the number from the server, the client tests the availability of the NFS service (nfsd). Also, the client requests NFS information about the file system that uses the file handle.

In the following trace, the client is mounting the file system with the public option.

client -> server NFS C LOOKUP3 FH=0000 /export/home9/terry
server -> client NFS R LOOKUP3 OK FH=9000
client -> server NFS C FSINFO3 FH=9000
server -> client NFS R FSINFO3 OK
client -> server NFS C GETATTR3 FH=9000
server -> client NFS R GETATTR3 OK

By using the default public file handle (which is 0000), all the transactions to obtain information from the portmap service and to determine the NFS port number are skipped.

Posted in nfs, solaris | Leave a comment