Java Keytool is a command-line tool that is used for managing cryptographic keys, certificates, and keystores in Java-based applications. In Linux, Java Keytool is often used for managing SSL/TLS certificates and securing web applications that run on Java-based servers like Tomcat, GlassFish, and JBoss.
Some of the key features of Java Keytool in Linux include:
Generating key pairs: Java Keytool can be used to generate key pairs, which are used for encryption, decryption, and digital signatures.
Importing and exporting certificates: Java Keytool can import and export certificates, which are used for verifying the authenticity of digital signatures and ensuring secure communications.
Managing keystores: Java Keytool can create, modify, and delete keystores, which are containers for cryptographic keys and certificates.
Configuring SSL/TLS: Java Keytool can be used to configure SSL/TLS connections for Java-based web applications, which are essential for securing data communications.
Some of the most commonly used Java Keytool commands in Linux include:
keytool -genkeypair: This command is used to generate a new key pair.
keytool -import: This command is used to import a certificate into a keystore.
keytool -list: This command is used to list the contents of a keystore.
keytool -delete: This command is used to delete a key or certificate from a keystore.
Overall, Java Keytool is an important tool for managing cryptographic keys and certificates in Java-based applications in Linux, and it is essential for securing web applications and ensuring the privacy and integrity of sensitive information.
Before we begin make copy of old keystor like this:
This script helps to notify me by e-mail about the condition of the disk. Remember to indicate the disk accordingly – in this case it is “/dev/sda” and change the e-mail address from “soban@soban.pl” to your own. Save the script in “/root/checkbadsector.sh“:
The best way to check information about domain and DNS configuration is “whois” and “dig”. This tools can provide a lot of informations. Lets try use it. First we must check that package is installed. I have already installed “dig”:
Shell
1
2
# which dig
/usr/bin/dig
In debian, you can use “dpkg -S”
Shell
1
2
# dpkg -S /usr/bin/dig
dnsutils:/usr/bin/dig
if you don’t have it then you should install:
Shell
1
# apt install dnsutils
Now we can check “dig” in “soban.pl” domain:
The same case in “whois”:
Shell
1
2
# which dig
/usr/bin/dig
Check what package provide:
Shell
1
2
# dpkg -S /usr/bin/whois
whois:/usr/bin/whois
And if you don’t have it, then install:
The best way to check information about domain and DNS configuration is “whois” and “dig”. This tools can provide a lot of informations. Lets try use it. First we must check that package is installed. I have already installed “dig”:
Shell
1
2
# which dig
/usr/bin/dig
In debian, you can use “dpkg -S”
Shell
1
2
# dpkg -S /usr/bin/dig
dnsutils:/usr/bin/dig
if you don’t have it then you should install:
Shell
1
# apt install dnsutils
Now we can check “dig” on “soban.pl” domain:
The same case in “whois”:
Shell
1
2
# which dig
/usr/bin/dig
Check what package provide:
Shell
1
2
# dpkg -S /usr/bin/whois
whois:/usr/bin/whois
And if you don’t have it, then install:
Shell
1
# apt install whois
As you can see, the domain “soban.pl” is currently using cloudflare DNS – which I highly recommend.
Sometimes it is necessary to change the DNS name indication to a different IP address. As you can see in the example below, google.com currently points to:
To change google.com indication to, for example – 37.187.101.239, edit the file: “/etc/resolv.conf” as root:
Shell
1
2
# cat /etc/resolv.conf
google.com37.187.101.239
After making this change, the effect is as follows:
Windows as you see there is similar situation:
File must be edited as administrator “C:\Windows\System32\drivers\etc\hosts”:
A convenient way to maintain the test environment is automatic updating. However, remember to set the backup, e.g. the day before – I always set it like that in proxmoxe. The script that updates the Debian system looks like this:
Shell
1
2
3
4
5
6
# cat /root/update.sh
#!/bin/bash
apt-getupdate
apt-getupgrade-q-y
apt-getautoremove-y-q
rm-rf/var/cache/apt/archives/*.deb
You can download the script from:
Shell
1
2
$cd/root/
$wget https://soban.pl/bash/update.sh
The script cleans unnecessary deb files after the update. Keep in mind the permissions and capabilities of the script:
Shell
1
# chmod +x /root/update.sh
In crontab, I set the day after automatic backup in proxmoxe:
Shell
1
104**3/root/update.sh>/dev/null2>&1
Of course, the script can be added in the production environment, but it should not be added to the crontab.
Before we start upgrading the Debian system version, please make a snapshot or a possible backup of the system. Such a change entails significant changes that can damage the system. Of course, before you upgrade the system in production, it is best to upgrade to the testing environment first. The upgrade process affects the entire system. Services may not be available at this time. If the system is doing the hosting for your website then it may not be available!
Always bear in mind that the production environment is different from test environment, so I recommend that you do it carefully. A good practice is to keep a time interval between the upgrade of test and production environment, in my case it is a week. Remember not to make changes to production on Friday!
This is how we check the version of the system:
And now, we going to update OS, but before we do that – we will make copy of:
Shell
1
cp/etc/apt/sources.list/root/sources.list_buster
There is sorces setup for buster:
Shell
1
2
3
4
5
6
# cat /etc/apt/sources.list
deb http://ftp.debian.org/debian buster main contrib
deb http://ftp.debian.org/debian buster-updates main contrib
deb http://security.debian.orgbuster/updates main contrib
Now you need get some the system upgrade process has started. You can go for a coffee, or not 😉 There will be questions. And more information, albout apt listchanges:
Just press ‘q’ and enter.
In this case we press enter.
Services to restart:
Enter agien.
This is question, about ssh deamon configuration:
In my case, I press enter because I don’t want to make changes to its configuration.
If all went well, we can reboot the system:
Shell
1
# reboot
Now check the system:
Congratulations, we are on the new version of the system! At this point, we can verify all services, for example whether the website is working properly. If it is OK, upgrade the production environment.
In my cases, I have problem PHP new version. PHP have no persmision on nginx to user – when I try enter to page: