Re: FreeRadius+PostgreSQL connection error on FreeBSD

2002-10-26 Thread Sergey Holod
On Thursday 24 October 2002 16:15, Igor Chen wrote:
> On Thu, 10 Oct 2002, Sergey Holod wrote:
> > On Monday 07 October 2002 21:42, Aleksandar Zhelyazkov wrote:

> Replace Nas-Port field name with Nas-Port-id and leave %{NAS-Port}
..
> NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctSessionTime,
 ^
So "Nas-Port-id" or "NASPortId"?..))

> -1 in AcctSessionTime field indicates opened users session.

Why not to use "AcctStopTime IS NULL"?
It is much simply and logical.
Before "acct-stop" packet "AcctStopTime" is unknown, so it is NULL
and we know that session is opened..

> Accounting on/off i've tested on cisco 3620 NAS and
> fr 0.4. I did not see any mistakes.

In accton/off query:
   WHERE AcctSessionTime=0 AND AcctStopTime=0 AND NASIPAddress=
   '%{NAS-IP-Address}' AND AcctStartTime <= '%S'"

"AcctStopTime=0" - is completely wrong
PostgreSQL (>7.1..) can't convert 0 to "-00-00 00-00" or something like,
it simply generates error..

-- 
With Best Regards,
Sergey Holod
SAH1-RIPE

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



Re: FreeRadius+PostgreSQL connection error on FreeBSD

2002-10-24 Thread Igor Chen
On Thu, 10 Oct 2002, Sergey Holod wrote:

> On Monday 07 October 2002 21:42, Aleksandar Zhelyazkov wrote:
> > There are also some diferences between the sql db schema supplied in
> > src/modules/rlm_sql/drivers/rlm_sql_postgres/db_postgres.sql
> > and the sql statemetns for accounting_onoff etc in postgresql.conf
>
> Some time ago I've posted here patch for "right" config and schema
> don't know maybe , it is in CVS..
>
Yep, we got few mistakes there :) Seems like nobody didn't try to use it
before :-) Anyway, thanx. And shame on me (i knew about that and did
nothing :) )

Replace Nas-Port field name with Nas-Port-id and leave %{NAS-Port} unchanged,
and of course write somthing else except "...AND AcctStopTime = 0" in
accounting_update_query. Maybe "... AcctSessionTime = 0". It's not a good
idea, cause u can get zero sessions, as well as comparing
AcctStartTime,AcctStopTime timestamps, so i do acct_start that way:
accounting_start_query =
"INSERT into radacct (AcctSessionId, AcctUniqueId, UserName, Realm,
NASIPAddress, NASPortId, NASPortType, AcctStartTime, AcctSessionTime,
AcctAuthentic, ConnectInfo_start, ConnectInfo_stop, AcctInputOctets,
AcctOutputOctets, CalledStationId, CallingStationId, AcctTerminateCause,
ServiceType, FramedProtocol, FramedIPAddress, AcctStartDelay,
AcctStopDelay) values('%{Acct-Session-Id}', '%{Acct-Unique-Session-Id}',
'%{SQL-User-Name}', '%{Realm}', '%{NAS-IP-Address}', '%{NAS-Port}',
'%{NAS-Port-Type}', '%S', '-1', '%{Acct-Authentic}', '%{Connect-Info}',
'', '0', '0', '%{Called-Station-Id}', '%{Calling-Station-Id}', '',
'%{Service-Type}', '%{Framed-Protocol}', '%{Framed-IP-Address}',
'%{Acct-Delay-Time}', '0')"
-1 in AcctSessionTime field indicates opened users session.

My accounting_update_query looks like:

accounting_update_query = "UPDATE ${acct_table1} SET FramedIPAddress =
'%{Framed-IP-Address}' WHERE AcctSessionId = '%{Acct-Session-Id}' AND
UserName = '%{User-Name}' AND NASIPAddress= '%{NAS-IP-Address}' and
NASPortId='%{NAS-Port}' "

It doesn't really matter... Even if it updates several rows... maybe
better would be "... and AcctSessionTime=-1"


My config was more complicated, i just tried to rip my functions/where
clauses/etc and "generalize" it that day and posted it... nobody
complained :)
My current config is optimized for use with buggy NAS-es and proxy,
which often sends Start, Stop packets several times with
totally different information, so i'm forced to filter it :(

