Add retries on auth failures

Do it.
Add config option for port security

...and fix flake8.