<?xml version="1.0" encoding="UTF-8"?>
<!--
  ! CCPL HEADER START
  !
  ! This work is licensed under the Creative Commons
  ! Attribution-NonCommercial-NoDerivs 3.0 Unported License.
  ! To view a copy of this license, visit
  ! http://creativecommons.org/licenses/by-nc-nd/3.0/
  ! or send a letter to Creative Commons, 444 Castro Street,
  ! Suite 900, Mountain View, California, 94041, USA.
  !
  ! You can also obtain a copy of the license at
  ! src/main/resources/legal-notices/CC-BY-NC-ND.txt.
  ! See the License for the specific language governing permissions
  ! and limitations under the License.
  !
  ! If applicable, add the following below this CCPL HEADER, with the fields
  ! enclosed by brackets "[]" replaced with your own identifying information:
  !      Portions Copyright [yyyy] [name of copyright owner]
  !
  ! CCPL HEADER END
  !
  !      Copyright 2012 ForgeRock AS
  !    
-->
<chapter xml:id='chap-change-hosts'
 xmlns='http://docbook.org/ns/docbook'
 version='5.0' xml:lang='en'
 xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
 xsi:schemaLocation='http://docbook.org/ns/docbook http://docbook.org/xml/5.0/xsd/docbook.xsd'
 xmlns:xlink='http://www.w3.org/1999/xlink'
 xmlns:xinclude='http://www.w3.org/2001/XInclude'>
 <title>Changing Host Names</title>

 <para>When you change the OpenAM host name, you must make manual changes
 to the configuration. This chapter describes what to do. If you also must
 move an embedded configuration directory from one host to another, see the
 OpenDJ documentation on <citetitle>Moving Servers</citetitle>.</para>

 <itemizedlist>
  <para>Changing OpenAM host names involves the following high level
  steps.</para>
  <listitem>
   <para>Adding the new host name to the Realm/DNS Aliases list</para>
  </listitem>
  <listitem>
   <para>Exporting, editing, then importing the configuration</para>
   <para>This step relies on the <command>ssoadm</command> command, which you
   install separately from OpenAM as described in <link
   xlink:href="install-guide#install-openam-admin-tools"
   xlink:role="http://docbook.org/xlink/role/olink"><citetitle>To Set Up
   Administration Tools</citetitle></link>.</para>
  </listitem>
  <listitem>
   <para>Stopping OpenAM and editing configuration files</para>
  </listitem>
  <listitem>
   <para>Removing the old host name from the Realm/DNS Aliases list</para>
  </listitem>
 </itemizedlist>

 <para>Before you start, make sure you have a current backup of your current
 installation. See <link xlink:href="admin-guide#chap-backup-restore"
 xlink:role="http://docbook.org/xlink/role/olink"><citetitle>Backing Up and
 Restoring OpenAM Configurations</citetitle></link> for instructions.</para>

 <procedure xml:id="add-new-alias">
  <title>To Add the New Host Name As an Alias</title>

  <step>
   <para>Login to OpenAM console as administrator,
   <literal>amadmin</literal>.</para>
  </step>
  <step>
   <para>Under Access Control &gt; / (Top Level Realm), add the new host name
   to the Realm/DNS Aliases list, and then save your work.</para>
  </step>
 </procedure>

 <procedure xml:id="change-host-in-service-config">
  <title>To Export, Edit, &amp; Import the Service Configuration</title>

  <step>
   <para>Export the service configuration.</para>
   <screen>$ ssoadm export-svc-cfg -u amadmin -e fZatIu68OiqccJMXosSRyVjMsWJIx+SA
 -f /tmp/pwd.txt -o config.xml

