I think it would be nice to have that option in web interface.
I have looked inside neptune354 source.
In
http://opensvn.csie.org/neptune354/trun ... firewall.c there is a code:
Code:
if (remotemanage)
{
/* zhangbin 2005.3.21 */
char http_wanport_buf[10];
//char *http_wanport = nvram_safe_get("http_wanport");
//char *http_wanport_buf = malloc(strlen(http_wanport) + 1);
memset(http_wanport_buf,0,sizeof(http_wanport_buf));
//strncpy(http_wanport_buf, http_wanport, strlen(http_wanport));
strcpy(http_wanport_buf, nvram_safe_get("http_wanport"));
//http_wanport_buf[strlen(http_wanport)] = '\0';
save2file("-A PREROUTING -p tcp -m tcp -d %s --dport %s "
"-j DNAT --to-destination %s:%d\n"
, wan_if_addr[conn_no]
, http_wanport_buf/*nvram_safe_get("http_wanport")*/
, nvram_safe_get("lan_ipaddr")
, web_lanport);
//free(http_wanport_buf);
}
I think it wouldn't be that hard to add similar code for ssh.
In Google Code I have found
source code of tofu that does exactly that but with a bit different code:
Code:
/* Enable remote management */
if (remotemanage) {
save2file("-A PREROUTING -p tcp -m tcp -d %s --dport %s "
"-j DNAT --to-destination %s:%d\n",
wanaddr, nvram_safe_get("http_wanport"),
nvram_safe_get("lan_ipaddr"), web_lanport);
}
/* do the same for ssh remote management */
if ((nvram_match("sshd_enable", "1")) && (nvram_match("sshd_remote", "1"))) {
save2file("-A PREROUTING -p tcp -m tcp -d %s --dport %s "
"-j DNAT --to-destination %s:%s\n",
wanaddr, nvram_safe_get("ssh_wanport"),
nvram_safe_get("lan_ipaddr"), nvram_safe_get("sshd_port"));
}