As a general deployment practice, my company, finds it helpful to remove the .TXT files from the Drupal root before production deployment. While this is a bit of security through obscurity, it does make it harder for scripts to identify version and other details about the Drupal instance. Would be great to have a patch to core to eliminate these files and include it in Guardr.

CommentFileSizeAuthor
#74 guardr-remove-changelog-txt-1878172-74.patch111.52 KBcatapipper
#72 guardr-remove-changelog-txt-1878172-72.patch111.39 KBcatapipper
#71 guardr-remove-changelog-txt-1878172-71.patch111.47 KBcatapipper
#65 guardr-remove-changelog-txt-1878172-65.patch109.54 KBshrop
#63 guardr-remove-changelog-txt-1878172-63.patch210.38 KBshrop
#62 guardr-remove-changelog-txt-1878172-62.patch104 KBshrop
#58 guardr-remove-changelog-txt-1878172-58.patch103.88 KBdeekayen
#57 guardr-remove-changelog-txt-1878172-57.patch102.27 KBdeetergp
#56 guardr-remove-changelog-txt-1878172-56.patch199.71 KBdeetergp
#55 guardr-remove-changelog-txt-1878172-55.patch93.53 KBdeekayen
#54 guardr-remove-changelog-txt-1878172-54.patch93.6 KBdeekayen
#53 guardr-remove-changelog-txt-1878172-53.patch89.46 KBdeekayen
#47 guardr-remove-changelog-txt-1878172-47.patch89.24 KBdeetergp
#43 guardr-remove-changelog-txt-1878172-43.patch88.59 KBbdone
#41 guardr-remove-changelog-txt-1878172-41.patch86.13 KBbdone
#39 guardr-remove-changelog-txt-1878172-39.patch86.01 KBbdone
#38 guardr_remove_changelog_txt-1878172-38.patch82.15 KBbdone
#37 guardr_remove_changelog_txt-1878172-37.patch82.22 KBbdone
#36 guardr_remove_changelog_txt-8202979-36.patch82.22 KBdeetergp
#34 guardr-remove-changelog-txt-1878172-34.patch82.02 KBbdone
#33 guardr-remove-changelog-txt-1878172-33.patch82.1 KBbdone
#28 guardr-remove-changelog-txt-1878172-28.patch79.17 KBshrop
#23 guardr-remove-changelog-txt-1878172-23.patch79.28 KBshrop
#18 guardr-remove-changelog-txt-1878172-18.patch75.01 KBshrop
#16 guardr-remove-changelog-txt-1878172-16.patch74.9 KBshrop
#7 guardr-remove-txt-files-1878172-7.patch74.77 KBshrop
#2 guardr-remove-txt-files-1878172-2.patch141.3 KBshrop
#1 guardr-remove-txt-files-1878172-1.patch142.17 KBshrop

Comments

shrop’s picture

Assigned: Unassigned » shrop
Status: Active » Needs review
StatusFileSize
new142.17 KB

Attached is a patch to remove the following files:

  • CHANGELOG.txt
  • COPYRIGHT.txt
  • INSTALL.mysql.txt
  • INSTALL.pgsql.txt
  • INSTALL.sqlite.txt
  • INSTALL.txt
  • LICENSE.txt
  • MAINTAINERS.txt
  • README.txt
  • UPGRADE.txt

Feel free to comment if you feel like we should leave any of these files in place. It was easy to remove all as a start. I wonder if it will be good to leave the LICENSE.txt file in place for licensing reasons, but will await input from others on that subject.

I have included this patch in the current Guardr dev snapshot release 7.x-1.x-dev so it can be tested and reviewed easily.

I will leave this open for a while for review to take place.

shrop’s picture

StatusFileSize
new141.3 KB

The previous patch was created against the current tip of the master branch for Drupal and will not apply correctly. This attached patch below works against Drupal 7.18. I have also updated Guardr to use the new patch. Continue to review and comment on this as you wish! :)

shrop’s picture

A tip to help in the same vein as this issue, make sure to use the --no-patch-txt switch when using Drush make so you don't have any PATCHES.txt files generated for projects.

shrop’s picture

@tecto brought up a good point on LICENSE.txt. We need to make sure that the d.o packaging system still slams the LICENSE.txt file into packaged downloads. If that doesn't work, we will re-patch so LICENSE.txt remains during drush make builds.

shrop’s picture

Also, it looks like with each Drupal core version update, we will need to roll a new patch for this purpose.

deekayen’s picture

There are going to be information leaks of some sort, like

<meta name=generator content="Drupal 7 (http://drupal.org)"/>

CHANGELOG.txt is the main concern I think since it is the only thing that has very specific version information, though it'll be the hardest patch to maintain. I think keeping the other files would be about as informative as some other directory trolling a malicious user could do. Just whack CHANGELOG.txt?

shrop’s picture

StatusFileSize
new74.77 KB

That makes sense to me. Here is a patch which just removes CHANGELOG.txt created against Drupal 7.18.

greggles’s picture

IMO this isn't super worth it http://drupalscout.com/knowledge-base/hiding-fact-your-site-runs-drupal-...

If someone wants to fingerprint the version they can use the CSS/JS/existence of a vulnerability to do it.

You're welcome to go ahead, of course. In practice there is some value to some levels of obscurity in terms of stopping a less skilled/determined attacker.

shrop’s picture

Thank you weighing in on this @greggles. I hoped you would.

This "security" technique may also make some auditors happy. I agree that is is obscurity and can't be counted on to stop someone with determination to target a site or app running Drupal. I definitely want users of this distro to understand that fact. My hope is that it may stop some scanning tools which just target CHANGELOG.txt.

I don't think it hurts anything to give this a go for now, but it is an extra patch we have to roll with each Drupal core release. So, in that sense, it may be more of a maintenance headache for Guardr. We need to watch to see how it works out.

greggles’s picture

Yeah, I think the only drawback to doing this is that it makes it harder to know what version you are using. That said...we've long had info files that have the version in them and that seems like a good solution to knowing what file you are running.

So, yeah, I'm in favor as long as the caveat is known.

deekayen’s picture

I don't ever remember opening a changelog file to see what version I was running; it's almost always the core status page.

greggles’s picture

I should say, those were the first results on google for "what version of drupal am I running site:drupal.org" - I didn't cherry pick them :)

deekayen’s picture

Status: Needs review » Reviewed & tested by the community

I think security and convenience have an inverse relationship.

greggles’s picture

Again, it's not really relevant to the conversation, but:

I think security and convenience have an inverse relationship.

I couldn't disagree more. The use of l() to create links is way easier/better than concatenating things together and it's also more secure. A well designed solution makes it easier to do things the more secure way.

shrop’s picture

Attached is a patch to remove CHANGELOG.txt from Drupal 7.19.

deekayen’s picture

#1841654: Add VERSION.txt to profile directly conflicts with this, kind of nullifying the entire idea. credit to bdone for realizing it.

shrop’s picture

Attached is a patch to remove CHANGELOG.txt from Drupal 7.20.

deekayen’s picture

Is there a hacker way of doing it like adding a static var to hook_requirements in Guardr core?

shrop’s picture

Like shell exec to delete the file?

chipway’s picture

My 2 cents :
If you remove README.txt from modules folders, you will get Errors on help for modules using README.text as help. Some examples are context, context_ui, features, print, strongarm.

The good practice is to keep your drupal installation udpated from Core to contrib modules and themes, and use all security filters provided by Drupal API in your custom code.

shrop’s picture

@chipaway-drupal: We are not planning on removing README.txt files. Currently, Guardr just patches core to remove the CHANGELOG.txt. I do agree that we don't want to mess around with the workings of contrib README files.

shrop’s picture

Attached is a patch to remove CHANGELOG.txt from Drupal 7.22.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, guardr-remove-changelog-txt-1878172-23.patch, failed testing.

shrop’s picture

I experimented with testing Guardr with qa.drupal.org, but it looks like testing for distros doesn't really work maybe?

deekayen’s picture

That's why simplytest.me exists IMO.

shrop’s picture

@deekayen: agreed. I haven't tested it in a while, but Guardr should work on simplytest.me now that we have it setup like a proper Drupal.org distro.

shrop’s picture

After some investigation on #1986384: Unable to download guardr from project page, it is apparent that my patch in #23 is actually failing and d.o testing did its job. So, I have turned testing back on and have an updated patch. It appears that when I diff'd to created the patch, I did the diff against the tip of 7.x and I should have diff'd against the commit where 7.22 was tagged.

shrop’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, guardr-remove-changelog-txt-1878172-28.patch, failed testing.

shrop’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, guardr-remove-changelog-txt-1878172-28.patch, failed testing.

bdone’s picture

Status: Needs work » Needs review
StatusFileSize
new82.1 KB

updated #28 for drupal-7.23

bdone’s picture

#33 was incorrectly created against 7.x. new patch is updated against the 7.23 tagged release.

shrop’s picture

Guardr was updated to Drupal core 7.24, but this patch was not updated in the the distro. A new patch is needed and should be uploaded if we want to continue patching for this.

deetergp’s picture

Issue summary: View changes
StatusFileSize
new82.22 KB

Attached is the 7.24 version of the patch.

bdone’s picture

re-roll to rename this patch with corrected issue id (1878172)

bdone’s picture

StatusFileSize
new82.15 KB

#36 was incorrectly created against 7.x.. new patch is updated against the 7.24 tagged release.

bdone’s picture

updated patch against drupal-7.26.

bdone’s picture

Title: Security recommendation for production usage: Remove .TXT files from core. » Security recommendation for production usage: Remove CHANGELOG.TXT from core
bdone’s picture

