Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New cheat sheet proposal: Apache HTTP Server #5

Closed
ghost opened this issue Jan 4, 2019 · 31 comments
Closed

New cheat sheet proposal: Apache HTTP Server #5

ghost opened this issue Jan 4, 2019 · 31 comments
Labels
ACK_OBTAINED Issue acknowledged from core team so work can be done to fix it. NEW_CS Issue about the creation of a new cheat sheet.
Milestone

Comments

@ghost
Copy link

ghost commented Jan 4, 2019

Thanks you for proposing a new cheat sheet.

Please provides the following information about your proposal:

  1. Which security issues are bring or commonly meet when someone must work on this topic?
    Most web servers completely undermine any security that was built into the application. It can render all app security code pointless. Very important to get this right.
  2. What is the objective of the cheat sheet?
    Make an updated single source of truth for a generally secure Apache config.
  3. What the CS will bring to the reader?
    Eliminate the need to rely on 10 year old+ documentation that is scattered across the internet and often wasn't even right back then. Actually explain Apache HTTP Server in a way people not committing to the source code can actually understand.

Thanks you again for your contribution 😃

@righettod
Copy link
Member

OK from my side.

@jmanico Do you are OK with this proposal?

@righettod righettod added the ACK_WAITING Issue waiting acknowledgement from core team before to start the work to fix it. label Jan 4, 2019
@righettod
Copy link
Member

As Jim is currently busy, i validate the proposal.

@righettod righettod added ACK_OBTAINED Issue acknowledged from core team so work can be done to fix it. and removed ACK_WAITING Issue waiting acknowledgement from core team before to start the work to fix it. labels Jan 7, 2019
@righettod righettod added this to the Roadmap 2019 milestone Jan 7, 2019
@righettod righettod added the NEW_CS Issue about the creation of a new cheat sheet. label Jan 7, 2019
@righettod righettod assigned ghost Jan 20, 2019
@righettod
Copy link
Member

Ping me when you will start working on it in order that i pass the issue from the backlog to pending.
Thanks you in advance 😃

@righettod righettod unassigned ghost Mar 18, 2019
@righettod righettod added the HELP_WANTED Issue for which help is wanted to do the job. label Mar 18, 2019
@righettod righettod changed the title New cheat sheet proposal - Apache HTTP Server New cheat sheet proposal: Apache HTTP Server Mar 21, 2019
@ghost
Copy link
Author

ghost commented Apr 13, 2019

I have got this started: https://github.com/danehrlich1/very-secure-apache/blob/master/apache2.conf
That is pretty much every option you can set at the Apache level. Need to cleanup + add more stuff + get in format for this repo.

Things included:

  • all 8 HTTP Security Headers you can possibly set
  • etags, tokens, signatures, and traces all disabled
  • http 1.1+ required
  • TLS 1.2+ required
  • Strong Ciphers only with HonorCipherOrder on
  • Redirect logic from HTTP Port 80 to HTTPS

@righettod
Copy link
Member

Hi,
OK thanks for the feedback.
I affect the issue to you and it add to the Pending area.

@righettod righettod assigned ghost Apr 13, 2019
@righettod righettod removed the HELP_WANTED Issue for which help is wanted to do the job. label Apr 13, 2019
@Malvoz
Copy link

Malvoz commented May 23, 2019

I'd like to help with this.

H5BP have for a long time been providing developers with a terrific boilerplate of apache security configs, and I feel obligated mentioning them: https://github.com/h5bp/server-configs-apache

If there's anything to take away from this comment; I would like to highlight one thing when it comes to HTTP (security) headers:

We need a consensus of which headers applies to which Content-Types. I'll refer you to h5bp/server-configs-apache#187 for more info on that.

@righettod
Copy link
Member

Thank you very much for your proposal, feel free to submit a PR 😃

@righettod
Copy link
Member

@danehrlich1 Any news about the PR for this issue ? Thank you very much in advance for your feedback 😃

@Malvoz
Copy link

Malvoz commented May 27, 2019

