Beispiel #1
0
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

# This is the configuration plugin for logging options
# The name is 'b10logging' because logging.py is an existing module
#
# For a technical background, see
# http://bind10.isc.org/wiki/LoggingCppApiDesign
#

from isc.config.module_spec import module_spec_from_file
from isc.util.file import path_search
from bind10_config import PLUGIN_PATHS
spec = module_spec_from_file(path_search('logging.spec', PLUGIN_PATHS))

ALLOWED_SEVERITIES = [ 'default',
                       'debug',
                       'info',
                       'warn',
                       'error',
                       'fatal',
                       'none' ]
ALLOWED_DESTINATIONS = [ 'console',
                         'file',
                         'syslog' ]
ALLOWED_STREAMS = [ 'stdout',
                    'stderr' ]

def check(config):
# INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

from isc.config.module_spec import module_spec_from_file
from isc.util.file import path_search
from bind10_config import PLUGIN_PATHS
import isc.dns
import isc.datasrc
import json
import os.path
import copy

spec = module_spec_from_file(path_search('datasrc.spec', PLUGIN_PATHS))

def check(config):
    """
    Check the configuration.
    """
    # Check the data layout first
    errors=[]
    if not spec.validate_config(False, config, errors):
        return ' '.join(errors)

    classes = config.get('classes')
    # Nothing passed here
    if classes is None:
        return None
Beispiel #3
0
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

# This is the plugin for tsig_keys configuration section. The TSIG keyring
# lives there (eg. all the shared secrets, with some exceptions where there
# are some TSIG keys elsewhere, but these should be removed soon). We do
# sanity checking of user configuration here, simply by trying to construct
# all the keys here.

from isc.config.module_spec import module_spec_from_file
from isc.util.file import path_search
from pydnspp import TSIGKey, InvalidParameter
from bind10_config import PLUGIN_PATHS
spec = module_spec_from_file(path_search('tsig_keys.spec', PLUGIN_PATHS))


def check(config):
    # Check the data layout first
    errors = []
    if not spec.validate_config(False, config, errors):
        return ' '.join(errors)
    # Get the list of keys, if any
    keys = config.get('keys', [])
    # Run through them, check they can be constructed and there are no
    # duplicates
    keyNames = set()
    for key in keys:
        try:
            name = str(TSIGKey(key).get_key_name())
Beispiel #4
0
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

# This is the configuration plugin for logging options
# The name is 'b10logging' because logging.py is an existing module
#
# For a technical background, see
# http://bind10.isc.org/wiki/LoggingCppApiDesign
#

from isc.config.module_spec import module_spec_from_file
from isc.util.file import path_search
from bind10_config import PLUGIN_PATHS
spec = module_spec_from_file(path_search('logging.spec', PLUGIN_PATHS))

ALLOWED_SEVERITIES = [
    'default', 'debug', 'info', 'warn', 'error', 'fatal', 'none'
]
ALLOWED_DESTINATIONS = ['console', 'file', 'syslog']
ALLOWED_STREAMS = ['stdout', 'stderr']


def check(config):
    # Check the data layout first
    errors = []
    if not spec.validate_config(False, config, errors):
        return ' '.join(errors)
    # The 'layout' is ok, now check for specific values
    if 'loggers' in config:
Beispiel #5
0
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

# This is the plugin for tsig_keys configuration section. The TSIG keyring
# lives there (eg. all the shared secrets, with some exceptions where there
# are some TSIG keys elsewhere, but these should be removed soon). We do
# sanity checking of user configuration here, simply by trying to construct
# all the keys here.

from isc.config.module_spec import module_spec_from_file
from isc.util.file import path_search
from pydnspp import TSIGKey, InvalidParameter
from bind10_config import PLUGIN_PATHS
spec = module_spec_from_file(path_search('tsig_keys.spec', PLUGIN_PATHS))

def check(config):
    # Check the data layout first
    errors=[]
    if not spec.validate_config(False, config, errors):
        return ' '.join(errors)
    # Get the list of keys, if any
    keys = config.get('keys', [])
    # Run through them, check they can be constructed and there are no
    # duplicates
    keyNames = set()
    for key in keys:
        try:
            name = str(TSIGKey(key).get_key_name())
        except InvalidParameter as e: