Posts

Showing posts from September, 2020

Lets learn "How to transport docker images from one host to another"

Image
In this tutorial, we'll learn about how to transport/send a docker image from one host to another. 1. Use shared docker registry One way is to use the shared docker registry between the hosts. Like in the below example if we wanna share a docker image built on HOST1 to HOST2. After building the image (<IMAGE-NAME>:<TAG>) on HOST1, Run the below commands to push it to the shared registry. ON HOST1, publish the docker image docker tag <IMAGE-NAME>: <TAG> <REGISTRY-ADDRESS>/<IMAGE-NAME>:<TAG> docker push <REGISTRY-ADDRESS>/<IMAGE-NAME>:<TAG> ON HOST2, pull the docker image docker pull  <REGISTRY-ADDRESS>/<IMAGE-NAME>:<TAG> 2. Create an image file and SCP to the target host This way requires to convert the docker image to a file. After the image is converted to file, it can be transported to other hosts where it can be loaded back to its own docker registry. This method emilinates one hop of shared docker reg

Lets learn "How to write good Dockerfiles"

Image
  In this tutorial, we'll try to learn the best practices and methods to build efficient docker images using Dockerfile. Writing a good dockerfile can reduce the image build time significantly. It can also save your money by reducing the storage cost because an efficient docker image can reserve very little disk space compared to an inefficient docker image. Hence it is very important to take a few things into account while writing a dockerfile. Before going further let's learn what exactly Dockerfile is in case you don't know. Dockerfile is a text file containing a set of instruction which is used by docker daemon to build the docker image. For docker to build a docker image from Dockerfile, the file needs to adhere to a specific format and set of instructions. Docker image/container layers Basically, all the docker images consist of layers. Each instruction in Dockerfile forms a layer. The more the number of layers more is the size of the image. Also as mentioned in the a

Lets learn "How to add tables on blogger post"

Image
  In this article, we'll learn how to create a table on a blogger post. At first, I was surprised to see the blogger editor doesn't have support to add the tables in the blog post. Googling a bit mentioned to add a table change the View to "HTML View" and write HTML code to add a table. But what about if you don't know HTML which most of the bloggers don't ;) Below is an image highlighting the button to switch the view. Now let's learn how to insert a table on Compose View. There can be multiple ways to do that but the easiest method I found is using the google docs. Let's go through step by step on how to do that. 1. Open google docs from here . 2. Create a blank document.  3. Click the insert button. 4. Select "Table" and select the size of the table. 5. On selecting the table, a table will be generated on the doc. 6. This table is resizable, you can resize if you want. 7. Select and Copy the table 8. Paste the table on the blogger "Co

Lets learn "About k8s Descheduler"

Image
Introduction One of the components of the kubernetes stack is Kube-scheduler which takes care of scheduling pods on k8s worker nodes based on some strategies. These strategies include node resources, node affinity, etc. Basically, Kube-scheduler tries to schedule a pod on that node that meets its scheduling requirements the best. The problem here is once a pod is scheduled on a node, it will never be auto rescheduled on another node unless it is manually deleted and recreated.  Now one question that can come into mind in what scenarios we want a pod to get rescheduled automatically: The original scheduling decisions (made by Kube-scheduler) may no longer hold true because of the following reasons: Node resources are changed. New taints/labels are added to the node. New nodes are added to the cluster, which makes existing nodes overutilized and new nodes underutilized. Some nodes which were failed are brought back and its pods are scheduled to other nodes. So the conclusion is there are

Lets learn "How to replace a failed etcd member"

Image
  It is possible that one of the nodes in the etcd cluster went into a bad state either because of network issues or due to disk corruption. In such scenarios, one requires replacing an etcd member in etcd cluster. This tutorial explains the steps to replace etcd member. This tutorial assumes that the reader has sufficient knowledge about what exactly etcd is. The terminology used in this tutorial: Peer node : One of the active nodes in etcd cluster Corrupted node : Node which is going to be replaced Fresh node : Node with which the corrupted node is going to be replaced with. So below is the list of commands we need to run to perform the etcd replacement. Stop etcd service on Fresh node . Clear the etcd data directory on Fresh node just to ensure that we don't have any stale data there. The command is " rm -rf <etcd-data>" directory. The next step is we need to figure out the member id of the corrupted node. Then command to figure that out is " etcdctl membe

