Rasppi-SHcmd

From openmichigan

Jump to: navigation, search

If the "Techie" availability does not include the required expertise to "ssh" into the RPi, it is possible to use the web browser as a "Terminal" window by:

  • Installing shcmd
  • securing the Apache web server with TLS/SSL 


[edit] HOWTO install "shcmd" on the RPi:

You will need to "ssh" to the RPi (ssh pi@192.168.42.1) to perform the install

cd /home/pi

mkdir local-www

wget [https://open.umich.edu/wiki/images/c/c6/Shcmd-1.0.zip https://open.umich.edu/wiki/images/c/c6/Shcmd-1.0.zip]

unzip Shcmd-1.0.zip

cp shcmd-1.0/shcmd.php local-www

chmod +x local-www/shcmd.php

[edit] Here's the commands to install & configure SSL for the RPi Apache server:

sudo a2enmod ssl - enable ssl module in apache
sudo mkdir /etc/apache2/ssl - create place to store certs
cd /etc/apache2/ssl
sudo openssl req -x509 -nodes -days 365000 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

Here is an example how to respond to the prompts generated by the openssl command issued above:

Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:Michigan
Locality Name (eg, city) []:Ann Arbor
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Open Michigan
Organizational Unit Name (eg, section) []:University of Michigan Medical School
Common Name (e.g. server FQDN or YOUR name) []:www.ummspi.net
Email Address []:open.michigan@umich.edu

Append the following parameters to the RPi Apache configuration file found at /etc/apache2/sites-enabled/000-default:

<VirtualHost *:443>
ServerName www.ummspi.net:443
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

Alias "/4kdJIXn8E7/shcmd.php" "/home/pi/local-www/shcmd.php"
<Directory "/home/pi/local-www">
Options -Indexes -FollowSymLinks -MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

Reboot the RPi.  Either of these URL's will connect you to the shcmd on the RPi:
     [Https://www.ummspi.net/4kdJIXn8E7/shcmd.php https://www.ummspi.net/4kdJIXn8E7/shcmd.php]
     https://192.168.42.1/4kdJIXn8E7/shcmd.php

Personal tools