Accounting on/off i've tested on cisco 3620 NAS and
fr 0.4. I did not see any mistakes.

Feel free to point me on my mistakes.

P.S. me is ME :-)

-- 
cron-ripe


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



Re: FreeRadius+PostgreSQL connection error on FreeBSD

2002-10-10 Thread Sergey Holod

On Monday 07 October 2002 21:42, Aleksandar Zhelyazkov wrote:
> There are also some diferences between the sql db schema supplied in
> src/modules/rlm_sql/drivers/rlm_sql_postgres/db_postgres.sql
> and the sql statemetns for accounting_onoff etc in postgresql.conf

Some time ago I've posted here patch for "right" config and schema
don't know maybe , it is in CVS..



-- 
With Best Regards,
Sergey Holod
SAH1-RIPE

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



Re: FreeRadius+PostgreSQL connection error on FreeBSD

2002-10-07 Thread Jared Quinn

Sergey Holod([EMAIL PROTECTED])@Mon, Oct 07, 2002 at 06:45:21PM +0300:

> > What version are you running with - if your not running it, grab
> > the latest CVS release. 
> 
> It was 0.7.1..

I was having similar problems with 0.7.1, I am currently running CVS from mid
August without any probs - it's been stable for two months so I haven't touched
it ;-)   

Jared.

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



Re: FreeRadius+PostgreSQL connection error on FreeBSD

2002-10-07 Thread Aleksandar Zhelyazkov

There are also some diferences between the sql db schema supplied in 
src/modules/rlm_sql/drivers/rlm_sql_postgres/db_postgres.sql
and the sql statemetns for accounting_onoff etc in postgresql.conf


Sergey Holod wrote:

>On Monday 07 October 2002 15:02, Jared Quinn wrote:
>  
>
>>Sergey,
>>
>>  What version are you running with - if your not running it, grab
>>the latest CVS release. 
>>
>>
>
>It was 0.7.1..
>
>  
>
>>   Are you getting anything in your postgres logs
>>when this is happening?
>>
>>
>
>In pospgres log:
>
>   DEBUG:  pq_recvbuf: unexpected EOF on client connection
>
>  
>
>>>In log:
>>>
>>>   Error: PostgreSQL Query failed Error: no connection to the server
>>>
>>>And all SQL accounting breaks (we don't use sql authorization).
>>>  
>>>
>
>  
>




- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



Re: FreeRadius+PostgreSQL connection error on FreeBSD

2002-10-07 Thread Sergey Holod

On Monday 07 October 2002 15:02, Jared Quinn wrote:
> Sergey,
>
>   What version are you running with - if your not running it, grab
> the latest CVS release. 

It was 0.7.1..

>Are you getting anything in your postgres logs
> when this is happening?

In pospgres log:

   DEBUG:  pq_recvbuf: unexpected EOF on client connection

> > In log:
> >
> >Error: PostgreSQL Query failed Error: no connection to the server
> >
> > And all SQL accounting breaks (we don't use sql authorization).

-- 
With Best Regards,
Sergey Holod
SAH1-RIPE

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



Re: FreeRadius+PostgreSQL connection error on FreeBSD

2002-10-07 Thread Jared Quinn

Sergey,

What version are you running with - if your not running it, grab
the latest CVS release. Are you getting anything in your postgres logs
when this is happening?

Jared.

> When I start radiusd everything is good.
> But it seems that after some time of inactivity
> connection to Postgre SQL closes
> but freeradius don't understatnd that
> or don't create new connection.
> In log:
> 
>Error: PostgreSQL Query failed Error: no connection to the server
> 
> And all SQL accounting breaks (we don't use sql authorization).

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



FreeRadius+PostgreSQL connection error on FreeBSD

2002-10-07 Thread Sergey Holod

Hello!

When I start radiusd everything is good.
But it seems that after some time of inactivity
connection to Postgre SQL closes
but freeradius don't understatnd that
or don't create new connection.
In log:

   Error: PostgreSQL Query failed Error: no connection to the server

And all SQL accounting breaks (we don't use sql authorization).

-- 
With Best Regards,
Sergey Holod
SAH1-RIPE

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html