Coder Social home page Coder Social logo

access-manager's Introduction

Access Manager - Subscriber Manager for ISPs

Access Manager is a centralised radius based subscriber management system for WiFI Hotspot operators and Small/Medium ISPs. It supports Mikrotik as a NAC. It includes most of the features related to subscriber management. Including subscriber account, free/paid subscriptions, prepaid voucher generation and limiting subscription services based on data/time limit among others.

Supported NAC/Router Vendors:

  • Mikrotik

Installation

Access Manager is written in PHP (Laravel Framework) and uses MySQL for database storage. Thus requires one time setup process to be followed. And this is going to be a lengthy one. And with that in mind, lets get started.

Prerequisite

  • Basic Knowledge of Linux Operating System

Though Access Manager can be installed on any linux flavor, however in this example we'll be using Ubuntu Server 16.04 LTS. And I assume you have configured network interface with IP address of 192.168.1.10/24.

This is considered good practice to update your system packages time to time, so run following command to check & install available updates.

$ sudo apt update
$ sudo apt upgrade 

Next install the required packages:

$ sudo apt install apache2 libapache2-mod-php php7.0 php-zip php7.0-mbstring php7.0-bcmath php7.0-mysql mysql-server freeradius freeradius-mysql freeradius-utils

NOTE: During the installation you'll be asked to set root password for MySQL server, choose a strong password and make a note of it, you'll need it later.

Access Manager manages its dependencies & updates using composer. So, before we can download Access Manager, we need to download composer by following instructions from official composer website: https://getcomposer.org/download/

After downloading composer you'll end up with composer.phar in current directory. After that, issue following commands:

$ chmod +x composer.phar
$ sudo mv composer.phar /usr/bin/composer

The above mentioned commands will add executable bit to the composer file and move it to /usr/bin to make it globally accessible.

After having composer in place, we're ready to download Access Manager. In this example we'll download the project in current user's home directory. In case you're already not in the home directory type cd to change to home directory and pwd will output the path to current working directory, if you want to verify.

Now, to download Access Manager project issue following command:

$ composer create-project access-manager/access-manager -s beta

Above mentioned command will download Access Manager 3.0-BETA & its dependencies. We'll also need to create a database we want to use for Access Manager. Use following commands to create a new databased called acmanager, you can choose whatever you want to name it:

when prompted enter the password for MySQL root user, you set during MySQL installation.

$ mysql -u root -p
mysql> create database acmanager;

Press ctrl+d to get out of MySQL prompt.

Still being in the home directory issue following commands to get into project directory & make the storage directory writeable:

$ cd access-manager
$ chmod 777 -R storage

Since this is a fresh install, run following command for configuration setup.

This command will ask for a few inputs including MySQL username/password. For testing you can provide root username & password, but it is strongly recommended to create a new user with less privileges for production server.

$ php artisan setup:fresh

Access Manager setup is complete but we need to configure apache web server to serve our project. If you want to host other projects/websites on this server multiple virtual servers can be created. But for this example I'll edit the default virtual server. Use following command to open virtualserver config file using vim text editor:

$ sudo vim /etc/apache2/sites-enabled/000-default.conf

In this file we need to make two modifications:

  1. change document root to /home/{Your_User_Name}/access-manager/html
  2. add following code block somewhere within .... block.
<Directory /home/am/access-manager/html>
    Options Indexes FollowSymLinks
    AllowOverride all
    Require all granted
</Directory>

Next step is to enable rewrite mode for apache.

$ sudo a2enmod rewrite

Now, for the changes to take effect, restart apache server with following command:

$ sudo service apache2 restart 

At this point, you should be able to access the project by pointing your browser to IP address of the server, which in this case is 192.168.1.10. Login using admin credentials & create new accouts, subscriptions, routers and all other features of Access Manager. But one more thing left to be configured is freeradius. Installing & configuring Freeradius is same as earlier versions of Access Manager ie. 2.*.

