It'd be good to be able to increase the verbosity in the drush output (ie. output the stuff you see on the individual check pages to CLI), using a -v, --verbose switch.

This would be particularly useful if there was a way to run an individual check from drush, instead of all checks (say --check). ie, run the standard check, then run drush secrev --lastrun --verbose --check=filefield.

Comments

coltrane’s picture

Status: Active » Needs review
StatusFileSize
new7.83 KB
coltrane’s picture

Good idea @naught101! Apologies it's taken so long to address.

New option 'check'.

Run configuration security checks on your Drupal site.

Examples:
 secrev                                    Run the checklist and output the results
 secrev --store                            Run the checklist, store, and output the results
 secrev --lastrun                          Output the stored results from the last run of the checklist
 secrev                                    Run the Text formates and Upload extension checks
 --check=input_formats,upload_extensions


Options:
 --check                                   Comma-separated list of specified checks to run. See README.txt for list of options.
 --lastrun                                 Do not run the checklist, just print last results
 --log                                     Log results of each check to watchdog, defaults to off
 --store                                   Write results to the database


Aliases: secrev

Also changed the default output to the check 'success' and 'failure' messages:

Untrusted users are not allowed to input dangerous HTML tags.                       [success]
Dangerous tags were found in submitted content (fields).                           [error]
Errors are written to the screen.                                         [error]
Private files is enabled but the specified directory is not secure outside the web server root.              [error]
Only safe extensions are allowed for uploaded files and images.                      [success]
Untrusted roles do not have administrative or trusted Drupal permissions.                [success]
PHP files in the Drupal files directory cannot be executed.                    [success]
Base URL is not set in settings.php.                                                [error]
Sensitive temporary files were found on your files system.                   [error]
Views are access controlled.                                               [success]

verbose flags are used by drush itself so I'm not sure they're a good option to use. What do you think?

coltrane’s picture

Minor update to fix if the --check option isn't provided.

coltrane’s picture

Title: verbose switch for drush command » verbose switch for drush command and optional specific checks

Updating title to reflect check option.

coltrane’s picture

And since I know some people prefer the current format of short messages here's an option for it: 'short'

$> drush secrev --short
Text formats                                                                                 [success]
Content                                                                                      [error]
Error reporting                                                                              [error]
Private files                                                                                [error]
Allowed upload extensions                                                                    [success]
Drupal permissions                                                                           [success]
Executable PHP                                                                               [success]
Drupal base URL                                                                              [error]
Temporary files                                                                              [error]
Views access                                                                                 [success]
$> drush secrev
Untrusted users are not allowed to input dangerous HTML tags.                                [success]
Dangerous tags were found in submitted content (fields).                                     [error]
Errors are written to the screen.                                                            [error]
Private files is enabled but the specified directory is not secure outside the web server    [error]
root.
Only safe extensions are allowed for uploaded files and images.                              [success]
Untrusted roles do not have administrative or trusted Drupal permissions.                    [success]
PHP files in the Drupal files directory cannot be executed.                                  [success]
Base URL is not set in settings.php.                                                         [error]
Sensitive temporary files were found on your files system.                                   [error]
Views are access controlled.                                                                 [success]
coltrane’s picture

Status: Needs review » Needs work

Setting back to CNW, I recognize that your request was also about exposing some of the specific findings.

coltrane’s picture

Updated patch adds '--results' option which will print details of the failed checks. CNW because the help functions need to be modified to support #2058969: Allow checklist to be run without installing module.

coltrane’s picture

Status: Needs work » Needs review
StatusFileSize
new37.19 KB
$> drush help secrev
Run configuration security checks on your Drupal site.

Examples:
 secrev                                    Run the checklist and output the results
 secrev --store                            Run the checklist, store, and output the results
 secrev --lastrun                          Output the stored results from the last run of the checklist


Options:
 --check                                   Comma-separated list of specified checks to run. See
                                           README.txt for list of options
 --lastrun                                 Do not run the checklist, just print last results
 --log                                     Log results of each check to watchdog, defaults to off
 --results                                 Show the incorrect settings for failed checks.
 --short                                   Short result messages instead of full description (e.g. 'Text
                                           formats').
 --store                                   Write results to the database


Aliases: secrev
$> drush secrev --results
Untrusted users are not allowed to input dangerous HTML tags.                                  [success]
Dangerous tags were found in submitted content (fields).                                       [error]
	Javascript:/node/3/edit

Errors are written to the screen.                                                              [error]
Private files is enabled but the specified directory is not secure outside the web server root.[error]
Only safe extensions are allowed for uploaded files and images.                                [success]
Untrusted roles do not have administrative or trusted Drupal permissions.                      [success]
PHP files in the Drupal files directory cannot be executed.                                    [success]
Base URL is not set in settings.php.                                                           [error]
Sensitive temporary files were found on your files system.                                     [error]
	/Users/ben.jeavons/projects/d7/drupal-7.16/sites/default/settings.php.orig
	/Users/ben.jeavons/projects/d7/drupal-7.16/sites/default/settings.php.save
	/Users/ben.jeavons/projects/d7/drupal-7.16/sites/default/settings.php~

omega8cc’s picture

Status: Needs review » Needs work

@coltrane Awesome work on this! Thank you!

omega8cc’s picture

Status: Needs work » Needs review

Oops, unintended status change.

coltrane’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.