retrieve amount of traffic by username

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

retrieve amount of traffic by username

Janis Heller
Dear SQUID users;

what’s the best way to retrieve the amount of a user connected to SQUID server by using his username as an identifier?
Would be necessary for me to do so for including some traffic based limitations for each user (would send traffic amount generated by a user back to some backend for further processing), so all I’m looking for is some way to retrieve the amount generated by a user using a custom script.

All the best;
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: retrieve amount of traffic by username

FredB
delay_pool mixed with an acl like this acl ldap_auth proxy_auth REQUIRED

delay_access 1 allow ldap_auth
delay_access 1 deny all

A delay_class 4 should be good

Fred

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: retrieve amount of traffic by username

Amos Jeffries
Administrator
In reply to this post by Janis Heller
On 06/06/17 21:36, Janis Heller wrote:
> Dear SQUID users;
>
> what’s the best way to retrieve the amount of a user connected to SQUID server by using his username as an identifier?
> Would be necessary for me to do so for including some traffic based limitations for each user (would send traffic amount generated by a user back to some backend for further processing), so all I’m looking for is some way to retrieve the amount generated by a user using a custom script.

What you are looking for seems to be a logging daemon.
<http://wiki.squid-cache.org/action/show/Features/LogModules#Module:_Daemon>


Amos

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: retrieve amount of traffic by username

Janis Heller
In reply to this post by Janis Heller

Dear Fred,


thanks for your reply, let me explain a bit more. I'm using the RADIUS module for authentication, RADIUS is using a custom backend script to validate the provided login data (received from SQUID server). How to keep track on traffic usage of each user (for example OpenVPN config allows calling a script with used traffic + username each time a user is disconnecting). Is there some easy way, since I would need to store the generated traffic of a user per month (for being able to deny access on my custom backend script). So all I need to get is the traffic generated by a user when he's disconnecting. Polling the generated traffic in an interval won't be the best way I think.


All the best;

Janis


Von: FredB <[hidden email]>
Gesendet: Dienstag, 6. Juni 2017 13:09:22
An: Janis Heller
Betreff: Re: AW: [squid-users] retrieve amount of traffic by username
 
Ldap as an example with basic identification, but it can works with NTLM or DIGEST
Ldap is the identification mode here, this is not a ldap setup to limit the bandwidth.


Please let the group in Cc:


_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: retrieve amount of traffic by username

FredB

My answer was only for this point

> Would be necessary for me to do so for including some traffic based limitations for each user

I don't known radius with Squid but I guess you have an acl like this
acl radius-auth proxy_auth REQUIRED ?? (or something close)

In this case I guess you can easily mixed this acl with delay_pool http://wiki.squid-cache.org/Features/DelayPools

Here, I have bandwidth limitation for each account also based on time (not limitation at night)


_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: retrieve amount of traffic by username

Alex Rousskov
In reply to this post by Janis Heller
On 06/06/2017 06:10 AM, Janis Heller wrote:
> Is there some easy way, since I would need to store the
> generated traffic of a user per month (for being able to deny access on
> my custom backend script).

If parsing Squid access.log entries is easy for you, then there is an
easy way -- either parse the log Squid writes to disk or, as Amos,
suggested, add your own logging daemon that will parse the log entries
on the fly.


> So all I need to get is the traffic generated
> by a user when he's disconnecting.

HTTP does not have a concept of "user disconnect" beyond a single HTTP
transaction or, in some cases, a single HTTP connection. Each access log
entry is logged at the end of an HTTP transaction.

Alex.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: retrieve amount of traffic by username

Janis Heller
Seems like parsing would be what I need. Is the size (consumed bandwith) and the usernams (timestamp can be generated by my parser) being written to this file?
Could you show me a sample output of this file?
________________________________
Von: Alex Rousskov <[hidden email]>
Gesendet: Dienstag, 6. Juni 2017 15:40:18
An: Janis Heller; [hidden email]
Betreff: Re: [squid-users] retrieve amount of traffic by username

On 06/06/2017 06:10 AM, Janis Heller wrote:
> Is there some easy way, since I would need to store the
> generated traffic of a user per month (for being able to deny access on
> my custom backend script).

If parsing Squid access.log entries is easy for you, then there is an
easy way -- either parse the log Squid writes to disk or, as Amos,
suggested, add your own logging daemon that will parse the log entries
on the fly.


> So all I need to get is the traffic generated
> by a user when he's disconnecting.

HTTP does not have a concept of "user disconnect" beyond a single HTTP
transaction or, in some cases, a single HTTP connection. Each access log
entry is logged at the end of an HTTP transaction.

Alex.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: retrieve amount of traffic by username

Leonardo Rodrigues Magalhães
Em 06/06/17 10:45, Janis Heller escreveu:
> Seems like parsing would be what I need. Is the size (consumed bandwith) and the usernams (timestamp can be generated by my parser) being written to this file?
> Could you show me a sample output of this file?

     the already existing documentation is your friend :)

http://wiki.squid-cache.org/SquidFaq/SquidLogs


--


        Atenciosamente / Sincerily,
        Leonardo Rodrigues
        Solutti Tecnologia
        http://www.solutti.com.br

        Minha armadilha de SPAM, NÃO mandem email
        [hidden email]
        My SPAMTRAP, do not email it



_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Loading...