Posts

Showing posts from December, 2017

Importing a self signed certificate to java cacert trust store

The following steps to be used only in non production environments. Self signed certificates could be used in some organisations to make server to server calls between java programs on SSL.  During these situations, we can import the certificate from the server jvm to client's jvm to fix the SSL handshake issue. On Server JVM: Generate a self signed certificate keytool -genkey -noprompt -alias test.example.com -dname "CN=localhost, OU=Team Name, O=Organisation Name, L=London, S=Greater London, C=UK" -ext "san=dns:test.example.com,dns:test.example.org" -storetype PKCS12 -keyalg RSA -keysize 2048 -keystore /tmp/keystore.p12 -validity 36500 -storepass mypassword -keypass mypassword List the certificate keytool -list -keystore /tmp/keystore.p12 -storepass mypassword -storetype PKCS12 -v Export the certificate keytool -exportcert -keystore /tmp/keystore.p12 -storetype PKCS12 -storepass mypassword -alias localhost -file /tmp/test.example.com.crt On...

Install a specific version of a package in Debian / Ubuntu

Quiet often we setup auto pipelines for Continuous Integration in Cloud (like GitLab CI, Travis CI etc) and we install required packages (like mvn or gradle) using apt-get install  command to run the build. Sometimes it is quiet important to have a specific major version of a package or major-minor version of a package to run the build, otherwise the build might break with unintended behaviour. Hence this post explains the following commands on Debian / Ubuntu operating system: List all available packages Search for a package List the available version of a package Install a specific version of a package Install a specific major version of a package Install a specific major.minor version of a package Install a specific major.minor.security version of a package List all available packages apt-cache pkgnames Search for a package apt-cache search jdk List the available version of a package apt-cache madison maven Install a specific version of a package ...

Import self signed in Linux for Chrome / Chromium headless testing

Chrome / Chromium browser offers headless mode, which is quite useful to run tests via Selenium WebDriver in CI servers. However under some circumstance your test will hit a server with self signed certificate or invalid certificate or expired certificate. This may happen for developers trying to write tests against a server started on localhost with self signed certificates or testers trying to write tests against non-production servers with expired certificates (invalid certificates). Chrome / Chromium browser ignores the SSL errors when running in non-headless mode. However in CI servers, then it should be running in headless mode and currently we cannot ignore the SSL errors for tests accessing non-localhost websites. This blogs explains the steps for import a certificate into Linux's trust store, which will make the Chrome / Chromium browser to trust the self signed certificate.  Please do not apply these steps in production servers as it will make server vulnerable to ...

docker-compose plain ubuntu container

The following article explains how to start and keep running a plain ubuntu container in the background. During everyday software development, you might want to share a folder in host machine along with a unix based container like Debian or Ubuntu container to verify if certain things works as expected in headless mode or remote server. Hence this blog post explains how to start and keep running an empty Ubuntu container without installing any additional package or service and the current directory of host machine will be mounted at /var/host_machine_folder/ Create file "my-ubuntu-container.yml" with the following contents ################ version: '2' services:   my-ubuntu:     container_name: my-ubuntu     image: "ubuntu:latest"     command: tail -f /dev/null     volumes:       - .:/var/host_machine_folder/     environment:       # This is set in host system and the value ...

Maven change project version

Changing snapshot to release mvn versions:set -DoldVersion=1.0-SNAPSHOT -DnewVersion=1.0 -DgenerateBackupPoms=false Changing release to snapshot mvn versions:set -DoldVersion=1.0 -DnewVersion=2.0-SNAPSHOT -DgenerateBackupPoms=false