nnrpd_access.py

Edmund Wong e_wong at pw-wspx.org
Mon Sep 26 07:33:24 UTC 2016


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


More information about the inn-workers mailing list