Friday, February 22, 2019

Creating Self-Signed Certificates for the Apache Web Server

Use the OpenSSL package.  Issue the following commands in the Linux terminal:

# openssl req -new > ca.csr

# openssl rsa -in privkey.pem -out ca.key

# openssl x509 -in ca.csr -out ca.crt -req -signkey ca.key -days 720

These commands creates the SSL certificates good for 720 days with the files ca.csr, ca.crt, and ca.key.  Copy these files to the SSL directory of your Apache web server.  In my Linux system, this is located in /etc/apache2/ssl

# cp ca.* /etc/apache2/ssl

Then, restart the Apache webserver for the new certificates to take effect.

# service apache2 restart

Thursday, February 21, 2019

Mounting Remote SSH Filesystem

This is how to mount remote SSH (Secure Sockets Host) filesystem on your local directory (e.g., /home/clemrasul/remoteserv) on Linux.  Mounting remote directories in this way allows you to do server side programming with ease since source code can be edited using your favorite GUI text editor.  The text editor need not have the feature of being able to log on to an SSH server.  Here are the steps:

Step 1:  Install the sshfs software

On Ubuntu, this is done using the command apt-get.

# apt-get install sshfs


Step 2:  Place it in the Linux module and give permissions

# modprobe fuse
# adduser clemrasul fuse
# chown root:fuse /dev/fuse
# chmod +x /dev/fuse

This assumes a username of "clemrasul" that is added to the "fuse" group.


Step 3:  Create the directory where the remove SSH filesystem will be mounted

# cd /home/clemrasul
# mkdir ~/remoteserv

This assumes a remove directory name of "remoteserv".


Step 4:  Mount the remote SSH directory as follows:

# sshfs {fully qualified SSH username}:{default directory}  {local directory mount point}

Example:

# sshfs clemrasul@taocoven.com:/home/clemrasul/html ~/remoteserv

You will be prompted by the remote SSH server for password.  Once authenticated, the remote directory can be seen in the local directory as:

# cd /home/clemrasul/remoteserv/