Skip to main content

Posts

Showing posts from 2021

How to resolve Log4j CVE-2021-44228 in Spring Boot

 As you may know, Log4j released a patch (actually a couple of patches) recently for a vulnerability  [CVE-2021-44228] that was identified in their library. Since a lot of Spring boot applications are out there using Log4j 2.x series. It is better to fix them as soon as possible.  Also, this article is considering you are using Maven for dependency management. Fixing this in the Spring boot applications is easy. It is just adding a version property for the pom.xml.  As of this date of writing, the latest updated Log4J version is  2.17.1 . So the fix is to update the version property with this. <properties>     <log4j2.version>2.17.1</log4j2.version>     <log4j.version>2.17.1</log4j.version> </properties> If you are using BOM, instead of spring boot parent dependency, update it as follows. <dependencyManagement>     <dependencies>         <dependency>             <groupId>org.apache.logging.log4j</groupId>             &l

AWS add multiple MFA devices

 Adding multiple MFA devices to AWS user account I wanted to use more than one device for MFA. Well, once I was abroad and my phone broke for some time. My phone had  MFA setup for the AWS account. Then I was locked out and couldn't log in to AWS without having the phone. This made me wanted to keep more than one MFA device. However, AWS doesn't really allow you to add more than one device. It is to note that we always use virtual MFA devices and that is also the trick to do this. I haven't tried this with hardware devices though. Just to be clear a virtual MFA allows us to set up an MFA application such as Google Authenticator or Microsoft Authenticator etc.  The Workaround The trick is to use the same QR code to add another device. Also, this can be done using the secret too. When the first device is added, keep the QR code (maybe take a screenshot and then add another MFA device.  Scan the same QR code with the next device or enter the secret key. The same pin numbers wi

Ubuntu MySQL ERROR 1698 (28000)

Ubuntu MySQL ERROR 1698 (28000): Access denied for user 'root'@'localhost'  This is a quick note about MySQL root access error in Ubuntu even though the password is correct.

Moodle Enable HTTPS with a proxy or an ELB

 If you are converting Moodle site from HTTP to HTTPS or setting up from the scratch, it will be a bit tricky as I also experienced. By the way, I'm not going to talk about how to install the SSL certificate here. This is only about the Moodle configurations you have to do after that. There are two ways you can do this. 1. Enable HTTPS using a proxy or an ELB If you have this setup, then again we need to change the config.php as below. //Change the URL to https $CFG->wwwroot = ' https ://my.moodle.site.edu'; //Add the following line $CFG->sslproxy = true; If the SSL proxy configuration is not enabled, your browser will keep trying to redirect.  You should enable this configuration if you have SSL termination from a proxy or a load balancer. I tried this with an AWS ALB (Application Load Balancer).  If you don't change the config, it will fail to load the styles and Javascript. 2. Enable HTTPS in Apache server This is if HTTPS is enabled in the Apache server on

Automatically open Chrome developer tools in a new tab

Sometimes we need to check the console or the network transactions of a link that opens up in a new tab. By default, the Chrome developer tools are not opening in a new tab. So, by the time when we hit F12 and open the dev tools, part of the information we needed could be already gone.  There's a setting in dev tools where you can keep the dev tools open automatically in a new tab. To enable that, hit F12 and open up the dev tools. Click on the settings icon in the top right corner. In the Preferences section, scroll down to the bottom. You'll be able to find the option to Auto-open DevTools for popups. Select the checkbox and we're good to go!

How to access a container in Rancher from the command line

How to access a container in Rancher from the command line without SSH If you have deployed an application pod in rancher, sometimes you have to access the running container for various tasks. Maybe, to check some files, monitor logs, run some commands, copy files, etc.  Assume you have an application pod running in Rancher as the following image. Using the Web UI One of the ways to access the container would be using the Rancher UI. If you click on the pod name and then on the next page, you can select Execute Shell from the Pod's context menu. Then it is supposed to bring the command window in the web UI itself. However, this method has its limitations. You cannot copy files to or from the Pod using the web UI itself.  Using Rancher CLI The link to the CLI package can be found in the bottom right corner of the Rancher web UI. Select the CLI client according to your OS and download. I'm using Linux, so I've downloaded the Linux client.  Extract it. tar -xf rancher-linux-am

TJ's theory of human evolution

Human evolution from the eyes of a programmer From the first life that appeared on Earth, there have been so many species that came into existence. As Darwin showed, a species can evolve from a common ancestor into a specific species with unique properties and behaviors of its own. Each species may possess some abilities based on its properties and behaviors. The abilities of a species can be used to get an understanding of development and intelligence. For example, a simple microorganism would only show the capabilities of primitive life i.e. energy consumption, reproduction, growth, and development. However, a developed higher species may display abilities like building nests, homes, communication with sound patterns, etc.  Evolution of species as a class diagram Among, all the animals, humans are capable of quite peculiar and advanced abilities that come with the large brain and cognitive development. Humans have developed so advance with our capabilities we have complex languages t

Linux deleted log file doesn't free up the disk space

TL DR; Kill or restart the process which writes the log file. Even though the file is deleted, it won't free up the disk space if the process is still writing to the log file. Only after stopping the process, it will actually be deleted. ---------------------------------------------------------------------------------------- Usually, disk spaces of servers are getting cluttered and filled by application log files when a proper log rotation mechanism is not implemented.  In case if you find such a log file causing the disk space to fill up 100%, it will probably impact any application which trying to use the disk.  You can see the disk space by the following command. df -h If the root dir ("/") usage is 100% the impact may be high for the system. Or else, if there is more than one disk attached then any application that uses that disk can be impacted.  In the above image, mine is not filled yet. I have only used 25% of the disk. How to find what files are using the disk sp