Archived
35
0
Fork 0
Mainly on GitHub! TOOD: Add Github CI which pushes to Foregejo (or migrate issues over here and close GH repo) https://github.com/voc/relay_register
This repository has been archived on 2026-01-27. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • Ruby 79%
  • Haml 21%
Find a file
2021-04-04 00:45:41 +02:00
db removed unused functionality 2017-12-23 17:21:22 +01:00
examples readme: added screenshot 2017-12-25 13:07:20 +01:00
lib use packed iv for crypto to fix newer ruby 2019-12-23 01:46:36 +01:00
models removed unused functionality 2017-12-23 17:21:22 +01:00
spec use packed iv for crypto to fix newer ruby 2019-12-23 01:46:36 +01:00
views sub_path: sub-path functionality without passenger_base_uri 2018-07-18 19:38:42 +02:00
.gitignore readme: added screenshot 2017-12-25 13:07:20 +01:00
.travis.yml travis: reduced builds to debian versions 2015-11-24 15:09:54 +01:00
config.ru Initial commit 2014-09-23 12:45:30 +02:00
Gemfile use packed iv for crypto to fix newer ruby 2019-12-23 01:46:36 +01:00
Gemfile.lock use packed iv for crypto to fix newer ruby 2019-12-23 01:46:36 +01:00
Guardfile Initial commit 2014-09-23 12:45:30 +02:00
Rakefile added active record integration 2014-09-23 13:15:24 +02:00
README.md readme: added screenshot 2017-12-25 13:07:20 +01:00
settings.yml.example sub_path: sub-path functionality without passenger_base_uri 2018-07-18 19:38:42 +02:00
webapp.rb replace deprecated "update_attributes" with "update" 2021-04-04 00:45:41 +02:00

relay register

relay register screenshot

Usage

Register new relay

Sending data to /register to register a new relay can be done with curl

curl -k -H "CONTENT-TYPE: application/json" -d "{"iv":"1231234345354", "data":{…}}"

or use the ruby client in examples folder.

The API expects the following object resources in JSON format:

{
  "iv": "iv",
  "data": {
    "api_key": "api_key",
    "raw_data": {
      "hostname": "#{`hostname -f`}",
      "lspci": "#{`lspci`}",
      "ip_config": "#{`ip a`}",
      "disk_size": "#{`df -h`}",
      "memory": "`#{free -m`}",
      "cpu": "#{File.read('/proc/cpuinfo')}"
    }
  }
}

data needs to be AES-256-CBC encrypted and Base64 encoded.

Create archive

wget --http-user=winke --http-password=katze --mirror --page-requisites \
     --adjust-extension --convert-links https://c3voc.de/31c3/register

Install

  1. Clone repository.

  2. Install dependencies.

     bundle install
    
  3. Create settings.yml

      cp settings.yml.example settings.yml
    
      vim settings.yml
    
  4. Test installation and run application with puma.

     ruby webapp.rb
    

Deployment

It is highly recommended to deploy this application with passenger or comparable webservers.

License

Copyright (c) 2014-2015, c3voc
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.