網頁

2017年3月13日 星期一

LoadRunner 12.53 --- How to Configure Client-Server Authentication

In LoadRunner 12.00 or later, it introduced a complete security solution based on an industry standard SSL/TLS library (OpenSSL), which includes both data encryption and authentication.
When we do the HP LoadRunner Setup process, we need to setup or configure a certificate for client-server authentication.
If we have a valid existing CA or certificate file, we can directly choose it. If no, we have to create a certificate authority(CA) and an SSL digital certificate next to install it.

How to do it ? By using the LoadRunner Certificate Manager is simple.

1. Run the Certificate Manager from < LoadRunner installation folder >\bin\LRcertificateMngr.exe

2. If we have not previously created certificates with this application, it displays the default LoadRunner certificates

3. In the Certificate Manager, click Change.

4. Click New for creating a new CA certificate

5. Enter the required values in the Create New CA Certificate screen. When finished, click Create.


6. Click Next and continue following the on-screen instructions to create a corresponding SSL certificate


7. Click New for creating a new SSL certificate.

8. Enter the required values in the Create New CA Certificate screen. When finished, click Create

9. When Finish, it will installs the SSL certificate and corresponding CA certificate on the current LoadRunner machine.

So do that we can go ahead next install steps.

Reference:
(#1). To install this CA certificate on other LoadRunner computers, click Export to save the generated certificate.

Then install it on other LoadRunner computers using the gen_ca_cert command with a -install option as  < LoadRunner installation folder >\bin\gen_ca_cert  -install < name of CA certificate file >

(#2). To install this SSL certificate on other LoadRunner computers, click Export to save the generated certificate.
Then install it on other LoadRunner computers using the gen_cert command with the -install option as < LoadRunner installation folder >\bin\gen_cert  -install < name of SSL certificate file >

2017年2月28日 星期二

Docker 1.13.0 --- How to add "restart" policy to the initiating Container if never set it

Since docker 1.11.0 or above version, we can change the restart policy if an initiating container forget to set it.
docker update --restart [Option] [Container ID]
where
        --restart Restart policy to apply when a container exits
 [Option]  
   no         Do not automatically restart the container when it exits. This is the default.
   on-failure[:max-retries] Restart only if the container exits with a non-zero exit status. Optionally, limit the number of restart retries the Docker daemon attempts.
    always          Always restart the container regardless of the exit status. When you specify always, the Docker daemon will try to restart the container indefinitely. The container will also always start on daemon startup, regardless of the current state of the container.
    unless-stopped Always restart the container regardless of the exit status, but do not start it on daemon startup if the container has been put to a stopped state before.

     Note that if the container is started with “–rm” flag, you cannot update the restart policy for it. The AutoRemove and RestartPolicy are mutually exclusive for the container.

As to old version as 1.11.0 before, we can rename the orginial container, start a temp container (but attach the existing volumes of the orginial container), and remove the temp container now that it's no longer needed.
$ docker stop my-old-container
$ docker rename my-old-container my-temp-container
$ docker run  ...  --volumes-from=my-temp-container --restart always myimage
$ docker rm my-temp-container

 To restart the Docker daemon and we can find out the container will start automatically now.


2017年2月25日 星期六

Docker Machine 0.9.0 --- Docker Machine install on the local client and manage Docker Engine on the remote host

Docker Machine is a tool that lets we install Docker Engine on virtual hosts and manager the hosts with docker-machine command.

By docker-machine command, we can start, inspect, stop and restart a managed host, upgrade the Docker client and daemon, and configure a Docker client to talk to the host next to run docker commands directly on this host.

In the moment, we will demo how to practice that docker machine manage the remote host.

Prerequisites
docker host never install a docker engine on the remote machine (# 1)
docker client   install docker client and docker machine on the local machine(as laptop)
where
OS in the remote need to be CentOS 7, Ubuntu 16.04 or above version
The net-tools package (# 2) need to be installed on the remote machine

[Remote Machine]
To create a docker manager account with new password (# 3)
$ sudo adduser {dockermanager}

To allow sudo for docker manager
In the remote machine, we have to edit the /etc/sudoers file and add the following content

                          {dockermanager}  ALL=(ALL) NOPASSWD:ALL
where
        {dockermanager} is the username on the remote machine
So do that Machine communicates with the hosts over password-less SSH

To check whether ssh daemon is running and is listening on port 22
sudo service ssh status
sudo netstat -anp | grep sshd
If it don't show the listening on tcp 0.0.0.0:22, we need to install openssh server
sudo apt-get update
sudo apt-get install openssh-server



[Local Machine]
To generate a public/private keys with empty passphrase (# 4)
$ ssh-keygen -t rsa
where
id_rsa.pub (RSA public key for authentication) file is the public key
id_rsa (RSA authentication identity of the user) file is the private key
In bash shell, the SSH key will be saved on ~/.ssh on linux platform

To copy a public key from local machine to a remote machine
$ ssh-copy-id -i ~/.ssh/id_rsa.pub {dockermanager}@{docker host}
where
{dockermanager} is the username on the remote machine
{docker host} is the ip address or host name of the remote machine

To connect the remote machine by using the SSH key
$ ssh {dockermanager}@{docker host}

To install Docker Client Tool
Until now, there is no docker client-only debs/rpms binary so that we need to do something for getting the individual binary. That is download the docker latest release next to extract it and execute docker command directly.


To install Docker Machine (# 5)
$ curl -L https://github.com/docker/machine/releases/download/v0.9.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine

$ chmod +x /tmp/docker-machine

$ sudo cp /tmp/docker-machine /usr/local/bin/docker-machine

To check docker machine version
$ docker-machine version

To create the remote docker-vm using an existing VM/Host with SSH
$ docker-machine create \
 --driver generic \
 --generic-ip-address={remote docker host ip} \
 --generic-ssh-key ~/.ssh/id_rsa \
 --generic-ssh-user {dockermanager} \
 --generic-ssh-port 22 \
 --generic-engine-port 2376 \
{remote-docker-host}

To check which docker engine is active now
$ docker-machine ls

To print out the detail about the docker client to use the remote docker engine
$ docker-machine env {remote-docker-host}

To connect your shell to the new machine
$ eval $(docker-machine env {remote-docker-host})

To create a docker container on the remote docker host
$ docker run -d -p 8080:80 --name httpserver nginx
so do that any docker command you type at this command prompt will be executed on that remote host

Reference:
(# 1) How to prove that docker engine never is installed on this computer? To switch to the command path next to run $./docker ps command
(# 2) Installing net-tools package on Ubuntu 16.04 (Xenial Xerus) by running the following command on terminal
         $ sudo apt-get update
         $ sudo apt-get install net-tools
(# 3) We can change the account's password by running the following command on terminal
         $ sudo passwd {dockermanager}
(# 4)  If have already set a password for SSH passphrase, we have to change it by the following command
          To change directory to $HOME/.ssh         $ cd ~/.ssh/
          To change RSA passphrase                       $ ssh-keygen -f id_rsa -p
(# 5)  We can download the release version of docker machine from docker/machine release page.
(# 6)  Install Docker Machine https://docs.docker.com/machine/install-machine/
          Machine Driver Generic https://docs.docker.com/machine/drivers/generic/

2017年1月30日 星期一

Docker 1.13.0 --- How to install Docker on Lubuntu 16.10 x64

For a long time no go deep into the Docker's Knowledge!
Due to the job rotation, I have to spend some time to mange team member so that no time to write down something. In the duration of the Chinese holiday, I go to the Docker's Official Website to read the related document(# 1) and find out the some knowledge is a little different with before learning.
I will follow up the Docker's document to re-learn the installation step. For avoiding the forget memory in my mind, I will summary something as follows:

To remove the old Docker component if we ever install Docker or the system build in
sudo apt-get purge lxc-docker

To install extra packages for allowing Docker to use the aufs storage drivers
$ sudo apt update
$ sudo apt install curl linux-image-extra-$(uname -r) linux-image-extra-virtual

To install Docker by using the Docker's repositories
For setting up the Docker repository, we need to install some packages to allow apt to use a repository over HTTPS
$ sudo apt install apt-transport-https ca-certificates
and add Docker's official GPG key
curl -fsSL https://yum.dockerproject.org/gpg | sudo apt-key add -

and add the record of the stable repository into the /etc/apt/sources.list
$ sudo add-apt-repository "deb https://apt.dockerproject.org/repo/ ubuntu-$(lsb_release -cs) main"

To update the apt package index
$ sudo apt update

To verify the apt pull from the right repository
$ apt-cache policy docker-engine

To install the latest version of Docker(# 2)
sudo apt install docker-engine

To check Docker is running
sudo systemctl status docker

To verify the Docker is installed correctly
$ sudo docker run hello-world


Reference
(# 1). Get Docker for Ubuntu
(# 2). If we want to install a specific version of Docker Engine, not the latest version, we can use apt-cache madison command to list all available version.
apt-cache madison docker-engine
next to choose the the appropriate version
$ sudo apt-get install docker-engine=1.13.0-0~ubuntu-yakkety
(# 3). If we want to manage Docker as a non-root user, we need to create the docker group and add the specific user into this group.
To create the docker group
$ sudo groupadd docker

To add a logon user to the docker group
$ sudo usermod -aG docker $USER
Log out and log back again so that we can use docker command without sudo now.
Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.