$ cat animalscatfishzebramonkey
$ cat animals | tr "\n" " "cat fish zebra monkey
$ cat animalscatfishzebramonkey
$ cat animals | tr "\n" " "cat fish zebra monkey
For multi domain, we have to create a config file for openssl command to refer to, since the interactive mode would not, by default ask for multi domain in a CSR creation.
To create the config file, please follow below command (this example is for mydomain.com)
$ cat >> www-portal.mydomain.conf <<EOF
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
prompt = no
[req_distinguished_name]
C = MY
ST = Selangor
L = Cyberjaya
O = MyCompany
OU = Software Development Division
CN = www.mydomain.com
[v3_req]
keyUsage = keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1 = portal.mydomain.com
EOF
Run openssl CSR creation command against the config file
$ openssl req -new -newkey rsa:2048 -nodes -keyout www-portal.mydomain.key -out www-portal.mydomain.csr -config www-portal.mydomain.conf
Once generated, we can send the CSR to the Certificate Authority (usually SSL provider), to get our cert. This one CSR is usable for 2 domains, which are www.mydomain.com and portal.mydomain.com.
To generate a certificate signing request (CSR), you need to have openssl package installed. Please refer here for the instruction on how to install it.
Once you have openssl installed, please use below command to create a CSR with key for mydomain.com.
$ openssl req -new -newkey rsa:2048 -nodes -keyout mydomain.com.key -out mydomain.com.csr
Press Enter and you will need to provide a few information regarding the CSR. The information are as follows:
The openssl program is a command line tool for using the various cryptography functions of OpenSSL's crypto library from the shell.
To install openssl in ubuntu or debian:
$ sudo apt install openssl -y
To install openssl in RHEL, CentOS or Fedora:
$ sudo yum install openssl -y
First, we need to know the username. This can easily be done using w command
# w
12:34:31 up 36 days, 14:14, 2 users, load average: 0.07, 0.02, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
ironman pts/0 ::1 12:34 2.00s 0.01s 0.01s w
root pts/3 10.29.25.230 12:22 7.00s 0.13s 0.00s bash
Let's say we want to log out ironman from our server. What we have to do is to use a command called pkill against that user.
# pkill -u ironman
12:34:31 up 36 days, 14:14, 2 users, load average: 0.07, 0.02, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/3 10.29.25.230 12:22 7.00s 0.13s 0.00s bash
The ironman user is no longer logged in. Easy peasy.