Setting up RPi for kiosk mode for PMC
=====
## Download Raspbian Lite no desktop
https://downloads.raspberrypi.org/raspbian_lite_latest
flash it to an SD card and boot RPi with it
## change password
passwd
sudo raspi-config
- Localisation Options: Select your preferred locale (we simply keep the default en_GB.UTF-8), timezone, and keyboard layout.
- Change User Password: This is important – keeping the default password means your Pi will get owned faster than you can say “botnet” as soon as you connect it to the internet. (Make sure to have selected the correct keyboard layout before typing in the new password, though.)
- Network Options: Configure WiFi as needed. Alternatively, you also configure WiFi manually using wpa_passphrase if you don’t want your WiFi password stored on the Pi in clear text.
- Boot Options: Select “Desktop / CLI” and then “Console Autologin”. We’ll come back to this later.
- Interfacing Options: Enable SSH access if needed.
- Advanced Options: Disable “Overscan” if the Pi’s output does not fill your screen completely.
apt update
apt upgrade
sudo apt-get install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox
sudo apt-get install --no-install-recommends chromium-browser
sudo chown pi:pi /etc/teleport.yaml
vim /etc/xdg/openbox/autostart
```
# Disable any form of screen saver / screen blanking / power management
xset s off
xset s noblank
xset -dpms
# Allow quitting the X server with CTRL-ATL-Backspace
setxkbmap -option terminate:ctrl_alt_bksp
# Setup teleport
script_mac_address=$(</home/pi/script_mac_address)
system_mac_address=$(</sys/class/net/eth0/address)
if [ "$script_mac_address" != "$system_mac_address" ]; then
#remove teleport
sudo service teleport stop &&
sudo rm -rf /var/lib/teleport
read -d '' teleportConfig <<"EOF"
# REPLACE <nodename> BY APPROPRIATE NAME
teleport:
nodename: <nodename>
data_dir: /var/lib/teleport
auth_servers:
- localhost:3025
connection_limits:
max_connections: 1000
max_users: 250
log:
output: stderr
severity: ERROR
storage:
type: bolt
auth_service:
enabled: yes
dynamic_config: false
authentication:
type: local
second_factor: otp
u2f:
app_id: https://localhost:3080
facets:
- https://localhost
- https://localhost:3080
listen_addr: 0.0.0.0:3025
cluster_name: "<nodename>"
trusted_clusters:
#- key_file: /etc/teleport/certs/pmc-cluster.ca
# allow_logins: root
# tunnel_addr: pmc-teleport.quarkstudios.net
ssh_service:
enabled: yes
listen_addr: 0.0.0.0:3022
labels:
role: master
type: postgres
commands:
- name: hostname
command: [/usr/bin/hostname]
period: 1m0s
- name: arch
command: [/usr/bin/uname, -p]
period: 1h0m0s
proxy_service:
enabled: yes
listen_addr: 0.0.0.0:3023
tunnel_listen_addr: 0.0.0.0:3024
web_listen_addr: 0.0.0.0:3080
EOF
sudo echo "$teleportConfig" > /etc/teleport.yaml
sudo sed -i "s/<nodename>/${system_mac_address}-`date +%N`/g" /etc/teleport.yaml
sudo service teleport start &&
sleep 60
sudo tctl create /etc/cluster.yml
echo $system_mac_address > /home/pi/script_mac_address
fi
# Start Chromium in kiosk mode
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' ~/.config/chromium/'Local State'
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' ~/.config/chromium/Default/Preferences
chromium-browser --disable-infobars --kiosk --incognito --window-size=800,480 --noerrdialogs --window-position=0,0 --start-maximized http://localhost:3000
```
### Install Teleport
http://raspberry-projects.com/pi/pi-operating-systems/raspbian/custom-boot-up-screen
https://www.raspberrypi.org/forums/viewtopic.php?t=171843
sudo apt-get install xserver-xorg-legacy

https://scribles.net/customizing-boot-up-screen-on-raspberry-pi/
https://yingtongli.me/blog/2016/12/21/splash.html
https://raspberrypi.stackexchange.com/questions/59310/remove-boot-messages-all-text-in-jessie