Community discussions

 
e066377
just joined
Topic Author
Posts: 6
Joined: Sun May 13, 2018 12:11 am

ssh code to reset a hotspot user

Tue Sep 25, 2018 10:38 pm

I have an application that manages radius database and i want to reset a hotspot user after i change its Mikrotik-Rate-Limit in database;
How can i force user to change its d/u rate with new value in radius database by ssh?

For juniper ssh command is 'clear network-access aaa subscriber username UserName', how is it for Mikrotik?

Is it possible to change connected user download/upload rate without disconnecting?
 
e066377
just joined
Topic Author
Posts: 6
Joined: Sun May 13, 2018 12:11 am

Re: ssh code to reset a hotspot user  [SOLVED]

Sun Sep 30, 2018 11:03 pm

For debian based Linux radius server;
PasswordConnectionInfo passwordConnectionInfo;

if (sSGCenter.RadiusServer.Port == null)
{
	passwordConnectionInfo = new PasswordConnectionInfo(sSGCenter.RadiusServer.Server, sSGCenter.RadiusServer.UserName, sSGCenter.RadiusServer.Password);
 }
else
{
	passwordConnectionInfo = new PasswordConnectionInfo(sSGCenter.RadiusServer.Server, sSGCenter.RadiusServer.Port.Value, sSGCenter.RadiusServer.UserName, sSGCenter.RadiusServer.Password);
}

using (var client = new SshClient(passwordConnectionInfo))
{
	string coaRequest = disconnect ? "Disconnect" : "CoA";

	 client.Connect();
	client.RunCommand($"echo \"User-Name={line.xDSLUserNameWithDomain}\" | radclient {sSGCenter.Server}:{sSGCenter.RadiusIncomingPort} {coaRequest} {sSGCenter.Secret}");
	client.Disconnect();
 }

Who is online

Users browsing this forum: MSN [Bot] and 11 guests