Oracle VM Site Review - Oracle VM Health Check
view counter

Linux Feed

Linux Support, Oracle Linux, Red Hat Enterprise Linux, SUSE, Oracle Unbreakable Enterprise Kernel and the Oracle Unbreakable Linux Support Program (ULN) resources, news, and support articles.

Free on-line Introduction to Linux course

In August 2014, more than 300,000 people registered for the first offering of the Introduction to Linux course. This popular Massive Open Online Course (MOCC) is taught by the Linux Foundation, and hosted on edx. The same course starts again on January 5, 2015. The course is designed for people who have limited or no previous exposure to Linux.

SSH Fingerprint and Hostkey with Paramiko in Python

Following on from SSH and SFTP with Paramiko & Python, I recently had the need to gain a remote SSH server’s fingerprint and hostkey for verification purposes. This is achievable through setting up a socket, and then applying paramiko.Transport over our established socket. First, we include the various bits and pieces we’ll need:

Ansible tags

 
To run specific part or exclude specific part in a playbook we an use tags attrubute.
Here is my example playbook with name tags_example.yml:

---
- hosts: all
tasks:
- name: Hello
shell: "echo hello"
tags:
- hello

- name: Bye
shell: "echo bye"
tags:
- bye

In above playbook we have two tasks Hello and Bye with tags hello and bye tags respectively.
To execute above playbook use following command:

Linux Namespaces

Starting from kernel 2.6.24, Linux supports 6 different types of namespaces. Namespaces are useful in isolating processes from the rest of the system, without needing to use full low level virtualization technology.

SSH and SFTP with Paramiko & Python

Paramiko is a Python implementation of SSH with a whole range of supported features. To start, let’s look at the most simple example – connecting to a remote SSH server and gathering the output of ls /tmp/

Simple IMAP Account Verification in Python

imaplib is a great library for handling IMAP communication. It supports both plaintext IMAP and IMAP over SSL (IMAPS) with ease. Connecting to an IMAP server is achieved as follows:

DNS Black List / RBL Checking in Python

Following on from performing basic DNS Lookups in Python, it’s relatively trivial to begin testing DNS Block Lists/Real Time Black Lists for blocked mail server IP addresses. To assist in preventing spam, a number of public and private RBLs are available. These track the IP addresses of mail servers that are known to produce spam, thus allowing recipient mail servers to deny delivery from known spammers.

Performing DNS Queries in Python

dnspython provides a detailed interface into DNS. In its simplest form, it’s possible to perform queries in only a couple of lines of code. Here’s a commented example:

import dns.resolver #import the module
myResolver = dns.resolver.Resolver() #create a new instance named 'myResolver'
myAnswers = myResolver.query("google.com", "A") #Lookup the 'A' record(s) for google.com
for rdata in myAnswers: #for each response
    print rdata #print the data

The results in my case are:

Linux – check if a remote port is open

 
By using nc(Netcat) command we can check if a port in remote machine is opened or closed.
Here is an example to check if remote port is opened or closed:

STATUS=$(nc -z you_remote_host 80 ; echo $?)

if [ $STATUS -eq 0 ]
then
echo "Port is opened"
else
echo "Port is opened"
fi

bash – get previous command status

 
To get previous command status in bash use “$?” variable.
echo $? will return zero if previous command is success & if its non zero it indicates failure.
Example:
$ ls ; echo $?
Output of the above command is list of files, directories and next line it will return number.
We can use condition for check if previous command is success or failure:

view counter