This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

SSH Port Forwarding still not working

Astaro 3.2 with all updates applied. I am forwarding http to an internal server, no problem very nice and easy. I want to forward SSH to the same server but am unable, set it up the same as the HTTP with no luck. Tried the settings from the current post: http://www.astaro.org/ubb/ultimatebb.php?ubb=get_topic;f=6;t=001078 from rob fegley
 Topic: SSH port-forwarding (DNAT) to internal/DMZ host 
 And all that happened is it killed all SSH access and I had to change it back at the terminal. 
 Tried the changes from this post: http://www.astaro.org/ubb/Forum3/HTML/000100.html
 Topic:   Port Forwarding? 
 With no luck (times out), what I have in the filter Live logs (iptables) is the following:

 under Packet Filter:
Chain USR_FORWARD (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    1    48 ACCEPT     tcp  --  *      *       0.0.0.0/0            192.168.2.5        tcp spts:1024:65535 dpt:22 
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0          tcp spts:1024:65535 dpt:80

 Under Nat Rules:
Chain AUTO_NAT_OUT (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DNAT       tcp  --  *      *       0.0.0.0/0            142.xxx.xxx.xxx    tcp spts:1024:65535 dpt:80 to:192.168.2.5 
    0     0 DNAT       tcp  --  *      *       0.0.0.0/0            142.xxx.xxx.xxx    tcp spts:1024:65535 dpt:22 to:192.168.2.5:22 

Chain AUTO_NAT_POST (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 MASQUERADE  all  --  *      eth2    192.168.2.0/24       0.0.0.0/0          

Chain AUTO_NAT_PRE (1 references)
 pkts bytes target     prot opt in     out     source               destination         
    0     0 DNAT       tcp  --  *      *       0.0.0.0/0            142.xxx.xxx.xxx    tcp spts:1024:65535 dpt:80 to:192.168.2.5 
    1    48 DNAT       tcp  --  *      *       0.0.0.0/0            142.xxx.xxx.xxx    tcp spts:1024:65535 dpt:22 to:192.168.2.5:22 
 I could not get this command from Markus to run: please copy with scp tcpdump loginuser@YOUR_FIREWALL_IP:/tmp

 I have masq set up from the local network to the external interface and it only works sporadically through win boxes, although my HTTP server seems to have no problem (in case this is somehow relevant).
 Hoping someone can help me to get this working as it is quite critical, next comes FTP and I have seen some postings on issues with that as well.


This thread was automatically locked due to age.
Parents
  • you might collide with the SSH access on the 
    Astaro itself and the auto rules for this. use a different port which you then forward, e.g. 2222
  • Still no go Andy, perhaps I'm missing something here because I don't think this should be rocket science. This is what I have set up currently>>

    service created:
      NAT_SSH TCP 1024:65535 2222 (as per your post) I have also tried 0:65534 and 22 (as per other posts)

    Nat/Masquerading:
     All -> eth2_internet_Interface__ / NAT_SSH   None   praxair_web / NAT_SSH 

    Packet Filter Rules:
      Any NAT_SSH praxair_web Allow 

     I think that this should be no more difficult than the HTTP forward on port 80 and am confused as to why it wont work. 
     Your help is appreciated.
     Thanks
Reply
  • Still no go Andy, perhaps I'm missing something here because I don't think this should be rocket science. This is what I have set up currently>>

    service created:
      NAT_SSH TCP 1024:65535 2222 (as per your post) I have also tried 0:65534 and 22 (as per other posts)

    Nat/Masquerading:
     All -> eth2_internet_Interface__ / NAT_SSH   None   praxair_web / NAT_SSH 

    Packet Filter Rules:
      Any NAT_SSH praxair_web Allow 

     I think that this should be no more difficult than the HTTP forward on port 80 and am confused as to why it wont work. 
     Your help is appreciated.
     Thanks
Children
  • Is there anything in the logs at the SSH server?  You might find it is denying you there.
    Basics:  Allow SSH to the external interface and to the inside server.  NAT from external interface to internal server.

    If you don't need SSH to the ASL box on the internet side then it is fine to use standard ports for an SSH NAT, it will override the ASL SSH.

    Mine works fine with normal ports/rules/NAT like I do for HTTPS NAT.
  • Sorry, I left off one important detail.  That being that once you've modified '/etc/sshd_config' to list the specific IP address of your internal interface on your Astaro box, you will need to stop and restart SSHD.  Again, sorry folks!  

    [QUOTE]Originally posted by kmacmillan:
    [QB]Astaro 3.2 with all updates applied. I am forwarding http to an internal server, no problem very nice and easy. I want to forward SSH to the same server but am unable, set it up the same as the HTTP with no luck. Tried the settings from the current post: http://www.astaro.org/ubb/ultimatebb.php?ubb=get_topic;f=6;t=001078 from rob fegley
     Topic: SSH port-forwarding (DNAT) to internal/DMZ host 
     And all that happened is it killed all SSH access and I had to change it back at the terminal. 

    [Extraneous information from original post suppressed]....  
  • >"Quote from pablito Is there anything in the logs at the SSH server? You might find it is denying you there."
     I can SSH to the webserver via the local lan and there is only 1 NIC so no problem there
    >"Basics: Allow SSH to the external interface and to the inside server. NAT from external interface to internal server."
     This is what I believe as well, I have tried the rules again (new day, you never know) with using the standard SSH service and a packet filter rule that allows SSH any to any (should open it up ?) And still no connect.

     With regard to rob.fegleys post "you will need to stop and restart SSHD"
     I thought that this might be the case and was unsure how to restart on the command line so I re-booted and that is when I lost all ssh and had to change the line back.
     I do appreciate your guys help, and am quite confused as to why this is not working well at all, do you know how or where I can edit the iptables?. I'm thinking that it is just not writing to it correctly and if I went in and replicated everything that works with my HTTP (except using port 22) then maybe it might work.
     Thanks
  • Since I could have been more thorough in my initial posting, I am DNAT'ing SSH on emy "eth1" to an internal box as follows:

    Assumptions
    -----------
    eth0 = Internal interface = 192.168.0.1
    eth1 = External interface

    Note: I have some static routes to other subnets (WLAN, 2nd DMZ) behind a different Linux router called Redhat1.  Those networks are declared as a group in Astaro called "All_Internal"

    -------------------------
    Web-based Configurations:
    -------------------------
    Under System:Settings:SSH Settings:Allowed Networks:
    "All_Internal" (a group of subnets behind my eth0 interface)

    Under Network:NAT/Masquerading:
    Name = SSH_Internal
    Match Params = Any->eth1/ssh
    Src Translation = None
    Dst Translation = redhat1/ssh

    Under Packet Filter Rules:
    From = Any
    Service = SSH (the one that's coded into Astaro)
    To(server) = redhat1
    Action = Allow

    -------------------------------------
    SSH- or console-based Configurations:
    -------------------------------------
    In /etc/sshd_config:
    Line 2 = "Listen 0.0.0.0"
    Since this allows SSHD to listen on all interfaces, you change this to:
    "Listen 192.168.0.1" (in my case, insert the IP of your internal interface)

    This will force the daemon to only listen on this interface, provided you restart the sshd process after editing this file.

    You restart sshd specifically by typing "/sbin/init.d/sshd restart".

    I hope this helps.  If not, reply back with issues.  As I mentioned previously, this works for me, although I haven't had to run any Up2Dates that make patches or changes to how sshd works, so I am not positive that the text-based changes will survive any Up2Dates.  But, it's so simple to re-configure this that it wouldn't bother me if it needed to be set back up after such a patch.

    Thanks again to the Astaro development team for a great product!

    RAF
  • I tried your configuration exactly as you illustrated Rob and I got the same as I had the last time, which was that all my SSH was killed through any interface and I had to go back to the terminal and change sshd_config back to its original config. Very perplexing as to why this works for you and not me, perhaps it is because of one of the new updates. 
     KDM