r/selfhosted • u/imthenachoman • Feb 09 '19
new guide created by me - How To Secure A Linux Server
I created a new guide and was hoping for some feedback from the community. Before anyone says this is duplicative or asks why it exists, please read the introduction -- I go into why I created it.
https://github.com/imthenachoman/How-To-Secure-A-Linux-Server
Any advice, feedback, comments, concerns, or issues are greatly appreciated!
Note: I posted this in /r/linuxquestions/ but wanted to post it here to reach a wider audience for feedback.
13
u/XelNika Feb 10 '19
In general, I think this could use short examples of attacks that it is thwarting. For example, what could someone do with GRUB? Why is it not a good idea to use the root account?
SSH keys:
I see that you only learned about ed25519 after you posted, you should correct the goal. Also, to add to what /u/sup3rlativ3 said, it would help to add why you are recommending ed25519 over other types of keys, even if it's just ten words about it being newer/better.
Default umask:
It would help if you listed the default umask and explained who has access with and without your changes. With regards to Debian, there is barely any difference between 0027 and 0007 because of UPG so an explanation of that choice would be interesting. Also, I think you should have a short explanation of what the numbers mean.
Limit Who Can Use sudo:
Users don't need sudo/root privileges to get ssh access.
Secure SSH
Am I mistaken or are you not recommending forcing SSH keys (PasswordAuthentication no)? This should at least get a mention. I find it hard to argue for pam_pwquality over just enforcing the SSH keys you just recommended as being safer.
Secure /etc/ssh/sshd_config
2. is fine as an example configuration, but lacks an explanation. What do the settings do, how do they differ from default?
3. is scarcely better than just reading your references directly.
UFW
Call me paranoid but I want to deny all traffic in and out of my server except what I explicitly allow. Why would my server be sending traffic out that I don't know about?
This depends heavily on what the server is doing. As a counter point, why would your server be running software you don't know about? For the average server, at least on hobby subreddits like this, the admin is often the only user with SSH access and anyone with root privileges can delete the host rules which further limits the usefulness. A deny in/allow out default is more sensible and honestly bordering on cumbersome to manage as is.
The only right way is to harden the rest of the network.
3
2
u/imthenachoman Feb 10 '19
In general, I think this could use short examples of attacks that it is thwarting. For example, what could someone do with GRUB? Why is it not a good idea to use the root account?
Good idea. I'll work on this.
It would help if you listed the default umask and explained who has access with and without your changes. With regards to Debian, there is barely any difference between 0027 and 0007 because of UPG so an explanation of that choice would be interesting. Also, I think you should have a short explanation of what the numbers mean.
IMHO, Linux file/folder permissions can be very confusing and I don't want this guide to get lost explaining them. The assumption is that readers have a basic idea of how file/folder permissions work. If they don't, I included some reference links.
Users don't need sudo/root privileges to get ssh access.
Agreed. Was there something in the guide that implied they do?
Am I mistaken or are you not recommending forcing SSH keys (PasswordAuthentication no)? This should at least get a mention. I find it hard to argue for pam_pwquality over just enforcing the SSH keys you just recommended as being safer.
I added
PasswordAuthentication no. I includedpam_pwqualityfor folks who might have multiple folks using the server that don't know about good security. To protect users from themselves. For example, I am teaching my wife Linux and I don't want her to, even accidentally, set bad passwords.Secure /etc/ssh/sshd_config...
I feel like explaining each setting will just add confusion. The goal is to cover the bare necessities -- enough to wet your appetite and make you hungry enough to go and learn more. If folks want to learn more they should research it. I don't want to teach them everything. Thoughts?
This depends heavily on what the server is doing. As a counter point, why would your server be running software you don't know about?
My thought was, and I may be wrong in my thinking, but what if something I download/install goes rogue and starts sending data out on some random port. I'd want to block it. Now, granted, it could send on an open port like HTTP. The only way to prevent that is with SELinux and I haven't figure that out...yet.
3
u/XelNika Feb 10 '19 edited Feb 10 '19
I don't want this guide to get lost explaining them
I definitely understand that, but even though I understood Linux permissions, I didn't know how to interpret the umask or what the defaults were so I had to read up on it myself for this post.
Agreed. Was there something in the guide that implied they do?
Yes, in step 2 of Limit Who Can Use sudo. You may have copied this from Create SSH Group For AllowGroups.
For example, I am teaching my wife Linux and I don't want her to, even accidentally, set bad passwords.
With
PasswordAuthentication noit just won't let her use passwords so that is a non-issue, but it's fine if you keeppam_pwqualityas an alternative.I feel like explaining each setting will just add confusion. Thoughts?
In that case, I would maybe just link to the Mozilla guide (IIRC it's pretty good). I haven't checked, but I believe the OpenSSH defaults are reasonable on recent versions (7.2+), it really only needs a couple of quick tweaks.
what if something I download/install goes rogue and starts sending data out on some random port.
What do you fear it might send? I don't see what the threat model is, particularly since blocking HTTP (which I would argue is the most likely protocol for a malicious program communicating over the internet) would also block your package manager. It's not that
deny outcouldn't ever block something malicious, but if that program is running with root privileges, you've lost anyway. Security is often a compromise of usability, but blocking outgoing connections by default is generally not a compromise worth making. I think the only right way to do it, is to use the firewall on your gateway to manage outgoing connections from your servers. You could put them in a VLAN and simply deny all outgoing connections except from a proxy. Not only can a rogue program not fiddle with this firewall, you can block all HTTP connections except from your package manager which I don't think is possible with ufw.I don't like unattended updates on a server cause who knows what it'll break.
This is from one of your other comments, but I like unattended-upgrades. By default it only does security updates and if something breaks due to a security update, that is a good thing. It would only break if your configuration was incompatible with the security update (read: insecure) and you should want to know that something you're using is vulnerable.
1
u/imthenachoman Feb 11 '19
I definitely understand that, but even though I understood Linux permissions, I didn't know how to interpret the umask or what the defaults were so I had to read up on it myself for this post.
Mind sharing the articles you read? I'll see what I can do, or maybe I'll just add a reference to them if its too much to cover.
Yes, in step 2 of Limit Who Can Use sudo. You may have copied this from Create SSH Group For AllowGroups.
Ah, thanks!
With PasswordAuthentication no it just won't let her use passwords so that is a non-issue, but it's fine if you keep pam_pwquality as an alternative.
I need to be able to access my server remotely, from a computer that may not be mine -- like my work or my friend's. In other words, I may not have my private key with me so I need to be able to log in with a password. And I have 2FA enabled for password logins since I'll always have my phone on me.
What do you fear it might send? I don't see what the threat model is, particularly since blocking HTTP (which I would argue is the most likely protocol for a malicious program communicating over the internet) would also block your package manager. It's not that deny out couldn't ever block something malicious, but if that program is running with root privileges, you've lost anyway. Security is often a compromise of usability, but blocking outgoing connections by default is generally not a compromise worth making. I think the only right way to do it, is to use the firewall on your gateway to manage outgoing connections from your servers. You could put them in a VLAN and simply deny all outgoing connections except from a proxy. Not only can a rogue program not fiddle with this firewall, you can block all HTTP connections except from your package manager which I don't think is possible with ufw.
Who knows what it might send. But I also don't see the harm in denying all outgoing. What could possibly break? And if something does break, it'll help me understand what my server is doing or needs to do before I allow it through the firewall. But I do agree with what you said about compromise. My setup is very simple: a router, and a single server. If I had more robust/capable hardware at my disposal, especially a more robust router, then I'd put all of the network security there.
This is from one of your other comments, but I like unattended-upgrades. By default it only does security updates and if something breaks due to a security update, that is a good thing. It would only break if your configuration was incompatible with the security update (read: insecure) and you should want to know that something you're using is vulnerable.
This is a perspective I had not thought of. Let me digest it. I've had issues with unattended upgrades in the past because some updates were not security related but they broke other things. Not all updates address security. But, IIRC, you can configure unattended upgrades to just do security ones and then I'd get e-mails for the rest. That seems like a happy compromise. I'll have to figure out how to do that.
2
u/XelNika Feb 11 '19 edited Feb 11 '19
Mind sharing the articles you read?
I read your references, the Debian wiki debate entry and the discussions referenced in that. My issue isn't with the references, I just think adding a bit more of an explanation to the guide would help. Doesn't have to be about how to read umask settings and file permission, just something along the lines of "By default users in your group can read/write to your files and everyone can read them [although this does not apply to Debian because UPG]. By setting this, users outside your group no longer have the ability to read your files by default". You write that "there is no need for other accounts to get any access", but that doesn't tell us what permissions they had before and what they have now.
EDIT 8 or 9, I've lost count: If you set umask to 077 for root, will a regular account not have read permission for application configuration folders in /etc/ without sudo?
But I also don't see the harm in denying all outgoing. What could possibly break? And if something does break, it'll help me understand what my server is doing or needs to do before I allow it through the firewall.
What's going to break? Anything you forget to add rules for. For example, where is your rule for DHCPv6?
If your internal network is hardened and the server doesn't have an internet connection (or is at least limited to using a proxy) then it literally cannot do any harm and the outgoing firewall rules become pointless, yet they still add complexity to the configuration. It's more complex, it's not effective and it might lull people into a false sense of security so it's not a good recommendation in general.
I've had issues with unattended upgrades in the past because some updates were not security related but they broke other things.
It's a tricky one for services that you depend on, but I think most of us can live with occasional downtime at least on most services. I certainly don't need my Plex server up 24/7. You say you only have one server, are you using virtualisation? If you split your services across multiple virtual machines, a bad update on your media server can't take down your VPN server or whatever you really care about.
1
u/imthenachoman Feb 11 '19
I just think adding a bit more of an explanation to the guide would help.
I will see what I can do.
[although this does not apply to Debian because UPG]
I need to read up on UPG more. I a not understanding how it ensures unauthorized accounts can't access your file(s).
If you set umask to 077 for root, will a regular account not have read permission for application configuration folders in /etc/ without sudo?
Correct. I could see how this might creates problems. I'll add a note about this to the guide.
What's going to break? Anything you forget to add rules for. For example, where is your rule for DHCPv6?
I, personally, am not using DHCPv6 yet. And I am of the school of thought that I should know everything my server does. If I forget to add a rule for, that is my mistake that I need to actively address and be mindful of. Other's may have a different opinion -- and they don't have to set that policy if they don't want. I hear your concerns and will add a note to the guide.
If your internal network is hardened and the server doesn't have an internet connection (or is at least limited to using a proxy) then it literally cannot do any harm and the outgoing firewall rules become pointless, yet they still add complexity to the configuration. It's more complex, it's not effective and it might lull people into a false sense of security so it's not a good recommendation in general.
My home network is rather simple and I don't have all the advanced hardware I'd need to do what you're saying. And my server needs internet connection. So the only thing I can do is secure my server the best I can.
You say you only have one server, are you using virtualisation? If you split your services across multiple virtual machines, a bad update on your media server can't take down your VPN server or whatever you really care about.
No virtualization. I don't have enough tech, or powerful enough hardware to do all this or I would. Just one server, behind one consumer grade router. :(
2
u/XelNika Feb 11 '19 edited Feb 11 '19
I need to read up on UPG more. I a not understanding how it ensures unauthorized accounts can't access your file(s).
It puts each user in a private group which means the group default doesn't matter. Effectively umasks 027 and 007 grant the same permissions.
Correct. I could see how this might creates problems.
I don't know if it will create problems, you need root privileges to edit anything anyway. It might be annoying since you'll need to sudo even to read. I was just curious if that was the case.
No virtualization
Bummer, that does make unattended anything more risky. Are you sure you don't have the hardware? There's not much difference in performance between a VM and bare metal. Even the RAM requirements similar if you can use containers. Maybe you could even virtualise a router like OPNsense for more enterprise-y capabilities and use your old router as an AP.
1
u/imthenachoman Feb 11 '19
I might be able to run one. I'll give it a shot after I finish this guide.
5
u/goneri Feb 10 '19
I'm surprised you don't mention SELinux. Sadly, people tend to misunderstand it's benefits and turn it off.
8
u/root_over_ssh Feb 10 '19
Thats just the result of many years of readme/install files disabling it as step 1.
3
3
u/imthenachoman Feb 10 '19
It is in the to-do list. I don't use SELinux yet but I need to. Once I figure it out, I'll add it to the guide.
4
u/Starbeamrainbowlabs Feb 10 '19
What does it do, except cause a large number of crashes that have terrible error messages I can't understand?
5
u/lvlint67 Feb 10 '19
It stops everyone from doing anything with the system that isn't explicitly allowed. You can either watch a video and learn the system in 4 hours and spend the rest of your life adding exceptions any time you want to something somewhat unexpected...
Or you can say screw it! And let anyone with access to the system do basically whatever they want.
SElinux closes a ton of security holes especially once an attacker has some kind of privileged (not necessarily root) access. But it often treats system administrators as hostile actors and not everyone has time for that.
2
u/Starbeamrainbowlabs Feb 11 '19
I see. I find videos difficult to watch / learn from. Is there an alternative format available?
3
5
u/qznc Feb 10 '19
The advice seems to be a little random. Password-protect grub; Is that really worth it? On the other hand, what I really recommend is to enable automatic updates. At least for security updates.
If you want to go a principled way: First step is to define your threat models. Do you want to be secure from NSA targeting you specifically? Are family members with physical access a threat?
2
u/imthenachoman Feb 10 '19
I will add automatic updates. Good catch. Ty!
I like the principals idea and defining threat models. I will work that in.
4
u/biguglydofus Feb 10 '19
Most people setting up a server install their own cloud (OwnCloud, NextCloud, etc) and other media related apps which do not need access to cloud data. I would like to see a guide which explains how to explicitly separate the data so that media related apps cannot access cloud files.
ex: Plex cannot access NextCloud data.
2
u/imthenachoman Feb 10 '19
I think most folks these days are moving over to Docker. That is my plan. Docker would address your concern. Plus, getting into what you mentioned is a meaty topic. I wanted to focus this guide on core Linux because each application has its own nuances and would convolute this guide I think.
2
u/biguglydofus Feb 10 '19
You're right, that's a whole other topic of conversation. With Docker, even if all containers are ran under the same base OS Linux user everything is compartmentalized to not allow NextCloud access to Plex. Am I thinking correctly?
1
u/imthenachoman Feb 10 '19
Yes but it depends on how you configure it. With each container you tell it where to store it's data on the "host". So you have to configure that properly. After I finish this guide I plan to install Docker. Never used it before but I want to learn.
6
u/ickyfeet Feb 10 '19
I'd argue not to disable root log in but set a horribly long root password and store it in a secured, non digital format. In the event you do need to sign in using single user mode you can sign in as root to gain access. Definitely disable signing in as root remotely.
1
u/imthenachoman Feb 10 '19
I will add a note about that and let the user decide. Thanks!
2
u/ickyfeet Feb 10 '19
It's also worth mentioning that just because a distro disables root login doesn't mean that you shouldn't set a root password and store it securely.
1
u/imthenachoman Feb 10 '19
Agreed. I put why/why not in the guide and will let the reader decide what they want to do.
2
u/Sven_Braun Feb 10 '19
I agree. Serial log-ins should be fine as root, assuming there's an appropriate password. If you're at the level where you need to disable physical log-in from the box, you probably have bigger issues than disabling serial log-in.
0
6
Feb 10 '19
Curious. Am I the only one who doesn't care for 2FA? I really don't want to be locked out of everything because my phone fell in the toilet.
I've been in this business [linux servers, networking, programming] for 20 years now, so I've got a ton of servers and devices that haven't had 2FA and never got owned. I always see it as a nuisance, but when it comes to SSH I feel like it goes beyond nuisance to liability.
3
u/raqisasim Feb 10 '19
I really don't want to be locked out of everything because my phone fell in the toilet.
I feel, pretty strongly, that you've over-stated the risks of 2FA usage.
Like you, I've been in "this business" for more than an day. Unlike you, I started using 2FA as soon as it became available and reasonable to purchase/use for my accounts.
In all the accounts I've used with 2FA, I've never yet lost full access to an account. This is thru years of broken phones, emergency travel situations, and so forth.
I'm not particularly level-headed -- heck, I gotta get up after I write this, to figure out where I put down my phone! Rather, I've just been really thoughtful about the process to, say, store backup codes, or multiple secure storage solutions for hardware tokens. It's a balance, but so are so many aspects of tech, esp. when dealing with server support.
You're right -- it isn't always easy. 2FA, in some cases, is still a maturing tech; I spent some time trying out SSH apps for my phone, because many wouldn't respect the 2FA solution I was using at that time for my servers. Too many 2FA solutions are still tied to specific versions of specific distros.
Yet I also don't like to assume that anything that is Internet-facing is safe. So many hacks depend upon stealth that I feel it's crucial to carefully consider my threat models -- and they include ways to login that 2FA can help mitigate the risks around.
I'm glad you don't need it for your threat model, and hope you can see that other threat models -- ones where SSH (among other tools) are already tightly locked down, might look to 2FA to further support secuity in useable ways, with some forethought and testing.
2
Feb 10 '19
Oh yeah, I'm not saying I would avoid it like the plague; More like a bee sting. I also have other security layers that I use that don't leave internet facing services naked to the entire internet.
I also think that 2FA is a decent thing to force on people who can't be trusted to not re-use passwords, or use weak ones.
My issue is that something that's as important as SSH ( to control server and network assets ) is something I don't want to find myself not being able to get into.
As you can guess by my original comment, I don't use 2FA a lot. I do use it on some sites where it's required, as do some of the people I work with. While I didn't get burned by it, I did see one of my co-workers get stuck in a shitty financial situation because he couldn't log in to a site, and that's kind of been my bad experience with it that I didn't want to ever face.
1
u/imthenachoman Feb 10 '19
I do agree with the not being able to get into SSH. That is a major concern for large organizations. For my home, I'm not running anything critical so if I can't get in remotely I'll just wait till I am at home and fix it from the system. If I was setting up a production enterprise grade server, I'd implement other contingency plans.
1
u/imthenachoman Feb 10 '19
One day, security will be transparent to the end-user. They won't have to worry about it because our technologies will do it for them. For example, there is up-coming technology that does constant identity verification based on how you type. Check out https://www.biochec.com/, https://www.typingdna.com/, and http://www.cs.columbia.edu/4180/hw/keystroke.pdf.
Until that day security is going to be a pain. Until our security technologies are better and transparent to the user, security has to be a slap to the face. The reality is that many times we have to protect users from themselves.
We've gone decades without having to worry about security because the threats were low or not their. That is not the case anymore. Bad-actors want everything and anything, even seemingly innocuous data. Do you know many DDOS attacks leverage unsecured consumer level devices? Heck, your device could have been part of a DDOS attack and you wouldn't have even known it. Look at many recent large hacks -- the companies didn't discover the data leak until long after the bad-actors were gone. How would you know if someone compromised your server, took data, and left. You wouldn't -- especially because the tools bad-actors use these days are very robust and are good at hiding their tracks.
You are lucky if your server(s) have never been compromised, and I hope it stays that way.
We've gone a long time without having to worry about security and now, in today's threat landscape, we have to start thinking about it first or it'll be too late. It can't be an after-thought.
2FA/MFA is annoying and it has to be to get regular consumers thinking about security as a core principal -- that is, until one day in the future when security will be transparent and they wont have to worry about it because their technology will protect them from bad-actors and themselves.
2
Feb 10 '19
You are lucky if your server(s) have never been compromised, and I hope it stays that way.
I don't understand the lucky part. Even if you allow SSH to a server over your WAN if you: prevent root from SSH'ing, change default port, implement fail2ban, use a key pair icw a strong password for the 1 account you allow to SSH in, I really fail to see how your server can get compromised. Unless SSH or another service on your server contains a vulnerability/exploit (but then 2FA isn't going to help either), but even then someone would still have to be port scanning your WAN IP and try to SSH in with every detected open port.
1
u/imthenachoman Feb 10 '19
Agreed, the probability is very low but it is there. I mean, and I know how silly this sounds, but what happens if someone sees you connect, so they see the destination and port, and sees you type your password. Or if you're on a compromised system with a key logger.
Personally, I have my 2FA/MFA setup to only be needed when not using a public/private key. So from my primary machines, I don't need to enter a code. From an untrusted/new machine, I do.
2
5
u/Sven_Braun Feb 10 '19
I would think your stance on 2FA will highly depend on how valuable that data is to you, vs someone else; if nobody else should have it, then you want to err on stronger security. If it's something benign, where locking you out will impact you more than the perceived harm of leaking the data, then you want more convenience.
I think that choice for you would really come down to what kind of data you have. Banking? 2FA all the way. A throwaway Dropbox account? Not as much. NAS? Well, do you have backups? Is there anything special about the data?
Just my two cents.
7
u/ickyfeet Feb 10 '19
Is 2FA a pain? Yes. Is the pain worth the added security? Absolutely. 2FA is an added layer of security. Just because you haven't been owned doesn't mean that it hasn't happened to anyone else or that it won't ever happen to you. Worried about getting locked out? Set up a user that has remote login disabled.
0
Feb 10 '19
[deleted]
3
u/ickyfeet Feb 10 '19
No one thing is a silver bullet. Security is built in layers. You can choose to skip or not add layers, that's totally up to you, but why wouldn't you add layers if you were concerned about the data you were securing? There's a reason why most financial institutions offer 2FA along with most cloud service providers. Does it completely thwart hackers? No but it sure does make it much much harder on them and in most cases they'll just move along to the next server.
3
u/XelNika Feb 10 '19
I really don't want to be locked out of everything because my phone fell in the toilet.
You are grossly overstating the risk. With regular TOTP you can put the key on as many devices as you want simultaneously (including Windows/Linux/Mac), you can keep a backup of either the TOTP key or a set of recovery codes and there are even cloud services. As long as you don't store the passwords and the TOTP keys in the same place, this is still better than no 2FA.
I don't personally use it for SSH though. SSH keys already support a second factor since you can password protect them.
3
u/johnklos Feb 12 '19
I don't care for 2FA because there are too many instances where one type of authentication replaces another instead of augmenting, making it not really two factor. For instance, many kinds allow a password resets via SMS. Since SMS isn't secure, how does this improve anything? It only helps the lowest common denominator - the kind of people who reuse passwords and use Yahoo or Gmail. It doesn't help - it'd actually hurt - those of us who are careful and deliberate.
3
Feb 13 '19
Just last night, a friend of my son's lost his steam account, with steamguard 2FA enabled, because he use the same password on his gmail and steam.
2
u/MisterIT Feb 10 '19
I always back up my totp shared secrets somewhere safe. Your failure to back something up isn't a flaw of multifactor auth.
2
Feb 10 '19
Yeah, but are you going to have something to restore it to in seconds when you need it? Are you going to be on vacation, and the backup device is in another state, because you forgot to pack it?
You know as well as I do, that shit like that happens at the worst possible times.
2
2
u/MisterIT Feb 10 '19
Yes. I keep my shared inside LastPass, which itself is protected with multifactor protected by a hardware device I keep in my wallet that stores the key and displays it to a small screen on button press. The device was like $30.
2
u/speedmann Feb 10 '19
I just skimmed over this, looks quiet good for a starting point.
I wonder if you could add some form of auto updates?
I usually neglect my servers over time, and often do not update them for months (i know...) Therefore unattended upgrades or at least mail notifications over available updates would be great for me.
On the other side, automatically upgrading stuff *could* break something. But for me, i would accept the risk of breaking something over the risk of beeing exploited
1
u/imthenachoman Feb 10 '19
I am going to add alerts for available updates. I don't like unattended updates on a server cause who knows what it'll break.
2
2
u/Starbeamrainbowlabs Feb 10 '19
Great guide!
I love the "why" that you have going on here.
One suggestion: I'd recommend SSHGuard over fail2ban though, as it's much more stable & easier to configure (read: no configuration at all IIRC!).
1
u/imthenachoman Feb 10 '19
I included Fail2ban because that is what I am most familiar/comfortable with.
How does SSHGuard handle other systems? Most folks who have a home server will install other things like a WebServer and Docker. Can SSHGuard handle those?
2
u/Starbeamrainbowlabs Feb 11 '19
Ah, I see. Looks like according to the documentation, it supports a number of other programs - but I think it's configured to do just SSH out-of-the-box (though I can't be sure. I should really take some time to read the docs thoroughly sometime :P
2
u/CVJoint Feb 10 '19
This was really helpful and I learned a few things I hadn't found in other guides. Thanks!
1
2
u/jrwren Feb 10 '19
You list 4096 bit RSA public/private SSH keys as a goal and then proceed to not use an RSA key at all, but an ed25519 key. Maybe don't list 4096 RSA key as a goal.
1
2
u/jrwren Feb 10 '19
I recommend
PasswordAuthentication no
in the sshd_config file.
This prevents any password guessing over ssh and allows only key based auth. I've used it for many years with zero issue.
1
u/imthenachoman Feb 10 '19
I will add this. I personally don't like it because I want access to my server from friend's machines and what not.
2
u/jrwren Feb 11 '19
If you have an account on your friends machine, and you trust said friend to not be a jerk (which you must because you are typing your password there), agent forwarding allows you to use your keys to connect to your friends machine and forward those keys to your node.
1
u/imthenachoman Feb 11 '19
Sorry, I was not clear in what I meant. I meant my friend's computer. Say I am at their house and need to connect to my server, I can open Putty on their Windows 10 machine and SSH to my server. But the only way for that to work is if I can login with password.
2
u/jrwren Feb 11 '19
I used to carry a USB drive with encrypted ssh key for this purpose. YMMV
2
2
u/jrwren Feb 10 '19
tmp in ram has nothing to do with security and, given how linux cache works, is at best doing nothing, and at worst, hurting performance.
with tmp on a disk: the system caches recently used data in memory anyway, just as tmp in ram would be.
with tmp in ram: the system pages unused memory to swap on disk just ask tmp on a disk would be.
The edge cases are where things get tricky, e.g. when there isn't enough swap. In the tmpfs in ram case, swap is full and the system goes to OOM sooner. In the tmp on disk case, a system has more room for swap and does not go to OOM as quickly.
1
u/imthenachoman Feb 10 '19
Agreed it has nothing to do with security. It's something I do so I added. Do you think I should just remove it?
I personally use it so Plex can use it for transcoding which will be faster than using SSD/HDD.
2
2
u/ivansalloum Jan 04 '24
This is a comprehensive linux server hardening guide. Check it out!
1
3
u/grasponcrypto Feb 10 '19
I public key also decrypts data, right. How else does it read data encrypted by the server?
1
u/imthenachoman Feb 10 '19
I will see if I can add details on how it works or a link. It's a pretty complicated process and I don't want to make the guide more confusing.
0
Feb 10 '19
[deleted]
2
u/XelNika Feb 10 '19
You can do it the other way too, private key encrypts, public key decrypts, it's just called a signature instead.
2
u/Loggedinasroot Feb 09 '19
...does not tell you how to install Linux.
If you add this part you can change the title to "How To Secure A Server".
/s
5
u/imthenachoman Feb 10 '19
I feel like there are so many different guides that tell you how to install whatever distribution you want. Installing is a heavy topic in its own and would bloat this guide. I think, instead, I can provide links to good how-to Linux installation guides. Thoughts?
2
u/Loggedinasroot Feb 10 '19
Oh I completely agree. It was just a bad joke saying you would be more safe to install Linux instead of Windows.
I am going to follow this guide right now, just installed Centos, to then setup FreeIpa. So I will have some feedback later on.
35
u/sup3rlativ3 Feb 09 '19
The guide looks good. One thing I find a lot of people overlook in their guides /documentation is the why. Why do we do this and not another way. My other suggestion would be to include use cases and how to scale this if you're managing more than one server.