Giter VIP home page Giter VIP logo

escape-2's Introduction

Escape

Please take note of the known issues

Install

Warning: The installation proccess will overwrite many system config files. Only run it on a pi dedicated for hosting the Escape service!

1) Install Raspbian on SD Card

  1. Download Raspbian Jessie Lite (311 MB)
  2. bsdtar -xf 2017-07-05-raspbian-jessie.zip
  3. dd bs=4M if=2017-07-05-raspbian-jessie.img of=/dev/sdX conv=fsync
  4. Mount the SD card. Create empty file named ssh in boot partition /dev/sdX (vfat)

2) Login and Update OS

  1. Login using SSH with the user pi and password raspberry
  2. Provide internet access to the pi
  3. It is recommended to update the system using sudo apt-get update && sudo apt-get upgrade
  4. Install git and clone the repo

3) Install Escape-2

  • Run install.sh. This will perform the following operations:
    • Install LAMP
    • Configure apache2 to serve on port 80
    • Configure mysql with username root and password password
    • Install the systemd service escape which will run on startup
    • Create directories required for log files in /var/log/escape
    • Install the config.ini file to /usr/opt/escape
    • Enable the camera interface on the pi
    • Bridge eth0 and wlan0 (Some module devices refuse to use WiFi if they cannot access internet)

4) Clone

  • You can now clone the SD card image to speed up setting up multiple devices

Usage

General

  • On boot a hotspot will be created with the SSID defined in configs/hostapd.conf
  • Once connected to the hotspot the server can be accessed at 172.24.1.1
  • Use the 172.24.1.1/admin.html page to manage presenters.
    • Can also tweet the winner and the lucky draw from the admin page

Twitter

  • Create a Twitter app at https://apps.twitter.com/
    • Tweets will be posted using the identity of the account the app was made under
  • Twitter credentials are to be stored in config.ini
  • After updating this file, run refresh.sh to copy the config to where the server can read it

Managing the service

The escape service will start on boot, it can also be manually controlled

  • Start:
    • sudo systemctl start escape
  • Stop:
    • sudo systemctl start escape

Scripts generated on install

  • control/start.sh and control/stop.sh created on install and used by the systemd service
  • /control/<start|stop>.sh are defined in install-scripts/install-service.sh

Updates

It may be required to update the software, in this case install.sh should be run to install all files and packages,

refresh.sh will only copy the new web files and reinstall the systemd service

Logs

  • /var/log/escape/php.log - output from the Apache server
  • /var/log/escape/service.log - Output from the systemd service and related processes

Known issues

Frontend

High

  • Delete from admin page does not work

Backend

High

  • Vulnerable to SQL injection
  • No auth protection for admin pages.
  • Images are currently disabled (Caused problems on slow internet on day of demo)

Low

  • Database credentials are scattered across php files: Not all php files use db.php
  • Logging not enabled for all php files
  • BackgroundWorker can be spawned multiple times causing problems with Twitter
  • No error handling for most pages
  • Images are currently saved to a hard coded path (/home/pi/desktop/image.png)

Setup

Low

  • Having to run refresh.sh to update the config can easily be forgotten

Service

Low

  • Scripts and configs generated on installation makes debug challenging. However this was done to make set the directory and script paths on installation. A static path is required by systemd. The ideal would be to copy the config files to /etc/escape/ and scripts to /opt/escape/ and store logs in /var/log/
    • constrol/start.sh|stop.sh
    • control/accesspoint/accesspoint.sh
    • escape.service
  • /var/log/escape/service.log is not real-time due to buffering

escape-2's People

Contributors

egeldenhuys avatar brandon-pickup avatar gerritburgerdev avatar duncanv avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

mikegeyser

escape-2's Issues

Known Issues

Frontend

High

  • Delete from admin page does not work
  • No auth protection for admin pages.

Backend

High

  • Vulnerable to SQL injection
  • No auth protection for admin pages.

Low

  • Database credentials are scattered across php files. Not all php files use db.php
  • Logging not enabled for all php files
  • BackgroundWorker can be spawned multiple times.
  • No error handling for most pages
  • Images are currently saved to a hard coded path
  • Images are currently disabled (Caused problems on slow internet on day of demo)

Setup

Low

  • Having to run refresh.sh to update the config is not desirable

Service

Low

  • Scripts and configs generated on installation makes debug challenging. However this was done to make set the directory and script paths on installation. A static path is required by systemd. The ideal would be to copy the config files to /etc/escape/ and scripts to /opt/escape/ and store logs in /var/log/
    • constrol/start.sh|stop.sh
    • control/accesspoint/accesspoint.sh
    • escape.service
  • /var/log/escape/service.log is not real-time due to buffering

Photo buffer

Keep enought photos so that every comment can have a photo.
1 per minute minimum.

Test deploy on fresh Raspbian image

  • Install Raspbian
  • Create system backup
  • Install Escape-2

Steps

Install Raspbian on SD Card

  1. Download Raspbian Jessie Lite (311 MB)
  2. bsdtar -xf 2017-07-05-raspbian-jessie.zip
  3. dd bs=4M if=2017-07-05-raspbian-jessie.img of=/dev/sdX conv=fsync
  4. Mount the SD card. Create empty file named ssh in boot partition /dev/sdX (vfat)

Prepare OS

  1. Login using SSH with the user pi and password raspberry
  2. Provide internet access to the pi
  3. It is recommended to update the system using sudo apt-get update && sudo apt-get upgrade
  4. Install git and clone the repo

Install Escape-2

  • install.sh

Notes

  • control/start.sh and control/stop.sh created on install. Used by the systemd service
  • Configure SSID in configs/hostapd.conf
  • /control/start.sh|stop.sh are defined in install-scripts/install-service.sh
  • Service output is logged to /var/log/escape/service.log
  • Warning: Destroys config files. Only run on pi!
  • The server has the following IP: 172.24.1.1
  • Bridging between eth0 and wlan0 enabled. Some mobile devices will automatically resort to mobile data if they cannot access internet.

Twitter loop

  • Take photos periodically (Keep a set of 30 photos in memory)?
  • Post comment with photo from database
  • How to store photo paths?
  • Only take photos during active sessions
  • If no photo available, take one?

systemd service for AP

Start

  • If our AP configs are not in place, swap them with the origi
  • Runn commands

Stop

  • Opposite of start

install.sh script

  • Run as root
  • Copies web server files
  • Configures initial database
  • Registers systemd services
  • Copies configs
  • Sets permissions

Custom TLD

  • Visit escape.bbd or escape-vote.bbd.com

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.