LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-12-2014, 07:39 PM   #1
thealmightyos
Member
 
Registered: Mar 2009
Distribution: CentOS 6.5 / 7
Posts: 119

Rep: Reputation: 1
securing CentOS7 Server ssh/vsftp w/key | multiple client pc's


I am starting over on my server and this time I am being more serious about security. I think shellshock has made everyone a little weary.

The first time I configured my server I disabled selinux because I found it annoying, allowed remote log in by root and stored files in my web root so I could get to them easily. Not this time.

My goal for this thread is to change the port for ssh, disable root login, disable password login and create and install keys and certs.

I can do most of that myself. Figuring out how to configure selinux to know I changed the port and to change it in the firewall is just a google search away. However, creating the key pairs... well google gives me TOO MUCH info...

Most sites describe very different steps. Some have you create the keys on the server, others on the client. Most assume only one server and one client, and almost all of them assume the server is linux and the client is windows. I have tried a couple of these methods and found them incompatible with each-other.

I am hoping with the help from the security gurus here I can figure out the correct way to secure my system.

Server: CentOS 7

Clients:
CentOS 6.5
Mint 17
Android Phone (KitKat)
Windows 7 x3

For the Windows machines I am thinking about just putting putty on a thumb drive and having the key on there. If I lose the thumb drive I will have to change the keys.

I am eager to hear suggestions and possibly point me to a usable site about this.
 
Old 10-13-2014, 12:55 AM   #2
ilesterg
Member
 
Registered: Jul 2012
Location: München
Distribution: Debian, CentOS/RHEL
Posts: 587

Rep: Reputation: 72
In general, all you have to be concerned of is how to format the generated public key from your client machines to fit in the authorized_keys file on your centos server. For example, the following is the public key generated by puttygen on a Windows machine:

Code:
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20141013"
AAAAB3NzaC1yc2EAAAABJQAAAIEA2YAf4Y10NYtO13QVBFKLcT1DDKErK5oU4/0o
up4i2CnPRJVoBx2f2sIQMmw2Jq73WkyqwlAFr3iqtN5FLKVBcXLQilvpSXidboaG
19RyGOVt5eZubOS3lnaZ7eNHGwa/cbF/N0ma1zJVn6h2VYNQUEHwQiiI4yny2KaI
ioqvbgM=
---- END SSH2 PUBLIC KEY ----
should turn this into something like

Code:
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEA2YAf4Y10NYtO13QVBFKLcT1DDKErK5oU4/0o
up4i2CnPRJVoBx2f2sIQMmw2Jq73WkyqwlAFr3iqtN5FLKVBcXLQilvpSXidboaG
19RyGOVt5eZubOS3lnaZ7eNHGwa/cbF/N0ma1zJVn6h2VYNQUEHwQiiI4yny2KaI
ioqvbgM= rsa-key-20141013
and add it to your centos machine's authorized_keys

I just don't know how the public key looks like in the other machines.

Also, I am just being general with my response since..
Quote:
Originally Posted by thealmightyos View Post
I am hoping with the help from the security gurus here I can figure out the correct way to secure my system.
is quite a broad topic.
 
Old 10-13-2014, 10:48 AM   #3
thealmightyos
Member
 
Registered: Mar 2009
Distribution: CentOS 6.5 / 7
Posts: 119

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by ilesterg View Post

Also, I am just being general with my response since..

is quite a broad topic.
I know. Security is a very big issue with many complex choices. I will attempt to be more specific and say I am seeking assistance with using keys for remote authentication when using ssh and vsftpd.

Thank you for your demonstration of how certs created by puttygen differ from those made on a linux box. I think I can use that to make a usable pair. Will test and return with my results.

Question? Would it be best to have a different key pair for each device?
 
Old 10-13-2014, 12:23 PM   #4
thealmightyos
Member
 
Registered: Mar 2009
Distribution: CentOS 6.5 / 7
Posts: 119

Original Poster
Rep: Reputation: 1
Ok, so I did a lot more reading and it seams I got the whole process backwards and that was causing confusion and misunderstanding of how the keys worked. This page set me straight.

I thought that the server held the private key and the many devices that connected to it had public keys. But that isn't how it works. Both the public and private keys are on the client. The server only stores a file with the allowed public keys. You can add as many as you want. This also broke the misconception I had that key=file. The key itself is the string within the file and can be placed in other files (such as ~/.ssh/authorized_keys) or even program dialogs/settings.

I feel really stupid now posting a topic for this.


I guess I only have one more question: How did you guys learn to secure your servers? Class/Training? Trail and error? Books? Google-Fu? I want to become much better at this and my current "hey, let's try this!" approach isn't producing the desired results
 
  


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
[SOLVED] ssh tunnelling to multiple destinations - how to handle changing server key ? kubuntu-man Linux - Networking 7 09-17-2012 09:52 AM
Possible to have multiple SSH accounts & clients using the same RSA key on server?? a2brute Linux - Server 2 03-31-2008 12:25 PM
public key authentication for ssh - linux client to winxp server cdaaawg General 6 03-10-2008 04:38 PM
Rsyncing between windows client and gentoo server, over ssh, using key for auth. Passive Linux - Networking 0 08-03-2005 11:05 AM
Securing Multiple Domains on 1 Server jgillin Linux - Security 1 05-10-2004 06:44 AM

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

All times are GMT -5. The time now is 10:41 PM.

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