Deprecated: Function set_magic_quotes_runtime() is deprecated in /membri/cyberstorm/phpBB3/common.php on line 106

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /membri/cyberstorm/phpBB3/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3390: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3392: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3393: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3394: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
Neptune354 • View topic - Option to allow SSH access from WAN




Neptune354


SORRY GUYS; DUE TO A BIG AMOUNT OF SPAM I HAVE BLOCKED ALL THE FORUM ACTIVITY :-/
It is currently 22 Jul 2018, 12:55

All times are UTC + 1 hour [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Option to allow SSH access from WAN
PostPosted: 12 Jun 2007, 11:39 
Offline
 Profile

Joined: 07 Jun 2007, 22:06
Posts: 31
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"));
   }


Top
 

 Post subject: Re: Option to allow SSH access from WAN
PostPosted: 15 Jun 2007, 22:08 
Offline
 Profile

Joined: 07 Jun 2007, 22:06
Posts: 31
I have now compiled my own firmware with this feature.
Thanks Marco and/or Carciofone for almost implementing this option. Commented out code was was almost all that was needed. It was only nessecary to add one rule to firewall.c. :)

Also I have added /usr/sbin to default PATH and done some minor tweaks to web interface. My router is superb now, hehe.


Top
 

 Post subject: Re: Option to allow SSH access from WAN
PostPosted: 16 Jun 2007, 12:24 
Offline
Site Admin
 Profile

Joined: 04 Jun 2007, 17:55
Posts: 67
if u want you can send me some patches/files to put in svn
cheers


Top
 

 Post subject: Re: Option to allow SSH access from WAN
PostPosted: 22 Jun 2007, 21:08 
Offline
 Profile

Joined: 07 Jun 2007, 22:06
Posts: 31
Modifications were made on Carciofone sources so patch won't work I think (not to mention that I don't know how to make diff files).
Also, I'm worried that this modification might not be top quality. It should be tested in different conditions which I have not made. For example with firewall enabled (I have it switched off) and so on.
Anyway, it works for me and I will do anything needed to get this onto some of the public builds.


Top
 

Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC + 1 hour [ DST ]



Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group  
Design By Poker Bandits