1234567891011121314151617181920212223242526272829 |
- #!/opt/mcfi/venv/bin/python
- # This script is called by the webserver for users basic authentication when
- # they "git push" something
- import configparser
- import sys
- username = sys.stdin.readline().strip()
- password = sys.stdin.readline().strip()
- # Load list of users
- actors = configparser.ConfigParser()
- actors.read('/var/lib/gitolite3/.gitolite/forgefed/actors')
- if username not in actors:
- sys.stderr.write('Username does not exists: {}\n'.format(username))
- exit(1)
- if actors[username]['type'] != 'Person':
- sys.stderr.write('Not a Person: {}\n'.format(username))
- exit(2)
- if actors[username]['password'] != password:
- sys.stderr.write('Password does not match for user {}.\n'.format(username))
- exit(3)
- # exit 0
|