Skip to content

Commit

Permalink
Netskope (20 November)
Browse files Browse the repository at this point in the history
  • Loading branch information
rneher-igel committed Nov 20, 2023
1 parent 2189554 commit 37f2826
Show file tree
Hide file tree
Showing 5 changed files with 332 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CP_Source/Apps/Netskope/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Netskope (20 November)

-----

**NOTE:** Builder works for OS11 (build with Ubuntu 18.04 - bionic) and **pending** OS12 (build with Ubuntu 20.04 - focal)

-----

| CP Information | |
|-----------------|------------|
| Package | [Netskope](https://docs.netskope.com/en/netskope-help/netskope-client/netskope-client-supported-os-and-platform/) |
| Script Name | [netskope-cp-init-script.sh](build/netskope-cp-init-script.sh) |
| Packaging Notes | Details can be found in the build script |
| Package automation | [build-netskope-cp.sh](build/build-netskope-cp.sh) |

-----
152 changes: 152 additions & 0 deletions CP_Source/Apps/Netskope/build/build-netskope-cp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
#!/bin/bash
#set -x
#trap read debug

# Creating an IGELOS CP
## Development machine Ubuntu (OS11 = 18.04; OS12 = 20.04)
CP="netskope"
ZIP_LOC="https://github.com/IGEL-Community/IGEL-Custom-Partitions/raw/master/CP_Packages/Apps"
ZIP_FILE="Netskope"
FIX_MIME="TRUE"
CLEAN="FALSE"
OS11_CLEAN="11.08.230"
OS12_CLEAN="12.01.100"
USERHOME_FOLDERS="TRUE"
USERHOME_FOLDERS_DIRS=("custom/${CP}/userhome/.netskope")
APPARMOR="FALSE"
GETVERSION_FILE="$HOME/Downloads/NSClient*.run"
MISSING_LIBS_OS11=""
MISSING_LIBS_OS12=""

VERSION_ID=$(grep "^VERSION_ID" /etc/os-release | cut -d "\"" -f 2)

if [ "${VERSION_ID}" = "18.04" ]; then
MISSING_LIBS="${MISSING_LIBS_OS11}"
IGELOS_ID="OS11"
elif [ "${VERSION_ID}" = "20.04" ]; then
MISSING_LIBS="${MISSING_LIBS_OS12}"
IGELOS_ID="OS12"
echo "Builder has not been updated for OS12"
exit 1
else
echo "Not a valid Ubuntu OS release. OS11 needs 18.04 (bionic) and OS12 needs 20.04 (focal)."
exit 1
fi

if ! compgen -G "${GETVERSION_FILE}" > /dev/null; then
echo "***********"
echo "Obtain Netskope ${GETVERSION_FILE} for Linux (Linux version) 64bit, save into $HOME/Downloads and re-run this script "
echo "https://download-sfoster.eu.goskope.com/dlr/linux/get"
echo "***********"
exit 1
fi

sudo apt install unzip -y

mkdir build_tar
cd build_tar

for lib in $MISSING_LIBS; do
apt-get download $lib
done

mkdir -p custom/${CP}

find . -name "*.deb" | while read LINE
do
dpkg -x "${LINE}" custom/${CP}
done

#START setup
# file listing before install
pushd .
cd /
#sudo sh -c 'find bin etc home lib opt sbin usr var | sort > /tmp/find_root_listing1.txt'
sudo sh -c 'find opt usr | sort > /tmp/find_root_listing1.txt'
popd

# do install
echo "==============================================="
echo "==============================================="
echo "Installer will run and do not change defaults"
echo "==============================================="
echo "==============================================="
echo ""
read -p "(Press Enter)" name
chmod a+x ${GETVERSION_FILE}
sudo ${GETVERSION_FILE}

# file listing after install
pushd .
cd /
#sudo sh -c 'find bin etc home lib opt sbin usr var | sort > /tmp/find_root_listing2.txt'
sudo sh -c 'find opt usr | sort > /tmp/find_root_listing2.txt'
popd

# tar file of the new files
pushd .
cd /
sudo sh -c 'comm -1 -3 /tmp/find_root_listing1.txt /tmp/find_root_listing2.txt | xargs tar -cjvf /tmp/newfiles.tar.bz2'
popd

# untar files into CP
sudo tar xvf /tmp/newfiles.tar.bz2 --directory custom/${CP}
sudo mv custom/${CP}/usr/local/share/applications custom/${CP}/usr//share/applications
#END setup

if [ "${FIX_MIME}" = "TRUE" ] && [ "${IGELOS_ID}" = "OS11" ]; then
sudo mv custom/${CP}/usr/share/applications/ custom/${CP}/usr/share/applications.mime
fi

if [ "${USERHOME_FOLDERS}" = "TRUE" ]; then
for folder in "${USERHOME_FOLDERS_DIRS[@]}"; do
mkdir -p "$folder"
done
fi

if [ "${CLEAN}" = "TRUE" ]; then
echo "+++++++======= STARTING CLEAN of USR =======+++++++"
wget https://raw.githubusercontent.com/IGEL-Community/IGEL-Custom-Partitions/master/utils/igelos_usr/clean_cp_usr_lib.sh
chmod a+x clean_cp_usr_lib.sh
wget https://raw.githubusercontent.com/IGEL-Community/IGEL-Custom-Partitions/master/utils/igelos_usr/clean_cp_usr_share.sh
chmod a+x clean_cp_usr_share.sh
if [ "${IGELOS_ID}" = "OS11" ]; then
./clean_cp_usr_lib.sh ${OS11_CLEAN}_usr_lib.txt custom/${CP}/usr/lib
./clean_cp_usr_share.sh ${OS11_CLEAN}_usr_share.txt custom/${CP}/usr/share
else
./clean_cp_usr_lib.sh ${OS12_CLEAN}_usr_lib.txt custom/${CP}/usr/lib
./clean_cp_usr_share.sh ${OS12_CLEAN}_usr_share.txt custom/${CP}/usr/share
fi
echo "+++++++======= DONE CLEAN of USR =======+++++++"
fi

wget ${ZIP_LOC}/${ZIP_FILE}.zip

unzip ${ZIP_FILE}.zip -d custom

if [ "${APPARMOR}" = "TRUE" ]; then
mkdir -p custom/${CP}/config/bin
mkdir -p custom/${CP}/lib/systemd/system
mv custom/target/build/${CP}_cp_apparmor_reload custom/${CP}/config/bin
mv custom/target/build/igel-${CP}-cp-apparmor-reload.service custom/${CP}/lib/systemd/system/
fi
mv custom/target/build/${CP}-cp-init-script.sh custom
chmod a+x custom/${CP}-cp-init-script.sh

cd custom

# edit inf file for version number
VERSION=$(head -n 25 ${GETVERSION_FILE} | grep "^appversion" | cut -d "\""" -f 2)
#echo "Version is: " ${VERSION}
sed -i "/^version=/c version=\"${VERSION}\"" target/${CP}.inf
#echo "${CP}.inf file is:"
#cat target/${CP}.inf
# new build process into zip file
sudo tar cvjf target/${CP}.tar.bz2 ${CP} ${CP}-cp-init-script.sh
zip -g ../${ZIP_FILE}.zip target/${CP}.tar.bz2 target/${CP}.inf
zip -d ../${ZIP_FILE}.zip "target/build/*" "target/igel/*" "target/target/*"
mv ../${ZIP_FILE}.zip ../../${ZIP_FILE}-${VERSION}_${IGELOS_ID}_igel01.zip
cd ../..
sudo rm -rf build_tar
61 changes: 61 additions & 0 deletions CP_Source/Apps/Netskope/build/netskope-cp-init-script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/sh

ACTION="custompart-netskope_${1}"

# mount point path
MP=$(get custom_partition.mountpoint)

# custom partition path
CP="${MP}/netskope"

# config directory
USER_CONFIG="/userhome"

# output to systemlog with ID amd tag
LOGGER="logger -it ${ACTION}"

echo "Starting" | $LOGGER

case "$1" in
init)
# Initial permissions
chown -R root:root "${CP}" | $LOGGER
# Linking files and folders on proper path
find ${CP} -printf "/%P\n" | while read DEST
do
if [ ! -z "${DEST}" -a ! -e "${DEST}" ]; then
# Remove the last slash, if it is a dir
[ -d $DEST ] && DEST=${DEST%/} | $LOGGER
if [ ! -z "${DEST}" ]; then
ln -sv "${CP}/${DEST}" "${DEST}" | $LOGGER
fi
fi
done

# basic persistency
if [ -d "${CP}${USER_CONFIG}" ]; then
chown -R user:users "${CP}${USER_CONFIG}"
fi

# after CP installation run wm_postsetup to activate mimetypes for SSO
if [ -d /run/user/777 ]; then
wm_postsetup
# delay the CP ready notification
sleep 3
fi

;;
stop)
# Unlinking files and folders on proper path
find ${CP} -printf "/%P\n" | while read DEST
do
if [ -L "${DEST}" ]; then
unlink $DEST | $LOGGER
fi
done

