Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Encryption Security

SSH or IPSec? 43

shawngiese asks: "I'm looking for some feedback on which is the better way to make VPN connections - using SSHv2 or IPSec. My company apliware.com makes embedded linux firewalls here in Switzerland. Our next firmware will be coming out with SSH added to IPSec but during my tests I have noticed that the throughput of SSH is much faster when using the same ciphers. Is there any opinions on which has the better key exchange and also if the performance is better for SSH everywhere or just on our port/CPU? I assume since they both use the same ciphers that the data is as secure in one or the other. Of course IPSec offers full tunneling and encapsulation of more than just TCP but I can SSH through almost any NAT box and with the gain in throughput and many free clients for road warriors (even my Palm Pilot for terminal access) I wonder if SSH might not be the easier VPN than IPSec."
This discussion has been archived. No new comments can be posted.

SSH or IPSec?

Comments Filter:
  • And the answer is... (Score:4, Interesting)

    by PD ( 9577 ) * <slashdotlinux@pdrap.org> on Monday April 28, 2003 @05:48PM (#5829302) Homepage Journal
    ssh.

    As a consultant I've had to work with different remote access solutions, and everything except for ssh is a huge pain in the ass. Some of them don't work with anything but Windows, and most of them are too complicated for a large organization to figure out. If you're a big company and you don't want to frustrate your users, go with ssh. Otherwise, you're going to condemn everyone who wants to get hooked up to at least 4 weeks of phone call support hell.

    • I agree ssh, hands down, especially if you use compression too. My employer uses the Cisco VPN client for remote access by Windows machines. Cisco allegedly has a Linux client too, but I've not had a lot of pleasant experience with it. We (the Unix admins) had been using ssh to work from home for so long, we didn't even get any argument about using it instead of the VPN when the late scuffle in the desert broke out.
    • by Brian Hatch ( 523490 ) * on Monday April 28, 2003 @07:18PM (#5830008) Homepage Journal
      Never use a VPN when a single SSH or SSL connection will do.

      SSH can tunnel any number of ports along with the actual login stream, so you could have multiple ports on your local box that get tunneled through the secure connection. Say your SSH session terminates (through a firewall) to a box on the corporate LAN, and you tunnel IMAP, MySQL, and Squid. Point mutt and mysql to localhost, and point your browser to localhost as a proxy. Voila - you have secure access, no special software required.

      Stunnel can do the same thing, and is often faster because it only does the tunneling, and it doesn't need to transmit them all within the same single connection. Stunnel 4.x can handle multiple ports in separate threads like magic. End result though is that you can map the ports/services you actually require, and only those bits are open. Yes, it's not a VPN (unless you want PPP over SSH/SSL, see my comment below), but in most cases you don't need one.

      (Weird coincidence: I'll be giving a talk wednesday at real world linux about this very topic, and will be putting up the presentation when I get back. If anyone else is braving SARS in Toronto, stop by and say hi.)

      • The best part is using mindterm to tunnel ssh over https through my clients firewalls. It always freaks them out to see my homeoffice desktop via vnc over ssh over https with a zero foot print client.

        Joe
    • I currently have 16 sites VPNed back to a central site using VTUN.
      http://vtun.sourceforge.net/ [sourceforge.net]

      Works like a charm, setup is a breeze, just need port 5000 (or whatever u choose) open on the firewall from authorised clients.
      We use tightVNC and ssh and webmin etc over the link.

      no worries.

      Soon to bump this up to 100 sites

  • by Anonymous Coward
    From what I can see if it is Windows, you'll probably have an easier time deploying ipsec. In the land of unix, ssh is sanctum. Sure, there are putty and its workalikes to bring ssh to Windows, but to ask a Windows user to call putty a VPN is asking for trouble.
  • SSH is my preference (Score:5, Informative)

    by Korgan ( 101803 ) on Monday April 28, 2003 @06:07PM (#5829443) Homepage
    Given the proliferation of NAT on many fronts now, I personally have used, installed and maintained SSH VPNs on many of my clients networks because I find it a lot more reliable than IPSec.

    Here in NZ, ADSL is running via PPPoATM and all network terminators must be running NAT (this is a requiremet of the Telco, not of the technology). Because of the much lower costs of DSL vs Frame, this is becoming the default setup for most companies now. IPSec in this kind of environment where NAT is at both ends, or even just one, becomes a real PITA to get running and keep running. SSH just works.

    Once the keys are set at both ends, the tunnels just do their thing. Establishing ports is not difficult. For my setup I create Virtual IPs at both ends of the network and then essentially do port forwarding across the tunnel to those ports. Essentially a combination of SSH and (in my case) IPTABLES. Works very well, very sweetly and NAT doesn't cause me any problems.
    • by GigsVT ( 208848 ) *
      What about the TCP over TCP avelanche problem that the CIPE guys like to talk about? Is that just something they made up to push CIPE?
      • by Brian Hatch ( 523490 ) * on Monday April 28, 2003 @07:12PM (#5829960) Homepage Journal
        No, it is definitely a problem. Eventually, over a slow link that drops packets, the TCP over TCP problem results in increasing retransmit times, which can slow things down. However you can usually stop/start the VPN again very quickly (run a script out of cron that checks ping response times) and you won't loose the existing connections (though they will hang for a while, obviously.)

        Over stable links, you're unlikely to have a problem though.

    • For my setup I create Virtual IPs at both ends of the network and then essentially do port forwarding across the tunnel to those ports. Essentially a combination of SSH and (in my case) IPTABLES. Works very well, very sweetly and NAT doesn't cause me any problems.

      I'm very interested in this - could you go into a bit more detail or provide a link to some documentation? I've used vtun (vtun.sf.net) for years and years, and it is handy, but I'm always interested in other approaches.
    • this [de-generationx.net] is fucking disgraceful, man. How do you equate driving like a cunt with knowing about VPN's? I just don't get it.

      Dave :(
      • You have no idea of the circumstances, preparation, precautions or anything else about the event, nor do you even know me.

        Who are you to judge me?

        More over, how does one picture of a single event have any bearing at all on my knowledge or anything else other than the event itself?

        Is this honestly the best place to even have this discussion?
        • You have no idea of the circumstances, preparation, precautions or anything else about the event

          True, except that was was accompanied by at least one picture driving into Auckland - that, to be honest, I could have *sworn* claimed to have been taken at 180K.

          More over, how does one picture of a single event have any bearing at all on my knowledge or anything else other than the event itself?

          It was on the website referenced in your public information on slashdot. The site's tagline is "Korgan's news ram
  • Both (Score:4, Informative)

    by sporty ( 27564 ) on Monday April 28, 2003 @06:09PM (#5829466) Homepage
    ipsec has the advantages of encrypting entire lines with a good setup. ipsec has the disadvantage of having to be setup (exchanging keys, etc etc). you do excahnge keys via non-network like a good boy, right?

    ssh has the advantage of having very little setup and is uber portable. problem is, you can't encrypt an entire line easily, like you might with stunnel, or the contender, ipsec.

    But why contend? You are comparing two things that don't really compete directly. They come about it from different directions. One achieves security by encrypting telnet (and adding a bunch of features), while the other achieves security by encrypting the entire line.

    Granted, using both might be overkill, but hey, it depends on how ipsec is used with the OS and when the decripted data is viewable. Anyone get tcpdump to work on the ipsec layer yet?

    • Re:Both (Score:1, Informative)

      by Anonymous Coward
      he is talking about doing a VPN via SSH tunnels vs ipsec...all ip packets for all services go thru ssh links on two linux boxes on both ends which act as gateways.
      not the ssh telnet replacement only.
    • Re:Both (Score:5, Informative)

      by 4of12 ( 97621 ) on Monday April 28, 2003 @06:56PM (#5829842) Homepage Journal

      ssh has the advantage of having very little setup and is uber portable. problem is, you can't encrypt an entire line easily,

      The cheapo VPN solution that springs to mind in this case is something like running PPPoE on the ssh connection like this [geocrawler.com].

      I haven't done this, so I don't know whether this is easy or hard to setup. Someone here must know.

      • PPP over SSH/SSL/etc (Score:5, Informative)

        by Brian Hatch ( 523490 ) * on Monday April 28, 2003 @07:09PM (#5829940) Homepage Journal
        PPP (I haven't used PPPoE) over SSH or SSL/TLS (Stunnel) works like a charm. The problem is correctly configuring the authentication (you want to have both machines authenticate the other) and locking it down (you don't want the user to be able to do *anything* except create the network connection) and automating the route additions and any other changes (easiest to handle via ppp's up/down script support.)

        I've written up step-by-step instructions and scripts that will do the whole durned thing, no brain required, that are in Building Linux VPNs [buildinglinuxvpns.net], but was unable to convince NewRiders that one of these chapters should be the one put online. (Instead they picked chapter 1 which, while fine, doesn't provide any instantly-usable information for someone trying to actually build a VPN.

        There are a few examples on stunnel.org [stunnel.org] for setting one up with Stunnel (3.x). You may also want to learn how to correctly use and restrict passwordelss SSH ability here [hackinglinuxexposed.com] including using authprogs [hackinglinuxexposed.com] to restrict commands. (You do use command="",no-port-forwarding,no-x11-forwarding,no -agent-forwarding,from="" in all your .ssh/authorized_keys don't you? )

        Eventually, the TCP over TCP factor will kick in, and your VPN will be slow. But with a simple ping timer, you can kill/restart connections pretty painlessly via cron.

        Plus, no kernel recompilation is required.

  • I prefer ssh (Score:3, Interesting)

    by Fished ( 574624 ) * <amphigory@gma[ ]com ['il.' in gap]> on Monday April 28, 2003 @07:12PM (#5829956)
    I've had very poor experiences with IPSEC based products - they tend to be more or less flaky. Also, newer versions of ssh have the ability to run a SOCKS4 server (using the -D option) - I then point Mozilla at that (Chimera is my "regular" browser). Between that and X-windows/vnc, i can do everything i need to and don't have to have some nasty,proprietary client. (Furthermore, everything I need is included in the OS - which means I can get in from just about any computer, anywhere with a net connection.)
  • Should I use FTP or HTTP to allow custommers to download files from my systems. I know that FTP was designed for file transfer, but HTTP is so much easier and user friendly. Which one should I allow my users to use.

    Shouldn't the answer be YES, just use whatever works best.

    On a real note the IPsec implementation (free/SWAN) is not the best implementation of IPsec in the world, specifically if you are interested look at the OpenBSD IPsec implementation that takes advantage of crypto offload nics that

    • by erth64net ( 47842 ) on Monday April 28, 2003 @09:04PM (#5830647) Homepage
      FreeS/WAN may not be _The Best_, but it's darn good enough:
      I have a system where 12 sizable offices come into a FreeS/WAN router via a 1.5Mbit link, and the VPN moves on average 1Mbit/sec between these offices (sometimes peaks to 1.5Mbit). The VPN router that all 12 networks point to is a Pentium 166 w/ 64MB of ram, the router's been up for over 6 months (an office move required a shutdown 6 months ago), and the VPN only adds around 5 to 10 ms of latency to the connection. Heck, I get better network performance out of this setup, than my old Cisco's did running point-to-point frame-relay.

      The FreeS/WAN product can also offload [freeswan.org] the crypto tasks to hardware devices when really necessary.
      • Hmmmm... 1.5 Mbit crypto just isn't interesting. Of course that is what most people are dealing with on the client end (if not slower with DSL). However crypto on a server are much more interesting. Do you think a web server will deal with only a simple MB of traffic. For interesting designs I want to look at designs that can pass close to gigabit of encrypted traffic AND the Asymetric crypto to go along with it.

        I don't think you could get that out of a 4 way Xeon system

        • by Anonymous Coward
          Hell, thats not interesting at all. The only thing that is interesting it TB/ms traffic that is encrypted with 10MB (byte not bit) keys 100,000x times or more with alternating encrpytions. But of cource I can do this on my C64.
        • Maybe not interesting to you, but to most of the people out there - getting 1.5MBit on a low-end machine is far more than they could have asked for. Move up the ladder to a faster system, and you can push much more than that (for example. you can push 45Mbit/sec with a 1.2Ghz Pentium using FreeS/WAN [freeswan.org] - this is the equivalent of a fully loaded T3, or 28 fully loaded T1's). Could you get gigabit DES3 out of a 4 way xeon? Maybe...

          Regarding a webserver only dealing with 1Mbit/sec of traffic - yes I believe this
          • I didn't say the webserver would be running IPsec. However, I would like to see your 1.2 Ghz PIII handle a webserver even at 1 Mbit. The problem isn't the bulk crypto, that is easy, now do 100 Asymetric Crypto operations a second... Oh wait, you can't (well unless you count 512 bit, but then we want real crypto, so lets do 2048)

            Also the current IPsec NIC from Intel costs 60 bucks. Can't plug it into FreeSWAN, but Oh well

            • Actually one of my webservers handles 1Mbit without a sweat - but this is a very well designed and mostly static site, with little going on that is generated on the fly. I know someone who runs the systems for a DNS registar, and he claims to have servers that handle far more than that.

              For the NICs, I was thinking gigabit IPSec NICs. Either way, my point was that IPSec enabled NICs were pennies compared to the monthly cost of say an OC12. Look at it this way; if you can save your company $30k+ on not havin
  • depends on how... (Score:5, Informative)

    by josepha48 ( 13953 ) on Monday April 28, 2003 @08:01PM (#5830316) Journal
    ... much you want to secure...

    I use ipsec and wep on my wireless. wep is the 'tease'.. and ipsec does the work. This is because I want to secure the entirety of traffic...

    I can do ssh over ipsec as you mentioned. I never really noticed a speed slowdown, but never benchmarked it.

    If there is only one port and one protocol that you are trying to secure then ssh tunneling will suffice. That is assuming you can direct ALL the traffic you want through that tunnel. I have a friend who set up a tunnel to tunnel port 139 so he could mount windows shares at home. Problem is that he could only mount 1 share at a time.

    From the sounds of it this is the case.

    With ssh tunneling it would be easeier to setup. Anyone could set up the tunnel. With ipsec it is required that one have sysadmin privs or have ipsec set up.

    Key exchange is the real thing here. In ipsec keys are required (AFAIK). You can also set up racoon and have auto-exchanging keys. In ssh you have the option to setup keys to be required, but by default they are not. So ssh could be either an encrypted telnet session or it could be a key excehange encrypted session. I always opt for a key exchange session. Personally I go for the more secure the better. Just my parynoia though. It all depends on your level of required security and what you want to secure.

  • It ships with the latest redhat distros. Is brain-dead easy to setup. I'm using it now to connect multiple boxes for MySQL replication across the Internet. However, when using Windows workstations, I use puTTY and make SSH tunnels to my remote MySQL, IMAP, POP3, etc servers. I'm interested in IPSec but, sadly, haven't had a lot of success getting it going between platforms.
  • SSH vs IPsec (Score:4, Informative)

    by w01f1e ( 669307 ) on Tuesday April 29, 2003 @05:08AM (#5832446)
    SSH is a great secure connection software, not a VPN software. It's can be used to for simple problems, where you want a no hassle portable solution.

    IPsec is conceptually much prefered, and also indeed more secure. It is a more complex solution, implementations aren't always stable and are less tested. It is also the standard, if any, for TCP/IP encryption.

    SSH should have more overhead for a solution involving the same kind of encryption level and security, and should thus be slower, but this might not be the case in real life. A comparison on an OpenBSD platform would probably be fair, but make sure not to compare a full blown IPsec solution to a simple SSH stream.

    Example: You have 10 geographically separated offices...

    If you tried to do this using SSH tunnels I would laugh my head off... I'd use OpenBSD/IPsec.

    Example: You want to make an existing, specific stream, encrypted.

    Tunnel it through SSH.
  • by Shoten ( 260439 ) on Tuesday April 29, 2003 @08:40AM (#5832944)
    SSH will only carry TCP traffic. If you need to encrypt anything involving UDP or ICMP (or anything else for that matter), you cannot use SSH to get the job done, except by adding on more clunkiness in the form of things that will encapsulate connectionless protocols within TCP sessions. At that point, you're no longer reaping the benefits of simplicity that come from using something like stunnel [stunnel.org], and it's better to bite the bullet and become adept with VPNs (check out FreeS/WAN [freeswan.org]). On the upside, once you have VPN expertise in hand, you open up a new world of options for other things as well.
  • by apankrat ( 314147 ) on Tuesday April 29, 2003 @01:53PM (#5835950) Homepage
    There are few aspects of SSH vs. IPsec that you seem to be missing:

    * first of all, IPsec can go through NAT, no problem. There is a couple of IETF drafts that - define just that IPsec NAT Traversal [ietf.org]. Drafts are in their 5th revision, and Cisco, SSH, Nortel and some other manifacturers already support NAT-T and are quite interoperable with each other. Keep in mind though that it's UDP based, and that's the way it must be, because ...

    * TCP-based VPNs (and SSH/SSL tunneling in particular) are prone to a trivial DoS attacks, which severely depricates their robustness. I put a quick paper [cipherica.com] together that provides a bit more details on the subject.

    * keep also in mind that tunneling over SSH leads to TCP-over-TCP encapsulation, which is considered by many 'a bad idea' [sites.inka.de] in general due to the induced TCP retransmission problems.

    * you may also consider that SSH comes with a higher average per-packet overhead (due to TCP ACKs), which may require more frequent re-keying when compared to IPsec, which in turn may bring overall VPN performance down.

    The bottom line is I would not recommend SSH over IPsec unless it's a time-critical project .. or you dont have a budget for a decent IPsec client :)
  • by nologin ( 256407 ) on Tuesday April 29, 2003 @04:06PM (#5837285) Homepage

    Well, since I work in the infosec industry and have used both myself, they both have their good and bad points.

    SSH (the quick and dirty solution)

    If all you really care about is encrypting your data and only need to forward a few connections, then SSH is a great candidate. It provides your basic encryption which is a must for security reasons.

    However, it is essentially a stopgap measure to tunnel data between client and server. While you can forward as many ports as you have available, you can only tunnel TCP connections (unless you want the IP-over-TCP-over-TCP kludge) and you can only forward a finite amount of connections.

    Also, tunneling over TCP is not the preferred method to tunnel connections. While it does provide some method to acknowledge the receipt of a packet, several latentcy problems can occur when TCP-over-TCP tunneling (as the packet overhead starts increasing dramatically if a connection problem occurs).

    IPSec

    One of the benefits of IPSec is that tunneling connections is no longer a major factor to consider. You can tunnel the entire Internet through IPsec without having to worry how many TCP port forwardings you can configure.

    While it may be more difficult to initially setup a working infrastructure, it causes less headaches after it is proven to work properly.

    Also, IPSec will work on a NAT connection. As long as your IKE requests (on UDP port 500) are not source port translated when traversing the NAT device, you can establish an IPSec session (and I have got this working myself).

    Again, it really depends on what you need it for. For simple jobs, I use SSH. However, it doesn't scale very well, nor does it cover the full range of IP services that IPSec can handle.

  • Your company makes embedded firewalls? You MAKE firewalls? And you are asking Slashdot if SSH is better than IPSec?

    Fortunately, the companies that I purchase firewall and VPN devices from know both of these protocols intimately. Some of them even had a hand in developing the protocols themselves. These companies also know what the pros and cons of each protocol are and which should be used in any give situation. I would expect nothing less from a company that MAKES firewall and VPN devices.
  • It depends on your intended application.

    AFAIK SSH/STunnel implementations tend to be TCP centric. Applications requiring UDP lean towards IPSec flavoured tunnels.

    Bottom line MAPI over putty doesn't work (unless you enable OWA and http/tcp at which point there are dozens of more robust options).

  • - SSH only tunnels specified ports which is a pain if you need to tunnel several services or complicated protocols. Plus it makes things difficult to configure if you're constantly switching between wireless and ethernet on the same system.

    - PPPoE (or similar) over SSH can be incredibly unreliable. It's the TCP-over-TCP problem and you will sometimes see connections just freeze up.

    - IPsec is a pain in the ass to configure. I've noticed most implementations are pretty crappy. I've seen similar problems
  • I've done both (Score:2, Informative)

    by myz24 ( 256948 )
    I have used both SSH and FreeS/WAN IPsec to tie private networks together. My current setup brings together our two business locations. One location has a cable modem setup, the other DSL. Along with this, I create IPSec tunnels from my home to both locations, so that I can remotely manage those locations via vnc or what ever. My two Linux systems (both P166's) having been running for over 200 days with very few problems, it's been a true set it and forget (but remember it when someone calls ;-)) it deal

The use of money is all the advantage there is to having money. -- B. Franklin

Working...