https://github.com/joyrex2001/capport-detection
This is a proof of concept implementation of a capport api based on the draft specification 'draft-donnelly-capport-detection'.
https://github.com/joyrex2001/capport-detection
Last synced: over 1 year ago
JSON representation
This is a proof of concept implementation of a capport api based on the draft specification 'draft-donnelly-capport-detection'.
- Host: GitHub
- URL: https://github.com/joyrex2001/capport-detection
- Owner: joyrex2001
- Created: 2017-03-25T09:56:41.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-25T10:26:56.000Z (about 9 years ago)
- Last Synced: 2025-01-23T00:28:51.870Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 12.7 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CAPPORT API proof of concept
This is a proof of concept implementation of a capport api based on the draft
specification [draft-donnelly-capport-detection](https://datatracker.ietf.org/doc/draft-donnelly-capport-detection/). Note that this is not an
exact implementation of this draft, but actually implements the [comments](https://www.ietf.org/mail-archive/web/captive-portals/current/msg00312.html)
that were given on this draft.
# Running the capport
The capport api is written in Python, and uses MySQL/mariadb for the storage of the
sessions. The accompanied docker-compose file will set-up a complete
environment, however the capport-api can also run without it.
## Run with docker-compose
To start with docker-compose: ```docker-compose up --force-recreate```.
## Run without docker compose
This proof of concept can also run without docker, but requires some manual installation
of the dependencies.
On centos7, install the following:
```bash
yum -y install epel-release gcc gcc-c++ python-devel mariadb-devel mariadb-server
yum -y install python-pip
pip install -r capport-api/requirements.txt
```
Create the database, and add a default user:
```bash
sudo systemctl start mariadb
sudo mysql
MariaDB [(none)]> CREATE DATABASE capport CHARACTER SET utf8 COLLATE
utf8_unicode_ci;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON capport.* TO 'capport'@'%' IDENTIFIED
BY 'capport';
```
Finally, to start the service:
```cd capport-api; python app.py```.
# Accessing the api
The following curl commands will be helpful;
```
curl -H'Accept: application/json' http://localhost:5000/capport
```
```
curl -H'Accept: application/json' http://localhost:5000/capport/sessions -d '{"identity": "1234567890"}'
```
```
curl -H'Accept: application/json' http://localhost:5000/capport/sessions/9d09f746-10c7-11e7-a298-0242ac1b0003
```
```
curl -H'Accept: application/json' -X DELETE http://localhost:5000/capport/sessions/9d09f746-10c7-11e7-a298-0242ac1b0003
```
# References
* https://www.ietf.org/mail-archive/web/captive-portals/current/msg00312.html
* https://datatracker.ietf.org/doc/draft-larose-capport-architecture/
* https://datatracker.ietf.org/doc/draft-donnelly-capport-detection/