BasicInternet talk:Voucher Platform

From its-wiki.no

Jump to: navigation, search

Talk Page Voucher Platform

Discussions Dec 2019

  • Voucher creation

[igaritano]

I have created two bash scripts [(1) radcheck.sh and (2) radreply.sh] in order to create two sql scripts [(1) radcheck.sql and (2) radreply.sh]. Each bash script, creates a single sql script.


Whenever we create new vouchers, depending on the configuration parameters, we will need to populate either one or two database tables. These two tables are called (1) radcheck and (2) radreply.

(1) radcheck table will be always populated with new voucher information. (2) radreply will depend on the configuration parameters.


There are six (these are which up to now we have used) variables each voucher could (not all of them are necessary) have:

1.- username* [necessary] {BOTH radcheck and radreply}

2.- User-Password* (The password) [necessary] {ONLY radcheck}

3.- Mikrotik-Total-Limit (Data transfer limit in BYTES) [optional] {BOTH radcheck and radreply}

4.- Max-Secs-Passed (Maximum time per session in SECONDS) [optional] {ONLY radcheck}

5.- Max-All-Session (Maximum time per voucher in SECONDS) [optional] {ONLY radcheck}

6.- Mikrotik-Rate-Limit (Data transfer rate limit) [optional] {ONLY radreply}. Syntax is "uploadRate/downloadRate". For example 512k/1M


Each bash script takes as input a text file, where each voucher name (or username) is written in a single line. For example 1hour.csv :

OLFV

OTPU

OYKA

OPDM


Furthermore, we need to specify the optional variables. If any of them is equal to zero (0), then it will be ignored. For exapmle for radcheck script and 1hour vouchers  :

Mikrotik_Total_Limit=0

Max_Secs_Passed=0

Max_All_Session=3600


PLEASE, edit each script in order to adjust the variable values.


Each bash script takes this information as input and generates a sql script as output, which we will need to run on the radius server.

username@appserver:~/voucher_scripts$ ./radcheck.sh

username@appserver:~/voucher_scripts$ ./radreply.sh


PLEASE, verify that the sintax of the sql script looks ok.


In order to run the sql script on the server, use the following sentence:

username@appserver:~/voucher_scripts$ mysql -u root -p radius < radcheck_1hour.sql

or

username@appserver:~/voucher_scripts$ mysql -u root -p radius < radreply_1hour.sql


The first one should populate the radcheck table while the second one should populate the radreply table with the new 1 hour valid vouchers.


  • Voucher enabling to specific Radius server

Open issues

  • Architectural drawing
  • max number of vouchers
  • username/password when only using one string, e.g. GravidPlus "g1304"