Sunday, March 31, 2013

Booting the BIG-IP  V 9-11 system in single-user mode



On certain occasions, it may be necessary to boot the BIG-IP system into single-user mode to fix operating system issues, such as filesystem or root password issues.
To boot the BIG-IP system into single-user mode, perform the following procedure:
Note: To perform the following steps, you must be local to the BIG-IP system with a console connection or using a console server.
  1. Connect a terminal to the BIG-IP serial console port.
  2. Reboot the BIG-IP system.While booting, the BIG-IP system displays the GRUB menu and counts down before continuing the boot process.
  3. Before the countdown expires, use the up and down arrow keys to select the appropriate boot image.
    Note: Alternately, press SHIFT+6 (^) to arrow up, and press the v key to arrow down.
  4. Press the e key to edit the boot options.

    A new GRUB menu screen displays.
  5. Use the up and down arrow keys to select the line that begins with kernel /boot/vmlinuz.
    Note: Alternately, press SHIFT+6 (^) to arrow up and press the v key to arrow down.
  6. Press the e key to edit the line.
  7. Add the word single to the end of the kernel /boot/vmlinuz line, and then press the Enter key.For example:
    kernel /boot/vmlinuz single
    Depending on the platform, the boot command may instead appear similar to the following example:
    kernel (hd1,1) /boot/1/vmlinuz ro root=UUID=f6155ffc-db65-46e9-9ba6-7f842a7d06ee console==tty0 console=ttyS0 19200 panic=1 mem=384M platform = D68 quiet single
  8. The previous menu screen appears, and the system shows the new boot command.
  9. Press the b key to boot the system using the modified options.
  10. A prompt displays.

Enabling networking from single user mode in 1.x 4.x


How do I access the network in single user mode?


Sometimes it is necessary to utilize network tools while in single user mode. To access the network in single user mode, perform the following steps:
Note: To perform the following steps, you must be local to the BIG-IP or 3-DNS Controller with a console connection. If you have a redundant pair of controllers, you can minimize site down time by using the standby controller.
  1. Reboot the controller, by typing the following commands:
    /bin/sync
    /bin/sync
    /sbin/shutdown -r now
  2. Press the Spacebar to interrupt the boot up process after the CMOS check, during the BSD boot sequence 4-second countdown.
  3. At the boot: prompt, type the following command:
    bsd
  4. When you see the following prompt:
    root device?
    Type the following command:
    wd0a
  5. When prompted for the shell, type the following command:
    /bin/bash
    Or press Enter for the bourne shell.
  6. Run a filesystem check to assure that the filesystem can be mounted, by typing the following command:
    fsck -y
  7. After the filesystem check completes, mount the filesystem by typing the following command:
    /sbin/mount -a
  8. Bring up the appropriate interface, by typing the following command:
    /sbin/ifconfig exp0
    Note: Specify the IP address that the device normally uses, so that it can reach the Internet.
  9. Add the default route, by typing the following command:
    Note: This is only necessary if you need to access a host outside your subnet, such as ftp.f5.com.
    /sbin/route add default
    Now you can use FTP or other tools that require the use of a network.
    You must use IP addresses rather than domain names because address resolution does not work in single user mode.

    For example:
    /usr/bin/ftp
    Note: You need to use a different host to look up the names. (For example: nslookup ftp.f5.com)
  10. After you perform the necessary tasks in single user mode, you can return to multi-user mode by typing the following command:
    exit


Monday, March 25, 2013

Bluecoat Commands

test http get www.capitalone.com    
#test DNS
Example:
BluecoatSG#test dns www.google.com
Performing DNS lookup for: www.google.com
Sending A query for www.google.com to 10.105.12.36.
DNS Response data:
Official Host Name: www.l.google.com
Alias: www.google.com
Resolved Addresses:
74.125.19.147
74.125.19.103
74.125.19.104
74.125.19.99
74.125.19.106
74.125.19.105
Cache TTL: 155, cache MISS
DNS Resolver Response: Success


======================

Sunday, March 24, 2013

Sysctl For sytem info.

     sysctl    hw.byteorder                      
     sysctl    hw.machine                           
     sysctl    hw.model                           
     sysctl    hw.ncpu                             
     sysctl    hw.pagesize                          
     sysctl    hw.physmem                           
     sysctl    hw.usermem                          Sysctl For sytem info.












General OpenSSL Commands

General OpenSSL Commands

These commands allow you to generate CSRs, Certificates, Private Keys and do other miscellaneous tasks.
  • Generate a new private key and Certificate Signing Request
    openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
  • Generate a self-signed certificate (see How to Create and Install an Apache Self Signed Certificate for more info)
    openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out certificate.crt
  • Generate a certificate signing request (CSR) for an existing private key
    openssl req -out CSR.csr -key privateKey.key -new
  • Generate a certificate signing request based on an existing certificate
    openssl x509 -x509toreq -in certificate.crt -out CSR.csr -signkey privateKey.key
  • Remove a passphrase from a private key
    openssl rsa -in privateKey.pem -out newPrivateKey.pem

Checking Using OpenSSL

If you need to check the information within a Certificate, CSR or Private Key, use these commands. You can also check CSRs and check certificates using our online tools.
  • Check a Certificate Signing Request (CSR)
    openssl req -text -noout -verify -in CSR.csr
  • Check a private key
    openssl rsa -in privateKey.key -check
  • Check a certificate
    openssl x509 -in certificate.crt -text -noout
  • Check a PKCS#12 file (.pfx or .p12)
    openssl pkcs12 -info -in keyStore.p12
     
    openssl rsa -in 2013.admin-test-cer1b-pipB.sanoj.com.key -modulus -noout | openssl md5 --key
    724427f3ae344132c0284b3ceb16e481
    openssl req -in 2013.admin-test-cer1b-pipB.pipB.sanoj.com.csr -modulus -noout | openssl md5 --csr
    724427f3ae344132c0284b3ceb16e481
    openssl x509 -in 2013.admin-test-cer1b-pipB.pipB.sanoj.com.crt -modulus -noout | openssl md5 --crt
    724427f3ae344132c0284b3ceb16e481
     

Debugging Using OpenSSL

If you are receiving an error that the private doesn't match the certificate or that a certificate that you installed to a site is not trusted, try one of these commands. If you are trying to verify that an SSL certificate is installed correctly, be sure to check out the SSL Checker.
  • Check an MD5 hash of the public key to ensure that it matches with what is in a CSR or private key
    openssl x509 -noout -modulus -in certificate.crt | openssl md5
    openssl rsa -noout -modulus -in privateKey.key | openssl md5
    openssl req -noout -modulus -in CSR.csr | openssl md5
  • Check an SSL connection. All the certificates (including Intermediates) should be displayed
    openssl s_client -connect www.paypal.com:443



openssl req -new -nodes -newkey rsa:2048 -subj "/CN=sanoj.com /O=Sanoj  Corporation/C=US/ST=North Carolina/L=Charlotte" -keyout /var/tmp/sanoj.com.key -out /var/tmp/sanoj.csr




AWK examples

AWK EXAMPLES



cat db.txt

Ip,Henry 29 32 23 27
Frank,Joe 26 29 22 28
Gill,Marry 25 30 20 25
Avery,Adam 25 31 19 21
Chow,Samuel 23 29 19 25
Dible,Liz 22 30 20 22
Warn,Suzanne 23 29 19 23
Dow,Juila 24 29 20 20
Low,juila 22 21 19 18
Joe,Sarah 19 21 18 20


Example1: Search for Dow word in the file and print those lines. This is like simulate grep using AWK

awk '/Dow/' db.txt

Sample output:
Dow,Juila 24 29 20 20


Example2: Search for a word and print the lines which contain either Juila or juila in the given file.

awk '/[Jj]uila/' db.txt

Output:
Dow,Juila 24 29 20 20
Low,juila 22 21 19 18


In the above example we used regular expression to match both Juila and juila. Know more about RegExp here.

Example3: Print particular column from db.txt file.

awk '{print $2}' db.txt

Output:
29
26
25
25
23
22
23
24
22
19


Exampl4: Print multiple columns from a given file.

awk '{print $2,$4}' db.txt

Output:
29 23
26 22
25 20
25 19
23 19
22 20
23 19
24 20
22 19
19 18

Example5: Print multiple columns with a tab between columns as separator

awk '{print $2,"\t",$4}' db.txt

Output:
29 23
26 22
25 20
25 19
23 19
22 20
23 19
24 20
22 19
19 18

Example6: Search for Chow word and print corresponding third column. In most of the programming languages /searchterm/ is meant for searching for a word. AWK too uses same concept when search for a word in a given line.

awk '/Chow/{print $3}' db.txt
Output:
29

Example7: Print all the column 4 values between lines which contain Frank and Low

awk '/Frank/,/Low/{print $4}' db.txt
Output:
29
30
31
29
30
29
29
21

Example8: Print line numbers more than 5.
awk 'NR\>5'  db.txt
Output:
Dible,Liz 22 30 20 22
Warn,Suzanne 23 29 19 23
Dow,Juila 24 29 20 20
Low,juila 22 21 19 18
Joe,Sarah 19 21 18 20

Note1: NR is a inbuilt variable which keeps the Line numbers of a file, to know more about it just visit out post on AWK inbuilt variables.

Example9: Print lines from 3 to 6.

awk 'NR>3 && NR<7 db.txt="">
Output:
Avery,Adam    25    31    19    21
Chow,Samuel    23    29    19    25
Dible,Liz    22    30    20    22

Till this point we search for entire line and then printed desired output. Following examples will search for a particular column.

Example10: Print only lines which have 29 in its third column.

awk'$3 ~/29/' db.txt

Output:

Frank,Joe     26    29    22    28
Chow,Samuel    23    29    19    25
Warn,Suzanne    23    29    19    23
Dow,Juila    24    29    20    20

We can use Regexp for more control on what we want to print.

Example11: Print column 5 if the column 3 contain 31 in it.

awk '$3 ~/31/{print $5}' db.txt

Output:
21

Example12: Print column 3 for the lines more than 4.


awk '(NR>4){print $3}' db.txt
Output:
29
30
29
29
21
21

Example13: Want to print something other than file content at the start of the output?. We can use inbuilt Block called BEGIN block. Suppose I want to print "This is the filtered output" use below code.

awk 'BEGIN{print "This is the filtered output"}(NR>4){print $3}' db.txt

Output:
This is the filtered output
29
30
29
29
21
21

Example14: What about printing after the filter output?. We can use END block for doing this.
f
awk '(NR>4){print $3}END{print "This is the end of filter output"}' db.txt
Output:
29
30
29
29
21
21
This is the end of filter output

Thanks to LINIX