Skip to content

Ranthalion/rfidLock

Repository files navigation

View this project on CADLAB.io.

rfidLock

RFID Lock system

###Lock Hardware The lock is Morning Industry RF-01SN.

###Lamp Server Primary Network IP: 10.200.200.11 up on eth0
Secure Network IP: 172.12.123.20 up on eth1
Software: Apache2, php7 w/all mods and oauth extension, mariaDB, phpMyAdmin
Services: SSHD

Diagram

Diagram

Database Diagram

Database Diagram

Installation

Configuration File

A configuration file is necessary for managing the connection to the mysql database which is used as the authoratative data source. This file is also needed for other configuration details such as the location of templates.

The options that can be configured in this file's database parameter match with mysql.connector's Python Connection Arguments

A simple example configuration file is shown here for reference.

{
  "database": {
    "username": "rfid_user",
    "password": "db_passwd",
    "host": "rfid_host",
    "database": "rfid_db"
  },
  "templates": "/usr/share/rfidlock/templates"
}

Member Server

To install the member server and web interface:

git clone https://github.com/Ranthalion/rfidLock.git
sudo pip install rfidLock/
# Edit or create the config.json file described above
vim /etc/rfidlock/config.json
# Creates the necessary database tables
rfid_db_install

# For Arch, this should enable wsgi
echo "LoadModule wsgi_module modules/mod_wsgi.so" >> /etc/httpd/conf/httpd.conf
# For Debian/Ubuntu, this should enable wsgi
a2enmod wsgi

# Mount the WSGI script, again, this is for Arch, will be different on other distros
echo "WSGIScriptAlias /rfid_db.wsgi $(which rfid_db.wsgi)" >> /etc/httpd/conf/httpd.conf

# Install and enable mod_wsgi
# Modify Apache server configuration

# TODO run a script that installs an apache server site to a path
# Varies by distribution

# ? WSGIScriptAlias /wsgi /path/to/script/rfid_members.wsgi
# TODO configure apache server to run mod_wsgi

To remove the member server after installation:

Raspberry Pi

Secure Network IP: 172.12.123.98

git clone https://github.com/Ranthalion/rfidLock.git
sudo pip install rfidLock/
# TODO, establish a daemon that handles the RFID lock and enable it on start-up

Web API

GET /api/verify

Verifies access to a resource by rfid

Consumes

This API call consumes the following media types via the Content-Type request header:
application/x-www-form-urlencoded

Query parameters

resource (required)
Query Parameter — The name of the resource being requested
encryptedrfid (optional)
Query Parameter — The encoded rfid value
rfid (optional)
Query Parameter — The raw, unencoded rfid value

Return type

Content-Type: application/json

{
  "verified" : false
}