StatusFileSize
new86.13 KB

updated patch against drupal-7.27.

  • Commit 7bc0c67 on 7.x-1.x by bdone:
    Issue #1878172 by bdone: Re-rolled CHANGELOG.txt patch against 7.27...
bdone’s picture

updated patch against drupal-7.28.

bdone’s picture

  • bdone committed 47dca73 on 7.x-1.x
    Issue #1878172 by bdone: Re-rolled CHANGELOG.txt patch against 7.28...

  • bdone committed 5b067f6 on 7.x-1.x
    Drop www from issue #1878172 CHANGELOG.txt patch
    
deetergp’s picture

Attaching the latest iteration of this patch for Drupal 7.30.

deetergp’s picture

After updating the patch, I learned that we are actually blocking access to CHANGELOG.txt and others at the Apache level, which precludes us from having to worry about accidentally slipping it into our repos and/or deploying it to production.

bdone’s picture

Assigned: bdone » Unassigned
Status: Needs review » Closed (won't fix)
deekayen’s picture

Status: Closed (won't fix) » Active

You're mixing CG with open source. Guardr still shouldn't include CHANGELOG.txt.

shrop’s picture

I think maintaining the path for CHANGELOG.txt has been an issue for maintenance of our releases. If one doesn't use our build script, they will have CHANGELOG.txt. Also, if they use Guadr as a base distro, their base scripts may not exclude CHANGELOG.txt.

I am wondering if we documenting it as a best practice on the project page (maybe create a page for best practices) and investigate a better way to accomplish this. Maybe just delete the file after install?

Also, if we do the best practices page, we should include details on how CG blocks these files. That could be how Guardr contributes to this best pracice.. just tell folks how to configure their apache to block files.

deekayen’s picture

Status: Active » Closed (won't fix)
deekayen’s picture

Iteration for Drupal 7.32.

deekayen’s picture

Iteration for Drupal 7.34.

deekayen’s picture

Patch against correct 7.34 tag...

deetergp’s picture

StatusFileSize
new199.71 KB
deetergp’s picture

StatusFileSize
new102.27 KB
deekayen’s picture

StatusFileSize
new103.88 KB

Drupal 7.42

shrop’s picture

Looks like Guardr is at 7.43 now. We need a core patch for this one.

shrop’s picture

Or maybe the last patch by deekayen is working fine for 7.43?

shrop’s picture

I confirmed just now that 7.43 will need a new patch

shrop’s picture

Drupal 7.43

shrop’s picture

StatusFileSize
new210.38 KB

Drupal 7.44

shrop’s picture

shrop’s picture

StatusFileSize
new109.54 KB

Drupal 7.52

shrop’s picture

Need to add a patch for 7.53 and 7.54 in case others might want to use it

chipway’s picture

On my own I prefer to use NginX config that hides *.txt files.

shrop’s picture

@chipway, yeah. I agree completely. I am wondering if it makes sense to create a readme with the details on how to block CHANGELOG.txt on various platforms, allowing others to add to that. That way, it can still be a recommendations of Guardr. Thoughts?

chipway’s picture

Thanks @shrop,

IMHO I would better see it in a documentation page about securing a Drupal install.
May be somewhere in https://www.drupal.org/security/secure-configuration, or the next version of this doc.

shrop’s picture

Good idea! I will work on something for docs in a centralized area like you mentioned and then Guardr's readme could simply reference the link!

catapipper’s picture

StatusFileSize
new111.47 KB

7.56

catapipper’s picture

StatusFileSize
new111.39 KB

Sorry, rolled the wrong branch. This is Drupal 7.56

shrop’s picture

@catapiper, thanks for the patch!

catapipper’s picture

StatusFileSize
new111.52 KB

Patch for 7.57

shrop’s picture

Thank you catapipper! Your patch was included with https://www.drupal.org/project/guardr/releases/7.x-2.41

shrop’s picture

I am taking the update preparation for Guardr 7.x-2.43 as an opportunity to stop removing CHANGELOG.txt via patch for this and future releases. I will make sure this is noted in the release notes for the release on March 28th, 2018.

See: https://www.drupal.org/project/guardr/issues/2955947 for details on this upcoming release related to PSA 2018-001.

There are a number of reasons for this change:
* It make it hard to maintain releases (not super hard mind you) since a patch to remove CHANGELOG.txt has to be maintained for each core release
* It is security through obscurity
* Many security departments require removal/hiding of CHANGELOG.txt, but this can be accomplished with web server rules such as Apache and Nginx provide. Even Pantheon has an easy way to block access to CHANGELOG.txt via pantheon.yml.

I am recommending that we document some of these methods in Guardr documentation, along with other Drupal files that are often recommended for obscuring by enterprise security requirements.

Thanks for everyone's help on this issue over the years! :)