diff --git a/designate/backend/impl_akamai.py b/designate/backend/impl_akamai.py deleted file mode 100644 index 2c9172467..000000000 --- a/designate/backend/impl_akamai.py +++ /dev/null @@ -1,259 +0,0 @@ -# Copyright 2012-2015 Hewlett-Packard Development Company, L.P. -# -# Author: Kiall Mac Innes -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -from oslo_log import log as logging -from oslo_config import cfg -from oslo_utils import importutils - -from designate import exceptions -from designate import utils -from designate.backend import base - - -try: - SudsClient = importutils.import_class("suds.client.Client") - HttpAuthenticated = importutils.import_class( - "suds.transport.https.HttpAuthenticated") - -except ImportError: - SudsClient = None - - class HttpAuthenticated(object): - pass - - -LOG = logging.getLogger(__name__) -CONF = cfg.CONF - - -class EnhancedDNSException(exceptions.Backend): - pass - - -class DelegationExists(exceptions.BadRequest, EnhancedDNSException): - """ - Raised when an attempt to delete a zone which is still delegated to Akamai - is made - """ - error_type = 'delegation_exists' - - -class DuplicateZone(exceptions.DuplicateZone, EnhancedDNSException): - """ - Raised when an attempt to create a zone which is registered to another - Akamai account is made - """ - pass - - -class Forbidden(exceptions.Forbidden, EnhancedDNSException): - """ - Raised when an attempt to modify a zone which is registered to another - Akamai account is made. - - This appears to be returned when creating a new subzone of zone which - already exists in another Akamai account. - """ - pass - - -class EnhancedDNSHttpAuthenticated(HttpAuthenticated): - def addenhanceddnsheaders(self, request): - request.headers['Pragma'] = ('akamai-x-get-request-id, ' - 'akamai-x-cache-on, ' - 'akamai-x-cache-remote-on, ' - 'akamai-x-get-cache-key') - - def logenhanceddnsheaders(self, response): - request_id = response.headers.get('x-akamai-request-id', '-') - cache = response.headers.get('x-cache', '-') - cache_key = response.headers.get('x-cache-key', '-') - cache_remote = response.headers.get('x-cache-remote', '-') - - LOG.debug('Akamai Request-ID: %s, Cache-Key: %s, Cache: %s, ' - 'Cache-Remote: %s', request_id, cache_key, cache, - cache_remote) - - def send(self, request): - self.addenhanceddnsheaders(request) - - response = HttpAuthenticated.send(self, request) - - self.logenhanceddnsheaders(response) - - return response - - -class EnhancedDNSClient(object): - """EnhancedDNS SOAP API Client""" - - def __init__(self, username, password): - # Ensure Suds (or suds-jerko) have been installed - if SudsClient is None: - raise EnhancedDNSException( - "Dependency missing, please install suds or suds-jurko") - - # Prepare a SUDS transport with the appropriate credentials - transport = EnhancedDNSHttpAuthenticated( - username=username, - password=password, - proxy=utils.get_proxies()) - - # Prepare a SUDS client - self.client = SudsClient(CONF['backend:akamai'].enhanceddns_wsdl, - transport=transport) - - def buildZone(self, zoneName, masters, endCustomerId, tsigKeyName=None, - tsigKey=None, tsigAlgorithm=None): - zone = self.client.factory.create('ns3:Zone') - - # Set some defaults - zone.transferMode = "axfr" - zone.type = "edns" - zone.notify = 1 - zone.dnssec = False - - # Set the remaining options - zone.zoneName = self._sanitizeZoneName(zoneName) - zone.masters = masters - zone.tsigKeyName = tsigKeyName - zone.tsigKey = tsigKey - zone.tsigAlgorithm = tsigAlgorithm - zone.endCustomerId = endCustomerId - - return zone - - def getZone(self, zoneName): - LOG.debug("Performing getZone with zoneName: %s", zoneName) - zoneName = self._sanitizeZoneName(zoneName) - - try: - return self.client.service.getZone(zoneName=zoneName) - except Exception as e: - raise EnhancedDNSException('Akamai Communication Failure: %s', e) - - def setZones(self, zones): - LOG.debug("Performing setZones") - try: - return self.client.service.setZones(zones=zones) - except Exception as e: - if 'You do not have permission to view this zone' in str(e): - raise DuplicateZone() - elif 'You do not have access to edit this zone' in str(e): - raise Forbidden() - elif 'basic auth failed' in str(e): - raise exceptions.ConfigurationError( - 'Invalid Akamai credentials') - else: - raise EnhancedDNSException('Akamai Communication Failure: %s' - % e) - - def setZone(self, zone): - LOG.debug("Performing setZone with zoneName: %s", zone.zoneName) - try: - self.client.service.setZone(zone=zone) - except Exception as e: - if 'You do not have permission to view this zone' in str(e): - raise DuplicateZone() - elif 'You do not have access to edit this zone' in str(e): - raise Forbidden() - elif 'basic auth failed' in str(e): - raise exceptions.ConfigurationError( - 'Invalid Akamai credentials') - else: - raise EnhancedDNSException('Akamai Communication Failure: %s' - % e) - - def deleteZone(self, zoneName): - LOG.debug("Performing deleteZone with zoneName: %s", zoneName) - zoneName = self._sanitizeZoneName(zoneName) - - self.deleteZones(zoneNames=[zoneName]) - - def deleteZones(self, zoneNames): - LOG.debug("Performing deleteZones with zoneNames: %r", zoneNames) - zoneNames = [self._sanitizeZoneName(zN) for zN in zoneNames] - - try: - self.client.service.deleteZones(zoneNames=zoneNames) - except Exception as e: - # *READ THIS SECTION BEFORE MAKING ANY CHANGES* - # Added 01/2017 by Graham Hayes. - # If you have run a spell checking tool against the repo, and it - # changes the line below - the patch will get -2'd. - # This is matching a string that comes back from the akamai API. - # If the akamai API changes - then this should change, but no - # other reason. - if 'Could not retrive object ID for zone' in str(e): - # The zone has already been purged, ignore and move on - pass - elif 'The following zones are still delegated to Akamai' in str(e): - raise DelegationExists() - elif 'basic auth failed' in str(e): - raise exceptions.ConfigurationError( - 'Invalid Akamai credentials') - else: - raise EnhancedDNSException('Akamai Communication Failure: %s' - % e) - - def _sanitizeZoneName(self, zoneName): - return zoneName.rstrip('.').lower() - - -def build_zone(client, target, zone): - masters = [m.host for m in target.masters] - - if target.options.get("tsig_key_name", None): - return client.buildZone( - zone.name, - masters, - zone.id, - target.options.get("tsig_key_name", None), - target.options.get("tsig_key_secret", None), - target.options.get("tsig_key_algorithm", None)) - else: - return client.buildZone( - zone.name, - masters, - zone.id) - - -class AkamaiBackend(base.Backend): - __plugin_name__ = 'akamai' - - __backend_status__ = 'untested' - - def __init__(self, target): - super(AkamaiBackend, self).__init__(target) - - self.username = self.options.get('username') - self.password = self.options.get('password') - - self.client = EnhancedDNSClient(self.username, self.password) - - for m in self.masters: - if m.port != 53: - raise exceptions.ConfigurationError( - "Akamai only supports mDNS instances on port 53") - - def create_zone(self, context, zone): - """Create a DNS zone""" - zone = build_zone(self.client, self.target, zone) - - self.client.setZone(zone=zone) - - def delete_zone(self, context, zone): - """Delete a DNS zone""" - self.client.deleteZone(zoneName=zone['name']) diff --git a/designate/conf/__init__.py b/designate/conf/__init__.py index 9abbf6a73..3eada868b 100644 --- a/designate/conf/__init__.py +++ b/designate/conf/__init__.py @@ -14,7 +14,6 @@ from oslo_config import cfg from designate.conf import base # noqa -from designate.conf import akamai from designate.conf import agent from designate.conf import api from designate.conf import bind9 @@ -41,7 +40,6 @@ from designate.conf import worker CONF = cfg.CONF base.register_opts(CONF) -akamai.register_opts(CONF) agent.register_opts(CONF) api.register_opts(CONF) bind9.register_opts(CONF) diff --git a/designate/conf/akamai.py b/designate/conf/akamai.py deleted file mode 100644 index e091675c0..000000000 --- a/designate/conf/akamai.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2012-2015 Hewlett-Packard Development Company, L.P. -# -# Author: Kiall Mac Innes -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -import os - -from oslo_config import cfg - -WSDL_PATH = os.path.abspath( - os.path.join( - os.path.dirname(__file__), '..', 'resources', 'wsdl', 'EnhancedDNS.xml' - ) -) - -AKAMAI_GROUP = cfg.OptGroup( - name='backend:akamai', - title='Backend options for Akamai' -) - -AKAMAI_OPTS = [ - cfg.StrOpt('enhanceddns_wsdl', - default='file://%s' % WSDL_PATH, - sample_default=os.path.join('/path', 'to', 'EnhancedDNS.xml'), - help='Akamai EnhancedDNS WSDL URL'), -] - - -def register_opts(conf): - conf.register_group(AKAMAI_GROUP) - conf.register_opts(AKAMAI_OPTS, group=AKAMAI_GROUP) - - -def list_opts(): - return { - AKAMAI_GROUP: AKAMAI_OPTS, - } diff --git a/designate/resources/wsdl/EnhancedDNS.xml b/designate/resources/wsdl/EnhancedDNS.xml deleted file mode 100644 index b17fa81f2..000000000 --- a/designate/resources/wsdl/EnhancedDNS.xml +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/devstack/designate_plugins/backend-akamai b/devstack/designate_plugins/backend-akamai deleted file mode 100644 index 6c593582b..000000000 --- a/devstack/designate_plugins/backend-akamai +++ /dev/null @@ -1,150 +0,0 @@ -# Configure the Akamai backend - -# Requirements: -# An active Akamai account / contract will be requied to use this DevStack -# plugin. - -# Enable with: -# DESIGNATE_BACKEND_DRIVER=akamai - -# Dependencies: -# ``functions`` file -# ``designate`` configuration - -# install_designate_backend - install any external requirements -# configure_designate_backend - make configuration changes, including those to other services -# init_designate_backend - initialize databases, etc. -# start_designate_backend - start any external services -# stop_designate_backend - stop any external services -# cleanup_designate_backend - remove transient data and cache - -# Save trace setting -DP_AKAMAI_XTRACE=$(set +o | grep xtrace) -set +o xtrace - -# Defaults -# -------- - -DESIGNATE_AKAMAI_USERNAME=${DESIGNATE_AKAMAI_USERNAME:-username} -DESIGNATE_AKAMAI_PASSWORD=${DESIGNATE_AKAMAI_PASSWORD:-password} -DESIGNATE_AKAMAI_MASTERS=${DESIGNATE_AKAMAI_MASTERS:-"$DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT_MDNS"} -DESIGNATE_AKAMAI_NAMESERVERS=${DESIGNATE_AKAMAI_NAMESERVERS:-""} -DESIGNATE_AKAMAI_ALSO_NOTIFIES=${DESIGNATE_AKAMAI_ALSO_NOTIFIES:-"193.108.155.34,23.73.134.141,80.67.64.148,23.73.134.237,23.73.133.141,23.73.133.237,80.67.64.10,72.246.0.10,72.247.45.157,72.246.192.168,193.108.152.143,60.254.128.45,72.247.45.110,72.247.45.65,72.247.45.25"} - -# Pull in DESIGNATE_3RDPARTY_CREDS user/pass if set -if [ -n "$DESIGNATE_3RDPARTY_CREDS" ]; then - DESIGNATE_AKAMAI_USERNAME=`echo $DESIGNATE_3RDPARTY_CREDS | cut -f1 -d:` - DESIGNATE_AKAMAI_PASSWORD=`echo $DESIGNATE_3RDPARTY_CREDS | cut -f2- -d:` -fi - -# Sanity Checks -# ------------- -if [ -z "$DESIGNATE_AKAMAI_NAMESERVERS" ]; then - die $LINENO "You must configure DESIGNATE_AKAMAI_NAMESERVERS" -fi - -if [ "$DESIGNATE_SERVICE_PORT_MDNS" != "53" ]; then - die $LINENO "Akamai requires DESIGNATE_SERVICE_PORT_MDNS is set to '53'" -fi - -# Entry Points -# ------------ - -# install_designate_backend - install any external requirements -function install_designate_backend { - : -} - -# configure_designate_backend - make configuration changes, including those to other services -function configure_designate_backend { - # Generate Designate pool.yaml file - sudo tee $DESIGNATE_CONF_DIR/pools.yaml > /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null < /dev/null <=6.0.0 # Apache-2.0 SQLAlchemy>=1.2.19 # MIT sqlalchemy-migrate>=0.11.0 # Apache-2.0 stevedore>=1.20.0 # Apache-2.0 -suds-jurko>=0.6 # LGPLv3+ WebOb>=1.7.1 # MIT dnspython>=1.16.0 # http://www.dnspython.org/LICENSE oslo.db>=8.3.0 # Apache-2.0 diff --git a/setup.cfg b/setup.cfg index f9463ba27..97ac662e4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -74,7 +74,6 @@ designate.backend = designate = designate.backend.impl_designate:DesignateBackend pdns4 = designate.backend.impl_pdns4:PDNS4Backend dynect = designate.backend.impl_dynect:DynECTBackend - akamai = designate.backend.impl_akamai:AkamaiBackend akamai_v2 = designate.backend.impl_akamai_v2:AkamaiBackend nsd4 = designate.backend.impl_nsd4:NSD4Backend infoblox = designate.backend.impl_infoblox:InfobloxBackend