LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-07-2013, 03:19 PM   #1
jlct021
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
How to secure my router and pc for remote access via dyndns + ssh?


Hi

I have Debian Wheezy running as my desktop that I currently have remote access to by way of a dyndns script running on my (Mikrotik) router that's forwarding ports 22 and 5900-5905 to my pc.

This is great as I have remote cli access to my pc via ssh from where I can turn on vnc4server if I like and then access desktop via vnc as I've forwarded ports 5900-5905 to my pc too. In addition the dyndns script on my router gives me remote access to my Mikrotik router. (Currently I'm en/disabling all port forwarding on router before/after each use for security)

While this is all great; how secure is my pc and router and what steps can I take to secure both my router and pc without loosing the above remote access I currently have?

Thanks

Last edited by jlct021; 02-07-2013 at 03:23 PM.
 
Old 02-07-2013, 03:36 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Check your router docs and settings to see what ports are open from the internet and what ports are forwarded to other hosts. You can also use a tool like nmap from an internet host to scan your router IP address. Once you know what ports are exposed from the internet you can address each one.

As far as your SSH install goes, there are plenty of tutorials out there on securing it - I don't allow root logins or password authentication. I also limit the users with AllowUsers. To cut down on log entries, I also don't run the daemon on port 22.

Last edited by gilead; 02-07-2013 at 03:40 PM. Reason: Added AllowUsers
 
Old 02-07-2013, 06:51 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
...also see http://www.linuxquestions.org/questi...tempts-340366/
 
Old 02-07-2013, 06:53 PM   #4
jnihil
Member
 
Registered: Dec 2012
Location: inside the matrix
Distribution: Debian, Xubuntu, Gentoo, Antergos
Posts: 90

Rep: Reputation: 27
I agree with the former post about not running ssh on port 22. You can do so on your linux host, but run a forwarding rule on your router so that externally the ssh port is something in the private range - meaning that you're using a port in the 49152–65535 range externally, but mapped by the router to port 22 on your PC. That way you're unlikely to get port-scanned by people who have little to do and port-scan for open ssh ports on the net.

You need not open ports 5900-5905. You can tunnel these vis the same ssh session.

Finally I would run fail2ban on the sshd, so that failed login attempts can be logged/banned. You can whitelist your usual IP addresses you acess externally. This makes access to your PC pretty secure.

BUT remember, a really lame login/passwd combination kills everything mentioned above.

Regards.
 
Old 02-08-2013, 06:28 PM   #5
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
if your router can map different ports (external/internal) then that is a fast easy way to cut down on script kiddies trying to hack port 22.

example on the router set the external port of 222222 and map it to internal 22, use what ever number scheme you want for the external, then you are set a bit safer. also make sure that root is NOT able to ssh in directly to your linux box. this forces crackers to crack one more p/w before they own your system, that is if they can guess the port you are forwarding for ssh.

i do this with multiple external ports mapped to different computers on my LAN all to port 22.

made up example of this:

external port 1234 mapped to 22 on computer 1.
external port 5678 mapped to 22 on computer 2.
etc...

this allows you to directly ssh into the computer without having to ssh into computer 1, then from computer 1 over to computer 2, or 3, or etc... just a nice little shortcut if your router can handle this type of basic routing.
 
Old 02-09-2013, 06:12 AM   #6
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,367

Rep: Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747
Quote:
In addition the dyndns script on my router gives me remote access to my Mikrotik router.
After securing your ssh connection, this is your biggest security concern, as the access is on a known port and is likely accessed via a username/password combination that is potentially vulnerable to capture. I always turn off remote access as otherwise the consequences can be dire. http://nakedsecurity.sophos.com/2012...brazil-vb2012/

Last edited by allend; 02-09-2013 at 08:34 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
secure remote server from unwanted ssh logins dinakumar12 Linux - Server 4 07-02-2010 12:53 PM
how to secure router via SSH that have only internal telnet matters Slackware 8 11-25-2008 06:01 PM
LXer: PHP Shell, for secure remote access when SSH isn't available LXer Syndicated Linux News 0 02-19-2008 07:00 AM
Easy secure remote access ? waynep Linux - Newbie 2 02-18-2005 04:05 PM
Still secure with remote access? muppski Linux - Security 5 11-11-2004 01:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 10:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration