Tuesday, November 6, 2018

How to test that your usb live cd is working

To do this, you need qemu-kvm. Install it:
$ sudo apt install qemu-kvm

Check the address of your usb, by using dmesg
$ dmesg | grep sd

Once you have the address, you can start it using below command (make sure you allocate at least 1024M memory, else it will return kernel panic)
$ sudo qemu-system-x86_64 -m 1024 -hda /dev/sdb

To use a cdrom, you can use below command
$ sudo qemu-system-x86_64 -m 1024 -cdrom /dev/cdrom

You can also test an iso file, using below command
$ sudo qemu-system-x86_64 -m 1024 -cdrom centos.iso

Thursday, October 25, 2018

Using ssh-agent to do ssh agent forwarding

Normally, in order to use a key to login to a server, you need to have the ssh private key inside the machine you are initiating your ssh connection from, and the server needs to have a matching public key already recorded in .ssh/known_hosts. The private key is supposed to be private, and cannot be put everywhere and anywhere.

To overcome this, we can use ssh-agent command, with ssh agent forwarding (-A) feature of ssh.

Start ssh-agent

$ eval `ssh-agent`


$ ssh-agent bash 

Use the agent forwarding feature of ssh to jump through many servers using the same key
$ ssh -A -i mine.key mine@server1

When you want to jump to server2, just run:
$ ssh -A mine@server2

and you will be connected to server2 using the same key (provided you already register the matching public key inside server2)

Once you have finished, do not forget to exit your ssh-agent, by typing exit, or killing the ssh-agent pid

$ kill `pidof ssh-agent`

Tuesday, August 28, 2018

Deploying cloud based openvpn server easily

Openvpn is an opensource software application that implements virtual private network techniques to create secure point-to-point or site-to-site connections in routed or bridged configurations and remote access facilities. One of the usage of openvpn, is so that we can browse the web without exposing our public ip address. With cloud server nowadays, it is truly cheap and easy to own an openvpn server. In this tutorial, I will use vultr cloud provider to setup my openvpn server.

Create your vultr account here

Once created, login to your account. You will be presented with below dashboard

Click on the + button to create your new cloud server

Choose your desired server location, in my case I choose Singapore

For server type, click on Application tab, and choose openVPN

For server size, choose $5/month for time being. You can always upgrade it to bigger size, if there is a need in the future.

Leave options 4, 5 and 6 as default

Put in your desired server hostname

Click on Deploy Now to deploy the server

Wait while the server is being installed

Once the status turned to "Running", your openvpn server is ready.

Click on the server name, to see the details of your openvpn. Follow the url shown in the details of your server, to get to the openvpn login page

From there, you can download the client for your device, and start using your own, brand new openvpn server, with just $5 a month.

Enjoy :)

Tuesday, August 14, 2018

Adding new virtual hard disk to existing RHV virtual machine

Login to your RHV/RHEV/ovirt console

Enter your administrator username and password

Once inside, search for your VM name

Scroll down, and choose Disk tab

Add details of your new virtual hard disk and click OK once done.

Make sure that your newly created disk is listed in the Disk tab

Login to your vm, and run lsblk to check your newly created disk
# lsblk 
vdc               252:32   0   200G  0 disk 

Create partition on the new disk
# cfdisk /dev/vdc
Choose New --> Primary --> Set size --> Write --> answer 'yes' --> Quit

Run lsblk again to check if your partition is successfully created 
# lsblk 
vdc               252:32   0   200G  0 disk 
└─vdc1            252:33   0   200G  0 part 

Make filesystem for your partition, in this case I want an ext4 partition
# mkfs.ext4 /dev/vdc1 
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Writing superblocks and filesystem accounting information: done   

Once done, you can mount your partition wherever you want
# mount /dev/vdc1 /mnt
# df -Th /mnt/
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/vdc1      ext4  197G   61M  187G   1% /mnt


Monday, August 13, 2018

Easily checking your domain name availability online

You can easily check this using an online NS checker by ping.eu

Fill in the domain that you would like to check in the white box as shown by the red arrow, like so:

You should be getting response like above, if the domain name is accessible.

If you are getting like below, the dns for that domain is down.