MIND YOUR CREDENTIALS WHEN FOLLOWING OLDER EXAMPLES

To install & configure Freeradius server, refer to: http://accessmanager.in/userguide/install_and_configure_freeradius .

And to integrate Access Manager & Freeradius to complete the setup, follow:

http://accessmanager.in/userguide/integrate_access_manager_with_freeradius

Use following code for exec modules:

exec am-authorize { 
input_pairs = request 
shell_escape = yes 
wait = yes 
output_pairs = reply 
program = "/usr/bin/php /home/am/access-manager/artisan am:authorize %u" 
} 

exec am-accounting { 
input_pairs = request 
shell_escape = yes 
wait = yes
output = none 
program = "/usr/bin/php /home/am/access-manager/artisan am:account %Z" 
}

Hope you enjoy the project. :)

access-manager's People

Contributors

rahulmkhj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

access-manager's Issues

Installation error while doing installation

Hello,

Please look out the follow errror while executing installation process.

Writing lock file
Generating autoload files
PHP Fatal error: Cannot redeclare makeExpiry() (previously declared in /var/www/html/access-manager/laravel/vendor/access-manager/am-h
elpers/src/Helpers.php:23) in /var/www/html/access-manager/laravel/app/helpers.php on line 28
Script php laravel/artisan clear-compiled handling the post-install-cmd event returned with an error

[RuntimeException]
Error Output: PHP Fatal error: Cannot redeclare makeExpiry() (previously declared in /var/www/html/access-manager/laravel/vendor/
access-manager/am-helpers/src/Helpers.php:23) in /var/www/html/access-manager/laravel/app/helpers.php on line 28

create-project [-s|--stability="..."] [--prefer-source] [--prefer-dist] [--repository-url="..."] [--dev] [--no-dev] [--no-plugins] [--n
o-custom-installers] [--no-scripts] [--no-progress] [--keep-vcs] [--no-install] [--ignore-platform-reqs] [package] [directory] [version
]

Error page doesnt display

The following error occurs instead of the 404 page;

Error in exception handler: Undefined variable: admin_theme (View: /var/www/access-manager/laravel/app/views/admin/header_footer.blade.php) (View: /var/www/access-manager/laravel/app/views/admin/header_footer.blade.php) in /var/www/access-manager/laravel/app/storage/views/c669423243e61c4bef26442adca95b40:40

Class translator does not exist

in Container.php line 752

at ReflectionClass->__construct('translator')in Container.php line 752
at Container->build('translator')in Container.php line 631
at Container->resolve('translator', array())in Container.php line 586
at Container->make('translator', array())in Application.php line 732
at Application->make('translator')in Container.php line 1195
at Container->offsetGet('translator')in ServiceProvider.php line 27
at ServiceProvider->updateLocale()in ServiceProvider.php line 21
at ServiceProvider->boot()
at call_user_func_array(array(object(ServiceProvider), 'boot'), array())in BoundMethod.php line 29
at BoundMethod::Illuminate\Container{closure}()in BoundMethod.php line 87
at BoundMethod::callBoundMethod(object(Application), array(object(ServiceProvider), 'boot'), object(Closure))in BoundMethod.php line 31
at BoundMethod::call(object(Application), array(object(ServiceProvider), 'boot'), array(), null)in Container.php line 549
at Container->call(array(object(ServiceProvider), 'boot'))in Application.php line 792
at Application->bootProvider(object(ServiceProvider))in Application.php line 775
at Application->Illuminate\Foundation{closure}(object(ServiceProvider), 3)
at array_walk(array(object(EventServiceProvider), object(LogServiceProvider), object(RoutingServiceProvider), object(ServiceProvider), object(BaseServiceProvider)), object(Closure))in Application.php line 776
at Application->boot()in BootProviders.php line 17
at BootProviders->bootstrap(object(Application))in Application.php line 213
at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders'))in Kernel.php line 162
at Kernel->bootstrap()in Kernel.php line 146
at Kernel->sendRequestThroughRouter(object(Request))in Kernel.php line 116
at Kernel->handle(object(Request))in index.php line 53

