diff --git a/bin/BIG-IP-13.1.0.8-ILX-WebSSH2-current.tgz b/bin/BIG-IP-13.1.0.8-ILX-WebSSH2-current.tgz new file mode 100644 index 0000000..d7dc6e8 Binary files /dev/null and b/bin/BIG-IP-13.1.0.8-ILX-WebSSH2-current.tgz differ diff --git a/bin/BIG-IP-13.1.0.8-ILX-WebSSH2-current.tgz.sha256 b/bin/BIG-IP-13.1.0.8-ILX-WebSSH2-current.tgz.sha256 new file mode 100644 index 0000000..db8f6ff --- /dev/null +++ b/bin/BIG-IP-13.1.0.8-ILX-WebSSH2-current.tgz.sha256 @@ -0,0 +1 @@ +26e5b0c2aa2c3d064b682f327cad337f5f1f5e3a1251845db19c36eeadcb3fd1 ./bin/BIG-IP-13.1.0.8-ILX-WebSSH2-current.tgz diff --git a/bin/BIG-IP-ILX-WebSSH2-current.tgz b/bin/BIG-IP-ILX-WebSSH2-current.tgz deleted file mode 100644 index 29efaae..0000000 Binary files a/bin/BIG-IP-ILX-WebSSH2-current.tgz and /dev/null differ diff --git a/env.sh b/env.sh deleted file mode 100755 index 7aa6578..0000000 --- a/env.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -ilxhost=root@192.168.30.209 -workspace_name=webssh2 -package_name=BIG-IP-13.1.0.8-ILX-WebSSH2 -pua_location=../f5-pua/bin diff --git a/revsync.sh b/revsync.sh deleted file mode 100755 index f0c5311..0000000 --- a/revsync.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -source env.sh - -rsync -e 'ssh -ax' -av --delete --exclude='.DS_Store' --exclude extensions/$workspace_name/node_modules workspace/. $ilxhost:/var/ilx/workspaces/Common/$workspace_name/. - -ssh $ilxhost chown -R root.sdm /var/ilx/workspaces/Common/$workspace_name/ -ssh $ilxhost chmod -R ug+rwX,o-w /var/ilx/workspaces/Common/$workspace_name/ -ssh $ilxhost chmod u+rw,go-w /var/ilx/workspaces/Common/$workspace_name/version -ssh $ilxhost chmod u+rw,go-w /var/ilx/workspaces/Common/$workspace_name/node_version diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..b95be88 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash +## Syncs from BIG-IP and builds a release based on version in extensions/ephemeral_auth/package.json + +source ./scripts/env.sh + +source ./scripts/util.sh + +./scripts/pull.sh + +package_version=$(jq -r ".version" workspace/extensions/webssh2/package.json) + +webssh_workspace_name=$webssh_workspace_name-$package_version + +ssh -o ClearAllForwardings=yes $webssh_ilxhost /bin/tar czf - -C /var/ilx/workspaces/Common/$webssh_workspace_name . > Build/Release/$webssh_package_name-$package_version.tgz + +cp Build/Release/$webssh_package_name-$package_version.tgz $webssh_pua_location/$webssh_package_name-current.tgz +shasum -a 256 $webssh_pua_location/$webssh_package_name-current.tgz > $webssh_pua_location/$webssh_package_name-current.tgz.sha256 + +find . -name '.DS_Store' -type f -delete diff --git a/scripts/env.sh b/scripts/env.sh new file mode 100755 index 0000000..c00dd7c --- /dev/null +++ b/scripts/env.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +webssh_ilxhost=root@192.168.30.209 +webssh_workspace_name=webssh2 +webssh_package_name=BIG-IP-13.1.0.8-ILX-WebSSH2 +webssh_pua_location=./bin diff --git a/scripts/pull.sh b/scripts/pull.sh new file mode 100755 index 0000000..dd51cf9 --- /dev/null +++ b/scripts/pull.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# +# ./scripts/pull.sh +# +# bill@f5.com +# +# Pulls an ILX workspace from a BIG-IP and syncs to ./workspace, excludes +# ./workspace/extensions/ephemeral_auth/node_modules. + +source ./scripts/env.sh + +source ./scripts/util.sh + +PACKAGE_VERSION=$(jq -r ".version" workspace/extensions/webssh2/package.json 2>&1) + +webssh_workspace_name=$webssh_workspace_name-$PACKAGE_VERSION + +# check to see if the workspace actually exists before attempting to copy over + +output=$(ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh list ilx workspace $webssh_workspace_name one-line 2>&1) +result="$?" 2>&1 + +if [ $result -ne 0 ]; then + echo -e "\n\n" + echo "Workspace: $webssh_workspace_name not found, are you sure that's the right one?" + echo -e "\n\n" + echo "Terminating." + echo -e "\n\n" + exit 255 +fi + +output=$(rsync -e 'ssh -o ClearAllForwardings=yes -ax' -avq --include="extensions/ephemeral_auth/node_modules/f5-*" --exclude=".DS_Store" --exclude="extensions/ephemeral_auth/node_modules/*" $webssh_ilxhost:/var/ilx/workspaces/Common/$webssh_workspace_name/. workspace/. 2>&1) +result="$?" 2>&1 + +if [ $result -ne 0 ]; then + echo -e "\n\n" + echo "Something went wrong with the rsync..." + echo -e "\n\n" + echo "Terminating." + echo -e "\n\n" + exit 255 +fi \ No newline at end of file diff --git a/scripts/push.sh b/scripts/push.sh new file mode 100755 index 0000000..03d0269 --- /dev/null +++ b/scripts/push.sh @@ -0,0 +1,86 @@ +#!/bin/bash +# +# ./scripts/push.sh +# +# bill@f5.com +# +# Pushes ./workspace to a BIG-IP ILX workspace +# + +source ./scripts/env.sh + +source ./scripts/util.sh + +# get version of package from package.json +PACKAGE_VERSION=$(jq -r ".version" workspace/extensions/webssh2/package.json 2>&1) + +# creates new workspace name with version +webssh_workspace_name=$webssh_workspace_name-$PACKAGE_VERSION + +echo -e "\n" +echo "Checking $webssh_ilxhost for workspace $webssh_workspace_name" +output=$(ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh list ilx workspace $webssh_workspace_name one-line 2>&1) +result="$?" 2>&1 + +if [ $result -ne 0 ]; then + echo -e "\n" + echo "Workspace: $webssh_workspace_name not found, attempting to create" + echo -e "\n\n" + output=$(ssh -o ClearAllForwardings=yes $webssh_ilxhost "tmsh create ilx workspace $webssh_workspace_name node-version 6.9.1" 2>&1) + result="$?" 2>&1 + if [ $result -ne 0 ]; then + echo -e "\n\n" + echo "Error creating workspace: $webssh_workspace_name... I give up, not sure what's going on..." + echo -e "\n\n" + exit 255 + fi +fi + +echo -e "\n" +echo "Pushing ./workspace to $webssh_ilxhost at $webssh_workspace_name" +rsync -e 'ssh -o ClearAllForwardings=yes -ax' -avq --delete --exclude='.DS_Store' --exclude extensions/webssh2/node_modules workspace/. $webssh_ilxhost:/var/ilx/workspaces/Common/$webssh_workspace_name/. + +echo -e "\n" +echo "Setting permissions at $webssh_workspace_name on $webssh_ilxhost" +output=$(ssh -o ClearAllForwardings=yes $webssh_ilxhost "chown -R root.sdm /var/ilx/workspaces/Common/$webssh_workspace_name/; \ + chmod -R ug+rwX,o-w /var/ilx/workspaces/Common/$webssh_workspace_name/; \ + chmod u+rw,go-w /var/ilx/workspaces/Common/$webssh_workspace_name/version; \ + chmod u+rw,go-w /var/ilx/workspaces/Common/$webssh_workspace_name/node_version" 2>&1) +result="$?" 2>&1 +if [ $result -ne 0 ]; then + echo -e "\n\n" + echo "Error setting permissions... I give up, not sure what's going on..." + echo -e "\n\n" + exit 255 +fi + +echo -e "\n" +echo "Installing node modules at $webssh_workspace_name on $webssh_ilxhost" +output=$(ssh -o ClearAllForwardings=yes $webssh_ilxhost "cd /var/ilx/workspaces/Common/$webssh_workspace_name/extensions/webssh2; npm i --production" 2>&1) +result="$?" 2>&1 + +if [ $result -ne 0 ]; then + echo -e "\n" + echo "Error installing modules \"npm i --production\", process incomplete." + echo -e "\n" + echo "See output below:" + echo -e "\n" + echo $output + + exit 255 +fi + +echo "Switching plugin to new workspace..." +# switch plugin to new workspace +output=$(ssh -o ClearAllForwardings=yes $webssh_ilxhost tmsh modify ilx plugin WebSSH_plugin from-workspace $webssh_workspace_name 2>&1) +result="$?" 2>&1 +if [ $result -ne 0 ]; then + echo -e "\n\n" + echo "I give up, not sure what's going on..." + echo -e "\n\n" + exit 255 +fi + +echo -e "\n" +echo "Push complete, associated $auth_workspace_name with a WebSSH_plugin plugin. Test and validate." +echo -e "\n" diff --git a/build.sh b/scripts/util.sh similarity index 54% rename from build.sh rename to scripts/util.sh index accf215..7fdb206 100755 --- a/build.sh +++ b/scripts/util.sh @@ -1,9 +1,8 @@ #!/bin/bash -## Syncs from BIG-IP and builds a release based on version in extensions/ephemeral_auth/package.json +# Utility functions / scripts -source env.sh - -which jq +# check for jq and try to install... +output=$(which jq 2>&1) if [[ $? -ne 0 ]]; then echo -e "You need to install jq: https://stedolan.github.io/jq\n" echo -e "If you have *brew* you can install with:\n" @@ -28,16 +27,4 @@ if [[ $? -ne 0 ]]; then exit 255 fi fi -fi - -./sync.sh - -package_version=$(jq -r ".version" workspace/extensions/$workspace_name/package.json) - -ssh $ilxhost /bin/tar czf - -C /var/ilx/workspaces/Common/$workspace_name . > Build/Release/$package_name-$package_version.tgz - -cp Build/Release/$package_name-$package_version.tgz $pua_location/$package_name-current.tgz -shasum -a 256 $pua_location/$package_name-current.tgz > $pua_location/$package_name-current.tgz.sha256 - -find . -name '.DS_Store' -type f -delete -find $pua_location -name '.DS_Store' -type f -delete +fi \ No newline at end of file diff --git a/scripts/ver.sh b/scripts/ver.sh new file mode 100755 index 0000000..72101c3 --- /dev/null +++ b/scripts/ver.sh @@ -0,0 +1,29 @@ +#!/bin/bash +## displays and optionally changes version of product + +source ./scripts/env.sh + +source ./scripts/util.sh + +echo +# get current version of workspace, ask to change or rebuild +webssh_ilx_ver=$(jq -r ".version" ./workspace/extensions/webssh2/package.json 2>&1) +if [[ $? -ne 0 ]]; then exit; echo "error reading ILX irule version";fi + +echo "Current version of $webssh_workspace_name is: $webssh_ilx_ver" + +echo -n "If you want to change this version, enter it now otherwise press enter to retain: " + +read newver + +echo + +if [[ ("$newver" != "") ]]; then + echo "Updating version of ILX to: $newver" + export newver + jq --arg newver "$newver" '.version = $newver' < ./workspace/extensions/webssh2/package.json > ./workspace/extensions/webssh2/package.json.new + if [[ $? -ne 0 ]]; then exit; echo "error changing version - ilx";fi + mv ./workspace/extensions/webssh2/package.json.new ./workspace/extensions/webssh2/package.json +else + echo "No changes made" +fi diff --git a/sync.sh b/sync.sh deleted file mode 100755 index 46c0135..0000000 --- a/sync.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -source env.sh - -rsync -e 'ssh -ax' -av --exclude extensions/$workspace_name/node_modules $ilxhost:/var/ilx/workspaces/Common/$workspace_name/. workspace/.