LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-24-2021, 10:58 AM   #1
snacksy
LQ Newbie
 
Registered: Jan 2021
Posts: 2

Rep: Reputation: Disabled
Lightbulb Cron job importing public keys from Github account, good idea?


So i am very new to the server world, so i am trying to learn.

My server got hacked from a ssh brute force attack, so i reinstalled the OS and am currently trying not to make the same mistake again!
The world sure isn't kind to new folks around here lol.

This time i will use SSH keys and disable password login. So after finding out i can store my SSH keys on Github i tought it would be smart to have a Cron job that runs.
This way if i move to a new computer i can just upload them to Github and be ready to go, no moving private keys required (a supposedly big nono)
Code:
0 * * * * ssh-import-id-gh User-Name
I have 2 factor auth setup for GitHub so it would be hard to hack me there. Is this a smart thing to do?

What does the council of LinuxQuestions say, what is my faith?

Last edited by snacksy; 01-24-2021 at 11:05 AM.
 
Old 01-24-2021, 12:22 PM   #2
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
I fail to see how moving a key in a secure connection is a nono. As I do with giving someone else access to them. Does that script use a secure connection when transferring the key? If not you have sent them in plain text over the internet. A definite security nono and I would think since you were owned already that you had failed to install the fail2ban software to protect the connections to your server. I would start there for your efforts on securing your system.

https://vexxhost.com/resources/tutor...-on-ubuntu-12/
 
Old 01-24-2021, 12:46 PM   #3
snacksy
LQ Newbie
 
Registered: Jan 2021
Posts: 2

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by HappyTux View Post
I fail to see how moving a key in a secure connection is a nono. As I do with giving someone else access to them. Does that script use a secure connection when transferring the key? If not you have sent them in plain text over the internet. A definite security nono and I would think since you were owned already that you had failed to install the fail2ban software to protect the connections to your server. I would start there for your efforts on securing your system.

https://vexxhost.com/resources/tutor...-on-ubuntu-12/
Why is it called owned, what a humiliating word to use haha.
Yeah i failed to mentioned that i also have installed fail2ban now as i was told this would be a good idea.

And yes the script uses a secure https connection to Github so i think it's fine
 
Old 01-24-2021, 02:15 PM   #4
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 4,170

Rep: Reputation: 244Reputation: 244Reputation: 244
Quote:
Originally Posted by snacksy View Post
Why is it called owned, what a humiliating word to use haha.
Yeah i failed to mentioned that i also have installed fail2ban now as i was told this would be a good idea.

And yes the script uses a secure https connection to Github so i think it's fine
Because instead of you owning your server after that point they do.
 
Old 01-24-2021, 02:22 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,797

Rep: Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952
I see no point in constantly downloading the same key because it appends to the file each time it is run.
 
Old 01-24-2021, 03:09 PM   #6
sevendogsbsd
Senior Member
 
Registered: Sep 2017
Distribution: FreeBSD
Posts: 2,252

Rep: Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011Reputation: 1011
Private keys should never be moved anywhere except the local network or backup media. Public keys don’t matter, private keys do.
 
Old 01-24-2021, 04:27 PM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,797

Rep: Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952Reputation: 5952
Aws i understand ssh-import is just the reverse of ssh-copy.
 
  


Reply



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
LXer: Assume your GitHub account is hacked, users with weak crypto keys told LXer Syndicated Linux News 0 06-04-2015 10:04 PM
how can i run rsync as a cron job using public keys authentication disorderly Linux - Server 14 03-13-2008 09:51 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
KGpg setting for importing public keys linuxbeliever Debian 2 06-12-2007 12:17 PM
YUM requires public keys, how do I get public keys? GNUROCKS Linux - Newbie 3 05-29-2005 08:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:17 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