if i run
$php artisan config:clear

i get this error

In Container.php line 752:
Class translator does not exist

Unable to delete vouchers

When selecting a voucher and clicking the "Destroy" button I am directed to a page that says:

"Reached destroy function"

And nothing else.

Can't print vouchers

The following error occurs when trying to print voucher from admin dashboard;

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'v.plan_id' in 'on clause' (SQL: select v.pin, v.expires_on, sp.name as plan_name, sp.plan_type, sp.validity, sp.validity_unit, sp.sim_sessions, sp.interim_updates, sp.price from prepaid_vouchers as v inner join service_plans as sp on v.plan_id = sp.id where v.id in (6))

Users can't login

This is from freeradius debug, looks like AM is not righting anything to the freeradius tables

rad_recv: Access-Request packet from host 10.22.0.1 port 34766, id=206, length=194
NAS-Port-Type = Ethernet
Calling-Station-Id = "68-76-4F-FC-41-08"
Called-Station-Id = "hs-ether2"
NAS-Port-Id = "ether2"
User-Name = "demo"
NAS-Port = 2148532963
Acct-Session-Id = "801002e3"
Framed-IP-Address = 10.30.0.251
Mikrotik-Host-IP = 10.21.6.6
CHAP-Challenge = 0x673769f0dbcb065fde7e485369d0e461
CHAP-Password = 0xce5d96b0cce6780b9d598d97be89562e36
Service-Type = Login-User
WISPr-Logoff-URL = "http://10.30.0.1/logout"
NAS-Identifier = "jwifi.tk"
NAS-IP-Address = 10.22.0.1

Executing section authorize from file /etc/freeradius/sites-enabled/default

+- entering group authorize {...}
++[preprocess] returns ok
[chap] Setting 'Auth-Type := CHAP'
++[chap] returns ok
++[mschap] returns noop
++[digest] returns noop
[suffix] No '@' in User-Name = "demo", looking up realm NULL
[suffix] No such realm "NULL"
++[suffix] returns noop
[eap] No EAP-Message, not doing EAP
++[eap] returns noop
[sql] expand: %{User-Name} -> demo
[sql] sql_set_user escaped user --> 'demo'
rlm_sql (sql): Reserving sql socket id: 1
[sql] expand: SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{SQL-User-Name}' ORDER BY id -> SELECT id, username, attribute, value, op FROM radcheck WHERE username = 'demo' ORDER BY id
[sql] expand: SELECT groupname FROM radusergroup WHERE username = '%{SQL-User-Name}' ORDER BY priority -> SELECT groupname FROM radusergroup WHERE username = 'demo' ORDER BY priority
rlm_sql (sql): Released sql socket id: 1
[sql] User demo not found
++[sql] returns notfound
++[expiration] returns noop
++[logintime] returns noop
[pap] WARNING! No "known good" password found for the user. Authentication may fail because of this.
++[pap] returns noop
Found Auth-Type = CHAP

Executing group from file /etc/freeradius/sites-enabled/default

+- entering group CHAP {...}
[chap] login attempt by "demo" with CHAP password
[chap] Cleartext-Password is required for authentication
++[chap] returns invalid
Failed to authenticate the user.
Using Post-Auth-Type Reject

Executing group from file /etc/freeradius/sites-enabled/default

+- entering group REJECT {...}
[attr_filter.access_reject] expand: %{User-Name} -> demo
attr_filter: Matched entry DEFAULT at line 11
++[attr_filter.access_reject] returns updated
Delaying reject of request 12 for 1 seconds
Going to the next request
Waking up in 0.9 seconds.
rad_recv: Access-Request packet from host 10.22.0.1 port 34766, id=206, length=194
Waiting to send Access-Reject to client jwifi.tk port 34766 - ID: 206
Waking up in 0.6 seconds.
rad_recv: Access-Request packet from host 10.22.0.1 port 34766, id=206, length=194
Waiting to send Access-Reject to client jwifi.tk port 34766 - ID: 206
Waking up in 0.3 seconds.
Sending delayed reject for request 12
Sending Access-Reject of id 206 to 10.22.0.1 port 34766
Waking up in 4.9 seconds.
Cleaning up request 12 ID 206 with timestamp +251
Ready to process requests.

Admin can't change password

Admin changing password prints on screen ( shows what you just filled on the form) but doesn't change password

Class translator does not exist

[2018-10-02 06:04:38] local.ERROR: Class translator does not exist {"exception":"[object] (ReflectionException(code: -1): Class translator does not exist at /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Container/Container.php:752) [stacktrace] #0 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Container/Container.php(752): ReflectionClass->__construct('translator') #1 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\\Container\\Container->build('translator') #2 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Container/Container.php(586): Illuminate\\Container\\Container->resolve('translator', Array) #3 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(732): Illuminate\\Container\\Container->make('translator', Array) #4 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Container/Container.php(1195): Illuminate\\Foundation\\Application->make('translator') #5 /home/test/access-manager/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php(27): Illuminate\\Container\\Container->offsetGet('translator') #6 /home/test/access-manager/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php(21): Carbon\\Laravel\\ServiceProvider->updateLocale() #7 [internal function]: Carbon\\Laravel\\ServiceProvider->boot() #8 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(29): call_user_func_array(Array, Array) #9 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}() #10 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(31): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(AccessManager\\Base\\Extended\\Application), Array, Object(Closure)) #11 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\\Container\\BoundMethod::call(Object(AccessManager\\Base\\Extended\\Application), Array, Array, NULL) #12 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(792): Illuminate\\Container\\Container->call(Array) #13 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\\Foundation\\Application->bootProvider(Object(Carbon\\Laravel\\ServiceProvider)) #14 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}(Object(Carbon\\Laravel\\ServiceProvider), 3) #15 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(776): array_walk(Array, Object(Closure)) #16 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\\Foundation\\Application->boot() #17 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(213): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap(Object(AccessManager\\Base\\Extended\\Application)) #18 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(296): Illuminate\\Foundation\\Application->bootstrapWith(Array) #19 /home/test/access-manager/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(119): Illuminate\\Foundation\\Console\\Kernel->bootstrap() #20 /home/test/access-manager/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #21 {main} "}

invalid variable expansion

from radius -X log
I am using freeradius3.0.17

/etc/freeradius/mods-enabled/exec[36]: Failed parsing expanded string:
/etc/freeradius/mods-enabled/exec[36]: ...access-manager/artisan am:authorize %u
/etc/freeradius/mods-enabled/exec[36]: ^ Invalid variable expansion

admin login

well you say At this point, you should be able to access the project by pointing your browser to IP address of the server, which in this case is 192.168.1.10. Login using adminin the credentials & create new accouts, subscriptions, routers and all other features of Access Manager. but not admin is create in the database and I cant login
any ideas

Unknown column 'acctupdatetime' in 'field list'

Hi, I'm just doing my first tests and getting the above MySQL error. I'm using Freeradius 3.03 from PPA seeing as the distro-supplied versions are all past EOL and don't even have security updates. Not good when you have UDP ports facing the internet!

I'm guessing this is is a Freeradius version issue.

Keep up the good work.

