linux_wiki:freeipa_client_remove

FreeIPA Client Remove

General Information

Removing a client from FreeIPA server enrollment.

Checklist


The Script

ipa-remove-client.sh
#!/bin/bash
# Name: ipa-remove-client.sh
# Description: Removes IPA/SSSD settings.
# Last Updated: 12/28/2016
# Recent Changes:-Copied from ipa rollback script for a base. Removed un-needed steps. Added
#                 removal of keytab file.
###############################################################################################
 
#### Functions Here: Main Starts After ####
function check_os_type
{
  if [ -f /etc/system-release-cpe ];then
    distro=$(awk -F: '{printf "%s", $3}' /etc/system-release-cpe)
    major_version=$(awk -F: '{printf "%d", $5}' /etc/system-release-cpe)
  elif [ -f /etc/redhat-release ];then
    distro=$(awk '{printf "%s", $1}' /etc/redhat-release)
    major_version=$(awk -F. '{print $1}' /etc/redhat-release | awk '{printf "%d", $3}')
  fi
}
#### End of Functions ####
 
#==================
# Main Starts Here
#==================
 
# Pre-checks
check_os_type
 
#==============================================================
# Confirm running the script
#==============================================================
echo -e "======================================="
echo -e "####====== IPA: Remove Client =====####"
echo -e "======================================="
echo
echo -e "Warning: This script will remove the ipa-client, disable sssd, and remove the kerberos keytab."
echo -e "Detected Distro: ${distro} ${major_version}"
echo -e "\n=>Continue?[y/n]:\c"
read run_script
 
if [[ ${run_script} != "y" ]]; then
  echo -e "\n>>Will not run the IPA remove client script. Exiting..."
  exit 1
fi
 
echo -e "\n>>Uninstalling ipa-client..."
ipa-client-install --uninstall
 
echo -e "\n>>Removing keytab file..."
rm -fv /etc/krb5.keytab
 
echo -e "\n>>Removing old sssd config file..."
rm -fv /etc/sssd/sssd.conf.deleted
 
echo -e "\n=========================================="
echo -e "####==== IPA Remove Client Complete ====####"
echo -e "============================================"

  • linux_wiki/freeipa_client_remove.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)