Closed Thread
Results 1 to 3 of 3

Thread: Restrict SSH Tunnel

  1. #1
    Hektor is offline Programmer
    Join Date
    Jan 2007
    Posts
    126
    Rep Power
    0

    Restrict SSH Tunnel

    How can I restrict SSH Tunnels to certain users? Once that is in place, how do I restrict it to certain sites only? I'd also like only certain ports to be allowed. I don't want a bunch of users using my server as their SSH tunnel for file sharing.

    I've considered a firewall, will this do the trick? What firewall should I use?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Jordan Guest
    I'm not sure how you can limit it to certain users but you can disable it by editing /etc/ssh/sshd_config and setting or adding AllowTcpForwarding to NO
    .

    sshd_config
    Code:
    AllowTcpForwarding No

  4. #3
    RHochstenbach's Avatar
    RHochstenbach is offline Learning Programmer
    Join Date
    Feb 2011
    Location
    The Netherlands
    Posts
    47
    Rep Power
    0

    Re: Restrict SSH Tunnel

    SSH listens only to the port specified in the /etc/ssh/sshd_config file, which is 22 by default. You can restrict access to users by allowing only specific IP addresses in the firewall, or by using certificate logons and issues those to the specific users. As a firewall I would suggest either IPTABLES or CSF.

    If you're using the IP access method, and use IPTABLES as a firewall, then use these lines:
    First block access to the SSH port:
    Code:
    iptables -I INPUT 4 -p tcp --dport 22 -j DROP
    Then create entries for the allowed IP addresses (replace these example addresses with the real ones):
    Code:
    iptables -I INPUT 1 -p tcp --dport 22 -s 1.1.1.1 -j ACCEPT
    iptables -I INPUT 2 -p tcp --dport 22 -s 2.2.2.2 -j ACCEPT
    iptables -I INPUT 3 -p tcp --dport 22 -s 3.3.3.3 -j ACCEPT

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 06-20-2011, 03:44 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts