Enable Reverse zone page

153 views 0

How to set up a reverse zone page to allow users to add a reverse zone.

Overview

This setup provides a Reverse zone feature in Atomia Hosting Control Panel (HCP), which enables a customer to add a new reverse zone. A customer can add a new reverse zone in HCP via Domains and Websites->Reverse zone->Add reverse zone menu.

The reverse zone is added as a service inside a package that a customer has. This service can be configured:

  • as a free service that comes with the customer package
  • as an extra service that customers first need to buy and then they can add it via the HCP page
  • as a combination of the two above

Before you begin

Make sure Atomia DNS is installed and properly configured.

Enable Reverse zone in Atomia Hosting Control Panel

Add transformation file appConfig.ReverseZone.config in …Atomia/HostingControlPanel/App_Data/Transformation Files. This transformation file will enable Reverse zone feature in the HCP:

<?xml version="1.0" encoding="utf-8"?>
<appConfig xmlns="Atomia.Web.Base.Configs" xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xmlns:is="http://schemas.atomia.com/2009/06/configuration/identity" xmlns:hy="urn:nhibernate-configuration-2.2">
  <menusList>
    <menuItem id="menu007_7" name="ReverseZone" resourceKey="ReverseDns" action="Index" controller="ReverseDns" controllerAssembly="Atomia.Web.Plugin.Domains" controllerNamespace="Atomia.Web.Plugin.Domains.Controllers" xdt:Transform="InsertAfter(//*[local-name()='menuItem'][@id='menu007_1'])">
      <additionalRouteValuesList>
        <additionalRouteValues id="arv025" name="accountID" value="{accountID}" />
      </additionalRouteValuesList>
      <additionalItemPropertiesList>
        <additionalItemProperties id="aip039" name="packageLimitationSubItemService" value="ReverseZone" />
      </additionalItemPropertiesList>
    </menuItem>
  </menusList>
  <globalSettingsList>
    <globalSetting name="DnsReverseZonesEnabled" value="true" xdt:Locator="Match(name)" xdt:Transform="SetAttributes(value)"/>
  </globalSettingsList>
</appConfig>

Setting up reverse zone service in Atomia Automation

Add transformation file ProvisioningDescription.ReverseZone.xml in …Atomia/AutomationServer/Common/ProvisioningDescriptions/Transformation Files. This transformation file is adding necessary reverse zone services and is adding them as part of Atomia default packages (Base, Premium, and DNS package):

<?xml version="1.0" encoding="UTF-8"?>
<provisioningDescription xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <complexService name="CsDnsZoneReverse" description="Wrapper for standard DNS zone" xdt:Transform="InsertBefore(//complexService[@name='CsBaseKit'])">
    <complexServicePropertyList>
      <complexServiceProperty name="Zonename" description="DNS zone name" />
    </complexServicePropertyList>
    <partList>
      <partService name="DnsZone" min="1" max="1">
        <propertyTransformation>
          <simpleTransformer>
            <serviceProperty name="Zonename">
              <expression>$CsDnsZoneReverse::Zonename</expression>
            </serviceProperty>
            <serviceProperty name="IsReverse">
              <expression>true</expression>
            </serviceProperty>
          </simpleTransformer>
        </propertyTransformation>
      </partService>
    </partList>
    <init>
      <add partName="DnsZone"></add>
    </init>
  </complexService>
  <complexService name="CsDomainReverseZone" description="Complex service no website and reverse DNS zone" xdt:Transform="InsertAfter(//complexService[@name='CsDomainNoWebsite'])">
    <complexServicePropertyList>
      <complexServiceProperty name="Domain" description="Domain to enable parking for" key="true" />
      <complexServiceProperty name="DnsZone" description="Hostname DNS Zone" />
      <complexServiceProperty name="DnsZoneIsSlave" description="Is the DNS zone a slave zone" />
      <complexServiceProperty name="DnsSlaveZoneMasterIP" description="Master IP for slave zones, otherwise ignored." defaultValue="" />
      <complexServiceProperty name="DomainPrefix" description="Hostname domain prefix" />
    </complexServicePropertyList>
    <partList>
      <partService name="CsDnsZoneReverse" max="1">
        <propertyTransformation>
          <simpleTransformer>
            <serviceProperty name="Zonename">
              <expression>$CsDomainReverseZone::DnsZone</expression>
            </serviceProperty>
          </simpleTransformer>
        </propertyTransformation>
        <partList>
          <partService name="DnsZone">
            <partList>
              <partService name="DnsZoneRecord"></partService>
            </partList>
          </partService>
        </partList>
      </partService>
      <partService name="DnsSlaveZone" max="1"></partService>
    </partList>
    <init>
      <add partName="CsDnsZoneReverse" condition="$CsDomainReverseZone::DnsZoneIsSlave eq null"></add>
      <add partName="DnsSlaveZone" condition="$CsDomainReverseZone::DnsZoneIsSlave neq null">
        <initPropertyList>
          <propertyTransformation>
            <simpleTransformer>
              <serviceProperty name="Zonename">
                <expression>$CsDomainReverseZone::DnsZone</expression>
              </serviceProperty>
              <serviceProperty name="MasterIP">
                <expression>$CsDomainReverseZone::DnsSlaveZoneMasterIP</expression>
              </serviceProperty>
            </simpleTransformer>
          </propertyTransformation>
        </initPropertyList>
      </add>
    </init>
    <actionHooks>
      <onBeforeAddService type="Atomia.Provisioning.ActionHooks.BeforeAddService.UniquenessCheck, Atomia.Provisioning.ActionHooks.BeforeAddService" argument="" />
      <onSwitchService type="Atomia.Provisioning.ActionHooks.SwitchService.DomainWebsiteSwitch, Atomia.Provisioning.ActionHooks.SwitchService" argument="CsDnsZoneStandard" />
    </actionHooks>
  </complexService>
  <service name="CsDomainReverseZone" xdt:Locator="XPath(//package[@name='BasePackage']/serviceList)" xdt:Transform="Insert"/>
  <service name="CsDomainReverseZone" xdt:Locator="XPath(//package[@name='PremiumPackage']/serviceList)" xdt:Transform="Insert"/>
  <service name="CsDomainReverseZone" xdt:Locator="XPath(//package[@name='DnsPackage']/serviceList)" xdt:Transform="Insert"/>
