Tilted Forum Project Discussion Community  

Go Back   Tilted Forum Project Discussion Community > Interests > Tilted Technology


 
 
LinkBack Thread Tools
Old 06-11-2005, 01:37 AM   #1 (permalink)
Crazy
 
trib767's Avatar
 
Location: London, UK
SSH via web browser ?

Hello, I want to configure SSH access to my server (Linux) that can be accessed via a web browser. Here's the important bit: the comms between the browser and the server must go over HTTP (80) or HTTPS (443).

I just got MindTerm up and running but, while it is a very nice SSH client that runs very nicely in a browser, it does still use port 22.

I want to be able to access my server from any web browser without opening my server's port 22 to the internet and without worrying about whether the browser's local network has 'special' ports open for outgoing traffic. Most places with web browsers will have 80 and 443 open so this is the way to go.

Ideas, suggestions, tips....
trib767 is offline  
Old 06-11-2005, 03:55 AM   #2 (permalink)
Darth Papa
 
ratbastid's Avatar
 
Location: Yonder
You could take down the web server and configure a SSH server to use a custom port, 80 or 443. But you can only have one server listening on a given port. So while you've got your SSH going, you'd have to do without http or https.

I've seen CGI-like applications that mimic the shell by taking command line arguments in a form field and excecuting them on the server. There are major issues of security and usability there, though--obviously, your shell is exposed over the web browser which scares me silly, and you're only able to operate as the web server's user, which won't get you very far anyway.
ratbastid is offline  
Old 06-11-2005, 09:04 PM   #3 (permalink)
Insane
 
Location: Just West of Hell
Yeah, you really have to be careful about opening port 22 to the world. Since ssh/sftp/scp, etc run off of the same port, you really open up a hole that you don't want to mess with...

Can you use a webshare over https instead??? That's what we do in the Windows world. It authenticates using AD. You may be able to do the same thing using ldap....
__________________
Pimps and Ho's - it's this generation's cowboys and indians
beejay is offline  
Old 06-12-2005, 01:29 AM   #4 (permalink)
Crazy
 
trib767's Avatar
 
Location: London, UK
I am not going to open port 22. The only ports that will be open are 80 and 443. So my ssh client will have to somehow "tunnel" over one of these two ports. I prefer 443 as that can be wrapped in SSL security too.

I'll post the solution here when I have one. I'm pretty certain this can be done. I have the bricks but need to get the mortar.

beejay you mention ldap. This is just a directory service - I already use it as my central user-data repository on my domain controller. I'm not sure how it fits into a web tunnelling scheme ?
trib767 is offline  
Old 06-12-2005, 04:20 AM   #5 (permalink)
Darth Papa
 
ratbastid's Avatar
 
Location: Yonder
Well, hang on there. There's nothing inherantly scarier about one port over another. And there's nothing magically secure about port 443. A port is a port. It has a server running on it. Those servers have functions. End of story. Port 443 can be "wrapped in SSL security" only if the server behind that port provides that function. I don't even know what you mean by that.

Port 22 is the common port for ssh (and scp, which is provided by sshd, but not sftp which is a different thing altogether). As a result there will be doorknob-rattle attempts on port 22 more than on other ports, maybe, but that's really all. Choose decent passwords and you'll be fine.

Now, ssh tunneling is a whole other issue. With ssh tunneling, you can route OTHER protocols and services over an ssh-encrypted connection. Protocols like X or POP or ftp, for instance. It doesn't have anything to do with putting ssh on a non-standard port. You could route your https traffic through an ssh tunnel on port 443, but that would require all https users to have a live ssh connection to your server, which you probably don't want.

You haven't said what distro you're using. To put ssh on a non-standard port, you either use inetd or you configure the server manually to its own port, in whatever config files your server comes with. That's pretty much it. My Windows ssh client of choice, PuTTY, lets you specify the port to connect with.

In short, if you can trust an ssh server on port 443, you can trust it just as well on port 22 (or 2222 or 2020). And there's no way to put ssh "behind" http or https, though if you really want to--and everyone who's hitting this website has an account to ssh to--you can route those services through ssh connections.

