Skip to main content

Posts

Managing Password in Unix Using Pass

If you are looking for simple password management in Unix, pass maybe the answer. It utilizes GPG to encrypt the stored passwords. It stores the encrypted passwords as text files in a tree of directories. Each directory can maintain a separate GPG key for encrypting the passwords stored inside it. How easy is it? The following command shows how we can store a password and set AWS/access-key-id as the variable name to access it in the future. pass insert AWS/access-key-id The previous command will automatically create a directory named AWS inside the  ~/.password-store  directory which is the default location of pass storage. It also creates a file named access-key-id.gpg inside the ~/.password-store/AWS directory. To access the value we can call the following command. pass AWS/access-key-id There are some steps we need to run for utilizing the tool. Install pass using package manager Create a GPG key pair record Initialize the pass storage with the spe

The First Time Kenshin Met Hiko

"Tell me your name" "Shinta" "Too soft for a swordsman, as of today you are Kenshin"

Essentials Ansible Modules

Ansible is a reliable configuration management tool. It is shipped with a lot of modules including those provided by the communities. Some modules are essential and come in very handy in everyday tasks. Ansible is pushed-based and works by generating a Python script that will be run on the target server. It means the target server is required to have Python which is also commonly shipped in any Linux distros. package The module is used to manage packages in the target host. It is like running apt , yum , or aptitude . The following snippet is an example of its usage to install the Nginx package using the package manager. tasks: - name: Install Nginx package: name: nginx state: present update_cache: True file It is used to manage files, symlinks, links, or folders on the target host. These are the two examples. tasks: - name: Create a directory file: path: "/home/luki/mydir" state: directory mode: 0750 - name: C

Installing VSCode Server Manually on Ubuntu

I've ever gotten stuck on updating the VSCode server on my remote server because of an unstable connection between my remote server and visualstudio.com that host the updated server source codes. The download and update process failed over and over so I couldn't remotely access my remote files through VSCode. The solution is by downloading the server source codes through a host with a stable connection which in my case I downloaded from a cloud VPS server. Then I transfer the downloaded source codes as a compressed file to my remote server through SCP. Once the file had been on my remote sever, I extracted them and align the configuration. The more detailed steps are as follows. First, we should get the commit ID of our current VSCode application by clicking on the About option on the Help menu. The commit ID is a hexadecimal number like  92da9481c0904c6adfe372c12da3b7748d74bdcb . Then we can download the compressed server source codes as a single file from the host.

Creating Self-signed and CA Certificate using OpenSSL

A self-signed certificate is very useful for us when we are in a development or closed environment and require a secure communication channel between nodes in our system like implementing HTTPS for client-server communication. To make our self-signed certificate to be recognized by all nodes in the system, we should generate the CA certificate and distribute it to all nodes. This CA certificate is used to verify and determine the issuer of the self-signed certificate. It is like a stamp on a certificate that ensures the certificate is issued by the authority informed in the certificate itself. OpenSSL CLI tool will be used for this purpose. The following steps can be run to generate valid self-signed and CA certificates. Generate a private CA key Generate a public CA certificate Generate a private key for the target server Generate a CSR for the server Generate a public server certificate and sign it with the CA certificate Before we start the certificate generatio

Managing Kubernetes Cluster in Ubuntu

There are several tools and services in the market that we can use to deploy and manage Kubernetes clusters. Some tools allow us to self-manage the cluster without charge, some require us to subscribe for the license, and some services are provided as a Kubernetes as a Service such as Amazon EKS and Red Hat OpenShift Dedicated. For development purposes or small-scale service, there is a free tool to manage Kubernetes clusters named minikube which is available for Windows, Linux, and MacOS. To build the cluster, Minikube supports several virtualization technologies such as Hypervisor, KVM, Docker, and so on. In this writing, we will try to utilize Docker as the virtualization solution and run it in Ubuntu 22.04. In general, we will run through the following steps. Install Minikube Install Docker Allow a non-root user to access Docker Start Minikube Enable Ingress extension Install Kubectl Install Minikube First, we need to install Minikube's depen

Detecting Main Module in ESM Package

ESM package works in a different fashion from CJS. ESM package imports required modules asynchronously and have no support for several functions related to system files and directories. ESM follows Javascript cores that are implemented in the browser. There is no such entity like __dirname , __filename , require() , and so on. If we want to detect whether a module is a main module that is being run in CJS, we can compare the value of require.module and module . If it is the same, the module is being run as the main module. Meanwhile, for a module in the ESM package, we can use the following approach. Get the value of process.argv[1] that contains information of the main file that is being called by Node. Get the value of import.meta.url that contains information of the module's location that is being accessed. Transform the information to have a similar format, then compare it. For example, we have a module in an ESM package, named module1.js . import { r

Captain Levi Talked To Armin

At this point, Armin and the others start questioning their actions while Levi tries to justify what was happening.

Upgrading Gitlab Using Linux Package

Gitlab actively updates its products including the Community Edition (CE). The easiest way to install Gitlab CE on a Linux machine is by using the package manager. To add the repository to our system, we can run the following command. sudo apt update curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash Before we run the upgrade process, we should follow the recommendation of the version order. If not, we may end up breaking our Gitlab service. Upgrading one version to another version far greater may require upgrading from previous versions first, step by step. To check our current Gitlab version, we can visit <OUR_GITLAB_ADDRESS>/help . The upgrade recommendation can be found  HERE . Note, we are also suggested to upgrade our Gitlab regularly for security reasons. We can get the list of available versions HERE . To apply the upgrade on our machine, we can run the following command. sudo apt-get install gitlab-ce=<VERSION_C

Prototypal Inheritance in Javascript

Some programming languages support object-oriented approaches natively by providing a feature to create an object instance based on a class definition. Meanwhile, in Javascript, we know there is  class syntax, but it is just a kind of syntactic sugar that allows us to instantiate an object that can inherit some traits from another object or class definition in a similar fashion to other programming languages. In Javascript, a class is just a function with a  prototype property that maintain traits that can be passed down to other object instance. There are several ways to allow property inheritance in Javascript. Functional In this way, we utilize the Object.create() method built in Javascript. The steps are: Create an object as the prototype provider. Pass the prototype provider to the Object.create() method along with additional properties declaration if needed. For example, const provider = { sum: (a, b) => a + b }; const obj = Object.create( provider

Configuring Swap Memory on Ubuntu Using Ansible

If we maintain a Linux machine with a low memory capacity while we are required to run an application with high memory consumption, enabling swap memory is an option. Ansible can be utilized as a helper tool to automate the creation of swap memory. A swap file can be allocated in the available storage of the machine. The swap file then can be assigned as a swap memory. Firstly, we should prepare the inventory file. The following snippet is an example, you must provide your own configuration. [server] 192.168.1.2 [server:vars] ansible_user=root ansible_ssh_private_key_file=~/.ssh/id_rsa Secondly, we need to prepare the task file that contains not only the tasks but also some variables and connection information. For instance, we set /swapfile  as the name of our swap file. We also set the swap memory size to 2GB and the swappiness level to 60. - hosts: server become: true vars: swap_vars: size: 2G swappiness: 60 For simplicity, we only check the exi

Hiko Talks With Kenshin

 It was when Kenshin will leave for wandering.