#!/bin/env bash # version 0.0.1 # Note: This does not work with sh - must use bash or compatible # This is a quick setup script for the ARA wireless platform's containers. # It can be edited to taste. # Michael Ferolito. 2024 04 15 # This script is designed to set up an ARA wireless container to allow ssh # through the jumpbox by default, and will also install and configure the # packages required for using the GNU Radio platform # All of this should be eventually rolled into a docker image that we can # just pull on the servers. # WARNING: password here is insecure - it will be exposed through this script pass="12345678" if [ "$EUID" -ne 0 ] then echo "This script needs to be run as root" exit 1 fi echo "Installing packages..." yes | apt update # Vim - editor I use # fish - alternative shell # nano - editor some people like # ed - emergency editor # openssh-server - required to allow SSH connections through jumpbox # sudo - in case add users # curl - useful tool # wget - ensure this is on there # htop - system monitor # usbutils - allow you to see if USRP is connected yes | apt install vim fish nano ed openssh-server sudo curl wget htop usbutils echo "Done!" echo "Configuring sshd to allow root login..." echo "PermitRootLogin yes" >> /etc/ssh/sshd_config echo "Done!" echo "Changing root password to allow login..." chpasswd <<< "root:$pass" echo "Done! Changed to $pass" # APR 23 # Removed extraneous restart of ssh daemon echo "If you want to change your shell, run chsh, then log back out and in again" # 2024 04 12-15 # Added to fix initialization problems - Ubuntu ships with an older release echo "Installing gnu radio packages..." yes | apt install python3-pip echo "Making sure gnuradio is not installed - the version in the jammy repos is broken" echo "Will add upstream's PPA and go from there" # Remove if not installed. Expected result: Failure, hidden by ||true yes | apt remove gnuradio || true # Add ppa repository and autoconfirm echo -e "\n" | add-apt-repository ppa:gnuradio/gnuradio-releases apt update yes | apt install gnuradio # Run it once # It won't work since there's no GUI on the server, but doing this is required to # to initalize some of the files needed by compiled gnuradio python scripts # Added to fix this: https://lists.gnu.org/archive/html/discuss-gnuradio/2013-10/msg00471.html # gnuradio-companion 2> /dev/null || true # Oddly enough, redirecting the streams causes this to not run. # I removed those in the commands below. This causes it to display errors, # but they are entirely expected. # APR 22nd echo "The following lines should display errors. Something to the extent of" echo "Could not open display/X server init failed/etc" echo "This is entirely expected. There's no GUI at this point." gnuradio-companion echo "Done!" echo "Fetching test script..." wget "https://pages.cs.wisc.edu/~ferolito/ara/test.txt" mv test.txt /tmp/test.py echo -e "\n" | python3 /tmp/test.py echo "If there were no errors in the previous command, gnu radio has been set up" echo "Installing x..." # Packages needed # xorg - base x11 package - not installed by default since it's Ubuntu server # xauth - x11 authentication # x11-apps - test apps. Use xeyes or xclock to test it yes | apt install xorg xauth x11-apps # Add configuration options to ssh config to allow for X11 forwarding over SSH # AllowTCPForwarding - needs to be set to yes # X11Forwarding - was default no # X11UseLocalhost - this is needed on newer version of openssh-server, such as that # shipped by default in Ubuntu 22.04 (which this script targets) echo -e "AllowTcpForwarding yes\nX11Forwarding yes\nX11UseLocalhost no\n\n" >> /etc/ssh/sshd_config echo "Restarting sshd..." service ssh restart echo "Done!" # X option - x11 forward # C option - compress echo "Finished installation script. If you want to use the graphical interface, run the following command on your local machine:" echo "ssh -XC root@ -J username@jbox.arawireless.org" echo "For instance, this is the command the I (Michael) would use in one particular instance:" echo "ssh -XC root@10.189.10.191 -J mferolito@jbox.arawireless.org" # APR 23 echo "Note: if you have an older version of ssh, you cannot use the jump option. Instead, you will need to make a tunnel:" echo "ssh -L "59090:10.189.10.191:22" mferolito@jbox.arawireless.org" echo "Then, you can open up another terminal and do" echo "ssh -XC root@localhost -p 59090" exit