(4) sql : EXPAND INSERT INTO radacct (acctsessionid, acctuniqueid, username, realm, nasipaddress, nasportid, nasporttype, acctstarttime, acctupdatetime, acctstoptime, acctsessiontime, acctauthentic, connectinfo_start, connectinfo_stop, acctinputoctets, acctoutputoctets, calledstationid, callingstationid, acctterminatecause, servicetype, framedprotocol, framedipaddress) VALUES ('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}', '%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}', '%{NAS-Port-Type}', FROM_UNIXTIME(%{integer:Event-Timestamp} - %{%{Acct-Session-Time}:-0}), FROM_UNIXTIME(%{integer:Event-Timestamp}), FROM_UNIXTIME(%{integer:Event-Timestamp}), '%{Acct-Session-Time}', '%{Acct-Authentic}', '', '%{Connect-Info}', '%{%{Acct-Input-Gigawords}:-0}' << 32 | '%{%{Acct-Input-Octets}:-0}', '%{%{Acct-Output-Gigawords}:-0}' << 32 | '%{%{Acct-Output-Octets}:-0}', '%{Called-Station-Id}', '%{Calling-Station-Id}', '%{Acct-Terminate-Cause}', '%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}')
(4) sql : --> INSERT INTO radacct (acctsessionid, acctuniqueid, username, realm, nasipaddress, nasportid, nasporttype, acctstarttime, acctupdatetime, acctstoptime, acctsessiontime, acctauthentic, connectinfo_start, connectinfo_stop, acctinputoctets, acctoutputoctets, calledstationid, callingstationid, acctterminatecause, servicetype, framedprotocol, framedipaddress) VALUES ('00001234', 'db0917e996429c6f142a900f29cccf68', 'demo', '', '203.63.154.1', '1234', 'Async', FROM_UNIXTIME(1441966138 - 1000), FROM_UNIXTIME(1441966138), FROM_UNIXTIME(1441966138), '1000', '', '', '', '0' << 32 | '20000', '0' << 32 | '30000', '123456789', '987654321', '', 'Framed-User', '', '')

rlm_sql (sql): Executing query: 'INSERT INTO radacct (acctsessionid, acctuniqueid, username, realm, nasipaddress, nasportid, nasporttype, acctstarttime, acctupdatetime, acctstoptime, acctsessiontime, acctauthentic, connectinfo_start, connectinfo_stop, acctinputoctets, acctoutputoctets, calledstationid, callingstationid, acctterminatecause, servicetype, framedprotocol, framedipaddress) VALUES ('00001234', 'db0917e996429c6f142a900f29cccf68', 'demo', '', '203.63.154.1', '1234', 'Async', FROM_UNIXTIME(1441966138 - 1000), FROM_UNIXTIME(1441966138), FROM_UNIXTIME(1441966138), '1000', '', '', '', '0' << 32 | '20000', '0' << 32 | '30000', '123456789', '987654321', '', 'Framed-User', '', '')'
rlm_sql_mysql: MYSQL check_error: 1054 received
rlm_sql (sql): Unknown column 'acctupdatetime' in 'field list'

Some not work

Good day
In access manager not work paypal payment gateway,
no work self registrations for user,
Very need that IP address automatic add to user from IP pool

Access Manager Installation PHP Fatal Error

Hi,
Your app is awesome. I am interested and just as i followed installation guide i got this error after issuing the following command;
sudo composer create-project access-manager/access-manager

Generating autoload files
PHP Fatal error: Class 'Thujohn\Pdf\PdfServiceProvider' not found in /var/www/html/access-manager/laravel/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 157
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Class 'Thujohn\Pdf\PdfServiceProvider' not found","file":"/var/www/html/access-manager/laravel/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php","line":157}}Script php laravel/artisan clear-compiled handling the post-install-cmd event returned with an error

[RuntimeException]
Error Output: PHP Fatal error: Class 'Thujohn\Pdf\PdfServiceProvider' not
found in /var/www/html/access-manager/laravel/vendor/laravel/framework/src/
Illuminate/Foundation/ProviderRepository.php on line 157
kindly find attaced snapshot
Thank you!!
snapshot2

How to append data to database after migration

Hi, I downloaded this source using composer, migration and run in my localhost. Checking database, all tables was created but not any data (all tables are empty).

What should I do to run, bro?

Sorry for my bad English!

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.