I think what you want is configurable, there's no need for any extra script. It is not recommended to open the Luci interface or ssh server to the outside because of possible security issues, though.
The Image Builder can be used to make a custom image with your own config files already in the root filesystem. After flashing this image it will immediately start working with your configuration.
You would need to pre-make an /etc/config/network file for your WAN connection, and an /etc/config/firewall replacing the default to open ports to outside. It is OK to expose Dropbear to the Internet if you use public key authentication, which requires placing a key in /etc/dropbear/authorized_keys and configuring dropbear in /etc/config/dropbear. Never open LuCI to the Internet.
well, config was premade, but I couldn't attach him as imagebuilder package. I tried to open another compatible firmware with firmware mod kit, but got failure. What it can be?