Functions that handle parsing pyzor configuration files.
- pyzor.config.expand_homefiles(homefiles, category, homedir, config)¶
Set the full file path for these configuration files.
- pyzor.config.load_access_file(access_fn, accounts)¶
Load the ACL from the specified file, if it exists, and return an ACL dictionary, where each key is a username and each value is a set of allowed permissions (if the permission is not in the set, then it is not allowed).
‘accounts’ is a dictionary of accounts that exist on the server - only the keys are used, which must be the usernames (these are the users that are granted permission when the ‘all’ keyword is used, as described below).
- Each line of the file should be in the following format:
- operation : user : allow|deny
where ‘operation’ is a space-separated list of pyzor commands or the keyword ‘all’ (meaning all commands), ‘username’ is a space-separated list of usernames or the keyword ‘all’ (meaning all users) - the anonymous user is called “anonymous”, and “allow|deny” indicates whether or not the specified user(s) may execute the specified operations.
The file is processed from top to bottom, with the final match for user/operation being the value taken. Every file has the following implicit final rule:all : all : deny
- If the file does not exist, then the following default is used:
- check report ping info : anonymous : allow
Layout of file is: host : port : username : salt,key
Load the accounts from the specified file.
- Each line of the file should be in the format:
- username : key
If the file does not exist, then an empty dictionary is returned; otherwise, a dictionary of (username, key) items is returned.
Load the servers file.
- pyzor.config.setup_logging(log_name, filepath, debug)¶
Setup logging according to the specified options. Return the Logger object.