🚀 Host SmartConsole Extensions locally on your firewall management
🔒 Most secure way to host and access SmartConsole Extensions
👍 No third-party hosting software required
One-liner (Bash) to localize SmartConsole Extensions.
In expert mode run:
_smx(){ printf "\n _ ____ ____ ____ _ _ _____ ____ _____ \n| |__ / () \\/ (__\` / () \\ | |__ | |\` / /_| ===|| () )\n|____|\\____/\\____)/__/\\__\\|____||_| /___/|____||_|\\_\\ \n";printf '%.s ' {1..26};printf "for SmartConsole Extensions\n\n";read -p "Public extension URL: " u;[[ $u == https://* && $u == *.json ]]||{ echo Error: URL must start with https:// and point to .json;echo;return;};f=$(basename "$u");p="";i=$(grep proxy:ip /config/active|awk '{print $2}');o=$(grep proxy:port /config/active|awk '{print $2}');[[ $i ]]&&p="--proxy $i:$o";curl_cli $p --cacert $CPDIR/conf/ca-bundle.crt -fsSL "$u" -o "$f.tmp"||{ echo Error: Failed to download SmartConsole Extension;rm -f "$f.tmp";echo;return;};$CPDIR/jq/jq -e . "$f.tmp" >/dev/null 2>&1||{ echo Error: Invalid JSON syntax of SmartConsole Extension;rm -f "$f.tmp";echo;return;};e=$($CPDIR/jq/jq -r '.locations[0]."ui-element".action.url' "$f.tmp");[[ $e && $e != null ]]||{ echo Error: Couldn\'t find the url field in "$f";rm -f "$f.tmp";echo;return;};x=$(basename "$e");[[ $e == http*://* ]]&&w="$e"||{ [[ $e == /* ]]&&w="${u%%/*}//${u#*//}";w="${w%%/*}$e";[[ $e != /* ]]&&w="${u%/*}/$e";};curl_cli $p --cacert $CPDIR/conf/ca-bundle.crt -fsSL "$w" -o "$x.tmp"||{ echo Error: Failed to download extension file $w;rm -f "$f.tmp";echo;return;};d=/web/htdocs2/smx;[[ -d $d ]]||mkdir -p "$d";chmod o+rx "$d";$CPDIR/jq/jq ".locations[0].\"ui-element\".action.url=\"$x\"" "$f.tmp">"$f.tmp2";mv "$f.tmp2" "$f.tmp";mv -f "$f.tmp" "$d/$f"||{ echo "Error: Failed to move $f.tmp to $d/$f";rm -f "$f.tmp" "$x.tmp";echo;return;};mv -f "$x.tmp" "$d/$x"||{ echo "Error: Failed to move $x.tmp to $d/$x";rm -f "$f.tmp" "$x.tmp";echo;return;};chmod o+r "$d/$f" "$d/$x";l=/web/htdocs2/login;ln -sf "$d/$f" "$l/$f";ln -sf "$d/$x" "$l/$x";echo -n "Localized extension URL: ";h=$(grep hosts:v4:mgmt:address /config/active|awk '{print $2}');s=$(grep httpd:ssl_port /config/active|awk '{print $2}');[[ $s == 443 ]]&&echo https://$h/login/$f||echo https://$h:$s/login/$f;echo;};_smx;unset -f _smx
Simply copy & paste the localized URL into your SmartConsole > Manage & Settings > Preferences > SmartConsole Extensions
Done. 🎉
If your firewall management has no internet access to localize SmartConsole Extensions with this tool, easily localize them manually following these steps:
- Download the SmartConsole Extension .json manifest file
- Download the SmartConsole Extension file that is referenced in the url field of the .json file
- If the url field contains url or path information, remove it to just have the filename in there
- Example: "url": "ipcalc.htm"
- Login to your firewall management (expert mode) and create a folder named
smx in /web/htdocs2/
- chmod o+rx
/web/htdocs2/smx
- Copy the two SmartConsole Extension files into the newly created
smx folder
- chmod o+r
/web/htdocs2/smx/*
- Go to
/web/htdocs2/login and create symlinks to your SmartConsole Extension files
- Example:
ln -s /web/htdocs2/smx/ipcalc.json & ln -s /web/htdocs2/smx/ipcalc.htm
- Open SmartConsole and load your SmartConsole Extension via https://ip-of-your-management/login/manifest.json