nano /usr/local/opnsense/service/conf/actions.d/actions_custom.conf
[squidvpnproxy]command: /root/vpnscript.shparameters:type:scriptmessage: reload proxy with vpn interfacedescription: VPN via Proxy script
./proxyipupdate.sh: 27: Syntax error: Unterminated quoted string./proxyipupdate.sh: 27: Syntax error: Error in command substitution
nano proxyipupdate.sh
# VariablesVPN_IFACE=ovpnc1SQUID_CONFIG_FILE=/usr/local/etc/squid/squid.conf# Get current IP address of VPN interfaceVPN_IFACE_IP=$(ifconfig $VPN_IFACE | awk '{print $2}' | egrep -o '([0-9]+\.){3}[0-9]+')# Check if VPN interface is up and exit if it isn'tif [ -z "$VPN_IFACE_IP" ]then exit 0;fi# Check current IP for VPN interface in squid.conf fileVPN_CONFIG_IP=$(grep -m 1 "tcp_outgoing_address" $SQUID_CONFIG_FILE | awk '{print $2}' | egrep -o '([0-9]+\.){3}[0-9]+')# Check if the config file matches the current VPN interface IP, and if so exit scriptif [ "$VPN_IFACE_IP" == "$VPN_CONFIG_IP" ]then exit 0;fi# Replace the previous IP address in the squid.conf file with the current VPN interface addresssed -ie 's/'"$VPN_CONFIG_IP"'/'"$VPN_IFACE_IP"'/' $SQUID_CONFIG_FILE# Force reload of the new squid.conf file/usr/local/sbin/squid -k reconfigure
chmod 755 proxyipupdate.sh
acl VPNUsers src 192.168.20.0/24 tcp_outgoing_address (VPN IP) VPNUsers
root@opn:~ # ./proxyipupdate.shVPN_IFACE=ovpnc1: Command not found.SQUID_CONFIG_FILE=/usr/local/etc/squid/squid.conf: Command not found.Illegal variable name.
bash proxyipupdate.sh
/usr/local/etc/squid/post-auth/custom.conf/usr/local/etc/squid/pre-auth/custom.conf