</provisioningDescription>

Setting up Reverse zone limitation

With the configuration above (appConfig.ReverseZone.config and ProvisioningDescription.ReverseZone.xml) a customer will be able to add unlimited reverse zones free of charge for selected packages.

Place ProvisioningDescription.ReverseZoneLimit.xml transformation file in …Atomia/AutomationServer/Common/ProvisioningDescriptions/Transformation Files to limit the number of reverse zones per package:

 
<?xml version="1.0" encoding="UTF-8"?>
<provisioningDescription xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <group maxCount="10" xdt:Locator="XPath(//package[@name='BasePackage']/serviceLimitationList/globalLimitation)" xdt:Transform="Insert">
    <service name="CsDnsZoneReverse" />
  </group>
  <group maxCount="10" xdt:Locator="XPath(//package[@name='PremiumPackage']/serviceLimitationList/globalLimitation)" xdt:Transform="Insert">
    <service name="CsDnsZoneReverse" />
  </group>
  <group maxCount="10" xdt:Locator="XPath(//package[@name='DnsPackage']/serviceLimitationList/globalLimitation)" xdt:Transform="Insert">
    <service name="CsDnsZoneReverse" />
  </group>

  <packageExtension name="DnsReverseAddon" xdt:Locator="XPath(//packageExtensionList)" xdt:Transform="Insert">
    <serviceLimitationList>
      <globalLimitation>
        <group maxCount="1" name="CsDnsZoneReverse">
          <service name="CsDnsZoneReverse" />
        </group>
      </globalLimitation>
    </serviceLimitationList>
    <extendsList>
      <extends name="BasePackage" />
      <extends name="PremiumPackage" />
      <extends name="DnsPackage" />
    </extendsList>
  </packageExtension>
</provisioningDescription>

The transformation file is adding a limit of 10 reverse zones per package. It is also adding a package extension definition that can be used to increase the limit by 1.

When a customer tries to add the 11th reverse zone, he will get a notification that he can’t add it until he buys an extra service:

Good to know

By changing 10 to 0 (zero) in the ProvisioningDescription.ReverseZoneLimit.xml transformation file a customer will have no free reverse zones and will have to buy extra service every time.

Set up Reverse zone Extra Service (package extension) product

Add transformation file Web.DNSReverseZone.config in …Atomia/BillingAPIs/BillingApi/Transformation Files. This will add DnsReverseAddon as a provisioning service available for product definition in the Atomia Admin Panel:

<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
  <atomiaBilling xmlns="atomiaBilling">
    <provisioningOrders>
      <provisioningOrder provisioningService="DnsReverseAddon" order="10" xdt:Transform="Insert"/>
    </provisioningOrders>
  </atomiaBilling>
  <atomiaProvisioningConfiguration xmlns="atomiaProvisioning" adPasswordPattern="cczddAddAc" xdt:Transform="SetAttributes">
    <provisioningDescriptionMappings>
      <provisioningDescription name="ProvisioningDescription" xdt:Locator="Match(name)">
        <packages>
          <package name="DnsReverseAddon" type="PackageExtension" xdt:Transform="Insert">
            <properties>
              <packageProperty key="CsDnsZoneReverse"/>
            </properties>
          </package>
        </packages>
      </provisioningDescription>
    </provisioningDescriptionMappings>
  </atomiaProvisioningConfiguration>
</configuration>

The next step will be to add a new Extra Service product for reverse zone extension:

  • go to Atomia Admin Panel and open Products->Add product page
  • in product definition set for provisioning service DnsReverseAddon and for product category Extra Service
  • add the product to the default shop
  • flush product cache (button Flush Caches on the Products->Products list page)

At this point, if a new customer is created from Atomia Store, this new extra service product should be available on his Atomia Billing Control Panel Extra services page.

Enable email notifications after adding a new reverse zone

An email notification can be sent to a specified email address, each time a reverse zone is created in HCP:

  • go to AdminPanel->Settings->Mail templates
  • add a template for email subject, with the name AddReverseDnsZoneNotificationSubject, and template type Generic
  • add a template for the email body, with the name AddReverseDnsZoneNotificationBody and template type Generic
  • set ReverseZoneCreatedNotificationRecipientEmail property to recipient’s email address in Atomia.Web.Plugin.Domains.dll.config

Was this helpful?