|
|
@@ -8,8 +8,9 @@ echo "unattended-upgrades unattended-upgrades/enable_auto_updates boolean false"
|
|
|
sudo dpkg-reconfigure -f noninteractive unattended-upgrades
|
|
|
|
|
|
# mark linux-image-generic and linux-headers-generic as held back
|
|
|
-echo "Marking linux-image-generic and linux-headers-generic as held back..."
|
|
|
-sudo apt-mark hold linux-image-generic linux-headers-generic
|
|
|
+# no longer used
|
|
|
+#echo "Marking linux-image-generic and linux-headers-generic as held back..."
|
|
|
+#sudo apt-mark hold linux-image-generic linux-headers-generic
|
|
|
|
|
|
# Update and upgrade the system
|
|
|
echo "Upgrading the system..."
|
|
|
@@ -17,20 +18,26 @@ sudo DEBIAN_FRONTEND=noninteractive apt update
|
|
|
sudo DEBIAN_FRONTEND=noninteractive apt upgrade -y
|
|
|
|
|
|
# Install required packages for Active Directory
|
|
|
+echo "Installing Active Directory Tools..."
|
|
|
sudo DEBIAN_FRONTEND=noninteractive apt install -y realmd libnss-sss libpam-sss sssd sssd-tools adcli samba-common-bin oddjob oddjob-mkhomedir packagekit
|
|
|
|
|
|
# Install any additional software
|
|
|
-# Required packages for Ninja
|
|
|
+
|
|
|
+# Required packages for NinjaRMM
|
|
|
+echo "Installing Ninja Tools..."
|
|
|
sudo DEBIAN_FRONTEND=noninteractive apt install -y net-tools network-manager policycoreutils jq libjq1 libonig5
|
|
|
|
|
|
# Load configuration file
|
|
|
+echo "Loading config file..."
|
|
|
source config.sh
|
|
|
|
|
|
# Set the username and password
|
|
|
+echo "Enter Active Directory Password..."
|
|
|
ADMINUSER=$ADMIN_USER
|
|
|
#ADMINPASS=$ADMIN_PASSWORD
|
|
|
|
|
|
# Set the hostname
|
|
|
+echo "Setting System Hostname..."
|
|
|
sudo hostnamectl set-hostname "$NEW_HOSTNAME"
|
|
|
|
|
|
# Set /etc/host
|
|
|
@@ -38,11 +45,10 @@ echo "127.0.0.1 localhost" | sudo tee /etc/hosts
|
|
|
echo "$(hostname -I | cut -d' ' -f1) $HOST $NEW_HOSTNAME" | sudo tee -a /etc/hosts
|
|
|
|
|
|
# Update and install required packages
|
|
|
-#sudo apt update
|
|
|
-#sudo apt install -y realmd libnss-sss libpam-sss sssd sssd-tools adcli samba-common-bin oddjob oddjob-mkhomedir packagekit
|
|
|
+##sudo apt update
|
|
|
+##sudo apt install -y realmd libnss-sss libpam-sss sssd sssd-tools adcli samba-common-bin oddjob oddjob-mkhomedir packagekit
|
|
|
|
|
|
# Join the domain
|
|
|
-#echo "$ADMINPASS" | sudo -S realm join --user="$ADMINUSER" --computer-ou="$OU" "$DOMAIN"
|
|
|
echo "Joining the domain..."
|
|
|
sudo -S realm join --user="$ADMINUSER" --computer-ou="$OU" "$DOMAIN"
|
|
|
#work in progress - --computer-desc="$COMPUTER_DESC"
|
|
|
@@ -67,6 +73,7 @@ sudo chmod 0700 /home/*
|
|
|
sudo sed -i 's/use_fully_qualified_names = True/use_fully_qualified_names = False/g' /etc/sssd/sssd.conf
|
|
|
|
|
|
# Deny login to all users
|
|
|
+echo "Setting Permissions..."
|
|
|
sudo realm deny --all
|
|
|
|
|
|
# Allow login to domain groups
|
|
|
@@ -87,8 +94,8 @@ echo "Seting the Timezone..."
|
|
|
sudo timedatectl set-timezone America/New_York
|
|
|
|
|
|
# copy file from SCP server to local system
|
|
|
-# sudo scp -r anonymous@ptiwa001:ninja-agent.deb /home/coadmin/
|
|
|
-# curl -o ninja-agent.deb https://app.ninjarmm.com/agent/installer/e99519fc-b76e-4c50-b5ff-ef68db95b032/serverslinuxmainoffice-5.6.7925-installer-x86-64.deb
|
|
|
+## sudo scp -r anonymous@ptiwa001:ninja-agent.deb /home/coadmin/
|
|
|
+## curl -o ninja-agent.deb https://app.ninjarmm.com/agent/installer/e99519fc-b76e-4c50-b5ff-ef68db95b032/serverslinuxmainoffice-5.6.7925-installer-x86-64.deb
|
|
|
|
|
|
# Install Ninja RMM Agent
|
|
|
echo "Installing Ninja..."
|
|
|
@@ -156,12 +163,19 @@ sudo systemctl start falcon-sensor
|
|
|
sudo systemctl restart rsyslog
|
|
|
|
|
|
# check the status of the services
|
|
|
-sudo systemctl | grep -E 'falcon-sensor|ninjarmm-agent|sssd.service'
|
|
|
+echo "Checking status of required services..."
|
|
|
+sudo systemctl | grep -E 'falcon-sensor|ninjarmm-agent|sssd.service|rsyslog.service'
|
|
|
+ echo "$line"
|
|
|
+ echo ""
|
|
|
|
|
|
# Query user and print message
|
|
|
-id chagood && echo "Successfully queried Active Directory for user chagood"
|
|
|
+echo "Checking Active Directory..."
|
|
|
+id ansible && echo "Successfully queried Active Directory for user peo\ansible"
|
|
|
+ echo "$line"
|
|
|
+ echo ""
|
|
|
|
|
|
# Check if reboot is required
|
|
|
+echo "Is a reboot required?..."
|
|
|
if [ -f /var/run/reboot-required ]; then
|
|
|
echo -e "\033[31mA reboot is required.\033[0m"
|
|
|
else
|