I recommend you open up one non-standard port for ssh. Look, you could just turn the computer off and it would be 100% secure, right? What you want here is to balance security against usability. That's the whole game with practical security management. As long as you keep up with patches, sshd should be adequately secure, even running on port 22. scp uses the same security functions as ssh, so there's no additional risk to letting that run. And I'm speaking as a guy who has had two dozen servers get completely pwned due to out-of-date sshd patches. Entirely my fault--I didn't keep up with it and I got what I deserved. Don't do that. I don't anymore!

Just out of curiosity: You keeping state secrets on this box? Why isn't the industry-standard secure shell application secure enough for you? Are you unable to open additional ports on your router or something?
ratbastid is offline  
Old 06-12-2005, 04:49 AM   #6 (permalink)
Professional Loafer
 
bendsley's Avatar
 
Location: texas
Quote:
Originally Posted by beejay
It authenticates using AD. You may be able to do the same thing using ldap....
You do know that AD uses LDAP and Kerberos to authenticate against right?

As far as sFTP is concerned.

The common method for most Web users to transfer files to and from their Web hosting account is to use an FTP Client. Easy-to-use graphical user interfaces (GUIs) allow the user to drag and drop files between local computer and remote server - in a very easy manner. FTP clients allow the user to upload/download files, change file permissions using CHMOD command and more. All very convenient.

However, FTP and Unix command operations such as RCP are not secure. Packet sniffers can quite easily capture usernames, passwords and file content. If you have your own server, then you most likely know about FTP vulnerabilities. For the 'average' Web user, the 'sniffing' opportunities FTP and RCP provide (by sending the information 'in the clear' as ASCII plain text) are not known by many.

SSH1 combated this issue to an extent by using what is known as 'Port Forwarding' (aka SSH tunneling). FTP traffic (which uses standard TCP connections) can be port-forwarded over secure shell - preventing username and password sniffing. However, the file content must be transferred outside the secure shell over an unprotected clear text data connection.

SSH1 used 'port-forwarding' RCP (Remote copy) and FTP tunneled over a secure shell session. SCP (Secure copy) is the name used to refer to port-forwarding of the RCP command.

SFTP - Key Points

* SFTP doesn't require an FTP server - it operates on the SSH server.
* SFTP protects every piece of information sent over the network. Usernames, passwords and the data.
* An SFTP client running SSH software encrypts and tunnels traffic to a secure shell server, where the tunneled stream is decrypted.
* FTP, RCP » Data not encrypted. Username, password and data is sent in the clear. Prone to packet sniffing.
* SCP, FTP over a secure shell » Username and password is encrypted, but data is sent in the clear.
* SFTP is ideal for use by businesses who need to send sensitive information securely » company reports, financial statements, confidential files and so on. SFTP is ideal for secure file transfer within and between businesses.
* The server you are connecting to must have an SSH server installed (with SSH2). Most servers have Open source SSH servers already set-up (Openssh.com). There are also a number of commercial SSH servers on the market.
* Connecting to an SSH server with an SFTP client is very much like you would with an FTP client - with 2 exceptions. 1) You connect using the SFTP protocol: sftp://www.yourdomain.com. 2) You connect to Port 22 (The SSH port), NOT Port 21 (The FTP port).
* SFTP clients are readily available for download - both FREE (open source) and commercial versions for use on both Unix, Linux and Windows OS platforms.
* Using an SFTP client is easy-as-pie - just like it is when connecting with your favorite FTP client (which may in fact already support SSH2 connections and SFTP).
* SFTP may also use many features of SSH such as public-key encryption and compression.
__________________
"You hear the one about the fella who died, went to the pearly gates? St. Peter let him in. Sees a guy in a suit making a closing argument. Says, "Who's that?" St. Peter says, "Oh, that's God. Thinks he's Denny Crane."

Last edited by bendsley; 06-12-2005 at 04:53 AM..
bendsley is offline  
Old 06-12-2005, 10:37 AM   #7 (permalink)
Crazy
 
trib767's Avatar
 
