Koozali.org: home of the SME Server
Obsolete Releases => SME Server 9.x => Topic started by: tolistim on August 20, 2018, 09:08:21 PM
-
My webmaster was mucking around with iBay settings and has botched our system to the point that we can't connect to the web server-manager interface (I'm working on that issue separately and all other services work normally). In the mean time, I need to set up a quick port forward on the server. Does anyone have a CLI example for setting up a port forward rule for 9.2?
Thanks,Tim
-
Tim
Did you try the text based server manager.
Log in as root
Then type
console
Press Enter
Then select server manager from menu.
It could be that the text based manager is also "broken".
-
Tried that first and then realized that because the text-based server-manager still depends on the web interface, it's broken both places.
-
Tried that first and then realized that because the text-based server-manager still depends on the web interface, it's broken both places.
1. in /home/e-smith/db for the following 2 files :
portforward_tcp
portforward_udp
if you do not have any existing rules then these files will look like :
# DO NOT MODIFY THIS FILE.
# This file is automatically maintained by the Mitel Networks SME Server
# configuration software. Manually editing this file may put your
# system in an unknown state.
#
# updated: Thu Aug 9 19:34:43 2018
Here is what the file looks like ( i created a test port forward for tcp )
# DO NOT MODIFY THIS FILE.
# This file is automatically maintained by the Mitel Networks SME Server
# configuration software. Manually editing this file may put your
# system in an unknown state.
#
# updated: Mon Aug 20 22:50:35 2018
26296=forward|AllowHosts|192.168.1.2|Comment|wb test|DenyHosts|0.0.0.0/0|DestHost|localhost|DestPort|26296
This is what is logged when creating the above from server-manager :
Aug 20 22:50:35 roxy1 /etc/e-smith/web/panels/manager/cgi-bin/portforwarding[24732]: /home/e-smith/db/portforward_tcp: OLD 26296=(undefined)
Aug 20 22:50:35 roxy1 /etc/e-smith/web/panels/manager/cgi-bin/portforwarding[24732]: /home/e-smith/db/portforward_tcp: NEW 26296=forward
Aug 20 22:50:35 roxy1 /etc/e-smith/web/panels/manager/cgi-bin/portforwarding[24732]: /home/e-smith/db/portforward_tcp: OLD 26296=forward
Aug 20 22:50:35 roxy1 /etc/e-smith/web/panels/manager/cgi-bin/portforwarding[24732]: /home/e-smith/db/portforward_tcp: NEW 26296=forward|DestHost|localhost
Aug 20 22:50:35 roxy1 /etc/e-smith/web/panels/manager/cgi-bin/portforwarding[24732]: /home/e-smith/db/portforward_tcp: OLD 26296=forward|DestHost|localhost
Aug 20 22:50:35 roxy1 /etc/e-smith/web/panels/manager/cgi-bin/portforwarding[24732]: /home/e-smith/db/portforward_tcp: NEW 26296=forward|DestHost|localhost|DestPort|26296
Aug 20 22:50:35 roxy1 /etc/e-smith/web/panels/manager/cgi-bin/portforwarding[24732]: /home/e-smith/db/portforward_tcp: OLD 26296=forward|DestHost|localhost|DestPort|26296
Aug 20 22:50:35 roxy1 /etc/e-smith/web/panels/manager/cgi-bin/portforwarding[24732]: /home/e-smith/db/portforward_tcp: NEW 26296=forward|Comment|wb test|DestHost|localhost|DestPort|26296
Aug 20 22:50:35 roxy1 /etc/e-smith/web/panels/manager/cgi-bin/portforwarding[24732]: /home/e-smith/db/portforward_tcp: OLD 26296=forward|Comment|wb test|DestHost|localhost|DestPort|26296
Aug 20 22:50:35 roxy1 /etc/e-smith/web/panels/manager/cgi-bin/portforwarding[24732]: /home/e-smith/db/portforward_tcp: NEW 26296=forward|AllowHosts|192.168.1.2|Comment|wb test|DestHost|localhost|DestPort|26296
Aug 20 22:50:35 roxy1 /etc/e-smith/web/panels/manager/cgi-bin/portforwarding[24732]: /home/e-smith/db/portforward_tcp: OLD 26296=forward|AllowHosts|192.168.1.2|Comment|wb test|DestHost|localhost|DestPort|26296
Aug 20 22:50:35 roxy1 /etc/e-smith/web/panels/manager/cgi-bin/portforwarding[24732]: /home/e-smith/db/portforward_tcp: NEW 26296=forward|AllowHosts|192.168.1.2|Comment|wb test|DenyHosts|0.0.0.0/0|DestHost|localhost|DestPort|26296
Aug 20 22:50:35 roxy1 esmith::event[24733]: Processing event: portforwarding-update
Aug 20 22:50:35 roxy1 esmith::event[24733]: Running event handler: /etc/e-smith/events/actions/generic_template_expand
Aug 20 22:50:35 roxy1 esmith::event[24733]: expanding /etc/rc.d/init.d/masq
Aug 20 22:50:35 roxy1 esmith::event[24733]: generic_template_expand=action|Event|portforwarding-update|Action|generic_template_expand|Start|1534798235 555086|End|1534798235 949021|Elapsed|0.393935
Aug 20 22:50:35 roxy1 esmith::event[24733]: Running event handler: /etc/e-smith/events/actions/adjust-services
Aug 20 22:50:36 roxy1 esmith::event[24733]: adjusting non-supervised masq (adjust)
Aug 20 22:50:36 roxy1 esmith::event[24733]: adjust-services=action|Event|portforwarding-update|Action|adjust-services|Start|1534798235 949473|End|1534798236 643620|Elapsed|0.694147
Might be another way ( more correct ), but i think this should work :
: create the file in /home/e-smith/db/portforward_tcp
signal-event portforwarding-update
-
That's what I was missing - the signal-event portforwarding-update
Thanks!
-
Glad you got that sorted.
Not seen that before. I'll try and check if it is possible to to it entirely by CLI and add it to the wiki.
Always worth a browse through
/etc/e-smith/events
And
/etc/e-smith/events/actions
Some expect input but surprising what you can learn in there.
-
A bit more information for the future.
The server-manager sets these:
db portforward_tcp show
24444=forward
AllowHosts=192.168.10.1
Comment=Test
DenyHosts=0.0.0.0/0
DestHost=192.168.97.100
DestPort=24444
You can manually add a port forward like this:
db portforward_tcp set {port} forward AllowHosts {some.host.ip} Comment {Test} Denyhosts {0.0.0.0/0} DestHost {dest.host.ip} DestPort {port}
db portforward_tcp set {port} forward AllowHosts {some.host.ip} Comment {Test} Denyhosts {0.0.0.0/0} DestHost {dest.host.ip} DestPort {port}
You really need a minimum of port, DestPort and DestHost
Note the following defaults unless set:
AllowHosts 0.0.0.0/0
DestPort will be set to Port if DestPort is not set
AllowHosts can be a comma separated line e.g.
AllowHosts 0.0.0.0/0,192.68.0.1
You can check the code here:
/etc/e-smith/templates/etc/rc.d/init.d/masq/91adjustPortForward
AllowHosts/DenyHosts are also used here if set:
/etc/e-smith/templates/etc/rc.d/init.d/masq/90InboundUDP10filter_tcp
/etc/e-smith/templates/etc/rc.d/init.d/masq/90InboundUDP10filter_udp
And not forgetting:
signal-event portforwarding-update
HTH
-
https://wiki.contribs.org/DB_Variables_Configuration#Port_Forwarding
-
Thanks, ReetP. That's a great addition to the docs.
-
NP.... better late than never !!
-
NP.... better late than never !!
Thanks ReetP .. fixed minor spelling on wiki ( signal-event postforwarding-update ) to signal-event portforwarding-update
-
Thanks :-)
Bad hair day rolling asterisk modules :lol: