Changes between Initial Version and Version 1 of EDIR_adhoc_updates


Ignore:
Timestamp:
12/23/14 16:59:08 (10 years ago)
Author:
lttoth@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • EDIR_adhoc_updates

    v1 v1  
     1= Ad Hoc Changes to EDIR accounts = 
     2    Original author: Mark Anderson - 20091029 
     3 
     4== Limitations in the UI Interface Necessitating Alternate Editing Methods == 
     5We cannot make all necessary additions, deletions and updates to  
     6EDIR/AUTHSERV data through the existing web interfaces.  This document 
     7describes one way to make the small-scale changes which are the most common  
     8case.  Although simple to carry out, these changes must be performed  
     9with care to ensure that the updated data is accurate.  Since the changes  
     10are easy to make, it is also easy to make them carelessly. 
     11 
     12It is also important to ensure that the updated data is organized  
     13consistently with the other data in EDIR/AUTHSERV.  Otherwise, as  
     14inconsistent "edge cases" proliferate in the data it becomes increasingly  
     15difficult to carry out large-scale changes to, or queries of, the data. 
     16 
     17Changes must (almost always) be made to both the LDAP server Directory and  
     18the Oracle server Registry.  If changes are made only to the Directory, then 
     19they may be erased by the next Banner refresh which pushes the contents of 
     20the Registry out to the Directory.  If changes are made only to the Registry, 
     21they will not be visible in EDIR/AUTHSERV.  The only exceptions to this rule 
     22are the attributes which are not stored in the Registry but only in the  
     23Directory: userPassword, uakSecQuestion and uakSecResponse 
     24 
     25The following procedure is just one way to make these updates.  The  
     26artifacts of this procedure -- the .ldif and .sql files -- are not of 
     27permanent value but are useful to keep around for a short time so that 
     28if you made an error (for example, updated the Directory but not the 
     29Registry) you can consult the files to isolate that error.  They can also 
     30serve as templates for similar updates later. 
     31 
     32== EDIR LDAP Updates == 
     33To update the Directory, log in to any of the LDAP directory hosts 
     34as iplanet and submit an LDIF script to the appropriate Directory instance. 
     35How to do this is described in detail in this section. 
     36 
     37=== Create an LDIF === 
     38First, create an LDIF file consisting of four basic lines (described in detail 
     39below) and optional comment lines preceded by #:  
     40{{{ 
     41  % cat phmccarthy_addEduPersonAffiliation.ldif 
     42  # Paul McCarthy - emeritus 
     43 
     44  dn: uid=FR464UKX01,ou=people,dc=alaska,dc=edu 
     45  changetype: modify 
     46  add: eduPersonAffiliation 
     47  eduPersonAffiliation: Member 
     48  % 
     49}}} 
     50By convention the file is named after the directory entry followed by  
     51the change, e.g. 
     52 
     53        * phmccarthy_addEduPersonAffiliation.ldif 
     54        * elaineVroman_changeDefaultPassword.ldif 
     55        * syfnd_addVanityAddress.ldif 
     56 
     57==== Line 1: Distinguished Name (dn) ==== 
     58The first line of the LDIF will contain the unique Distinguished Name (dn)  
     59of the entry you intend to update.  Usually the entry will be for a People  
     60or Resource account, although occasionally the DN may be in the Departments or Routing OU of the directory. 
     61 
     62===== Distinguished Name - ou=people ===== 
     63{{{ 
     64  dn: uid=FL0Z2N9R01,ou=people,dc=alaska,dc=edu 
     65  dn: uid=GOOGLEAPPS03,ou=resource,dc=alaska,dc=edu 
     66}}} 
     67In any case, you can get the dn by querying the Directory for the entry. 
     68The DN will always be the first non-comment line returned: 
     69{{{ 
     70  % ldap_queryProd "(cn=lawrence duffy)" dn 
     71  # SSL connection to port 17630 
     72  dn: uid=FL0Z2N9R01,ou=people,dc=alaska,dc=edu 
     73}}} 
     74 
     75===== Distinguished Name - ou=resource ===== 
     76{{{ 
     77  % ldap_queryProd "(uid=GOOGLEAPPS03)" dn 
     78  # SSL connection to port 17630 
     79  dn: uid=GOOGLEAPPS03,ou=resource,dc=alaska,dc=edu 
     80}}} 
     81===== Distinguished Name - ou=routing ===== 
     82{{{ 
     83  % ldap_queryProd "(mailRoutingAddress=syfnd@email.alaska.edu)" dn 
     84  # SSL connection to port 17630 
     85  dn: uid=46506,ou=routing,dc=alaska,dc=edu 
     86}}} 
     87The examples above query the Prod Directory; you would use ldap_queryPrep 
     88or ldap_queryTest for the Prep or Test Directories.  The arguments to 
     89the scripts are the search filter and a space-delimited list of attributes  
     90you wish the query to return.  If you omit the list, all attributes will be  
     91returned. 
     92 
     93==== Line 2: LDIF Modification Entry ==== 
     94The second line of the LDIF will, for purposes of this document, always be 
     95 
     96        * changetype: modify 
     97 
     98=== Line 3: LDIF Change Type === 
     99The third line of the LDIF may be an "add:", "change:" or "delete:" of an attribute. 
     100However, best practice for changing an attribute's value is to delete it and then add it (details 
     101on this later).  For example: 
     102{{{ 
     103        add: edupersonAffiliation 
     104or  
     105        delete: defaultPassword 
     106}}} 
     107 
     108==== Line 4: Change Value ==== 
     109The fourth line of the LDIF will be the value of the attribute named in 
     110the third line, for example: 
     111{{{ 
     112        edupersonAffiliation: sponsored 
     113or 
     114        defaultPassword: 3562041167 
     115}}} 
     116 
     117=== Creating LDIF Files for Multiple Changes === 
     118If you want to make several changes to the same entry in the same LDIF,  
     119you can repeat the third and fourth lines separated by "-" on a line by  
     120itself.  For example, to modify an attribute: 
     121 
     122{{{ 
     123  delete: edupersonAffiliation 
     124  edupersonAffiliation: sponsored 
     125  - 
     126  add: edupersonAffiliation 
     127  edupersonAffiliation: member 
     128}}} 
     129 
     130=== Apply LDIF to EDIR LDAP === 
     131To apply the LDIF to the directory, use the ldap_modifyProd (or  
     132ldap_modifyTest or ldap_modifyPrep, as appropriate) script as iplanet: 
     133 
     134{{{ 
     135  % ldap_modifyProd < phmccarthy_addEduPersonAffiliation.ldif 
     136 
     137        (blah blah blah) 
     138  modify complete 
     139 
     140  % 
     141}}} 
     142The change you make will be automatically replicated to all the other 
     143LDAP servers in the Test, Prep or Prod EDIR instance. 
     144 
     145== People Registry Updates == 
     146To update the Registry, connect to the appropriate Registry database  
     147(RPTS or RPTP for Prod, RPTQ for Prep, RPTT for Test) as ops$sxldap and 
     148submit an SQL script.  
     149 
     150The steps to perform an update are 
     151  1. Log in to target database, RPTP (Prod), RPTT (Test), or RPTQ (Prep) 
     152  1. Shell to user 'sxldap' 
     153  1. Create SQL update file 
     154  1. Log in to People Registry Schema 
     155  1. Run query from SQLPLUS command line 
     156 
     157=== Login to RPTP and Shell to 'sxldap' === 
     158From your desktop login to RPTP. 
     159{{{ 
     160[Your desktop]: /Users/<desktop user name> > ssh <sx ID>@rptp.alaska.edu 
     161Password:  
     162Last login: Tue Dec 23 13:22:05 2014 from <desktop user name>.swits.alaska.edu 
     163<sx ID>@tazlina> ssh sxldap@tazlina.alaska.edu                                                                     
     164Last login: Tue Dec 23 13:41:05 2014 from tazlina.alaska.edu 
     165sxldap@tazlina>   
     166}}} 
     167 
     168===  Create a SQL File to Add an Attribute === 
     169Create an SQL script like the one below, by convention  
     170named exactly like the corresponding LDIF file but with a ".sql" extension.   
     171The following example '''adds''' an attribute. 
     172{{{ 
     173        % cat phmccarthy_addEduPersonAffiliation.sql 
     174        -- add eduPersonAffiliation: Member 
     175        insert into LDAP_ATTR_SS ( 
     176           LUID, 
     177           OU, 
     178           PIDM, 
     179           ATTRIB_NAME, 
     180           ATTRIB_VALUE, 
     181           ATTRIB_CHANGE_DATE, 
     182           ATTRIB_EXTRACT_DATE, 
     183           CHANGED_BY 
     184        ) 
     185        values ( 
     186           'FR464UKX01', 
     187           'people', 
     188           -1, 
     189           'eduPersonAffiliation', 
     190           'Member', 
     191           sysdate, 
     192           NULL, 
     193           'uid=XKK63NT8Z01,ou=people,dc=alaska,dc=edu' 
     194        ); 
     195        % 
     196}}} 
     197The "insert into" clause of the SQL enumerates the columns of the  
     198OPS$SXLDAP.LDAP_ATTR_SS table and the "values" clause lists the row of values  
     199that will be inserted into those columns. 
     200 
     201It is worth noting here that the Registry, unlike the Directory, separates 
     202data that flows into EDIR/AUTHSERV from Banner from data that flows into  
     203EDIR/AUTHSERV from other sources.  Ad hoc updates should only be made to 
     204tables with the latter kind of data (like LDAP_ATTR_SS); if you update 
     205tables of Banner data, your updates will be overwritten by the daily  
     206Banner refresh. 
     207 
     208The values for a row of the LDAP_ATTR_SS table are: 
     209 
     210   LUID - "uid" attribute from the dn: line on your LDIF file 
     211   OU - "ou" attribute from the dn: line on your LDIF file 
     212   PIDM - always -1 in non-Banner-data tables  
     213   ATTRIB_NAME - attribute name from the LDIF file "add:" line 
     214   ATTRIB_VALUE - attribute value from the LDIF file 
     215   ATTRIB_CHANGE_DATE - current date-time; the SYSDATE funtion will return this 
     216   ATTRIB_EXTRACT_DATE - always null in non-Banner-data tables 
     217   CHANGED_BY - your EDIR uid 
     218 
     219=== Create a SQL File to Delete an Attribute === 
     220Create an SQL script like this one, by convention 
     221named exactly like the corresponding LDIF file but with a ".sql" extension.  The following examples are for TEST. 
     222{{{ 
     223  % cat codyJohnson_removeVanityAddress.sql 
     224  -- Cody Johnson, Post Doctoral Researcher 
     225 
     226  -- delete mailAlternateAddress: cody.johnson@alaska.edu 
     227  delete from LDAP_ATTR_SS 
     228  where LUID = '0IP53JMT02'  
     229  and ATTRIB_NAME = 'mailAlternateAddress'  
     230  and ATTRIB_VALUE = 'cody.johnson@alaska.edu'; 
     231  % 
     232}}} 
     233In this example, LUID, ATTRIB_NAME and ATTRIB_VALUE have the same meanings  
     234that they did in the Add example.  The LUID uniquely identifies the entry  
     235(i.e. the EDIR account) and the ATTRIB_NAME and ATTRIB_VALUE uniquely  
     236identify the attribute within the entry. 
     237 
     238=== Log in to the People Registry and Submit the Script === 
     239The following example is for RPTP (Prod). Submit the SQL script to RPTP like this. The references to RPTP will be replaced by references to some other database as appropriate. 
     240{{{ 
     241% sqlplus / 
     242 
     243SQL*Plus: Release 11.2.0.2.0 Production on Tue Dec 23 16:39:40 2014 
     244 
     245Copyright (c) 1982, 2010, Oracle.  All rights reserved. 
     246 
     247 
     248Connected to: 
     249Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production 
     250With the Partitioning, OLAP, Data Mining and Real Application Testing options 
     251 
     252OPS$SXLDAP@RPTP>  @phmccarthy_addEduPersonAffiliation.sql 
     253 
     254        1 row created. 
     255 
     256OPS$SXLDAP@RPTP> commit work; 
     257 
     258        Commit complete. 
     259 
     260OPS$SXLDAP@RPTP> quit 
     261% 
     262}}} 
     263 
     264The following sequence sets the environment to one of the other environments.  You must know the password for the environment to use this approach. 
     265{{{ 
     266        % . ua_oracle rpts env 
     267        % sqlplus 
     268        Enter user-name: ops$sxldap 
     269        Enter password: 
     270        RPTS> 
     271}}} 
     272 
     273Double-check to ensure that you deleted exactly the number of rows that 
     274you expected to delete.  If anything unexpected happened, then roll back 
     275your changes: 
     276{{{ 
     277        RPTS> rollback work; 
     278 
     279        Rollback complete. 
     280}}} 
     281If all seems well, then commit your delete: 
     282{{{ 
     283        RPTS> commit work; 
     284 
     285        Commit complete. 
     286 
     287        RPTS> quit 
     288        % 
     289}}}