Location: London, UK
I want to be able to log onto my box from remote locations. I can't guarantee that outgoing connections on port 22 will be allowed. I can guarantee that if I try this from work that it is most definately not allowed. The only outgoing ports allowed from work are 80 and 443. Hence I need to do this over one of those ports.

There's something called "corkscrew" out there that seems to do this but I haven't got to the bottom of it yet.

Ideally I want to be able to point a browser at my web server and somehow get an ssh login going. I have the browser bit working with a java ssh client called Mindterm but that still uses port 22. I need to sort that bit out next
trib767 is offline  
Old 06-12-2005, 10:56 AM   #8 (permalink)
Darth Papa
 
ratbastid's Avatar
 
Location: Yonder
Aha. Now I understand your limitations. Really, no OUTGOING 22? That's surprising. I can totally get blocking incoming port 22 connections (or maybe forwarding them someplace other than to you), but blocking the outgoing port is just harsh. Maybe you've got a friend in IT who can relax that for you?

Okay, well, set up your sshd to run on port 443 and forget about https. Or... Figure out some way to trigger the server to switch what service is running on that port.

Then (and here's the main thing) go download PuTTY. It's a very nice windows freeware app. It lets you specify the port you want to ssh to. Yes that means you have to have it on your desktop rather than pulling your client down from the server, but... Maybe you could stick it on a flash thumb drive or something.
ratbastid is offline  
Old 06-12-2005, 01:14 PM   #9 (permalink)
Crazy
 
trib767's Avatar
 
Location: London, UK
Quote:
Originally Posted by ratbastid
Or... Figure out some way to trigger the server to switch what service is running on that port.
This is exactly what I've been thinking!! I was wondering if there is some kind of proxy that will recognise incoming connections of different protocols and send them to different services.

I don't want to have to kill off my web server (I use 443 for other web based things).

Yes my company is harsh. They close everything in both directions unless there is a business reason for not doing so. I can understand why they do this though.

I use PuTTY on machines I regularly use and I'd thought of just changing the port it connects to but, as I said above, I was hoping not to have to sacrifice one service (httpss) so another (ssh) can use it's port.
trib767 is offline  
Old 06-12-2005, 11:34 PM   #10 (permalink)
Irresponsible
 
yotta's Avatar
 
if the web server is apache, you could use mod_proxy to tunnel to the ssh server...

Make sure mod_proxy is turned on, and add the following to your httpd.conf

Code:
ProxyRequests On
AllowCONNECT 22
<Directory proxy:*>
    Deny from all
</Directory>
<Directory proxy:127.0.0.1:22>
    Allow from all
</Directory>
__________________
I am Jack's signature.

Last edited by yotta; 06-13-2005 at 12:11 AM..
yotta is offline  
Old 06-13-2005, 10:44 AM   #11 (permalink)
Insane
 
trache's Avatar
 
Quote:
I use PuTTY on machines I regularly use and I'd thought of just changing the port it connects to but, as I said above, I was hoping not to have to sacrifice one service (httpss) so another (ssh) can use it's port.
To scan packets to have a program proxy your request to another is suicide. Your router is not likely going to be able to do it (unless of course you have a sophisticated one), and at any rate, the service/routr/firewall will be too bogged down by trying to filter requests that it won't be worth it.

That's likely one reason SysAdmins at large corporations try to limit their firewall rules to the bare essentials.

WeirdX is an X-Windows JAVA client that can run in your browser. That may or may not suffice.

Are you sure you cannot run your web server under port 81, 8080, 8000 or something similar? Why not try accessing your web server through another proxy service such as The Cloak? They should be able to bring you the pages you request over any port to you no problem.
__________________
"You looked at me as if I was eating runny eggs in slow motion." - Gord Downie of The Tragically Hip
trache is offline  
Old 06-15-2005, 11:29 AM   #12 (permalink)
Crazy
 
trib767's Avatar
 
Location: London, UK
I've come across GNU httptunnel. Anyone got any experiences. It seems it might be the answer ?
trib767 is offline  
Old 06-15-2005, 03:44 PM   #13 (permalink)
Gentlemen Farmer
 
j8ear's Avatar
 
Location: Middle of nowhere, Jersey
Quote:
Originally Posted by ratbastid
Well, hang on there. There's nothing inherantly scarier about one port over another. And there's nothing magically secure about port 443. A port is a port. ...

...Choose decent passwords and you'll be fine.
Damn, that was particularly well said.

Kudos

-bear
__________________
It's alot easier to ask for forgiveness then it is to ask for permission.
j8ear is offline  
Old 06-16-2005, 07:23 PM   #14 (permalink)
Irresponsible
 
yotta's Avatar
 
mod_proxy!

Quote:
Originally Posted by trib767
I've come across GNU httptunnel. Anyone got any experiences. It seems it might be the answer ?
Mindterm has built in HTTP proxy support, so just enable that, and use the apache mod_proxy config I mentione before. This will put SSH and HTTP on the same port. I tested it on my server after posting, seems to work just fine.
__________________
I am Jack's signature.
yotta is offline  
Old 06-19-2005, 08:28 AM   #15 (permalink)
Crazy
 
trib767's Avatar
 
Location: London, UK
Quote:
Originally Posted by yotta
Mindterm has built in HTTP proxy support, so just enable that, and use the apache mod_proxy config I mentione before. This will put SSH and HTTP on the same port. I tested it on my server after posting, seems to work just fine.
Isn't the Mindterm proxy settings referring to the "local" proxy that is on the same local network as the browser. The mod_proxy apache config would need to be on the "remote" web server at the destination network.

I've got apache config for mod_proxy so it can "AllowCONNECT" to port 22 but that is on my host. My apache is not the local proxy to which Midterm directly connects.

Or maybe I just don't understand how proxies work ?
trib767 is offline  
Old 06-21-2005, 09:42 AM   #16 (permalink)
Irresponsible
 
yotta's Avatar
 
Quote:
Originally Posted by trib767
Isn't the Mindterm proxy settings referring to the "local" proxy that is on the same local network as the browser. The mod_proxy apache config would need to be on the "remote" web server at the destination network.

I've got apache config for mod_proxy so it can "AllowCONNECT" to port 22 but that is on my host. My apache is not the local proxy to which Midterm directly connects.

Or maybe I just don't understand how proxies work ?
No, the proxy can be any machine. Using your server as the proxy will work fine. Also, please make sure you use the access control restrictions I listed, or else some clown fill find the proxy and abuse it.
__________________
I am Jack's signature.
yotta is offline  
Old 06-25-2005, 06:29 AM   #17 (permalink)
Crazy
 
trib767's Avatar
 
Location: London, UK
Thanks very much yotta that works perfect. Next thing is to test it from work!

Also do you know if it is possible to do a proxy connect over https ?

Last edited by trib767; 06-25-2005 at 06:37 AM..
trib767 is offline  
Old 06-27-2005, 02:34 PM   #18 (permalink)
Crazy
 
trib767's Avatar
 
Location: London, UK
Ok, I have another problem. I need to proxy-chain because I HAVE to use the proxy at work to get outside and then I need my server's proxy to be used as this does the AllowConnect.

Can Mindterm or PuTTY be used with a proxy chain ?
trib767 is offline  
Old 06-29-2005, 12:14 AM   #19 (permalink)
Irresponsible
 
yotta's Avatar
 
Quote:
Originally Posted by trib767
Ok, I have another problem. I need to proxy-chain because I HAVE to use the proxy at work to get outside and then I need my server's proxy to be used as this does the AllowConnect.

Can Mindterm or PuTTY be used with a proxy chain ?
Have you checked to see if the proxy at work will allow you to connect? (telnet in to the proxy and do 'CONNECT yourhostort HTTP/1.0' and see if it connects.
PuTTY will work fine with a proxy chain, mindterm will not unless you have a signed copy (due to java security restrictions). I don't know about chaining proxies from windows, I'd start a new thread for that, but putty should be fine with it.

Final note: MAKE FUCKING SURE YOU WILL NOT GET FIRED FOR PROXY CHAINING!!!! Ask the IT guys if it's OK, and GET IT IN WRITING.
__________________
I am Jack's signature.
yotta is offline  
 

Tags
browser, ssh, web


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 01:13 AM.

Tilted Forum Project

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360