Service Configuration was exported.</screen>
   <para>In this example, the secret key for encrypting the password in
   <option>-e fZatIu68OiqccJMXosSRyVjMsWJIx+SA</option> was taken from the
   Password Encryption Key field in the OpenAM console under Configuration &gt;
   Servers and Sites &gt; <replaceable>Server Name</replaceable> &gt;
   Security.</para>
  </step>
  <step>
   <para>Edit the service configuration file.</para>
   <itemizedlist>
    <listitem>
     <para>Change the fully qualified domain name, such as
     <literal>openam.example.com</literal>, throughout the file.</para>
    </listitem>
    <listitem>
     <para>If you are changing the deployment descriptor, such as
     <literal>/openam</literal>, then change the value of
     <literal>com.iplanet.am.services.deploymentDescriptor</literal>.</para>
     <para>Also change the deployment descriptor in the
     <literal>propertiesViewBeanURL="<replaceable
     >deployment-descriptor</replaceable>/auth/ACServiceInstanceList"</literal>
     attribute.</para>
     <para>Also change the deployment descriptor in the
     <literal>propertiesViewBeanURL="<replaceable
     >deployment-descriptor</replaceable>/auth/ACModuleList"</literal>
     attribute.</para>
     <para>Also change the deployment descriptor in a &lt;Value&gt; element
     that is a child of an &lt;AttributeValuePair&gt; element.</para>
     <para>Also change the deployment descriptor where it occurs throughout
     the file in the full URL to OpenAM, such as
     <literal>http:&amp;#47;&amp;#47;openam.example.com:8080&amp;#47;<replaceable
     >deployment-descriptor</replaceable></literal>.</para>
    </listitem>
    <listitem>
     <para>If you are changing the port number, then change the value of
     <literal>com.iplanet.am.server.port</literal>.</para>
     <para>Also change the port number in <literal><replaceable>host</replaceable
     >:<replaceable>port</replaceable></literal> combinations throughout the
     file.</para>
    </listitem>
    <listitem>
     <para>If you are changing the domain name, then change the cookie domain
     such as <literal>&lt;Value&gt;.example.com&lt;/Value&gt;</literal>
     throughout the file.</para>
    </listitem>
   </itemizedlist>
  </step>
  <step>
   <para>Import the updated service configuration.</para>
   <screen>$ ssoadm import-svc-cfg -u amadmin -e fZatIu68OiqccJMXosSRyVjMsWJIx+SA
 -f /tmp/pwd.txt -X config.xml

Directory Service contains existing data. Do you want to delete it? [y|N] y
Please wait while we import the service configuration...
Service Configuration was imported.</screen>
  </step>
 </procedure>

 <procedure xml:id="edit-config-files">
  <title>To Edit OpenAM Configuration Files For the New Host Name</title>

  <step>
   <para>Stop the web container where OpenAM runs.</para>
  </step>
  <step>
   <para>Edit the bootstrap file, such as
   <filename>/home/user/openam/bootstrap</filename>, changing the FQDN, port,
   and deployment descriptor for OpenAM as necessary.</para>
  </step>
  <step>
   <para>If you are changing the deployment descriptor, then move the folder
   containing OpenAM configuration, such as
   <filename>/home/user/openam/</filename>, to match the new deployment
   descriptor, such as <filename>/home/user/openam2/</filename>.</para>
  </step>
  <step>
   <para>If you are changing the location or deployment descriptor, change the
   name of the file in the <filename>/home/user/.openssocfg</filename> folder,
   such as <filename>AMConfig_path_to_tomcat_webapps_openam_</filename>
   to match the new location and deployment descriptor.</para>
   <para>Also edit the path name in the file to match the change you made when
   moving the folder.</para>
  </step>
  <step>
   <para>Restart the web container where OpenAM runs.</para>
  </step>
 </procedure>

 <procedure xml:id="remove-old-alias">
  <title>To Remove the Old Host Name As an Alias</title>

  <step>
   <para>Login to OpenAM console as administrator,
   <literal>amadmin</literal>.</para>
  </step>
  <step>
   <para>Under Access Control &gt; / (Top Level Realm), remove the old host
   name from the Realm/DNS Aliases list, and then save your work.</para>
  </step>
 </procedure>
</chapter>

