Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Commit

Permalink
Merged PR 13563: #188796-Save and restore settings across upgrades
Browse files Browse the repository at this point in the history
#188796-Preserve existing registry.db when upgrading. Only saving UnprovisionedModeEnabled, AssumeDefaultCellModeEnabled, CellSupport

Related work items: #188796
  • Loading branch information
rali-bt committed Jul 22, 2019
2 parents dd1f963 + 8a011ef commit 01d3dfa
Show file tree
Hide file tree
Showing 14 changed files with 256 additions and 1 deletion.
19 changes: 19 additions & 0 deletions package/open-upgrade/deb/pbis-open-upgrade.preinst.in
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,23 @@ preserve_ignore_files()
fi
}

preserve_settings()
{
PRESERVE_FILE="${UPGRADEDIR}/preserveSetting"
LSASS_KEY="HKEY_THIS_MACHINE\\Services\\lsass\\Parameters\\Providers\\ActiveDirectory"
SAVE_VALUES="UnprovisionedModeEnabled|AssumeDefaultCellModeEnabled|CellSupport"

if [ -d /opt/pbis/bin ]; then
regshell=/opt/pbis/bin/regshell
elif [ -d /opt/likewise/bin ]; then
regshell=/opt/likewise/bin/lwregshell
else
regshell=/usr/bin/lwregshell
fi

$regshell list_values ${LSASS_KEY} | awk '{print $2, $4}' | grep -E ${SAVE_VALUES} >> ${PRESERVE_FILE} 2>&1
}

wait_for_lwsm_shutdown()
{
LWSMD_WAIT_TIME=$1
Expand Down Expand Up @@ -441,6 +458,8 @@ preinstall()

add_TrustEnumerationWaitSetting

preserve_settings

# Try to deconfigure pam/nsswitch
if [ -x @MK_BINDIR@/domainjoin-cli ]; then
run_quiet '@MK_BINDIR@/domainjoin-cli' configure --disable pam
Expand Down
18 changes: 18 additions & 0 deletions package/open-upgrade/depot/postinstall.in
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,22 @@ preserve_ignore_files()
fi
}

preserve_settings()
{
PRESERVE_FILE="${UPGRADEDIR}/preserveSetting"
LSASS_KEY="HKEY_THIS_MACHINE\\Services\\lsass\\Parameters\\Providers\\ActiveDirectory"
SAVE_VALUES="UnprovisionedModeEnabled|AssumeDefaultCellModeEnabled|CellSupport"

if [ -d /opt/pbis/bin ]; then
regshell=/opt/pbis/bin/regshell
elif [ -d /opt/likewise/bin ]; then
regshell=/opt/likewise/bin/lwregshell
else
regshell=/usr/bin/lwregshell
fi

$regshell list_values ${LSASS_KEY} | awk '{print $2, $4}' | grep -E ${SAVE_VALUES} >> ${PRESERVE_FILE} 2>&1
}

wait_for_lwsm_shutdown()
{
Expand Down Expand Up @@ -365,6 +381,8 @@ postinstall()

add_TrustEnumerationWaitSetting

preserve_settings

# Try to deconfigure pam/nsswitch
if [ -x @MK_BINDIR@/domainjoin-cli ]; then
run_quiet '@MK_BINDIR@/domainjoin-cli' configure --disable pam
Expand Down
19 changes: 19 additions & 0 deletions package/open-upgrade/freebsd/preinstall.in
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,23 @@ preserve_6_1_configuration()
fi
}

preserve_settings()
{
PRESERVE_FILE="${UPGRADEDIR}/preserveSetting"
LSASS_KEY="HKEY_THIS_MACHINE\\Services\\lsass\\Parameters\\Providers\\ActiveDirectory"
SAVE_VALUES="UnprovisionedModeEnabled|AssumeDefaultCellModeEnabled|CellSupport"

if [ -d /opt/pbis/bin ]; then
regshell=/opt/pbis/bin/regshell
elif [ -d /opt/likewise/bin ]; then
regshell=/opt/likewise/bin/lwregshell
else
regshell=/usr/bin/lwregshell
fi

$regshell list_values ${LSASS_KEY} | awk '{print $2, $4}' | grep -E ${SAVE_VALUES} >> ${PRESERVE_FILE} 2>&1
}

wait_for_lwsm_shutdown()
{
LWSMD_WAIT_TIME=$1
Expand Down Expand Up @@ -348,6 +365,8 @@ preinstall()
set_UnixLastChangeTime

add_TrustEnumerationWaitSetting

preserve_settings

# Try to deconfigure pam/nsswitch
if [ -x @MK_BINDIR@/domainjoin-cli ]; then
Expand Down
18 changes: 18 additions & 0 deletions package/open-upgrade/lpp/root.pre_i.in
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,22 @@ preserve_ignore_files()
fi
}

preserve_settings()
{
PRESERVE_FILE="${UPGRADEDIR}/preserveSetting"
LSASS_KEY="HKEY_THIS_MACHINE\\Services\\lsass\\Parameters\\Providers\\ActiveDirectory"
SAVE_VALUES="UnprovisionedModeEnabled|AssumeDefaultCellModeEnabled|CellSupport"

if [ -d /opt/pbis/bin ]; then
regshell=/opt/pbis/bin/regshell
elif [ -d /opt/likewise/bin ]; then
regshell=/opt/likewise/bin/lwregshell
else
regshell=/usr/bin/lwregshell
fi

$regshell list_values ${LSASS_KEY} | awk '{print $2, $4}' | grep -E ${SAVE_VALUES} >> ${PRESERVE_FILE} 2>&1
}

wait_for_lwsm_shutdown()
{
Expand Down Expand Up @@ -365,6 +381,8 @@ postinstall()

add_TrustEnumerationWaitSetting

preserve_settings

# Try to deconfigure pam/nsswitch
if [ -x @MK_BINDIR@/domainjoin-cli ]; then
run_quiet '@MK_BINDIR@/domainjoin-cli' configure --disable pam
Expand Down
18 changes: 18 additions & 0 deletions package/open-upgrade/pkg/postinstall.in
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,22 @@ preserve_ignore_files()
fi
}

preserve_settings()
{
PRESERVE_FILE="${UPGRADEDIR}/preserveSetting"
LSASS_KEY="HKEY_THIS_MACHINE\\Services\\lsass\\Parameters\\Providers\\ActiveDirectory"
SAVE_VALUES="UnprovisionedModeEnabled|AssumeDefaultCellModeEnabled|CellSupport"

if [ -d /opt/pbis/bin ]; then
regshell=/opt/pbis/bin/regshell
elif [ -d /opt/likewise/bin ]; then
regshell=/opt/likewise/bin/lwregshell
else
regshell=/usr/bin/lwregshell
fi

$regshell list_values ${LSASS_KEY} | awk '{print $2, $4}' | grep -E ${SAVE_VALUES} >> ${PRESERVE_FILE} 2>&1
}

wait_for_lwsm_shutdown()
{
Expand Down Expand Up @@ -365,6 +381,8 @@ postinstall()

add_TrustEnumerationWaitSetting

preserve_settings

# Try to deconfigure pam/nsswitch
if [ -x @MK_BINDIR@/domainjoin-cli ]; then
run_quiet '@MK_BINDIR@/domainjoin-cli' configure --disable pam
Expand Down
19 changes: 19 additions & 0 deletions package/open-upgrade/rpm/open-upgrade.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,23 @@ preserve_ignore_files()
fi
}

preserve_settings()
{
PRESERVE_FILE="${UPGRADEDIR}/preserveSetting"
LSASS_KEY="HKEY_THIS_MACHINE\\Services\\lsass\\Parameters\\Providers\\ActiveDirectory"
SAVE_VALUES="UnprovisionedModeEnabled|AssumeDefaultCellModeEnabled|CellSupport"

if [ -d /opt/pbis/bin ]; then
regshell=/opt/pbis/bin/regshell
elif [ -d /opt/likewise/bin ]; then
regshell=/opt/likewise/bin/lwregshell
else
regshell=/usr/bin/lwregshell
fi

$regshell list_values ${LSASS_KEY} | awk '{print $2, $4}' | grep -E ${SAVE_VALUES} >> ${PRESERVE_FILE} 2>&1
}

wait_for_lwsm_shutdown()
{
LWSMD_WAIT_TIME=$1
Expand Down Expand Up @@ -371,6 +388,8 @@ preinstall()

add_TrustEnumerationWaitSetting

preserve_settings

# Try to deconfigure pam/nsswitch
if [ -x @MK_BINDIR@/domainjoin-cli ]; then
run_quiet '@MK_BINDIR@/domainjoin-cli' configure --disable pam
Expand Down
18 changes: 18 additions & 0 deletions package/open/deb/pbis-open.postinst.in
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,22 @@ remove_TrustEnumerationWaitSettingFromADPath()
run_quiet '@MK_BINDIR@/regshell' delete_value '[HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory]' 'TrustEnumerationWaitSeconds'
}

restore_settings()
{
REGSHELL='@MK_BINDIR@/regshell'
SETTING_FILE="${UPGRADEDIR}/preserveSetting"
LSASS_KEY="[HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory]"

if [ -f ${SETTING_FILE} ]; then
while read buff; do
valueName=`echo $buff | awk '{ print $1}'|sed -e 's/\"//g'`
value=`echo $buff | awk '{ print $2}'|sed -e 's/\"//g'`
run_or_fail $REGSHELL set_value ${LSASS_KEY} ${valueName} ${value}
done < ${SETTING_FILE}
fi

}

postinstall()
{
logfile "Package: BeyondTrust AD Bridge Open postinstall begins (`date`)"
Expand Down Expand Up @@ -416,6 +432,8 @@ postinstall()

switch_to_open_provider

restore_settings

run_or_fail '@MK_BINDIR@/lwsm' shutdown

if [ -f "@LW_INITDIR@/lwsmd" ]; then
Expand Down
18 changes: 18 additions & 0 deletions package/open/depot/postinstall.in
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,22 @@ execute_auxiliary_scripts()
fi
}

restore_settings()
{
REGSHELL='@MK_BINDIR@/regshell'
SETTING_FILE="${UPGRADEDIR}/preserveSetting"
LSASS_KEY="[HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory]"

if [ -f ${SETTING_FILE} ]; then
while read buff; do
valueName=`echo $buff | awk '{ print $1}'|sed -e 's/\"//g'`
value=`echo $buff | awk '{ print $2}'|sed -e 's/\"//g'`
run_or_fail $REGSHELL set_value ${LSASS_KEY} ${valueName} ${value}
done < ${SETTING_FILE}
fi

}

postinstall()
{
logfile "Package: BeyondTrust AD Bridge Open postinstall begins (`date`)"
Expand Down Expand Up @@ -422,6 +438,8 @@ postinstall()

switch_to_open_provider

restore_settings

run_or_fail '@MK_BINDIR@/lwsm' shutdown

if [ -f "@LW_INITDIR@/lwsmd" -o -h "@LW_INITDIR@/lwsmd" ]; then
Expand Down
18 changes: 18 additions & 0 deletions package/open/freebsd/postinstall.in
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,22 @@ execute_auxiliary_scripts()
fi
}

restore_settings()
{
REGSHELL='@MK_BINDIR@/regshell'
SETTING_FILE="${UPGRADEDIR}/preserveSetting"
LSASS_KEY="[HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory]"

if [ -f ${SETTING_FILE} ]; then
while read buff; do
valueName=`echo $buff | awk '{ print $1}'|sed -e 's/\"//g'`
value=`echo $buff | awk '{ print $2}'|sed -e 's/\"//g'`
run_or_fail $REGSHELL set_value ${LSASS_KEY} ${valueName} ${value}
done < ${SETTING_FILE}
fi

}

postinstall()
{
log "Package: BeyondTrust AD Bridge Open postinstall begins (`date`)"
Expand Down Expand Up @@ -404,6 +420,8 @@ postinstall()

switch_to_open_provider

restore_settings

run_or_fail '@MK_BINDIR@/lwsm' shutdown

if [ -f "@LW_INITDIR@/lwsmd" ]; then
Expand Down
20 changes: 19 additions & 1 deletion package/open/lpp/root.config.in
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,22 @@ execute_auxiliary_scripts()
fi
}

restore_settings()
{
REGSHELL='@MK_BINDIR@/regshell'
SETTING_FILE="${UPGRADEDIR}/preserveSetting"
LSASS_KEY="[HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory]"

if [ -f ${SETTING_FILE} ]; then
while read buff; do
valueName=`echo $buff | awk '{ print $1}'|sed -e 's/\"//g'`
value=`echo $buff | awk '{ print $2}'|sed -e 's/\"//g'`
run_or_fail $REGSHELL set_value ${LSASS_KEY} ${valueName} ${value}
done < ${SETTING_FILE}
fi

}

postinstall()
{
log "Package: BeyondTrust AD Bridge Open postinstall begins (`date`)"
Expand All @@ -411,10 +427,12 @@ postinstall()

remove_npfs_dependencies

remove_dcerpc_dependencies
remove_dcerpc_dependencies

switch_to_open_provider

restore_settings

run_or_fail '@MK_BINDIR@/lwsm' shutdown

if [ -f "@LW_INITDIR@/lwsmd" -o -h "@LW_INITDIR@/lwsmd" ]; then
Expand Down
18 changes: 18 additions & 0 deletions package/open/mac/Resources/postflight
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,22 @@ execute_auxiliary_scripts()
fi
}

restore_settings()
{
REGSHELL='@MK_BINDIR@/regshell'
SETTING_FILE="${UPGRADEDIR}/preserveSetting"
LSASS_KEY="[HKEY_THIS_MACHINE\Services\lsass\Parameters\Providers\ActiveDirectory]"

if [ -f ${SETTING_FILE} ]; then
while read buff; do
valueName=`echo $buff | awk '{ print $1}'|sed -e 's/\"//g'`
value=`echo $buff | awk '{ print $2}'|sed -e 's/\"//g'`
run_or_fail $REGSHELL set_value ${LSASS_KEY} ${valueName} ${value}
done < ${SETTING_FILE}
fi

}

##
## Main
##
Expand Down Expand Up @@ -639,6 +655,8 @@ remove_npfs_dependencies

remove_dcerpc_dependencies

restore_settings

run_or_fail '@MK_BINDIR@/lwsm' shutdown

configure_and_start_lwsmd
Expand Down
18 changes: 18 additions & 0 deletions package/open/mac/Resources/preflight
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,22 @@ preserve_ignore_files()
fi
}

preserve_settings()
{
PRESERVE_FILE="${UPGRADEDIR}/preserveSetting"
LSASS_KEY="HKEY_THIS_MACHINE\\Services\\lsass\\Parameters\\Providers\\ActiveDirectory"
SAVE_VALUES="UnprovisionedModeEnabled|AssumeDefaultCellModeEnabled|CellSupport"

if [ -d /opt/pbis/bin ]; then
regshell=/opt/pbis/bin/regshell
elif [ -d /opt/likewise/bin ]; then
regshell=/opt/likewise/bin/lwregshell
else
regshell=/usr/bin/lwregshell
fi

$regshell list_values ${LSASS_KEY} | awk '{print $2, $4}' | grep -E ${SAVE_VALUES} >> ${PRESERVE_FILE} 2>&1
}

##
## Main
Expand Down Expand Up @@ -448,6 +464,8 @@ set_UnixLastChangeTime

add_TrustEnumerationWaitSetting

preserve_settings

stop_daemons

# Disable DS plugin
Expand Down
Loading

0 comments on commit 01d3dfa

Please sign in to comment.