Push old repo

This commit is contained in:
sm_moshi
2024-03-11 14:27:11 +01:00
parent 365ac992bc
commit 91de56d6b6
6 changed files with 330 additions and 0 deletions

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
*.zip
.DS_Store
*.App
*.mobileconfig
*.pkg
*.dmg
*.png
*.rtf

View File

@@ -0,0 +1,13 @@
#!/bin/bash
SOPHOS_DIR=$(mktemp -d -t Sophos_Install)
trap 'rm -rf ${SOPHOS_DIR}' EXIT
cd $SOPHOS_DIR
# Installing Sophos
curl -L -O "put installer URL in these quotes."
unzip SophosInstall.zip
chmod a+x $SOPHOS_DIR/Sophos\ Installer.app/Contents/MacOS/Sophos\ Installer
chmod a+x $SOPHOS_DIR/Sophos\ Installer.app/Contents/MacOS/tools/com.sophos.bootstrap.helper
$SOPHOS_DIR/Sophos\ Installer.app/Contents/MacOS/Sophos\ Installer --quiet
rm -rf $SOPHOS_DIR
exit 0

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict><key>RegistrationServerURL</key><string>https://mcs2-cloudstation-eu-central-1.prod.hydra.sophos.com/sophos/management/ep</string><key>CustomerId</key><string>1fa65763-ab79-44ae-b815-93c70b765ecc</string><key>TenantId</key><string>f16a7536-ba97-44ea-8b51-397cb067e5cc</string><key>RegistrationToken</key><string>51c03641d0a91178f6010ed3339cc0c55d6619857a949cfc068b88e39f65dbc6</string><key>CustomerToken</key><string>51a6ab29-6d76-43f1-aa38-e1231fadbbad</string><key>Products</key><string>intercept,antivirus</string><key>ProductType</key><string>business</string><key>GeneratedAt</key><string>2023-12-07T11:08:42Z</string><key>DciFileName</key><string>41aea06e7cf0d70e17fc260874fb911c</string><key>DesiredFeatures</key><string>APPCNTRL, AV, CLEAN, CORE, DLP, DVCCNTRL, EFW, HBT, NTP, SAV, SDU, WEBCNTRL, XPD</string></dict></plist>

View File

@@ -0,0 +1,54 @@
{
"remote_auth" : {
"psk" : {
"secret" : "GsUnjtyUoh49wdh-E*vG",
"id" : "0.0.0.0"
},
"otp" : false
},
"dpd_delay" : "60 ",
"proposals" : [
"aes256-sha2_256-modp2048"
],
"version" : 1,
"favicon" : "",
"child" : {
"remote_ts" : [
"172.27.10.0/24",
"172.27.20.0/24",
"172.27.30.0/24",
"10.76.0.0/16"
],
"proposals" : [
"aes256-sha2_256-modp2048"
],
"rekey_time" : 3060
},
"run_logon_script" : true,
"name" : "VPN_DeZIM_Institute",
"domain_suffix" : " ",
"vip" : "0.0.0.0",
"gateway" : "193.175.6.100",
"local_auth" : {
"psk" : {
"id" : "0.0.0.0"
},
"otp" : false,
"xauth" : {
"can_save" : true
}
},
"history" : {
"connect_time" : 0,
"connect_result" : 0
},
"managed" : false,
"display_name" : "VPN_DeZIM_Institute",
"rekey_time" : 15300,
"auto_connect" : {
"enabled" : false,
"required" : false
},
"type" : "xg",
"start_action" : "none"
}

33
dock.sh Executable file
View File

