Tuesday, October 8, 2019

VirtualBox 6 upgrade and issues for the latest version

Upgrade your VirtualBox to the latest release 6

Here  I am showing how i have upgraded/downgrade my VirtualBox on Ubuntu machine.
NB: You need to backup your virtual servers before you perform the steps.


Please find the below steps where i have followed for upgrading my virtualbox version 5.1.38 to latest stable version 6.0.12. I didn't take any backup :)



ajeesh@ajeesh-Aspire-A515-51G:~$ ps aux | grep virt
ajeesh   19129  0.1  0.1 167452 12920 ?        S    21:52   0:00 /usr/lib/virtualbox/VBoxXPCOMIPCD
ajeesh   19134  0.4  0.2 761312 23784 ?        Sl   21:52   0:01 /usr/lib/virtualbox/VBoxSVC --auto-shutdown

ajeesh@ajeesh-Aspire-A515-51G:~$ kill -9 19129 19134


root@ajeesh-Aspire-A515-51G:/etc/apt/sources.list.d# apt-get install virtualbox-6.0
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following additional packages will be installed:
  libsdl-ttf2.0-0
The following packages will be REMOVED:
  virtualbox virtualbox-ext-pack virtualbox-qt

The following NEW packages will be installed:
  libsdl-ttf2.0-0 virtualbox-6.0
0 upgraded, 2 newly installed, 3 to remove and 258 not upgraded.
Need to get 109 MB of archives.
After this operation, 147 MB of additional disk space will be used.
Do you want to continue? [Y/n] y



Setting up virtualbox-6.0 (6.0.12-133076~Ubuntu~xenial) ...
addgroup: The group `vboxusers' already exists as a system group. Exiting.
Processing triggers for libc-bin (2.23-0ubuntu10) ...
root@ajeesh-Aspire-A515-51G:





But this version 6.0.12 is causing some issue for my Vagrant containers.

vagrant-container$ vagrant up

The provider 'virtualbox' that was requested to back the machine
'kmaster' is reporting that it isn't usable on this system. The
reason is shown below:

Vagrant has detected that you have a version of VirtualBox installed
that is not supported by this version of Vagrant. Please install one of
the supported versions listed below to use Vagrant:

4.0, 4.1, 4.2, 4.3, 5.0, 5.1

A Vagrant update may also be available that adds support for the version
you specified. Please check www.vagrantup.com/downloads.html to download
the latest version.
ajeesh@ajeesh-Aspire-A515-51G:

So i have downgraded the VirtualBox version to 5.1.38

sources.list.d# apt-get install virtualbox-5.1
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Do you want to continue? [Y/n] y
Get:1 http://download.virtualbox.org/virtualbox/debian xenial/contrib amd64 virtualbox-5.1 amd64 5.1.38-122592~Ubuntu~xenial [66.0 MB]
Fetched 66.0 MB in 57s (1,147 kB/s)                                                                                                  
Preconfiguring packages ...

Setting up virtualbox-5.1 (5.1.38-122592~Ubuntu~xenial) ...
addgroup: The group `vboxusers' already exists as a system group. Exiting.
root@ajeesh-Aspire-A515-51G:


vagrant-container$ kubectl get nodes
NAME                   STATUS    ROLES     AGE       VERSION
kmaster.example.com    Ready     master    2d21h     v1.16.1
kworker1.example.com   Ready         2d21h     v1.16.1
kworker2.example.com   Ready         2d21h     v1.16.1

Thursday, October 3, 2019

LND Lighning Network Vulnerability reported

LND Lighning Network Vulnerability reported

Recently lightning network developer Russel updated a serious vulnerability for the old versions. The versions which is less than v0.7.0

    CVE-2019-12998 c-lightning < 0.7.1
    CVE-2019-12999 lnd < 0.7
    CVE-2019-13000 eclair <= 0.3

The issue he described as below:


A lightning node accepting a channel must check that the funding transaction
output does indeed open the channel proposed.  Otherwise an attacker can claim
to open a channel but either not pay to the peer, or not pay the full amount.
Once that transaction reaches the minimum depth, it can spend funds from the
channel. The victim will only notice when it tries to close the channel and none
of the commitment or mutual close transactions it has are valid.


Solution
--------

Once the funding transaction is seen, peers MUST check that the outpoint as
described in `funding_created`[1] is a funding transaction output[2] with
the amount described in `open_channel`[3].


Fixed versions:
 c-lightning: v0.7.1 and above
lnd: v0.7.1 and above
eclair: v0.3.1 and above

So the best way to fix the issue is you need t upgrade to the latest release, While right this i can see the latest version for the lnd is v0.8.0-Beta. From this release onwards, lnd will only support database upgrades from the previous major release. So that means those who are running on v0.6.0 would be required to upgrade v0.7.0 first and then to v0.8.0.

VMWare Tools : Not Running

In VMWare vSphere Client you will see the following errors.

VMWare Tools : Not Running  ( Not Installed)


We can easily fix this issue by installing open-vm-tools package in linux machine.

root@testing:/home/ubuntu# apt-get install open-vm-tools

Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following extra packages will be installed:
  libdumbnet1 libicu52 zerofree
Suggested packages:
  open-vm-tools-desktop
The following NEW packages will be installed:
  libdumbnet1 libicu52 open-vm-tools zerofree
0 upgraded, 4 newly installed, 0 to remove and 218 not upgraded.
Need to get 7,237 kB of archives.
After this operation, 30.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

After installing this package you can see your IP address and MAC address using this vmware tool.



Saturday, September 28, 2019

upgrade Visual Studio Code version in Ubuntu

It is very easy for upgrading your Visual Studio Code in your Ubuntu desktop machine.

ajeesh@ajeesh-Aspire-A515-51G:~$ code --version
1.35.1
c7d83e57cd18xxx2843bda1bcf21f
x64


root@ajeesh-Aspire-A515-51G:/home/ajeesh# apt-get install code
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
 code
1 upgraded, 0 newly installed, 0 to remove and 265 not upgraded.
Need to get 55.4 MB of archives.
After this operation, 45.8 MB of additional disk space will be used.
Get:1 https://packages.microsoft.com/repos/vscode stable/main amd64 code amd64 1.38.1-1568209190 [55.4 MB]
Fetched 55.4 MB in 23min 10s (39.9 kB/s)                                                                                              
(Reading database ... 379957 files and directories currently installed.)
Preparing to unpack .../code_1.38.1-1568209190_amd64.deb ...
Unpacking code (1.38.1-1568209190) over (1.35.1-1560350270) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for bamfdaemon (0.5.3~bzr0+16.04.20160824-0ubuntu1) ...
Rebuilding /usr/share/applications/bamf-2.index...
Processing triggers for mime-support (3.59ubuntu1) ...
Setting up code (1.38.1-1568209190) ...
root@ajeesh-Aspire-A515-51G:/home/ajeesh# exit

ajeesh@ajeesh-Aspire-A515-51G:~$ code --version
1.38.1
b37e54c98e1xxe5a3761284e3ffb0
x64
ajeesh@ajeesh-Aspire-A515-51G:~$

Thursday, February 28, 2019

How can we reduce the docker image size

DIVE

 This tool provides a way to discover and explore the contents of a docker image. Additionally the tool estimates
the amount of wasted space and identifies the offending files from the image.

root@ajeesh-desktop:/home/ajeesh# wget https://github.com/wagoodman/dive/releases/download/v0.6.0/dive_0.6.0_linux_amd64.deb

root@ajeesh-desktop:/home/ajeesh# apt install ./dive_0.6.0_linux_amd64.deb




root@ajeesh-desktop:/home/ajeesh# dive test_frontend:v1
Fetching image...
Parsing image...
  ├─ [layer:  1] 02c8cd0778ef78e : [==============================>] 100 % (29046/29046)
  ├─ [layer:  2] 0e24a3d04ebc058 : [==============================>] 100 % (4149/4149)
  ├─ [layer:  3] 1fbf962f1faa79c : [==============================>] 100 % (268/268)
  ├─ [layer:  4] 263da0d188f39bc : [==============================>] 100 % (20812/20812)
  ├─ [layer:  5] 2c6d59c15b5a74f : [==============================>] 100 % (22112/22112)
  ├─ [layer:  6] 4a3e40ad2625f55 : [==============================>] 100 % (6/6)
  ├─ [layer:  7] 5f67701353f1632 : [==============================>] 100 % (23/23)
  ├─ [layer:  8] 6e9ac776b0f4ad8 : [==============================>] 100 % (2/2)
  ├─ [layer:  9] 71f81c9582dbf66 : [==============================>] 100 % (25/25)
  ├─ [layer: 10] 84a49a835b59732 : [==============================>] 100 % (2/2)
  ├─ [layer: 11] 9a9aa5f37fdc24c : [==============================>] 100 % (9285/9285)
  ├─ [layer: 12] bb8588e06b91e7b : [==============================>] 100 % (3/3)
  ├─ [layer: 13] cacd4f0f725d2c5 : [==============================>] 100 % (4/4)
  ├─ [layer: 14] d107e0074bfc596 : [==============================>] 100 % (7010/7010)
  ├─ [layer: 15] d7ecfda03fa2ea7 : [==============================>] 100 % (6293/6293)
  ├─ [layer: 16] f08e6b62ac1a1d3 : [==============================>] 100 % (1354/1354)
  ├─ [layer: 17] ff6cffce858c4c9 : [==============================>] 100 % (1428/1428)
  ├─ [layer: 18] ffa2599ac9ec53e : [==============================>] 100 % (885/885)
  ╧
Analyzing image...
Building cache...

Tuesday, April 12, 2016

Export a Linux virtual machine from VMWare EXSI server and Import to AWS



We can export our EXSI virtual machine images to aws and create the exact same machine as your are running on your EXSI machine.

For this process we need to do the following steps.

1. Download and install AWS CLI
2. Configure the access key with your aws console (IAM access)
3. Export the virtual machine from EXSI machine to your local machine as ova formate
4. Import the OVA image file to your aws S3 bucket


Setup AWS CLI

Download the AWS CLI here:
https://s3.amazonaws.com/aws-cli/AWSCLI64.msi
After that complete the installation.

[root@ip-172-31-56-125 ec2-user]# aws configure
AWS Access Key ID [None]: AKIAXXXXXXXWHTA
AWS Secret Access Key [None]: svcngBGXXXnijOWPLDXXXXXXXHaqs
Default region name [None]: us-east-1
Default output format [None]:
[root@ip-172-31-56-125 ec2-user]#


After the configuration we can test and confirm everything seems to be working fine.

[root@ip-172-31-56-125 ec2-user]# aws ec2 create-security-group --group-name AJVMGRP --description "testing vmtestimptest"
{
    "GroupId": "sg-2a250452"
}
[root@ip-172-31-56-125 ec2-user]#

So we have successfully configured the AWS CLI on this machine


[root@ip-172-31-56-125 ec2-user]# aws ec2 import-image --cli-input-json "{ \"Description\": \"Kalilinux-2016\", \"DiskContainers\": [ {\"Description\": \"Kalilinux-2016\", \"UserBucket\": { \"S3Bucket\": \"vmimportajeesh\", \"S3Key\" : \"CentOS-6.4-i386-minimal.ova\" } } ]}"

{
    "Status": "active",
    "Description": "Kalilinux-2016",
    "Progress": "2",
    "SnapshotDetails": [
        {
            "UserBucket": {
                "S3Bucket": "vmimportajeesh",
                "S3Key": "CentOS-6.4-i386-minimal.ova"
            },
            "DiskImageSize": 0.0
        }
    ],
    "StatusMessage": "pending",
    "ImportTaskId": "import-ami-fggrwl9r"
}
[root@ip-172-31-56-125 ec2-user]#

On Our EXSI Box
We need to create a vm. The VM should be capable of accepting DHCP assign IP address and remove vmware-tool if we installed any.

Export VM in OVA format

File > Export > Export OVF Template [Single format]

 Create a S3 bucket

 Create a S3 bucket and make note the ARN

Import the OVA file to S3 Bucket
You can upload the particular OVA file to your S3 bucket

We need to change the service name to vmie.amazoneaws.com(Trust Relationship) and add the following condition

Create a new role[eg: vmimport] and assign administrative privilege
 {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "vmie.amazonaws.com"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "vmimport"
}
}
}
]
}
 


Import the OVA to AWS


[root@ip-172-31-56-125 ec2-user]# aws ec2 import-image --cli-input-json "{ \"Description\": \"Kalilinux-2016\", \"DiskContainers\": [ {\"Description\": \"Kalilinux-2016\", \"UserBucket\": { \"S3Bucket\": \"vmimportajeesh\", \"S3Key\" : \"CentOS-6.4-i386-minimal.ova\" } } ]}"
-----
{
    "Status": "active",
    "Description": "Kalilinux-2016",
    "Progress": "2",
    "SnapshotDetails": [
        {
            "UserBucket": {
                "S3Bucket": "vmimportajeesh",
                "S3Key": "CentOS-6.4-i386-minimal.ova"
            },
            "DiskImageSize": 0.0
        }
    ],
    "StatusMessage": "pending",
    "ImportTaskId": "import-ami-fggrwl9r"
}
---

