You are not logged in.

#1 2008-06-13 13:14:23

vomix
Member
From: Belgium
Registered: 2007-05-02
Posts: 84

SSH, wifi & basic security.

Hi all,

I'm discovering the joy of wireless connection since two weeks, and I'm now thinking about ssh to have remote access to my old computer, now considered as a huge jukebox: plugged to the hifi system and running MPD!

Actually, it's working great (with a basic ssh configuration, created with the help of the mighty wiki), but I'm a little paranoid about security.

- My network is encrypted with WPA2 and is filtering MAC addresses,
- The two machines (host & client) have both dedicated statics IPs,
- I put the AllowUsers <myusername> option in sshd_config
- The PermitRootLogin no option in sshd_config is working, but I still can login as root with the su command, once logged as a regular user.  Is there a way to change this?
- Changing the ssh port seems logic, but to which number?  I suppose there's a range to respect, and I don't know if this will affect others applications using certain ports (eg: mpd, rtorrent,...)  I'm not familiar with those kind of things, so if someone have some good-and-not-so-technical documentation it would be cool.
- Last question: is there a way to improve the network/ssh security? tongue

Cheers,
Vomix.

Offline

#2 2008-06-13 13:29:06

sniffles
Member
Registered: 2008-01-23
Posts: 275

Re: SSH, wifi & basic security.

- The PermitRootLogin no option in sshd_config is working, but I still can login as root with the su command, once logged as a regular user.  Is there a way to change this?

Sure: chmod 000 `which su` -- and nobody will be able to use "su" [Note: probably dangerous]. The question is, why would you want to do this? What exactly would you be avoiding?

- Changing the ssh port seems logic, but to which number?

Check out /etc/services.

- Last question: is there a way to improve the network/ssh security?

"Network security" is quite a large field. SSH? How about a firewall to make sure only certain boxes can connect? How about doubling that with TCP Wrappers? Are you using passwords or public keys? How about making use of port knocking?

Offline

#3 2008-06-13 13:29:18

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: SSH, wifi & basic security.

-if you have PermitROotLogin no and you don't want to use su to login as root how do you want the restart services or make a configuration or install new software?
if you have acces directly to computer, do not put user in wheel group and su will not work smile
EDIT:
i see that i'm wrong mad
you can change the group of /bin/su to be root:wheel and the permision 750

- changing port isn't good because if somebody want to hack your server he will scan your ip and will find your ssh port even you change it. you can put what port you want even 80 if the server didn't use that one.
- no password login. use keys

Last edited by wonder (2008-06-13 13:36:48)


Give what you have. To someone, it may be better than you dare to think.

Offline

#4 2008-06-13 14:54:14

miggy
Member
From: MT
Registered: 2007-11-05
Posts: 67

Re: SSH, wifi & basic security.

wheel group restriction does work if you have the correct line in /etc/pam.d/su

auth        required    pam_wheel.so use_uid

it probably is already there just commented at the moment

Offline

#5 2008-06-13 15:30:11

zenlord
Member
From: Belgium
Registered: 2006-05-24
Posts: 1,221
Website

Re: SSH, wifi & basic security.

vomix wrote:

- My network is encrypted with WPA2 and is filtering MAC addresses,

And you're still paranoid about security?

I think you're exaggerating. If a hacker really wants to break into your system, he'll probably be able to do so no matter what you're doing to avoid it. Using WPA2 wit AES makes it very hard t break in and if you limit the connections to specified MAC-addresses, then your wireless network is a secure as it gets.

To secure the internal network from the evil internet, I would suggest the use of iptables to block all incoming traffic to your machines except the traffic coming from those same MAC-addresses.

Zl.

Offline

#6 2008-06-13 15:52:56

anrxc
Member
From: Croatia
Registered: 2008-03-22
Posts: 834
Website

Re: SSH, wifi & basic security.

vomix wrote:

- Changing the ssh port seems logic, but to which number?

wonder wrote:

- changing port isn't good because if somebody want to hack your server he will scan your ip and will find your ssh port even you change it. you can put what port you want even 80 if the server didn't use that one.

If he puts sshd on some high non standard port he could avoid a large number of automated scanning and bots/brute force attacks. Targeted attacks you wouldn't avoid... security trough obscurity, it's your choice.

Also consider using knockd.


You need to install an RTFM interface.

Offline

#7 2008-06-13 16:18:04

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: SSH, wifi & basic security.

Or use something to block an IP after some unsuccessful login attempts for a couple of minutes. There are plenty of programs/scripts doing that. For instance denyhosts, sshguard, sshdfilter...