Lets learn "About web application security"

Image
  “Companies spend millions of dollars on firewalls, encryption and secure access devices, and it’s money wasted, because none of these measures address the weakest link in the security chain.” – Kevin Mitnick Any web application developer should be familiar with the fundamentals of web application security because any loophole in a web application can help the hacker to get unauthorized access to your precious resources . So in this tutorial we will discuss the fundamentals of web application security , we'll discuss the tools required to check the vulnerablities before deployment of any web application and list the vulnerabilities that we'll cover in a couple of tutorials . So Let's Get Started , Get Ready to enter into Security .... Coming to the tools first ... The most important tool we'll use is BurpSuite . BurpSuite is a proxy tool which allows the user to intercept the requests, modify the requests, repeat the requests and analyse the response . To install burp

Lets learn "Open Redirect - A web application vulnerability"

  In this tutorial , we will be discusssing about a web application vulnerability known as Open Redirect . Redirections are normally done in web applications . For example : If in some website like amazon if session expires during time user is surfing for the products , the user is redirected to the login page which requires the user to login again the access some page . And once the user login again , the user is redirected to the page where he left during session expires . Actually after relogin the redirection url is passed as a parameters which tells the server about the url where user should be redirected if he is able to login successfully . This redirection can impose a vulnerability on web application . If some attacker change the parameter (redirection url) , then after logging in the user is redirected to the page decided by the hacker which could be malicious . This is something most web application do not wants . So... Lets come to definition of Open Redirect . What is Open

Lets learn "How to free up hard drive space on your Windows 10 PC or Laptop"

Image
  In Windows 10, we can use the Store settings to get an overview on how space is being utilized on the main system drive and external hard drives. But more importantly, now you can see which folders are using the most space, which can help you to identify and make a decision on the files you can delete to free up some storage. Here's how to find and delete temporary files: Use the  Windows key + I  keyboard shortcut to open the Settings app. Click on  System . Click on  Storage . Under Storage select the drive you want to analyze. (Note that the  This PC  drive is the main computer's hard drive where Windows 10 is installed.) On Storage usage, you can see that Windows 10 categorizes the content based on default folders (e.g., Documents, Pictures, Music, etc.), apps and games, and system files, and you can view the storage usage. Simply click on of the item's name to get more information. If you want to delete its content, click the view button to open the folder location,

Lets learn "google-auth-login in php"

Image
  ============ Introduction ============ This project helps web developers to implement the user registration with Google account using PHP at their website project. Also the user information would be stored at the MySQL database. ============ Installation ============ 1. Go to https://console.developers.google.com 2. Create a new project 3. After the project is created , go to Credentionals and create credentials (fill the required details) 4. Go to Enabled APIs and enable the Gmail API 5. Create a database (say flipkart) at phpMyAdmin. 6. Import the users.sql file into the database (say flipkart). 7. Open the "includes/functions.php" file and modify the $dbServer, $dbUsername, $dbPassword, $dbName variables value with your phpMyAdmin details. 8. Open the "config.php" file and modify the $clientId, $clientSecret, $redirectUrl and $homeUrl variables value with your Google Project API credentials. 9. Test the functionalities. Clone the project from the below lin

Lets learn "How to send mail using google auth in Python"

Image
  ======================= Introduction ===================== This project helps the user to send email using their gmail account using Gmail Python API . Using this project user can send any kind of data (like music file,vedio file,pdf) . ======================= Setup ============================ 1. Create a project at https://console.developers.google.com . 2. Enable the Gmail API and Create the Credentials. 3. Download the Credentions in json ( there is an option for downloading the json file ) and copy to the project location as client_secret.json. 4. Modify the main function of send_mail.py according to your requirement. 5. Run the script (python send_mail.py). 6. At first time , It does authorization by opening a browser or giving the link if fails to open the browser . This is one time process. 7. As the authorization is successful , mails will be sent. You can Download the code from Gauth Send Mail . Code : from __future__ import print_function import httplib2 import os