jathanism / do_auth

A post-authorization script for tac_plus to allow greater flexibility in TACACS+ authentication and authorization controls.
tacacs.org
GNU General Public License v3.0
25 stars 9 forks source link

Parsing bugs. #1

Closed jathanism closed 11 years ago

jathanism commented 11 years ago

Reported by Dan Schmidt.

When running do_auth.py like so:

python do_auth.pyo -D -i 1.1.1.1 -fix_crs_bug -u dans -d 1.1.1.1 -l /root/log.txt

The parser doesn't work right. In short: Incorrect parsing sent it the wrong file and it did not log correctly.

You should get an error like:

2013-06-06 14:56:41: Error: Can't open/parse 'ix_crs_bug'

But we're getting:

2013-06-06 14:53:50,471 [CRITICAL]: users section doesn't exist!
jathanism commented 11 years ago

It looks to be a conflict with the '-f' argument and the '-fix_crs_bug' flag. If I uncomment a couple of the debug printing before the logging object is created:

% ./do_auth.py -D -i 1.1.1.1 -fix_crs_bug -u dans -d 1.1.1.1 -l /tmp/log.txt
filename: 'ix_crs_bug'
log_name: '/tmp/log.txt'

So it's trying to read ix_crs_bug as a config file.

I'm thinking this would be a good time to switch to optparse (which also preps for a future switch to argparse, which is in Python 2.7 and 3.x and replaces optparse). Optparse is supported all the way back to Python 2.3.

jathanism commented 11 years ago

Todo: