Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS on the latest version #1

Open
dd1245 opened this issue Jan 25, 2022 · 17 comments
Open

NAS on the latest version #1

dd1245 opened this issue Jan 25, 2022 · 17 comments

Comments

@dd1245
Copy link

dd1245 commented Jan 25, 2022

Hi.

On the latest version of RADIUSdesk, I can create RADIUS clients, but do not seem to be able to create a NAS now, with its own key. Is this still possible, and if not, If I manually insert an entry into the SQL nas table, will this still work?

@antoniovalenzuela
Copy link

I can't add NAS Direct (fixed IP).

Add "+" only can add NAS Dynamic.

RD OVA VirtualBox.

@antoniovalenzuela
Copy link

@dirkvanderwalt Hi, you can help us?

@dirkvanderwalt
Copy link
Member

Hi,

I need to check if the code paw ported to CakePHPv3.
If so, its probably just commented out and we can add maybe a config file setting so it can be displayed.

Nudge me again if I have not replied in 24 hours :-)

@antoniovalenzuela
Copy link

Thanks.
I need direct NAS to setup POD/COA 3799, because currently I can't kill user connected to Coova.

@antoniovalenzuela
Copy link

Please add timezone "America/Chile" now GMT-4 and DST with GMT-3.

I don't undestand the values of the table "timezone".

I think it would be better to read the timezones of the O.S.

;)

@antoniovalenzuela
Copy link

Hi @dirkvanderwalt

could you check the code?

@antoniovalenzuela
Copy link

Please add timezone "America/Chile" now GMT-4 and DST with GMT-3.

I don't undestand the values of the table "timezone".

I think it would be better to read the timezones of the O.S.

;)

Solved, I added into DB. GMT-4.

@dd1245
Copy link
Author

dd1245 commented Apr 6, 2022

Hi,

I need to check if the code paw ported to CakePHPv3. If so, its probably just commented out and we can add maybe a config file setting so it can be displayed.

Nudge me again if I have not replied in 24 hours :-)

Any luck with allowing the static NAS definitions?

@antoniovalenzuela
Copy link

@dirkvanderwalt ?

@dirkvanderwalt
Copy link
Member

Hi everyone,

I checked the code and it is there

https://github.com/RADIUSdesk/rdcore/tree/main/rd/classic/src/view/nas
https://github.com/RADIUSdesk/rdcore/blob/main/cake3/rd_cake/src/Controller/NasController.php

So I should have a way to enable / include it checked in (into Github) by Monday.

@dd1245
Copy link
Author

dd1245 commented Apr 8, 2022

Hi everyone,

I checked the code and it is there

https://github.com/RADIUSdesk/rdcore/tree/main/rd/classic/src/view/nas https://github.com/RADIUSdesk/rdcore/blob/main/cake3/rd_cake/src/Controller/NasController.php

So I should have a way to enable / include it checked in (into Github) by Monday.

That's great. Thanks

@dirkvanderwalt
Copy link
Member

Actually you should be able to activate them even in the current code
Just remove the comments (for root user)
https://github.com/RADIUSdesk/rdcore/blob/main/cake3/rd_cake/src/Controller/DashboardController.php#L795

And then for the other normal Access Providers
https://github.com/RADIUSdesk/rdcore/blob/main/cake3/rd_cake/src/Controller/DashboardController.php#L1513

Let us know if this works for you

@dd1245
Copy link
Author

dd1245 commented Apr 9, 2022

Seems to work fine, thanks very much.

@antoniovalenzuela
Copy link

@dirkvanderwalt
Works, but some issues:

  • Can't delete added "NAS Devices"
  • Kick doesn't work for CoovaChilli COA port 3799 (data saved in optional info)

To kick or disconnect I added in public function "kickActive" file RadacctsController.php

shell_exec("echo User-Name='".$ent->username."' | radclient -c '1' -n '3' -r '3' -t '3' -x '127.0.0.1:3799' 'disconnect' 'testing123'");

@dedykurniadi
Copy link

@dirkvanderwalt Works, but some issues:

  • Can't delete added "NAS Devices"
  • Kick doesn't work for CoovaChilli COA port 3799 (data saved in optional info)

To kick or disconnect I added in public function "kickActive" file RadacctsController.php

shell_exec("echo User-Name='".$ent->username."' | radclient -c '1' -n '3' -r '3' -t '3' -x '127.0.0.1:3799' 'disconnect' 'testing123'");

Can you give me example? I've add line like this

shell_exec("echo User-Name='".$ent->username."' | radclient -c '1' -n '3' -r '3' -t '3' -x '".$ent->
nasipaddress.:3799"' 'disconnect' 'secret'");

but I still cant kick the user, I use .$ent->nasipaddress. to determine which NAS, because I have many Mikrotik NAS.

@dedykurniadi
Copy link

shell_exec("echo User-Name='".$ent->username."' | radclient -c '1' -n '3' -r '3' -t '3' -x '".$ent-> nasipaddress.:3799"' 'disconnect' 'secret'");

ther right is

shell_exec("echo User-Name='".$ent->username."' | radclient -c '1' -n '3' -r '3' -t '3' -x '".$ent->
nasipaddress.":3799' 'disconnect' 'secret'");

for now i can kick the client

@netcom-rs
Copy link

netcom-rs commented Nov 23, 2022

Hi.

Is there a way to dynamically pull secret from database for radclient? It is useful if we have different secrets for each client.

[EDIT]
if anyone is interested, the code for dynamic pull of secrets from database is(paste this function instead of default kickActive):

public function kickActive(){
        $this->loadModel('Nas');
        //__ Authentication + Authorization __
        $user = $this->_ap_right_check();
        if(!$user){
            return;
        }

        $some_session_closed    = false;
        $count                  = 0;
        $msg                    = 'Could not locate session';
        $data                   = ['title' => 'Session Not Found', 'message' => $msg, 'type' =>'warn'];
        $req_q                  = $this->request->getQuery();

        foreach(array_keys($req_q) as $key){
            if(preg_match('/^\d+/',$key)){
                $ent = $this->{$this->main_model}->find()->where(['Radaccts.radacctid' => $key])->first();

                $qr = $this->Nas->find()->where(['Nas.nasname' => $ent->nasipaddress])->first();

                $count++;
                if($ent->acctstoptime !== null){
                    $some_session_closed = true;
                }else{
                    shell_exec("echo User-Name='".$ent->username."', Framed-IP-Address='".$ent->framedipaddress."' | radclient -c '1' -n '3' -r '3' -t '3' -x '".$ent->nasipaddress.":3799' 'disconnect' '".$qr->secret."'");
                    $data = $this->Kicker->kick($ent); //Sent it to the Kicker
                }
            }
        }

        if($count >0){
            $data = ['title' => 'Disconnect Sent', 'message' => 'Disconnect Instructions Sent', 'type' =>'info'];
        }

        if(($some_session_closed)&&($count>0)){
            $msg = 'Sessions Is already Closed';
            if($count > 1){
                $msg = 'Some Sessions Are already Closed';
            }
            $data = ['title' => 'Session Closed Already', 'message' => $msg, 'type' =>'warn'];
        }

        $this->set([
            'success'       => true,
            'data'          => $data
        ]);
        $this->viewBuilder()->setOption('serialize', true);
    }

Best regards,
Aleksa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants