Send inn-workers mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.isc.org/mailman/listinfo/inn-workers
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of inn-workers digest..."
Today's Topics:
1. nnrpd_access.py (Edmund Wong)
2. Re: nnrpd_access.py (Julien ?LIE)
3. Re: nnrpd_access.py (Edmund Wong)
----------------------------------------------------------------------
Message: 1
Date: Mon, 26 Sep 2016 15:33:24 +0800
From: Edmund Wong <[email protected]>
To: [email protected]
Subject: nnrpd_access.py
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8
Hi,
I took the sample nnrpd_access.py and set it up with readers.conf as
shown below:
auth "redirectlocal" {
hosts: "192.168.6.100"
default: <local>@areste.local
python_auth: nnrpd_auth
python_access: nnrpd_access
require_ssl: true
}
I'm running nnrpd as follows:
nnrpd -p 563 -S -t -D
nnrpd_auth works; but, I'm confused as to how to get
nnrpd_access working because the following lines in
nnrpd_access.py:
def access(self, attributes):
"""Called when python_access: is encountered in readers.conf."""
# Just for debugging purposes.
syslog('notice' 'bleh')
syslog('notice', 'n_a access() invoked: hostname %s, ipaddress
%s, interface %s, user %s' % ( \
attributes['hostname'], \
attributes['ipaddress'], \
attributes['interface'], \
attributes['user']))
for item in attributes.keys():
syslog('notice', 'key: %s, value:%s' % (item,
attributes[item]))
# Allow newsreading from specific host only.
ip = attributes['ipaddress']
syslog('notice', 'Checking against %s' % ip)
if ip in ['127.0.0.1', '192.168.6.100']:
syslog('notice', 'authentication access by IP address
succeeded: local')
dtc = {'newsgroups': '*,!control*,!junk'}
else:
syslog('notice', 'authentication access by IP address failed')
dtc = {'read': 'test.*', {'post', 'test.*'})
return dtc
it just keeps on complaining that the return value isn't a dictionary.
Am I doing this right?
Thanks
Ed
------------------------------
Message: 2
Date: Mon, 26 Sep 2016 10:31:08 +0200
From: Julien ?LIE <[email protected]>
To: Edmund Wong <[email protected]>
Cc: [email protected]
Subject: Re: nnrpd_access.py
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8; format=flowed
Hi Edmund,
> dtc = {'read': 'test.*', {'post', 'test.*'})
> return dtc
>
>
> it just keeps on complaining that the return value isn't a dictionary.
> Am I doing this right?
Wouldn't it look better this way:
dtc = {'read': 'test.*', 'post': 'test.*'}
--
Julien ?LIE
------------------------------
Message: 3
Date: Mon, 26 Sep 2016 17:32:41 +0800
From: Edmund Wong <[email protected]>
To: [email protected]
Subject: Re: nnrpd_access.py
Message-ID: <[email protected]>
Content-Type: text/plain; charset=UTF-8
Julien ?LIE wrote:
> Hi Edmund,
>
>> dtc = {'read': 'test.*', {'post', 'test.*'})
>> return dtc
>>
>>
>> it just keeps on complaining that the return value isn't a dictionary.
>> Am I doing this right?
>
> Wouldn't it look better this way:
> dtc = {'read': 'test.*', 'post': 'test.*'}
>
Yeah.. kinda screwed up the copy and paste from the terminal.
But even with that change, I'm still getting :
Sep 26 16:49:50 trex lt-nnrpd[26136]: python access method returned
wrong result -- expected a dictionary
I finally found out my faux-pas.
syslog('notice' 'bleh')
Forgot the comma. ;/
I'm surprised |python -c "import nnrpd, nnrpd_access"| didn't
complain.
Ed
------------------------------
Subject: Digest Footer
_______________________________________________
inn-workers mailing list
[email protected]
https://lists.isc.org/mailman/listinfo/inn-workers
------------------------------
End of inn-workers Digest, Vol 87, Issue 8
******************************************