We will get a image ID [ import-ami-fggrwl9r ]

to check the status::
aws ec2 describe-import-image-tasks --image-task-ids “import-ami-fggrwl9r”


[root@ip-172-31-56-125 ec2-user]# aws ec2 describe-import-image-tasks --import-task-ids "import-ami-fggrwl9r"
{
    "ImportImageTasks": [
        {
            "Status": "active",
            "Description": "Kalilinux-2016",
            "Progress": "28",
            "SnapshotDetails": [
                {
                    "UserBucket": {
                        "S3Bucket": "vmimportajeesh",
                        "S3Key": "CentOS-6.4-i386-minimal.ova"
                    },
                    "DiskImageSize": 346110976.0,
                    "Format": "VMDK"
                }
            ],
            "StatusMessage": "converting",
            "ImportTaskId": "import-ami-fggrwl9r"
        }
    ]
}
[root@ip-172-31-56-125 ec2-user]#


then this will change to

   "StatusMessage": "updating",
   "ImportTaskId": "import-ami-fggrwl9r"

   "StatusMessage": "booting",
   "ImportTaskId": "import-ami-fggrwl9r"

  "StatusMessage": "preparing ami",
  "ImportTaskId": "import-ami-fggrwl9r"

[root@ip-172-31-56-125 ec2-user]# aws ec2 describe-import-image-tasks --import-task-ids "import-ami-fggrwl9r"
{
    "ImportImageTasks": [
        {
            "Status": "completed",
            "LicenseType": "BYOL",
            "Description": "Kalilinux-2016",
            "ImageId": "ami-4e6e7924",
            "Platform": "Linux",
            "Architecture": "x86_64",
            "SnapshotDetails": [
                {
                    "UserBucket": {
                        "S3Bucket": "vmimportajeesh",
                        "S3Key": "CentOS-6.4-i386-minimal.ova"
                    },
                    "SnapshotId": "snap-649ee37d",
                    "DiskImageSize": 346110976.0,
                    "DeviceName": "/dev/sda1",
                    "Format": "VMDK"
                }
            ],
            "ImportTaskId": "import-ami-fggrwl9r"
        }
    ]
}
Finally this image is available on your AWS console. Using this you can launch a new vps.

Wednesday, March 23, 2016

Setting monit on your Ubuntu

Monit will watch around the clock in your server and can do the following capabilities :

* Monitoring the running server and have the ability to stop , start and restart
* Send email alerts
* Have the ability to monitor the service depends on the cpu,RAM disk, cut-off values


Install::
/home/ubuntu# apt-get install monit
:/etc/monit/conf.d# /etc/init.d/monit restart
 * Restarting daemon monitor monit     

/etc/monit/conf.d# service monit status
 * monit is running


Monit configuration file :: /etc/monit/monitrc

/etc/monit/conf.d# monit status
monit: error connecting to the monit daemon
You will found this error

Actually Monit has an embedded web server which can be used to view status of
services monitored and manage services from a web interface. So we need to enable apache interface in monit configuration file in order to fix this error.

open /etc/monit/monitrc and add the following lines under enable web server.

set httpd port 2812 and
use address localhost
allow localhost
allow admin:monit

/etc/monit/conf.d# /etc/init.d/monit restart
 * Restarting daemon monitor monit

/etc/monit/conf.d# netstat -lpn | grep 2812
tcp        0      0 127.0.0.1:2812          0.0.0.0:*               LISTEN      418/monit


root@ip-172-31-56-245:/etc/monit/conf.d# monit summary
The Monit daemon 5.6 uptime: 0m

Process 'mysqld'                    Running
System 'ip-172-31-56-245.ec2.internal' Running

Check out if mysql service is down on the server.

 /etc/monit/conf.d# service mysql status
mysql stop/waiting

root@ip-172-31-56-245:/etc/monit/conf.d# monit summary
The Monit daemon 5.6 uptime: 1m

Process 'mysqld'                    Does not exist
System 'ip-172-31-56-245.ec2.internal' Running

After 5 minute monit will automatically restart mysql service.

root@ip-172-31-56-245:/etc/monit/conf.d# monit summary
The Monit daemon 5.6 uptime: 5m

Process 'mysqld'                    Running
System 'ip-172-31-56-245.ec2.internal' Running