diff --git a/PowerShell/JumpCloud Commands Gallery/Linux Commands/Linux - remote-assist - Installation script.md b/PowerShell/JumpCloud Commands Gallery/Linux Commands/Linux - remote-assist - Installation script.md index fb71e826b..048ff642b 100644 --- a/PowerShell/JumpCloud Commands Gallery/Linux Commands/Linux - remote-assist - Installation script.md +++ b/PowerShell/JumpCloud Commands Gallery/Linux Commands/Linux - remote-assist - Installation script.md @@ -25,15 +25,17 @@ fi set -u # set the RAA version string in the below variable before running the script. -# the example format of version: v0.75.0 +# the example format of version: v0.172.0 declare -t raa_version="" if [[ "$raa_version" == "" ]]; then - echo "'raa_version' need to be provided in the script (eg. v0.75.0)" - exit 0 + echo "'raa_version' need to be provided in the script (eg. v0.172.0)" + exit 1 fi tmp_dir=$(mktemp -d) +arch="$(uname -m)" +echo $(arch) declare -r timeout=900 declare -r max_retries=4 @@ -42,17 +44,15 @@ declare -r max_retry_time=3600 declare -r tmp_dir declare -r pub_key_name="jumpcloud-remote-assist-agent.gpg.asc" -declare -r raa_binary_name="jumpcloud-remote-assist" - declare -r install_prefix="/opt/jc_user_ro" declare -r apps_path="/usr/share/applications" declare -r raa_directory="${install_prefix}/jumpcloud-remote-assist" declare -r raa_desktop_file="${raa_directory}/resources/build-app/linux/jumpcloud-remote-assist.desktop" -declare -r uninstaller_path="${install_prefix}/bin/uninstall-${raa_binary_name}" declare -r raa_service_install_file="${raa_directory}/resources/build-app/linux/raasvc-install.sh" +declare -r raa_binary_path="${raa_directory}/jumpcloud-remote-assist" -declare -r remote_pub_key_url="https://jumpcloud-windows-agent.s3.amazonaws.com/production/remote-assist/jumpcloud-remote-assist-agent.gpg.asc" -declare -r remote_tgz_url="https://jumpcloud-windows-agent.s3.amazonaws.com/production/remote-assist/versions/${raa_version}/jumpcloud-remote-assist-agent_x86_64.tar.gz" +declare -r remote_pub_key_url="https://cdn02.jumpcloud.com/production/remote-assist/jumpcloud-remote-assist-agent.gpg.asc" +declare -r remote_tgz_url="https://cdn02.jumpcloud.com/production/remote-assist/versions/${raa_version}/jumpcloud-remote-assist-agent_${arch}.tar.gz" declare -r old_pub_key_fingerprint="83463C47A34D1BC1" declare -r pub_key_fingerprint="8C31C1376B37D307" @@ -139,10 +139,10 @@ function remove_old_raa_dir() { function kill_running_raa_instance() { local pid_list - pid_list=$(pidof "${raa_binary_name}") + pid_list=$(pidof "${raa_binary_path}") for raa_pid in ${pid_list}; do echo "Stopping remote assist process ${raa_pid}" - kill "${raa_pid}" + kill -9 "${raa_pid}" done } @@ -169,15 +169,6 @@ function install_raasvc_file() { fi } -function install_uninstall_script() { - mkdir -p "$(dirname "${uninstaller_path}")" - cat > "${uninstaller_path}" <<'EOF' -{{template "linuxUninstall.tmpl.sh" .}} -EOF - chmod -x "${uninstaller_path}" - chmod 700 "${uninstaller_path}" -} - function main() { trap cleanup EXIT install_pub_key @@ -186,7 +177,6 @@ function main() { install_new_raa install_desktop_file install_raasvc_file - install_uninstall_script } main @@ -194,7 +184,7 @@ main #### Description -This script installs rempte assist application on the Linux machine. +This script installs remote assist application on the Linux machine. #### _Import This Command_ diff --git a/PowerShell/JumpCloud Commands Gallery/commands.json b/PowerShell/JumpCloud Commands Gallery/commands.json index 1921cd115..f0f4807c3 100644 --- a/PowerShell/JumpCloud Commands Gallery/commands.json +++ b/PowerShell/JumpCloud Commands Gallery/commands.json @@ -100,9 +100,9 @@ { "name": "Linux - remote-assist - Installation script | v1.0 JCCG", "type": "linux", - "command": "#!/usr/bin/env bash\n################################################################################\n# This script will install remote assist application on a Linux device\n################################################################################\n\n# Disable following external sources\n# shellcheck disable=SC1091,SC1090,SC2059\n\nif [[ \"${UID}\" != 0 ]]; then\n (>&2 echo \"Error: $0 must be run as root\")\n exit 1\nfi\n\nset -u\n\n# set the RAA version string in the below variable before running the script.\n# the example format of version: v0.75.0\ndeclare -t raa_version=\"\"\n\nif [[ \"$raa_version\" == \"\" ]]; then\n echo \"'raa_version' need to be provided in the script (eg. v0.75.0)\"\n exit 0\nfi\n\ntmp_dir=$(mktemp -d)\n\ndeclare -r timeout=900\ndeclare -r max_retries=4\ndeclare -r max_retry_time=3600\n\ndeclare -r tmp_dir\n\ndeclare -r pub_key_name=\"jumpcloud-remote-assist-agent.gpg.asc\"\ndeclare -r raa_binary_name=\"jumpcloud-remote-assist\"\n\ndeclare -r install_prefix=\"/opt/jc_user_ro\"\ndeclare -r apps_path=\"/usr/share/applications\"\ndeclare -r raa_directory=\"${install_prefix}/jumpcloud-remote-assist\"\ndeclare -r raa_desktop_file=\"${raa_directory}/resources/build-app/linux/jumpcloud-remote-assist.desktop\"\ndeclare -r uninstaller_path=\"${install_prefix}/bin/uninstall-${raa_binary_name}\"\ndeclare -r raa_service_install_file=\"${raa_directory}/resources/build-app/linux/raasvc-install.sh\"\n\ndeclare -r remote_pub_key_url=\"https://jumpcloud-windows-agent.s3.amazonaws.com/production/remote-assist/jumpcloud-remote-assist-agent.gpg.asc\"\ndeclare -r remote_tgz_url=\"https://jumpcloud-windows-agent.s3.amazonaws.com/production/remote-assist/versions/${raa_version}/jumpcloud-remote-assist-agent_x86_64.tar.gz\"\n\ndeclare -r old_pub_key_fingerprint=\"83463C47A34D1BC1\"\ndeclare -r pub_key_fingerprint=\"8C31C1376B37D307\"\ndeclare -r owner_trust=\"C2122200660347DB094054808C31C1376B37D307:6:\"\ndeclare -r tgz_name=\"jumpcloud-remote-assist-agent.tar.gz\"\ndeclare -r sig_name=\"${tgz_name}.zig\"\n\ndeclare -r local_pub_key_path=\"${tmp_dir}/${pub_key_name}\"\ndeclare -r local_tgz_tmp_path=\"${tmp_dir}/${tgz_name}\"\ndeclare -r local_sig_tmp_path=\"${tmp_dir}/${sig_name}\"\n\ndeclare -r remote_sig_url=\"${remote_tgz_url}.sig\"\n\nfunction cleanup() {\n rm -rf \"${tmp_dir}\"\n}\n\nfunction download_single_file() {\n local url=${1}\n local local_file=${2}\n\n echo \"Downloading ${url}\"\n\n curl_output=$(curl -v --trace-time \\\n --max-time \"${timeout}\" --retry \"${max_retries}\" \\\n --retry-max-time \"${max_retry_time}\" \\\n --output \"${local_file}\" \"${url}\" -C - 2>&1)\n\n rc=$?\n if [[ \"$rc\" != \"0\" ]]; then\n echo \"Failed to download ${url}\"\n echo \"${curl_output}\"\n exit ${rc}\n fi\n}\n\nfunction remove_old_pub_key() {\n if gpg --list-keys | grep -q \"${old_pub_key_fingerprint}\"; then\n echo \"Removing old public key ${old_pub_key_fingerprint}\"\n gpg --batch --yes --delete-key \"${old_pub_key_fingerprint}\"\n fi\n}\n\nfunction install_pub_key() {\n remove_old_pub_key\n\n output=$(gpg --list-keys | grep \"${pub_key_fingerprint}\")\n if [[ \"${output}\" == \"\" ]]; then\n download_single_file \"${remote_pub_key_url}\" \"${local_pub_key_path}\"\n echo \"Importing public key ${pub_key_fingerprint}\"\n gpg --import \"${local_pub_key_path}\"\n echo \"${owner_trust}\" | gpg --import-ownertrust\n fi\n}\n\nfunction verify_signature() {\n local sig=\"${1}\"\n local tgz=\"${2}\"\n gpg --verify \"${sig}\" \"${tgz}\" 2>&1\n}\n\nfunction download_files() {\n download_single_file \"${remote_tgz_url}\" \"${local_tgz_tmp_path}\"\n download_single_file \"${remote_sig_url}\" \"${local_sig_tmp_path}\"\n if ! verify_signature \"${local_sig_tmp_path}\" \"${local_tgz_tmp_path}\"; then\n echo \"Unable to verify signature for ${tgz_name}\"\n exit 1\n fi\n}\n\nfunction uncompress_tarball() {\n echo \"Installing new RAA\"\n mkdir -p \"${install_prefix}\"\n chmod 755 \"${install_prefix}\"\n tar zxf \"${local_tgz_tmp_path}\" -C \"${install_prefix}\"\n}\n\nfunction remove_old_raa_dir() {\n if [[ -d \"${raa_directory}\" ]]; then\n echo \"Removing old RAA\"\n rm -rf \"${raa_directory}\"\n fi\n}\n\nfunction kill_running_raa_instance() {\n local pid_list\n pid_list=$(pidof \"${raa_binary_name}\")\n for raa_pid in ${pid_list}; do\n echo \"Stopping remote assist process ${raa_pid}\"\n kill \"${raa_pid}\"\n done\n}\n\nfunction install_new_raa() {\n remove_old_raa_dir\n uncompress_tarball\n}\n\nfunction install_desktop_file() {\n echo \"Installing desktop shortcut\"\n if [[ -d \"${apps_path}\" ]]; then\n cp \"${raa_desktop_file}\" \"${apps_path}\"\n if command -v \"update-desktop-database\" &>/dev/null; then\n update-desktop-database\n fi\n fi\n}\n\nfunction install_raasvc_file() {\n echo \"Installing raasvc and raal service\"\n if [[ -f \"${raa_service_install_file}\" ]]; then\n chmod +x \"${raa_service_install_file}\"\n /bin/bash \"${raa_service_install_file}\"\n fi\n}\n\nfunction install_uninstall_script() {\n mkdir -p \"$(dirname \"${uninstaller_path}\")\"\n cat > \"${uninstaller_path}\" <<'EOF'\n{{template \"linuxUninstall.tmpl.sh\" .}}\nEOF\n chmod -x \"${uninstaller_path}\"\n chmod 700 \"${uninstaller_path}\"\n}\n\nfunction main() {\n trap cleanup EXIT\n install_pub_key\n download_files\n kill_running_raa_instance\n install_new_raa\n install_desktop_file\n install_raasvc_file\n install_uninstall_script\n}\n\nmain", + "command": "#!/usr/bin/env bash\n################################################################################\n# This script will install remote assist application on a Linux device\n################################################################################\n\n# Disable following external sources\n# shellcheck disable=SC1091,SC1090,SC2059\n\nif [[ \"${UID}\" != 0 ]]; then\n (>&2 echo \"Error: $0 must be run as root\")\n exit 1\nfi\n\nset -u\n\n# set the RAA version string in the below variable before running the script.\n# the example format of version: v0.172.0\ndeclare -t raa_version=\"\"\n\nif [[ \"$raa_version\" == \"\" ]]; then\n echo \"'raa_version' need to be provided in the script (eg. v0.172.0)\"\n exit 1\nfi\n\ntmp_dir=$(mktemp -d)\narch=\"$(uname -m)\"\necho $(arch)\n\ndeclare -r timeout=900\ndeclare -r max_retries=4\ndeclare -r max_retry_time=3600\n\ndeclare -r tmp_dir\n\ndeclare -r pub_key_name=\"jumpcloud-remote-assist-agent.gpg.asc\"\ndeclare -r install_prefix=\"/opt/jc_user_ro\"\ndeclare -r apps_path=\"/usr/share/applications\"\ndeclare -r raa_directory=\"${install_prefix}/jumpcloud-remote-assist\"\ndeclare -r raa_desktop_file=\"${raa_directory}/resources/build-app/linux/jumpcloud-remote-assist.desktop\"\ndeclare -r raa_service_install_file=\"${raa_directory}/resources/build-app/linux/raasvc-install.sh\"\ndeclare -r raa_binary_path=\"${raa_directory}/jumpcloud-remote-assist\"\n\ndeclare -r remote_pub_key_url=\"https://cdn02.jumpcloud.com/production/remote-assist/jumpcloud-remote-assist-agent.gpg.asc\"\ndeclare -r remote_tgz_url=\"https://cdn02.jumpcloud.com/production/remote-assist/versions/${raa_version}/jumpcloud-remote-assist-agent_${arch}.tar.gz\"\n\ndeclare -r old_pub_key_fingerprint=\"83463C47A34D1BC1\"\ndeclare -r pub_key_fingerprint=\"8C31C1376B37D307\"\ndeclare -r owner_trust=\"C2122200660347DB094054808C31C1376B37D307:6:\"\ndeclare -r tgz_name=\"jumpcloud-remote-assist-agent.tar.gz\"\ndeclare -r sig_name=\"${tgz_name}.zig\"\n\ndeclare -r local_pub_key_path=\"${tmp_dir}/${pub_key_name}\"\ndeclare -r local_tgz_tmp_path=\"${tmp_dir}/${tgz_name}\"\ndeclare -r local_sig_tmp_path=\"${tmp_dir}/${sig_name}\"\n\ndeclare -r remote_sig_url=\"${remote_tgz_url}.sig\"\n\nfunction cleanup() {\n rm -rf \"${tmp_dir}\"\n}\n\nfunction download_single_file() {\n local url=${1}\n local local_file=${2}\n\n echo \"Downloading ${url}\"\n\n curl_output=$(curl -v --trace-time \\\n --max-time \"${timeout}\" --retry \"${max_retries}\" \\\n --retry-max-time \"${max_retry_time}\" \\\n --output \"${local_file}\" \"${url}\" -C - 2>&1)\n\n rc=$?\n if [[ \"$rc\" != \"0\" ]]; then\n echo \"Failed to download ${url}\"\n echo \"${curl_output}\"\n exit ${rc}\n fi\n}\n\nfunction remove_old_pub_key() {\n if gpg --list-keys | grep -q \"${old_pub_key_fingerprint}\"; then\n echo \"Removing old public key ${old_pub_key_fingerprint}\"\n gpg --batch --yes --delete-key \"${old_pub_key_fingerprint}\"\n fi\n}\n\nfunction install_pub_key() {\n remove_old_pub_key\n\n output=$(gpg --list-keys | grep \"${pub_key_fingerprint}\")\n if [[ \"${output}\" == \"\" ]]; then\n download_single_file \"${remote_pub_key_url}\" \"${local_pub_key_path}\"\n echo \"Importing public key ${pub_key_fingerprint}\"\n gpg --import \"${local_pub_key_path}\"\n echo \"${owner_trust}\" | gpg --import-ownertrust\n fi\n}\n\nfunction verify_signature() {\n local sig=\"${1}\"\n local tgz=\"${2}\"\n gpg --verify \"${sig}\" \"${tgz}\" 2>&1\n}\n\nfunction download_files() {\n download_single_file \"${remote_tgz_url}\" \"${local_tgz_tmp_path}\"\n download_single_file \"${remote_sig_url}\" \"${local_sig_tmp_path}\"\n if ! verify_signature \"${local_sig_tmp_path}\" \"${local_tgz_tmp_path}\"; then\n echo \"Unable to verify signature for ${tgz_name}\"\n exit 1\n fi\n}\n\nfunction uncompress_tarball() {\n echo \"Installing new RAA\"\n mkdir -p \"${install_prefix}\"\n chmod 755 \"${install_prefix}\"\n tar zxf \"${local_tgz_tmp_path}\" -C \"${install_prefix}\"\n}\n\nfunction remove_old_raa_dir() {\n if [[ -d \"${raa_directory}\" ]]; then\n echo \"Removing old RAA\"\n rm -rf \"${raa_directory}\"\n fi\n}\n\nfunction kill_running_raa_instance() {\n local pid_list\n pid_list=$(pidof \"${raa_binary_path}\")\n for raa_pid in ${pid_list}; do\n echo \"Stopping remote assist process ${raa_pid}\"\n kill -9 \"${raa_pid}\"\n done\n}\n\nfunction install_new_raa() {\n remove_old_raa_dir\n uncompress_tarball\n}\n\nfunction install_desktop_file() {\n echo \"Installing desktop shortcut\"\n if [[ -d \"${apps_path}\" ]]; then\n cp \"${raa_desktop_file}\" \"${apps_path}\"\n if command -v \"update-desktop-database\" &>/dev/null; then\n update-desktop-database\n fi\n fi\n}\n\nfunction install_raasvc_file() {\n echo \"Installing raasvc and raal service\"\n if [[ -f \"${raa_service_install_file}\" ]]; then\n chmod +x \"${raa_service_install_file}\"\n /bin/bash \"${raa_service_install_file}\"\n fi\n}\n\nfunction main() {\n trap cleanup EXIT\n install_pub_key\n download_files\n kill_running_raa_instance\n install_new_raa\n install_desktop_file\n install_raasvc_file\n}\n\nmain", "link": "https://github.com/TheJumpCloud/support/blob/master/PowerShell/JumpCloud%20Commands%20Gallery/Linux%20Commands/Linux%20-%20remote-assist%20-%20Installation%20script.md", - "description": "This script installs rempte assist application on the Linux machine." + "description": "This script installs remote assist application on the Linux machine." }, { "name": "Mac - Disable Local User | v1.0 JCCG",