Thursday, 17 August 2017

How to create jks file form crt

Step 1

Create a store with temporary key inside

keytool -genkey-alias temp -keystore yourkeystore.jks -storepass brain123

Step 2

Delete existing entry

keytool -delete -alias temp -keystore yourkeystore.jks -storepass brain123

Step 3

We have empty keystore, we can check with below command

keytool -list -keystore yourkeystore.jks -storepass brain123

Step 4

Now we can import our certificate to the store

keytool -import -alias alias -file certificate.crt -keypass -keystore yourkeystore.jks -storepass brain123

That's all now you have jks file from crt.

Saturday, 1 July 2017

df -h shows wrong disk size

Some times df -h shows root partition 100% full but it's not correct when we try du command it will show different for example check the below screen shot. 


We need to find which is lock all the size for that you can use 

du -sch * 

this command will show the correct size of directories.

now we find nothing has fill the size the we need to check the deleted files cause deleted files which were still occupied by the PID we can find that with following command.

lsof +aL1 /filename

if filename doesn't show anything then use the same command to /

lsof +aL1 /



now it will show deleted files. We need to just kill the pid with kill command

kill -9 5996

and now check the size with df command

df -h


That's all

Note if I miss anything please command me to change my mistakes. Thank you.


Wednesday, 21 June 2017

Resetting Jenkins admin password

We can change the password with following command.

echo -n 'admin{bar}' | sha256sum

in this foo is the password and salt is bar we will get password like belwo

8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918 -

just take a copy and go to /var/lib/jenkins/users/admin/config.xml

and paste the password in <passwordHash> like

<passwordHash>bar:
8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918</passwordHash>


Now restart the jenkins service.

service jenkins restart

now login.


Monday, 19 June 2017

Time and date change in rhel 7

Step 1

It's easy to change time in rhel 7. We can check the date and time with  below command.

date

If we want to know all the details like timezone, date, time and etc... run the below command.

timedatectl

it will show like below





Step 2

To set time use the following command

timedatectl set-time 15:22:34

if some times it will show the error like below

Failed to set time: Automatic time synchronization is enabled 

then we need to disable the automatic time sync with following command

timedatectl set-ntp 0

after change date and time then again enable it if needed with following command.

timedatectl set-ntp 1

If we need to change time and date along then following command will help us.

timedatectl set-time "2017-06-19 15:28:40"

Step 3

If we want to change the timezone then follow the command

timedatectl set-timezone America/New-York

if you don't know correct name of time zone then search it with following command and you can add.

timedatectl list-timezone | grep -i york

if you want to list all the timezone then follow the command

timedatectl list-timezone

Step 4

To display the current year format

date +"%Y"

To display the current month format

date +"%m"

To display current year and month and year

date +"%m-%d-%Y"

Thanks it's for my study purpose only if you see any mistakes please command and make me perfect.



 




Wednesday, 10 May 2017

The remote host implements TCP timestamps and therefore allows to compute the uptime.

Add the mentioned line in /etc/sysctl.conf

net.ipv4.tcp_timestamps = 0

then run the command to restart the service

sysctl -p

Now check again the issue will not show again.

The remote SSH server is configured to allow weak encryption algorithms.

Add the following lines in /etc/ssh/sshd_config

Ciphers aes128-ctr,aes192-ctr,aes256-ctr
MACs hmac-sha1,umac-64@openssh.com,hmac-ripemd160

Now check with below command

THAT'S ALL

Following command is for your ssh configuration to find the correction.
ssh -vvv -F /etc/ssh/sshd_config root@192.168.1.1

If it's shows everything ok then no issue otherwise

it will show like this

/etc/ssh/sshd_config: line 28: Bad configuration option: hostkey
/etc/ssh/sshd_config: line 30: Bad configuration option: hostkey
/etc/ssh/sshd_config: line 31: Bad configuration option: hostkey
/etc/ssh/sshd_config: line 43: Bad configuration option: syslogfacility
/etc/ssh/sshd_config: line 49: Bad configuration option: permitrootlogin
/etc/ssh/sshd_config: line 59: Bad configuration option: authorizedkeysfile
/etc/ssh/sshd_config: line 94: Bad configuration option: gssapicleanupcredentials
/etc/ssh/sshd_config: line 110: Bad configuration option: usepam
/etc/ssh/sshd_config: line 115: Bad configuration option: x11forwarding
/etc/ssh/sshd_config: line 123: Bad configuration option: useprivilegeseparation
/etc/ssh/sshd_config: line 140: Bad configuration option: acceptenv
/etc/ssh/sshd_config: line 141: Bad configuration option: acceptenv
/etc/ssh/sshd_config: line 142: Bad configuration option: acceptenv
/etc/ssh/sshd_config: line 143: Bad configuration option: acceptenv
/etc/ssh/sshd_config: line 146: Bad configuration option: subsystem

Now add # the following lines that above mentioned.

Wednesday, 3 May 2017

OpenVAS installation and configuration in RHEL/CentOS 6

Step 1

Install atomic release from below link.


rpm -ivh http://www6.atomicorp.com/channels/atomic/centos/6/x86_64/RPMS/atomic-release-1.0-14.el6.art.noarch.rpm


Step 2 

setup atomic repository for OpenVAS.


wget -q -O - http://www.atomicorp.com/installers/atomic |sh

and now if we got some errors that means so many dependency is not available in it. In case if it happens the add the repo for Openvas


vi /etc/yum.repos.d/centos.repo

for 32 bit


[CentOS]
name=centos
baseurl=http://mirror.centos.org/centos/6/os/i386/
enabled=1
gpgcheck=0

for 64 bit


[CentOS]

name=centos
baseurl=http://mirror.centos.org/centos/6/os/x86_64/
enabled=1
gpgcheck=0

Step 3


Now install openvas


yum install openvas


after installation complete install atomic-sqlite-sqlite and atomic-sqlite-sqlite-devel


yum install atomic-sqlite-sqlite atomic-sqlite-sqlite-devel

now run the openvas setup


openvas-setup

it will take some time, finally it will ask useranme password


and then start the services of openvas


service openvas-manager start 

service gsad start


chkconfig gsad on


chkconfig openvas-manager on


Step 4

We can check the openvas installation with following command


openvas-check-setup

it will show the redis is not installed in it. Now installed redis


yum install redis -y


then remove # from below listed text


unixsocket /tmp/redis.sock
unixsocketperm 700

now start the redis service


service redis start 

chkconfig redis on


Step 5

Now create cert for client with following command

openvas-mkcert-client -n -i

now create user and password for the web interface

openvasmd --create-user=username --role=Admin && openvasmd --user=username --new-password=password

now rebuild the openvas setup it will take 1 to 3 min only

openvasmd --rebuild

now restart the openvas-manager and gsad services

service gsad restart 

service openvas-manager restart

now open the url with port number 9392

https://192.168.1.1:9392


That's all we can now check the server vulnerability with this tool.

Helm installation on rhel 9

 You can do install with 2 commands  first one is curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-hel...