And you should really go with the keys (google for 'ssh keys').

Offline

#8 2008-06-13 16:20:43

vomix
Member
From: Belgium
Registered: 2007-05-02
Posts: 84

Re: SSH, wifi & basic security.

Yeah I know, it's maybe exaggerating, I've surely read to much books / "omg phrakture was hacked!1" threads / or saw to much movies (make your choice wink ), but I think it's also an opportunity to improve my nonexistent network knowledge.

So, in a first time, I'll replace lame passwords with public keys (I didn't knew it was possible), and have a look at the famous iptables. smile

Thanks to you all!

Offline

#9 2008-06-13 16:23:17

Zepp
Member
From: Ontario, Canada
Registered: 2006-03-25
Posts: 334
Website

Re: SSH, wifi & basic security.

zenlord wrote:
vomix wrote:

- My network is encrypted with WPA2 and is filtering MAC addresses,

If a hacker really wants to break into your system, he'll probably be able to do so no matter what you're doing to avoid it

This is just over exagerating paranoia. Everything isn't hackable like the movies, it is possible to secure a device so that a little determination still won't let people in tongue.

As for securing your wireless. I think WPA2+AES is enouh. SSH however is encrypted regardless so it should be secure regardless if your wifi is open or not. I'd enable public key authentication and disable password authentication as well as root logins. You don't have to worry about being able to su after loggin in since no one should be able to get that far but you tongue.

Changing the SSH port can get rid of those annoying bots that try to brute force their way in, however it is necessary after you have disabled password authentication. They will never succeed if you allow only public key authentication so it is up to you if you want to leave it on 22 or not.

Oh and you can allow/deny certain hosts fro connecting in several ways, including a firewall or directly in the sshd config file.

Last edited by Zepp (2008-06-13 16:23:49)

Offline

#10 2008-06-13 16:29:27

sniffles
Member
Registered: 2008-01-23
Posts: 275

Re: SSH, wifi & basic security.

Zepp wrote:

This is just over exagerating paranoia. Everything isn't hackable like the movies, it is possible to secure a device so that a little determination still won't let people in tongue.

I'm just curious how one could protect against 0-day exploits. Kernel patches? l. o. l.

Offline

#11 2008-06-13 16:34:22

Zepp
Member
From: Ontario, Canada
Registered: 2006-03-25
Posts: 334
Website

Re: SSH, wifi & basic security.

sniffles wrote:
Zepp wrote:

This is just over exagerating paranoia. Everything isn't hackable like the movies, it is possible to secure a device so that a little determination still won't let people in tongue.

I'm just curious how one could protect against 0-day exploits. Kernel patches? l. o. l.

SSH has a pretty damn good track record as far as exploits go, and you are assuming that an exploit exists that is unpatched which there is no guarantee or law that says there must be. Also if a computer has no services listening then it won't be hacked without user intervention, it is that simple.

Offline

#12 2008-06-14 10:35:26

vomix
Member
From: Belgium
Registered: 2007-05-02
Posts: 84

Re: SSH, wifi & basic security.

Yay, I'm successfully using ssh with public keys / ssh-agent / keychain!

There's just one thing.  I added some lines in my .bashrc to automatically start keychain when a new term is invoked: 

/usr/bin/keychain ~/.ssh/id_dsa
[[ -f $HOME/.keychain/$HOSTNAME-sh ]] && source $HOME/.keychain/$HOSTNAME-s

It's working, but the problem is that keychain's also started when startx is used.  And as I'm using mingetty to auto-login at boot, I can't access to my desktop without typing my passphrase at every reboot...  So, is there a way to tell keychain to ask the passphrase only when I'm using ssh for the first time in the session?

I hope it's understandable... tongue

Thanks in advance.

Offline

#13 2008-06-14 11:16:33

sniffles
Member
Registered: 2008-01-23
Posts: 275

Re: SSH, wifi & basic security.

Zepp wrote:

SSH has a pretty damn good track record as far as exploits go, and you are assuming that an exploit exists that is unpatched which there is no guarantee or law that says there must be. Also if a computer has no services listening then it won't be hacked without user intervention, it is that simple.

So do default installs of OpenBSD, yet every now and then: it happens. You are assuming an exploit does not exist. I pref. my assumption. I don't know what you mean by "user intervention". Is running Firefox for example considered user intervention? How about running pacman? I'm talking about client-side exploits. And what about bugs in the kernel itself?

Last edited by sniffles (2008-06-14 11:18:05)

Offline

Board footer

Powered by FluxBB