feel free to submit a PR

This is not a small task. If you are referring to my proposal of mapping out which headers applies to which Content-Type.

I briefly reviewed, and commited to @danehrlich1's PR. There are some very debatable defaults in there, quick example:

Header set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"

This implies all subdomains are HTTPS, and although I agree they should be, this configuration with the (non-standard) preload directive is irreversible (from what I can remember) per the docs in https://hstspreload.org/.

@jmanico
Copy link
Member

jmanico commented May 27, 2019 via email

@Malvoz
Copy link

Malvoz commented May 27, 2019

@jmanico

https://hstspreload.org/#removal

Be aware that inclusion in the preload list cannot easily be undone. Domains can be removed, but it takes months for a change to reach users with a Chrome update and we cannot make guarantees about other browsers. Don't request inclusion unless you're sure that you can support HTTPS for your entire site and all its subdomains in the long term.

Yes it's not the end of the world, but there should be detailed information to the configurations.

@jmanico
Copy link
Member

jmanico commented May 27, 2019 via email

@Malvoz
Copy link

Malvoz commented May 27, 2019

Also, the example CSP is rather weak in terms of strictness. I'd like to refer you to https://github.com/h5bp/server-configs-apache/blob/master/src/security/content-security-policy.conf for a strict (https://csp.withgoogle.com/docs/strict-csp.html) example base policy. But which also should, IMO, include object-src 'none'. See details for that motivation in my proposal for H5BP here: h5bp/server-configs-apache#190

I've never contributed to OWASP before and I'm unsure of the course of action.

@jmanico
Copy link
Member

jmanico commented May 27, 2019 via email

@ThunderSon
Copy link
Contributor

About the preload, I'd suggest removing it from the default configuration and adding it as a note for web masters that are managing the domain. A lot folks will be using subdomains and will inject preload, which doesn't hurt by default, but doesn't provide anything extra if they don't know what it is.

About CSP, I'd prefer having a not so strict CSP, and a reference to the CSP CS with some Apache examples instead. Having a strict CSPs might get people into trouble without actually reading up a bit on it as it is a bit hard to implement it for new-comers.

@jmanico
Copy link
Member

jmanico commented May 27, 2019 via email

@Malvoz
Copy link

Malvoz commented May 27, 2019

@jmanico

All CSP policies should start with default-src 'none' and build from
that, ideally.

default-src only affect fetch directives, leaving document- and navigation directives to their defaults. This is less strict than e.g. setting frame-ancestors to 'self' or 'none' (following the same strictness as the OWASP example X-Frame-Options: deny).

However, setting no document/navigation directives aligns better with @ThunderSon's opinion on having it less strict by default.

Contrary to what I may have indicated, I don't really have strong opinions but I appreciate a dialog. ^^

@righettod
Copy link
Member

@Malvoz Take the time you need, it was just to "keep the ball rolling" and make a tour on the different issues in pending state at project level.
It's part of my role as PL 😃
Take all the time you need, no pressure, no delay 😃

@ThunderSon
Copy link
Contributor

@Malvoz We're more than happy to have discussions. We need to give you some feedback as well on how to proceed with the issue/PR. CSP is a hot topic recently and it is worth the investment.
CSP is better planned than forced, yet having a good and secure policy is more than welcome to be mentioned, but not set by default. I recommend checking the talks mentioned in the references of the CSP CS.

@ghost
Copy link
Author

ghost commented May 29, 2019

@Malvoz I 100% agree with you. Preload should be taken out. I am shocked I put that in there. That only works if you properly follow the preload requirements, doesn’t work for self-signing in testing, blah blah.

@ghost
Copy link
Author

ghost commented May 29, 2019

@righettod I can work on this more. The only thing though is...you’re never 100% sure with Apache. I’ve literally had different devs on the mailing list for httpd, and these guys are absolutely brilliant, tell me to do different things. The source code is so old...no one is totally sure. A good example of this is that recently, no one knew all the directives you could put in .htaccess, whose source code is based on a different web server (NCSA for University of Illinois) from like 1993.

I’ll finish it, but I am going to add two warning labels to the top:

  • blah blah blah no Apache config tutorial is 100% correct and there are different opinions on what is the most secure blah blah blah
  • a note that some Operating Systems, such as RHEL/CentOS, have the Apache2.conf spread out over several files and not in 1 (apache2.conf)or sometimes 2 files like Debian/Ubuntu

@ghost
Copy link
Author

ghost commented May 29, 2019

@Malvoz I would love to work with you. I’ve already learned a ton from your comments here.

@jmanico
Copy link
Member

jmanico commented May 29, 2019 via email

@ghost
Copy link
Author

ghost commented May 30, 2019

  1. @jmanico Agree and that can be done as a good compromise.

  2. I'd also like to note...if you are installing Apache from apt or yum or dnf you have a very old version in many cases. It's been patched for security stuff, but other than that like the default Debian one is 18+ months old.

  3. I've been playing around with HTTPD's official docker image which has the latest, 2.4.39. Interesting configuration layout (makes more sense actually), many new features. Will somehow work this way into the cheatsheet. People need to use that Docker container, or at least borrow its scripts for installation for sure. https://hub.docker.com/_/httpd

@ThunderSon
Copy link
Contributor

ThunderSon commented May 30, 2019

I really like how indulged you are in the Apache configuration versions and how complicated it can get.
The mentioned points, such as preload and CSP, I'd recommend having them in comments and have some notes with them for users to apply.
The notes that you want to mention are okay as well.

I'd recommend pushing for the PR, and not worrying as much about these minimal points 😄

@OWASP OWASP deleted a comment from jmanico Jun 17, 2019
@OWASP OWASP deleted a comment from jmanico Jun 17, 2019
@OWASP OWASP deleted a comment from jmanico Jun 17, 2019
@OWASP OWASP deleted a comment from jmanico Jun 17, 2019
@OWASP OWASP deleted a comment from jmanico Jun 17, 2019
@ThunderSon
Copy link
Contributor

@danehrlich1 @Malvoz Hello! Any status on the issue?

@Malvoz
Copy link

Malvoz commented Jun 25, 2019

Due to the fact that not all apache directives are accessible in the context of .htaccess files, for a large percentage of developers that do not have access to the main server configuration file (which is almost always the case of shared hosting), half of @danehrlich1's configurations either does nothing in an .htaccess file, or rather, most likely ends up returning a 500 Internal Server Error status. IMO, this Apache configuration must be .htaccess-first, with additions for users with such server access.

@mackowski
Copy link
Collaborator

Personally I think that the best way to address issues is to create a PR with proposal. That way we will be able to add comment to specific line and try to resolve it and avoid statements like 'large percentage'.
I can also suggest that even is something is not available from .htaccess but can increase security we should recommend it but also mention that it is not accessible in the context of .htaccess files. Or you can create two cases - first when you have access to the main server configuration file and second when you do not have it.

@mackowski
Copy link
Collaborator

@danehrlich1 hey, what is the status of this issue? Do you need any help from us?

@ghost
Copy link
Author

ghost commented Aug 20, 2019

Let me just get it in and over with. Then we can edit it there still but at least we've heaved it over the finish line. 72 hours.

@righettod righettod unassigned ghost Aug 23, 2019
@righettod righettod added the HELP_WANTED Issue for which help is wanted to do the job. label Aug 23, 2019
@ghost ghost mentioned this issue Aug 24, 2019
@righettod righettod assigned ghost Aug 24, 2019
@righettod righettod removed the HELP_WANTED Issue for which help is wanted to do the job. label Aug 24, 2019
@ThunderSon
Copy link
Contributor

This CS will not be picked up by the team in the coming time period, and as such, this issue will be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ACK_OBTAINED Issue acknowledged from core team so work can be done to fix it. NEW_CS Issue about the creation of a new cheat sheet.
Projects
None yet
Development

No branches or pull requests

5 participants