A critical vulnerability (CVE-2021-44228) was identified on the popular log4j logger library used by a lot of popular Java applications. The remote code execution (RCE) vulnerability allows attackers to gain access to the server by getting the application to log a special string.
Apache Log4j versions 2.0-beta9 to 2.14.1 are affected by this critical vulnerability.
To find if Log4J is installed on your server, run
find / -type f -name log4j*
This will list all available log4j files on your server.
Example
root@server:~# find / -type f -name log4j*
/opt/SoapUI-5.4.0/licenses/log4j-LICENSE.txt
/opt/SoapUI-5.4.0/lib/log4j-1.2.14.jar
root@server:~#
In the above result, the server has an application SoapUI-5.4.0, that use Log4J. But the version is older than 2.0, so not affected by this vulnerability.
If your server has any application, that uses Log4J and it uses a vulnerable version, you need to upgrade it to the latest version.
how to check apache log4j version
Usually, the jar file has names like
log4j-1.2.14.jar
File name format is log4j-VERSION.jar, in this case, version of log4j is 1.2.14
Oracle Linux 7 comes with MySQL yum repository pre-installed. By Default MySQL 8 repository is enabled. You can disable MySQL 8 repository and enable MySQL 5.7 repository to install MySQL 5.7.
You can find enabled repositories with command
yum repolist all | grep -i mysql
Example
[root@sql2 ~]# yum repolist all | grep -i mysql
ol7_MySQL55/x86_64 MySQL 5.5 for Oracle Lin disabled
ol7_MySQL56/x86_64 MySQL 5.6 for Oracle Lin disabled
ol7_MySQL57/x86_64 MySQL 5.7 for Oracle Lin disabled
ol7_MySQL80/x86_64 MySQL 8.0 for Oracle Lin enabled: 281
ol7_MySQL80_connectors_community/x86_64 MySQL 8.0 Connectors Com enabled: 56
ol7_MySQL80_tools_community/x86_64 MySQL 8.0 Tools Communit enabled: 15
[root@sql2 ~]#
Let’s disable MySQL 8 repo and enable MySQL 5.7 repository.
These are installed as dependency for the postfix mail server, so if you remove the packages with yum, postfix also get removed, so I removed it with command
On a Debian server, when running a command with sudo, I got the error
sudo: command not found
To fix this, you need to install “sudo” package. If you are logged in as non-root user, then you need to become root, for this, you can use the command
su -
Enter the root password when it prompt for the password.
Once logged in as user root, you can install sudo with the command
apt install sudo
To add a user to sudo group, run the command
usermod -aG sudo USER_NAME
Or
adduser USER_NAME sudo
If you don’t have a user, you can create a user with the command
useradd -m --shell /bin/bash USER_NAME
To verify if the user has sudo rights, you can use the command “sudo -v”. You can also use “id” or “groups” command, which lists all groups the current user is in, you can verify if the user is part of sudo group.
WebP is an image format for web by Google. The size of webp images are much smaller compared with other image formats, so better to use webp images on websites for faster site load speed.
To install webp on Ubuntu/Debian, run
sudo apt install webp
To convert an image to webp format, run
cwebp image.png -o image.webp
With the above command, image.png file gets converted to image.webp
Oracle Linux is Free 100% binary-compatible with Red Hat Enterprise Linux, same as CentOS. Unlike RHEL, Oracle Linux is free even for commercial use. Oracle only charges if you need support.
Oracle provides a script to convert CentOS to Oracle Linux
This script support CentOS 6, CentOS 7 and CentOS 8.
Before you can run the convert script, make sure you have updated the system to the latest version with yum or dnf and take a backup in case anything goes wrong.
Deleting a software RAID array will result in all data stored in the devices being lost. So be careful when you remove a RAID array, take backups in case needed.
Before you can remove the software RAID array, you need to unmount it.
umount /dev/mdX
Where /dev/mdX is the device name for the RAID device you need to remove.
Find the disk used to create the RAID with the command
mdadm --detail /dev/mdX
Stop the RAID device with the command
mdadm --stop /dev/mdX
Now you need to run the following commands for each storage device that are part of the RAID device.
mdadm --zero-superblock /dev/sdXY
IMPORTANT: you need to run this for each member of the RAID device.
Finally, edit /etc/mdadm/mdadm.conf, and remove the entry for the RAID array.
RAID 0 allows you to combine multiple disks into one large disk. Only use RAID 0 if the data is not important to you, for example, a backup server. If one disk fails in a RAID 0 array, all the data will be lost.
To create a software RAID 0 with 2 or more disks, first, we need to prepare the disks to be used as RAID members. Run the following commands on each of the disks we will be adding to the RAID 0 array.
parted /dev/sdX mklabel gpt
parted /dev/sdX mkpart primary ext4 0% 100%
parted /dev/sdX set 1 raid on
Replace /dev/sdX with actual device names and run the commands for all devices you will be adding to the RAID 0.