UFDS Credential Rotation
January 16, 2023 ยท View on GitHub
UFDS key rotation impacts multiple feature areas and requires about an hour to complete from start to finish.
The functional areas impacted during the change window include:
- authentication for Triton, Manta API, and the Triton Service portal
- smartlogin
- account CRUD and fabric creation
- firewall rule CRUD
Procedure summary
The high-level steps are as follows:
-
Update the data centers that have UFDS replicas by:
- Setting a new, local UFDS password.
- Configuring the passwords so they still talk to the UFDS primary using the current password. During this stage, only the replica data center being updated is impacted.
-
Update the data center containing the UFDS primary by:
- Setting a new, local UFDS password. Once this is done, all services connecting to the UFDS primary will no longer work. These services include, but is not limited to, all
ufds-replicators, portal, and cloudapi/adminui requests that write to UFDS. - Updating the remote UFDS password on each data center that has UFDS replicas.
- Setting a new, local UFDS password. Once this is done, all services connecting to the UFDS primary will no longer work. These services include, but is not limited to, all
Before you begin
-
Determine whether you have enabled UFDS replication. Parts of this guide assume that you have already enabled UFDS replication using the
sdc-ufds-m2sscript. If you have not set up UFDS replication, follow the steps for the UFDS primary only. Skip all sections that refer to replicas. -
Generate passwords. You may use a single password for all data centers because they have the same content. You may also use a unique password per data center. If you use unique passwords, then all replica data centers must use the primary's password as the remote password.
If you are unsure which data center is the primary, check
/usbkey/configon the headnode for the lineufds_is_master=true. There should be only one datacenter with this setting. If for some reason you have more than one data center withufds_is_master=trueand are unsure how to proceed, contact Triton support. -
Prepare to monitor UFDS log files. Monitor the logs while making the changes is a best practice to catch anything that might go wrong.
Each of these commands are run from the UFDS zone.
sdc-login -l ufds-
To monitor the UFDS application log (all datacenters):
tail -1f $(svcs -L ufds-master) | bunyan -
To monitor the replication log (replicas only):
tail -1f $(svcs -L ufds-replicator) | bunyan
-
Procedure
Start data center maintenance
These commands are run from the headnode global zone.
sdcadm dc-maint start --message="This DC is in maintenance."
# confirm status
sdcadm dc-maint status
On each data center that has a UFDS replica
-
Run
sdc-usbkey mount. -
Update
/usbkey/configand/mnt/usbkey/configto setufds_ldap_root_pwto the new<REPLICA_PW>. -
Run
sdc-usbkey unmount. -
Modify the local UFDS password to the new password.
sapiadm update $(sdc-sapi /applications?name=sdc | json -Ha uuid) metadata.ufds_ldap_root_pw=<REPLICA_PW> -
Reboot
cloudapi,mahi,adminui,fwapi, andimgapito ensure that the new password takes effect.for inst in $(sdcadm insts -Ho instance cloudapi adminui mahi fwapi imgapi); do sdc-vmadm reboot "$inst" done -
Restart the
ufds-capiservice in theufdszone.svcadm -z $(vmadm lookup alias=~ufds) restart ufds-capi -
Restart the
napi-ufds-watcherservice in thesdczone.svcadm -z $(vmadm lookup alias=~sdc) restart napi-ufds-watcher
Test the modifications
-
Test all affected features:
- CRUD account/sub-user/role
- provisioning
- list firewall rules
- Manta CLI
-
Check CNS to ensure that it automatically picks up the password change.
-
Check that that the
ufds-masterlog doesn't have any connection errors. Connection errors indicate that some consumers still have the old password.
On the UFDS primary datacenter headnode
-
Run
sdc-usbkey mount. -
Update
/usbkey/configand/mnt/usbkey/configand setufds_ldap_root_pwto the new<PRIMARY_PW>. -
Run
sdc-usbkey unmount. -
Update the UFDS password to the new password
<PRIMARY_PW>.sapiadm update $(sdc-sapi /applications?name=sdc | json -Ha uuid) metadata.ufds_ldap_root_pw=<PRIMARY_PW> -
Reboot
cloudapi,mahi,adminui,imgapi, andfwapi.for inst in $(sdcadm insts -Ho instance cloudapi adminui mahi fwapi imgapi); do sdc-vmadm reboot "$inst" done -
Restart the
ufds-capiservice in theufdszone.svcadm -z $(sdc-vmname ufds) restart ufds-capi -
Restart the
napi-ufds-watcherservice in thesdczone.svcadm -z $(sdc-vmname sdc) restart napi-ufds-watcher -
Test.
Portal
- To update each of the portal instances:
- In the portal installation directory, edit
/site/config/config.pro.json. - Restart the
portalservice.
- In the portal installation directory, edit
Note: Any other 2nd or 3rd party applications that connect directly to UFDS should also be updated at this time. This may include things like billing processing services or 3rd party LDAP bridges.
On each replica datacenter headnode
-
Run
sdc-usbkey mount. -
Update
/usbkey/configand/mnt/usbkey/configand setufds_ldap_root_pwto the new<LOCAL_PW>. -
Run
sdc-usbkey unmount. -
Set the remote UFDS password to match the new password for the UFDS primary.
sapiadm update $(sdc-sapi /applications?name=sdc | json -Ha uuid) metadata.ufds_remote_ldap_root_pw=<LOCAL_PW> -
Reboot
cloudapi,mahi,adminui, andfwapi.for inst in $(sdcadm insts -Ho instance cloudapi adminui mahi fwapi imgapi); do sdc-vmadm reboot "$inst" done -
Restart the
capiservice in theufdszone.svcadm -z $(sdc-vmname ufds) restart ufds-capiAt this point, the
napi-ufds-watcherwill need to be restarted. However, if it is in maintenance, you can simply clear it. -
To restart the
napi-ufds-watcherservice in thesdczone.svcadm -z $(sdc-vmname sdc) restart napi-ufds-watcherIf the
napi-ufds-watcheris in a maintenance state, you can clear it by running:svcadm -z $(sdc-vmname sdc) clear napi-ufds-watcher -
Test.
Update Manta components
Manta will not always be deployed. If there is no Manta, skip these steps.
Before beginning, load the config into your current shell. This sets the
variable CONFIG_ufds_ldap_root_pw which will be used in each of these commands.
. /lib/sdc/config.sh
load_sdc_config
-
Update Manta webapi and authcache for each data center:
Webapi
webapi=( $(manta-adm show -Ho zonename webapi) ) for api in "${webapi[@]}"; do sapiadm update "$api" metadata.UFDS_ROOT_PW="${CONFIG_ufds_ldap_root_pw}" doneCheck that all webapi instances have the correct passowrd. It may take a few moments for config-agent to update the config so you may need to check several times before all instances are up to date.
manta-oneach -s webapi 'json -f /opt/smartdc/muskie/etc/config.json ufds.bindPassword'Authcache
mahi=( $(manta-adm show -Ho zonename authcache) ) for m in "${mahi[@]}"; do sapiadm update "$m" metadata.UFDS_ROOT_PW="${CONFIG_ufds_ldap_root_pw}" manta-oneach -z "$m" reboot doneAuthcache instances will automatically be up to date after the instance is rebooted in the previous step.
-
Update madtom and marlin-dashboard. MantaV2 installations will not have marlin-dashboard.
mdash=$(manta-adm show -Ho zonename marlin-dashboard) sapiadm update "$mdash" metadata.UFDS_ROOT_PW="${CONFIG_ufds_ldap_root_pw}" madtom=$(manta-adm show -Ho zonename madtom) sapiadm update "$madtom" metadata.UFDS_ROOT_PW="${CONFIG_ufds_ldap_root_pw}" -
Locate any reshard zone in the DC and update its metadata. This only applies to MantaV2.
The reshard service is experimental and you should not have one unless you were explicitly instructed to create one by Triton support.
There should only be one reshard zone in each region:
reshard=$(manta-adm show -Ho zonename reshard) sapiadm update "$reshard" metadata.UFDS_ROOT_PW="${CONFIG_ufds_ldap_root_pw}"
End the data center maintenance
sdcadm dc-maint stop
# confirm status
sdcadm dc-maint status
Testing
-
Test all affected functions, including:
CRUD account/sub-user/roleprovisioninglist firewall rules- Manta CLI
-
Check CNS to ensure it automatically picks up the password change.
-
Check that the
ufds-masterservice logs in theufdszone don't have any connection errors. Connection errors indicate that some consumers still have the old password.