martes, 23 de junio de 2009

Creating ISO's with mkisofs

The main advantage of using mkisofs is that is available in many operating systems. The main disadvantage is that it syntax it's quite complex and the help it's not organized by examples.
This is the base recipe that i use for the command,

mkisofs -JR -d -v -o data.iso /cygdrive/h/Proyecto_organizado
It'll create an iso file that will preserve long filenames inside an iso archive.
Cheers,

viernes, 19 de junio de 2009

Handling wireless interfaces Linux

This recipe is intended for all the linux fans who use a wireless device to connect to their network.
The command is very similar to our beloved ifconfig :D
First you need to know ...

In order to get a list of the access points avaliable near the computer simply type:
iwlist |interface| scan
This will produce an output like this one:
ra0 Scan completed :
Cell 01 - Address: 00:23:54:85:1F:DA
ESSID:"WebSTAR"
Mode:Managed
Channel:1
Quality:96/100 Signal level:-52 dBm Noise level:-81 dBm
Encryption key:on
Bit Rates:54 Mb/s
IE: WPA Version 1
Group Cipher : TKIP
Pairwise Ciphers (1) : TKIP
Authentication Suites (1) : PSK


Once you know, we need to connect.
Iwconfig will make the deal. You need to provide the role that the device is going to play, and after that, the access point you are going to join...

iwconfig ra0 mode managed
iwconfig ra0 essid "WebSTAR"


Byeee...!!!

martes, 16 de junio de 2009

How to identify io devides

For the newbie Solaris looks like a hard stone. Sometimes something quite easy like mounting the cdrom can be quite difficult, mainly because the devices (like cdrom) have a quite extrange name (something like c0t0d0, or whatever).
The following command can help to identify what io devices are installed in the system:
\>iostat -En

c1t0d0 Soft Errors: 2 Hard Errors: 0 Transport Errors: 0
Vendor: VBOX Product: CD-ROM Revision: 1.0 Serial No:
Size: 0.00GB <0>
Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
Illegal Request: 2 Predictive Failure Analysis: 0

Using the output provided here we can now mount the cdrom with:

\>mount -F hsfs -o ro /dev/dsk/c1t0d0s0 /mnt/cdrom/

Easy, humm??
May the source be with you...

domingo, 14 de junio de 2009

Troubleshooting functions and symbols on Solaris

Execution environments with precompiled applications can be a painfull headache without the following troubleshooting tools. Using (and mastering) them will gave us a idea of how to set up critical variables (like LD_LIBRARY_PATH) in order to make programs or other libraries work.
ldd: lists the dependencies of a process or a library.
We can show the direct dependencies or even the indirect dependencies (-U), the order loading the libraries (-i), the path in use to search for the libraries (-s) , or even all dependencies required (-v).

nm: displays the symbol table for a given object. Translated to the common language: lists the functions used in a library.
nm -r -u -v /lib/libsocket.so
Will show the library name and the function name.

This command can provide very important information when used together with a debuger like truss (or linux strace).

viernes, 5 de junio de 2009

OpenSSL Basic CA operation

With the following commands you will be able to generate certificates with your own CA, for testing porpuoses. So... Enjoy!!!

Generating CA:

openssl req -x509 -nodes -days 365 -subj "/C=ES/O=Recipes/CN=ca" -newkey rsa:1024 -keyout ca_key.pem -out ca_pub.pem

Generate a client private key and csr:
openssl req -newkey rsa:1024 -out p10.p10 -keyout privket.pem

Generate a self signed certificate based on a csr:
openssl x509 -req -days 360 -in p10.p10 -signkey privket.pem -out server.crt

Sign a certificate request.
openssl ca -in p10.p10 -out server.p

Generate a PKCS12
openssl pkcs12 -export -in signcert.pem -out signFile.p12 -name "certSign" -inkey domainname.key -CAfile cacert.cer -chain

Extract a private key from a PKCS12 crypto bag
openssl pkcs12 -nokeys -in Certificado.p12 -passin pass:12345678 -out Certificado.pem

Other operations

Display the contents of a certificate:

 openssl x509 -in cert.pem -noout -text

Display the certificate serial number:

 openssl x509 -in cert.pem -noout -serial

Display the certificate subject name:

 openssl x509 -in cert.pem -noout -subject

Extract the private key:


openssl pkcs12 -nocerts -out userkey.pem -in cert.p12

Updating Solaris 10 Library Path

crle -u -l <path>

OpenLdap search example

This command will perform a ldap search operation on 10.1.23.101:

ldapsearch -Z -s sub -h 10.1.23.101 -p 389 -D "cn=Directory Manager" -W -d 999 enployeeNumber=1999

OpenSSL SHA Base64 Hashing

In order to perform a hash of a message (String) with openssl type:
echo <message>|openssl dgst -sha1|openssl base64