;;
esac
echo "Finished" | $LOGGER

exit 0
96 changes: 96 additions & 0 deletions CP_Source/Apps/Netskope/igel/netskope-profile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<profiles>
<profile>
<profile_id>5682</profile_id>
<profilename>Netskope CP</profilename>
<firmware>
<model>IGEL OS 11</model>
<version>11.09.100.01</version>
</firmware>
<description></description>
<overwritesessions>false</overwritesessions>
<is_master_profile>false</is_master_profile>
<is_igel_os>true</is_igel_os>
<settings>
<pclass name="custom_partition.enabled">
<pvalue instancenr="-1" variableExpression="" variableSubstitutionActive="false">true</pvalue>
<variableSubstitutionActive>false</variableSubstitutionActive>
</pclass>
<pclass name="userinterface.rccustom.custom_cmd_x11_final">
<pvalue instancenr="-1" variableExpression="" variableSubstitutionActive="false">systemctl enable /custom/netskope/opt/netskope/stagent/scripts/stagentd.service ; systemctl start stagentd.service</pvalue>
<variableSubstitutionActive>false</variableSubstitutionActive>
</pclass>
<pclass name="custom_partition.size">
<pvalue instancenr="-1" variableExpression="" variableSubstitutionActive="false">100M</pvalue>
<variableSubstitutionActive>false</variableSubstitutionActive>
</pclass>
</settings>
<instancesettings>
<instance classprefix="custom_partition.source%" serialnumber="-15716ed1:171bbf0e520:-8000127.0.1.1">
<ivalue classname="custom_partition.source%.autoupdate" variableExpression="" variableSubstitutionActive="false">true</ivalue>
<ivalue classname="custom_partition.source%.crypt_password" variableExpression="" variableSubstitutionActive="false"></ivalue>
<ivalue classname="custom_partition.source%.final_action" variableExpression="" variableSubstitutionActive="false">/custom/netskope-cp-init-script.sh stop</ivalue>
<ivalue classname="custom_partition.source%.init_action" variableExpression="" variableSubstitutionActive="false">/custom/netskope-cp-init-script.sh init</ivalue>
<ivalue classname="custom_partition.source%.password" variableExpression="" variableSubstitutionActive="false"></ivalue>
<ivalue classname="custom_partition.source%.url" variableExpression="" variableSubstitutionActive="false">https://[UMS_Server]:8443/ums_filetransfer/netskope.inf</ivalue>
<ivalue classname="custom_partition.source%.username" variableExpression="" variableSubstitutionActive="false">[USERNAME]</ivalue>
</instance>
<instance classprefix="sessions.custom_application%" serialnumber="-15716ed1:171bbf0e520:-7fff127.0.1.1">
<ivalue classname="sessions.custom_application%.applaunch" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.applaunch_path" variableExpression="" variableSubstitutionActive="false"></ivalue>
<ivalue classname="sessions.custom_application%.applaunch_system" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.appliance_mode_access" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.autostart" variableExpression="" variableSubstitutionActive="false">true</ivalue>
<ivalue classname="sessions.custom_application%.cmdline" variableExpression="" variableSubstitutionActive="false">/custom/netskope/opt/netskope/stagent/stAgentApp</ivalue>
<ivalue classname="sessions.custom_application%.desktop" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.desktop_path" variableExpression="" variableSubstitutionActive="false"></ivalue>
<ivalue classname="sessions.custom_application%.hotkey" variableExpression="" variableSubstitutionActive="false"></ivalue>
<ivalue classname="sessions.custom_application%.hotkeymodifier" variableExpression="" variableSubstitutionActive="false">None</ivalue>
<ivalue classname="sessions.custom_application%.icon" variableExpression="" variableSubstitutionActive="false">/custom/netskope/opt/netskope/stagent/resources/64x64_color.ico</ivalue>
<ivalue classname="sessions.custom_application%.menu_path" variableExpression="" variableSubstitutionActive="false"></ivalue>
<ivalue classname="sessions.custom_application%.name" variableExpression="" variableSubstitutionActive="false">Netskope Agent</ivalue>
<ivalue classname="sessions.custom_application%.position" variableExpression="" variableSubstitutionActive="false">0</ivalue>
<ivalue classname="sessions.custom_application%.pulldown" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.pwprotected" variableExpression="" variableSubstitutionActive="false">none</ivalue>
<ivalue classname="sessions.custom_application%.quick_start" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.restart" variableExpression="" variableSubstitutionActive="false">true</ivalue>
<ivalue classname="sessions.custom_application%.scardautostart" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.snotify" variableExpression="" variableSubstitutionActive="false">true</ivalue>
<ivalue classname="sessions.custom_application%.startmenu" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.startmenu_system" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.usehotkey" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.waitfornetwork" variableExpression="" variableSubstitutionActive="false">true</ivalue>
<ivalue classname="sessions.custom_application%.waittime2autostart" variableExpression="" variableSubstitutionActive="false">1</ivalue>
<ivalue classname="sessions.custom_application%.waittime2restart" variableExpression="" variableSubstitutionActive="false">3</ivalue>
</instance>
<instance classprefix="sessions.custom_application%" serialnumber="-15716ed1:171bbf0e520:-7fff127.0.1.1">
<ivalue classname="sessions.custom_application%.applaunch" variableExpression="" variableSubstitutionActive="false">true</ivalue>
<ivalue classname="sessions.custom_application%.applaunch_path" variableExpression="" variableSubstitutionActive="false"></ivalue>
<ivalue classname="sessions.custom_application%.applaunch_system" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.appliance_mode_access" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.autostart" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.cmdline" variableExpression="" variableSubstitutionActive="false">/custom/netskope/opt/netskope/stagent/stAgentUI</ivalue>
<ivalue classname="sessions.custom_application%.desktop" variableExpression="" variableSubstitutionActive="false">true</ivalue>
<ivalue classname="sessions.custom_application%.desktop_path" variableExpression="" variableSubstitutionActive="false"></ivalue>
<ivalue classname="sessions.custom_application%.hotkey" variableExpression="" variableSubstitutionActive="false"></ivalue>
<ivalue classname="sessions.custom_application%.hotkeymodifier" variableExpression="" variableSubstitutionActive="false">None</ivalue>
<ivalue classname="sessions.custom_application%.icon" variableExpression="" variableSubstitutionActive="false">/custom/netskope/opt/netskope/stagent/resources/64x64_color.ico</ivalue>
<ivalue classname="sessions.custom_application%.menu_path" variableExpression="" variableSubstitutionActive="false"></ivalue>
<ivalue classname="sessions.custom_application%.name" variableExpression="" variableSubstitutionActive="false">Netskope client GUI</ivalue>
<ivalue classname="sessions.custom_application%.position" variableExpression="" variableSubstitutionActive="false">0</ivalue>
<ivalue classname="sessions.custom_application%.pulldown" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.pwprotected" variableExpression="" variableSubstitutionActive="false">none</ivalue>
<ivalue classname="sessions.custom_application%.quick_start" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.restart" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.scardautostart" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.snotify" variableExpression="" variableSubstitutionActive="false">true</ivalue>
<ivalue classname="sessions.custom_application%.startmenu" variableExpression="" variableSubstitutionActive="false">true</ivalue>
<ivalue classname="sessions.custom_application%.startmenu_system" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.usehotkey" variableExpression="" variableSubstitutionActive="false">false</ivalue>
<ivalue classname="sessions.custom_application%.waitfornetwork" variableExpression="" variableSubstitutionActive="false">true</ivalue>
<ivalue classname="sessions.custom_application%.waittime2autostart" variableExpression="" variableSubstitutionActive="false">0</ivalue>
<ivalue classname="sessions.custom_application%.waittime2restart" variableExpression="" variableSubstitutionActive="false">0</ivalue>
</instance>
</instancesettings>
</profile>
</profiles>
7 changes: 7 additions & 0 deletions CP_Source/Apps/Netskope/target/netskope.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[INFO]
[PART]
file="netskope.tar.bz2"
version="X.X.X"
size="400M"
name="netskope"
minfw="11.09.100"

0 comments on commit 37f2826

Please sign in to comment.