Saturday, December 30, 2017

Setup SSL for Jira

How to do it...

Perform the following steps to import an SSL certificate:

1. Open up a command window and go to the directory where the certificate file
resides.

2. Generate a Java KeyStore (JKS) for JIRA by running the

keytool -genkey -alias jira -keyalg RSA -keystore /opt/jks/jira.jks

3. Import the certificate into KeyStore repository
keytool -import -alias jira -keystore JIRA_INSTALL/jira.jks -file file.crt

where file.crt is the certificate file.

4. Open the server.xml file located in the /opt/atlassian/jira/conf directory in a text editor.

5. Locate and uncomment the following XML configuration snippet:

maxThreads="150"
minSpareThreads="25" maxSpareThreads="75"
enableLookups="false"
disableUploadTimeout="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false"
sslProtocol="TLS" useBodyEncodingForURI="true"

keystoreFile="/opt/jks/jira.jks"
keystorePass="mypassword"
keyAlias="jira"
keystoreType="JKS"/>




Letsencrypt

Install certbot ppa:

sudo add-apt-repository ppa:certbot/certbot

then install certbot:
sudo apt install certbot


 run certbot for manual installation of letsencrypt using challenge via DNS:

sudo certbot certonly --manual --preferred-challenges dns

openssl pkcs12 -export -in fullchain1.pem -inkey privkey1.pem -out cert_and_key.p12 -name tomcat -CAfile chain1.pem -caname root

keytool -importkeystore -srcstorepass ppz2017 -deststorepass ppz2017 
-destkeypass ppz2017 -srckeystore jira.siza.my/cert_and_key.p12 
-srcstoretype PKCS12 -alias tomcat 
-keystore jira.jks

TO see what contains in the keystore:
keytool -list -keystore /opt/jks/jira.jks

6. Restart JIRA to apply the changes.
sudo systemctl stop jira
sudo systemctl start jira



Navigate through bash history with page up/down key

Linux bash history with Page up / Page down

In linux you can configure the pgup/pgdown keys to navigate through commands you typed that begin with the string you just typed. Type "mysql" and then hit "Page up", and you will see nothing but mysql-related commands.

Unfortunately this has to be configured anew on every machine or server/vm I work on, and I always forget where this is configured (and it takes a while to find it in google), so I thought I should write it down.


In /etc/inputrc, uncomment:
# alternate mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
"\e[6~": history-search-forward

Restart your shell or use Ctrl+X, Ctrl+R to tell it to re-read.
(thanks stackoverflow)

Yep, it's not ".bashrc" but "inputrc". Not sure why this one is not hidden, but so it is. You could try ~/.inputrc for a local, user-specific configuration.

Tried this in Ubuntu, and it works.

And I tried it in kde-neon and it works.

Credit goes to Andreas Hennings aka "donquixote". Visit his page about this here

Friday, October 20, 2017

Error mounting NFS volume

If you got error to mount NFS volume in CentOS like below:

#mount -t nfs  10.12.1.23:/volume1/test  /mnt/test                                             
mount: wrong fs type, bad option, bad superblock on 10.12.1.230:/volume1/test,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount. helper program)

       In some cases useful info is found in syslog - try
       dmesg | tail or so.





To solve this problem, you need to install nfs-utils package:

#yum install nfs-utils

In debian-based distros, you can try install nfs-common package:

#apt install nfs-common


That's all there is to it!

Have fun :)