Server Administration & Management

Lynis – Security & System auditing tool

Lynis is an auditing tool for Unix (specialists). It scans the system configuration and creates an overview of system information and security issues usable by professional auditors. This software aims in assisting automated auditing of Unix based systems and can be used in addition to other software, like security scanners, system benchmarking and fine tuning tools.

Examples of audit tests:
– Available authentication methods
– Expired SSL certificates
– Outdated software
– User accounts without password
– Incorrect file permissions
– Firewall auditing

Steps to run Lynis without installing & Download the source from here

# wget http://www.rootkit.nl/files/lynis-1.3.0.tar.gz
# mkdir /usr/local/lynis
# tar -xvf lynis-1.3.0.tar.gz
# cd lynis-1.3.0
# sh lynis -c

Without parameters, Lynis will give you a valid list of parameters and return back to the shell prompt. At least the ‘-c’ (–check-all) parameter is needed, to start the scan process.

January 27, 2013 Posted by | Security, Tips & Tricks, Unix/Linux | , , , | Leave a comment

Xmessage – Text Messaging from CLI to GUI

The command we need to use to pop an alert to the screen is xmessage. This is a very simple tool that dates back to the earliest years of X Windows, and will simply open a small window on your screen that includes a text message and a close button. The syntax for the xmessage command goes like this:

# xmessage -display :0.0 “You are late”

The display part of the command is important because it lets xmessage know which screen to use. If you add the command to at, you’ve got a flexible method for giving yourself reminders without having to resort to a separate application. This is often easier than using something like Cron, which can be a little daunting when all you want to do is run a simple command such as xmessage!

January 22, 2013 Posted by | Tips & Tricks, Unix/Linux | , | Leave a comment

How to SSH Port Forwarding without starting a new session

You can forward ports with ssh like this:

# ssh -L 8888:localhost:80 user@remotehost

This will log you into remotehost as user, and port 8888 on your local machine will be tunnelled to port 80 on remotehost. If remotehost can see a machine that you can’t (for example, if it’s on an internal network), you can even do this:

# ssh -L 8888:internalhost:80 user@borderhost

This will log you in to borderhost, and localhost:8888 will be directed to internalhost:80, even though you may not be able to see internalhost directly yourself.

January 17, 2013 Posted by | SSH | , | 5 Comments

How to get your Public External IP From Command Line Interface (CLI)

On linux Command prompt I would do something like this :

# wget -O – -q icanhazip.com

# curl ifconfig.me/ip

January 12, 2013 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment

How to check Server is running on Baremetal or VMWare

How we can identity that server os is running on single standalone hardware or vmware virtual machine. you can type one of the following commands to see if the server you are in is VMWare VM.

# /sbin/lspci | grep -i vmware
00:07.7 System peripheral: VMware Virtual Machine Communication Interface (rev 10)
00:0f.0 VGA compatible controller: VMware SVGA II Adapter
00:11.0 PCI bridge: VMware PCI bridge (rev 02)
00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)

# grep -i vmware /proc/scsi/scsi
Vendor: VMware Model:  Virtual disk  Rev: 1.0

# dmidecode | grep -A4 “System Information”
System Information
    Manufacturer: VMware, Inc.
    Product Name: VMware Virtual Platform
    Version: None
    Serial Number: VMware-56 4d 65 bb 9c e1 8e f0-6c db 0e 6b 2f a6 bb fd

# dmidecode | grep -A4 “System Information”
System Information
    Manufacturer: Acer
    Product Name: Veriton Series
    Serial Number: AWI44RT263B349056IE

January 7, 2013 Posted by | Tips & Tricks, Unix/Linux, Virtualization, VMWare | , , , , | 2 Comments

How to automatically reboot server On kernel panic error

There is a way to auto reboot your servers on Kernel Panic. This is helpful in a situation where your servers are remote and needs time to arrange a hard reboot. echo X >/proc/sys/kernel/panic , where X is the timeout in seconds, The kernel waits X seconds and reboots.

# echo “10” > /proc/sys/kernel/panic

Above it is 10 sec. BUT usually I keep it 10sec or more to believe that the problem was transitory.

  1. kernel.panic = 1 initiates a hard system reboot whenever the system runs into a kernel panic.
  2. kernel.panic_on_oops = 1 extends that behavior to oopses (the kernel will then treat any oops just like it treats a panic)

January 2, 2013 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment