Skip to content

Instantly share code, notes, and snippets.

@freitzzz
Last active August 18, 2023 14:57
Show Gist options
  • Save freitzzz/dc760116ee30e0737a988c20d1a75a03 to your computer and use it in GitHub Desktop.
Save freitzzz/dc760116ee30e0737a988c20d1a75a03 to your computer and use it in GitHub Desktop.
(debian/ubuntu) One click Clear Pass configuration script
#!/usr/bin/env bash
# This is an one-click install script to configure ClearPass OnGuard. This script is intended to be run on Debian / Ubuntu based systems.
banner="
__
____/ /__ ___ _____ ___ ___ ____ ___
/ __/ / -_) _ `/ __/ / _ \/ _ `(_-<(_-<
\__/_/\__/\_,_/_/ / .__/\_,_/___/___/
/_/
A one-click install script for ClearPass OnGuard configuration in Debian / Ubuntu based systems.
Run this script anytime over the Internet: wget -qO- https://gist.githubusercontent.com/freitzzz/dc760116ee30e0737a988c20d1a75a03/raw/clear_pass_configure.bash | bash
"
echo "$banner"
restart_clear_pass_tmp_path=/tmp/restart_clear_pass
restart_clear_pass_bin_path=/usr/sbin/restart-clearpass
os_info_path=/etc/os-release
# 1. Setup restart-clearpass script
restart_clear_pass_script=$( cat << EOF
#!/bin/bash
echo "Stopping clearpass onguard agent service..."
sudo service clearpass-onguard-agent-service stop
echo "Stopping clear service..."
sudo service clearpass-service stop
echo "Stopping onguard client..."
PID=$(pidof clearpass-onguard)
kill -9 $PID
echo "Starting clearpass onguard agent service..."
sudo service clearpass-onguard-agent-service start
echo "Starting clearpass service..."
sudo service clearpass-service start
echo "Starting onguard client..."
clearpass-onguard </dev/null &>/dev/null &
EOF
)
touch $restart_clear_pass_tmp_path
chmod +x $restart_clear_pass_tmp_path
echo "$restart_clear_pass_script" > $restart_clear_pass_tmp_path
sudo mv $restart_clear_pass_tmp_path $restart_clear_pass_bin_path
# 2. Replace OS Name to onguard agent controller service properly work
if [ "$(lsb_release -i -s)" != "Ubuntu" ];
then
sed -i 's/PRETTY_NAME=.*/PRETTY_NAME="Ubuntu 22.04"/g' $os_info_path
sed -i 's/NAME=.*/NAME="Ubuntu 22.04"/g' $os_info_path
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment