fail2ban.client.jailreader module¶
- class fail2ban.client.jailreader.JailReader(name, force_enable=False, **kwargs)¶
Bases: fail2ban.client.configreader.ConfigReader
Attributes
options Methods
add_section(section) Create a new section in the configuration. convert([allow_no_files]) Convert read before __opts to the commands stream defaults() extractOptions(option) get(section, option[, raw, vars]) Get an option value for a given section. getBaseDir() getIncludes(resource[, seen]) Given 1 config resource returns list of included files getName() getOptions() getboolean(section, option) getfloat(section, option) getint(section, option) has_option(section, option) Check for the existence of a given option in a given section. has_section(section) Indicate whether the named section is present in the configuration. isEnabled() items(section[, raw, vars]) Return a list of tuples with (name, value) for each option in the section. optionxform(optionstr) read() readfp(fp[, filename]) Like read() but the argument must be a file-like object. remove_option(section, option) Remove an option. remove_section(section) Remove a file section. sections() Return a list of section names, excluding [DEFAULT] set(section, option[, value]) Set an option. setBaseDir(basedir) setName(value) write(fp) Write an .ini-format representation of the configuration state. - DEFAULT_BASEDIR = '/etc/fail2ban'¶
- OPTCRE = <_sre.SRE_Pattern object at 0x7f937b8dd960>¶
- OPTCRE_NV = <_sre.SRE_Pattern object at 0x7f937b74c510>¶
- SECTCRE = <_sre.SRE_Pattern object at 0x7f937b4911b0>¶
- SECTION_NAME = 'INCLUDES'¶
- add_section(section)¶
Create a new section in the configuration.
Raise DuplicateSectionError if a section by the specified name already exists. Raise ValueError if name is DEFAULT or any of it’s case-insensitive variants.
- convert(allow_no_files=False)¶
Convert read before __opts to the commands stream
Parameters: allow_missing : bool
Either to allow log files to be missing entirely. Primarily is used for testing
- defaults()¶
- static extractOptions(option)¶
- get(section, option, raw=False, vars=None)¶
Get an option value for a given section.
If `vars’ is provided, it must be a dictionary. The option is looked up in `vars’ (if provided), `section’, and in `defaults’ in that order.
All % interpolations are expanded in the return values, unless the optional argument `raw’ is true. Values for interpolation keys are looked up in the same manner as the option.
The section DEFAULT is special.
- getBaseDir()¶
- static getIncludes(resource, seen=[])¶
Given 1 config resource returns list of included files (recursively) with the original one as well Simple loops are taken care about
- getName()¶
- getOptions()¶
- getboolean(section, option)¶
- getfloat(section, option)¶
- getint(section, option)¶
- has_option(section, option)¶
Check for the existence of a given option in a given section.
- has_section(section)¶
Indicate whether the named section is present in the configuration.
The DEFAULT section is not acknowledged.
- isEnabled()¶
- items(section, raw=False, vars=None)¶
Return a list of tuples with (name, value) for each option in the section.
All % interpolations are expanded in the return values, based on the defaults passed into the constructor, unless the optional argument `raw’ is true. Additional substitutions may be provided using the `vars’ argument, which must be a dictionary whose contents overrides any pre-existing defaults.
The section DEFAULT is special.
- optionCRE = <_sre.SRE_Pattern object at 0x7f93785b0af0>¶
- optionExtractRE = <_sre.SRE_Pattern object at 0x7f9378afc750>¶
- options¶
- optionxform(optionstr)¶
- read()¶
- readfp(fp, filename=None)¶
Like read() but the argument must be a file-like object.
The `fp’ argument must have a `readline’ method. Optional second argument is the `filename’, which if not given, is taken from fp.name. If fp has no `name’ attribute, `<???>’ is used.
- remove_option(section, option)¶
Remove an option.
- remove_section(section)¶
Remove a file section.
- sections()¶
Return a list of section names, excluding [DEFAULT]
- set(section, option, value=None)¶
Set an option. Extend ConfigParser.set: check for string values.
- setBaseDir(basedir)¶
- setName(value)¶
- write(fp)¶
Write an .ini-format representation of the configuration state.