@@ -0,0 +1,33 @@
#!/usr/bin/env bash
# sm @ DeZIM-Institut
# Clear existing persistent apps in the Dock
defaults write com.apple.dock persistent-apps -array
# Define an array of applications to add to the Dock
dock_apps=(
"/System/Library/CoreServices/Finder.app"
"/System/Applications/Launchpad.app"
"/Applications/Safari.app"
"Applications/Firefox.app"
"/Applications/Google Chrome.app"
"/Applications/Microsoft Outlook.app"
"/Applications/Slack.app"
"/Applications/Notes.app"
"/Applications/Microsoft Word.app"
"/Applications/Microsoft PowerPoint.app"
"/Applications/Microsoft Excel.app"
"/Applications/1Password.app"
"/Applications/Zoom.app"
"/Applications/TeamViewer.app"
"/Applications/Visual Studio Code.app"
"/Applications/iTerm.app"
"/System/Applications/System Settings.app"
)
echo "Setting the new macOS Dock layout..."
# Loop through the applications and add them to the Dock
for dockItem in "${dock_apps[@]}"; do
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>$dockItem</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
done

219
macOS_magic.sh Executable file
View File

@@ -0,0 +1,219 @@
#!/usr/bin/env bash
# sm @ DeZIM-Institut
# Name of new User
read -p "Enter surname of new user: " -r NEW_USER
# Variable for setting a non-root install folder (to run the script, need to export this to .zshrc afterwards)
# HOMEBREW_CASK_OPTS="--appdir=~/Applications"
# Set Homebrew paths...
BREW_PATH="/opt/homebrew/bin:/opt/homebrew/sbin"
# Add packages if needed...
PACKAGES=(
coreutils
gnu-sed
gnu-tar
gnu-indent
gnu-which
findutils
gnutls
git
bat
tmux
readline
zsh
zsh-completions
openssh
python
ruby
samba
ssh-copy-id
speedtest-cli
fish
)
CASKS=(
microsoft-office-businesspro # office programs
slack # app for internal communication
adobe-acrobat-reader # pdf reader and compressor
firefox # web browser
google-chrome # web browser
keka # unarchiver/archiver
1password # password manager
zoom # app for meetings
deepl # machine learning translator
)
# Add applications if needed...
OPTIONAL_CASKS=(
microsoft-remote-desktop # RDP client
iterm2 # terminal emulator
docker # GUI for Docker
rstudio # RStudio
r # R Programming Languages
zotero # Zotero
utm # VMs
veracrypt # encrypted containers
)
# Installing Rosetta 2...
echo "Checking for arm64 architecture..."
if [[ "$(uname -m)" == "arm64" ]]; then
echo "arm64 architecture detected. Installing Rosetta."
softwareupdate --install-rosetta --agree-to-license
fi
# Install Sophos
chmod a+x "/Volumes/macOS_Magic/macOS_Magic/SophosInstall/Sophos Installer.app/Contents/MacOS/Sophos Installer"
chmod a+x "/Volumes/macOS_Magic/macOS_Magic/SophosInstall/Sophos Installer.app/Contents/MacOS/tools/com.sophos.bootstrap.helper"
sudo "/Volumes/macOS_Magic/macOS_Magic/SophosInstall/Sophos Installer.app/Contents/MacOS/Sophos Installer" --quiet
# Sophos Connect
sudo installer -package "/Volumes/macOS_Magic/macOS_Magic/VPN/Sophos_Connect.pkg" -target "/Volumes/Macintosh HD"
# Check for errors after executing commands
if [ $? -ne 0 ]; then
echo "Error installing Sophos. Exiting..."
exit 1
fi
# Check for Homebrew to be present, install if it's missing
if ! command -v brew &>/dev/null; then
echo "Installing Homebrew..."
if /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"; then
echo "Homebrew installation successful."
else
echo "Homebrew installation failed."
exit 1
fi
fi
# Add Homebrew paths to .zshrc and .zprofile
#sudo echo "export PATH=\"$BREW_PATH:\$PATH\"" >>"/Users/$NEW_USER/.zshrc"
#sudo echo "export PATH=\"$BREW_PATH:\$PATH\"" >>"/Users/$NEW_USER/.zprofile"
# Source .zshrc to apply changes immediately
# source "$HOME/.zshrc"
# Fixing permissions for specific subdirectories in /opt/homebrew (Apple Silicon)
echo "Fixing permissions..."
sudo chown -R $NEW_USER:admin /opt/homebrew/
sudo chmod -R g+rwx /opt/homebrew/
# Security measure, install Casks which don't need root into ~/Applications, not /Applications
echo "Adding a security measure to install apps which don't need to be on root and instead install them in their local path."
sudo echo "export HOMEBREW_CASK_OPTS="--appdir=~/Applications"" >>"/Users/$NEW_USER/.zshrc"
echo "Activate Homebrew..."
(echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/admin/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
echo "Updating homebrew recipes..."
brew update
brew upgrade
brew tap homebrew/cask
brew tap homebrew/cask-fonts
brew doctor
echo "Installing packages..."
brew reinstall "${PACKAGES[@]}"
#echo "Enforcing macOS to use GNU tools..."
sudo echo "export PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH"" >>"/Users/$NEW_USER/.zshrc"
echo "Installing apps..."
brew reinstall --cask "${CASKS[@]}"
read -p "Install additional apps? [y/N] " -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
for cask in "${OPTIONAL_CASKS[@]}"; do
read -p "Install $cask ? [y/N] " -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
if ! brew reinstall --cask $cask; then
echo "Error installing $cask. Skipping..."
sleep 1
fi
fi
done
fi
echo "Cleaning up..."
brew cleanup
brew doctor
echo "Installing additional software... "
# Clevertouch
sudo cp -R "/Volumes/macOS_Magic/macOS_Magic/Clevertouch/Clevershare.app" "/Applications/"
# DFN Phone
sudo cp -R "/Volumes/macOS_Magic/macOS_Magic/DFN_Phone/"DFN VoIP-Centrex.app"" "/Applications/"
# Installing the RICO Printer Drivers...
sudo installer -package "/Volumes/macOS_Magic/macOS_Magic/Druckertreiber/Ricoh_IM_C3000_C3500_C4500_LIO_Driver.pkg" -target "/Volumes/Macintosh HD"
echo "Applying system settings..."
# Set hostname
read -p "Enter hostname: " -r newhostname
sudo scutil --set ComputerName "$newhostname"
sudo scutil --set HostName "$newhostname"
sudo scutil --set LocalHostName "$newhostname"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$newhostname"
# Clear existing persistent apps in the Dock
defaults write com.apple.dock persistent-apps -array
# Define an array of applications to add to the Dock
dock_apps=(
"/System/Library/CoreServices/Finder.app"
"/System/Applications/Launchpad.app"
"/Applications/Safari.app"
"Applications/Firefox.app"
"/Applications/Google Chrome.app"
"/Applications/Microsoft Outlook.app"
"/Applications/Slack.app"
"/Applications/Notes.app"
"/Applications/Microsoft Word.app"
"/Applications/Microsoft PowerPoint.app"
"/Applications/Microsoft Excel.app"
"/Applications/1Password.app"
"/Applications/Zoom.app"
"/Applications/TeamViewer.app"
"/Applications/Visual Studio Code.app"
"/Applications/iTerm.app"
"/System/Applications/System Settings.app"
)
echo "Setting the new macOS Dock layout..."
# Loop through the applications and add them to the Dock
for dockItem in "${dock_apps[@]}"; do
defaults write com.apple.dock persistent-apps -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>$dockItem</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
done
# Disable Sound Effects on Boot
sudo nvram SystemAudioVolume=" "
# Enable full disk encryption
sudo fdesetup enable
# Reset Launchpad
sudo defaults write com.apple.dock ResetLaunchPad -bool true
# automatic display sleep to 15 min
sudo pmset displaysleep 15
# Show All File Extensions
sudo defaults write -g AppleShowAllExtensions -bool true
# Quit Printer App After Print Jobs Complete
sudo defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Restart the Dock to apply changes
killall Dock
read -p "Reboot to apply changes? [Y/n] " -r
if [[ $REPLY =~ ^[Yy]$ || $REPLY == "" ]]; then
sudo reboot
fi
echo "Bye!"