ezproxy-config-lint
is a linter for EZproxy config files. It checks config files for common issues like:
Option Cookie
directive if an Option DomainCookieOnly
or Option CookiePassthrough
directive is used.AnonymousURL -*
directive after AnonymousURL
directives are used.URL
and Title
directive.The -annotate
flag makes the tool print the whole file, not just lines which raise warnings.
The tool uses non-zero exit codes to indicate problems: 1
means an error occured during linting, 2
means at least one warning was printed.
The linter has a built-in way to check the OCLC website for updates to some database stanzas. If a comment is seen which matches the pattern "# Source - https://help.oclc.org/Library_Management/EZproxy/EZproxy_database_stanzas/...", the tool will check the stanza at the provided URL and pull out the Title
directive. The tool will report if the stanza title in the config file does not match the stanza title from the OCLC website.
For example, for the resource Docuseek2, if the staza begins with a Source comment:
# Source - https://help.oclc.org/Library_Management/EZproxy/EZproxy_database_stanzas/Database_stanzas_D/Docuseek2
Title Docuseek2 (updated 20180101)
...
the linter will visit https://help.oclc.org/Library_Management/EZproxy/EZproxy_database_stanzas/Database_stanzas_D/Docuseek2, and pull out the Title directive, which might be:
Title Docuseek2 (updated 20191015)
...
Because the title directives do not match, the tool will report that you might want to update the stanza from the source.
This software is still an early prototype, with lots of false positives, false negatives, and missing features. Please feel free to submit issues!
tar xzvf ezproxy-config-lint_Linux_x86_64.tar.gz
ezproxy-config-lint
tool was extracted.
$ ls
config.txt
$ cat config.txt
Option DomainCookieOnly
Title EB Medicine
HJ http://www.ebmedicine.net
URL https://www.ebmedicine.net
DJ ebmedicine.net
NeverProxy cdnjs.cloudflare.com
$ wget --quiet https://github.com/cu-library/ezproxy-config-lint/releases/latest/download/ezproxy-config-lint_Linux_x86_64.tar.gz
$ tar xzvf ezproxy-config-lint_Linux_x86_64.tar.gz
$ cd ezproxy-config-lint_Linux_x86_64
$ ./ezproxy-config-lint -help
ezproxy-config-lint: Lint config files for EZproxy
-annotate
Print all lines, not just lines that create warnings.
-follow-include-file
Also process files referenced by IncludeFile directives. (default true)
-https
Report on URL directives which do not use the HTTPS scheme.
-include-file-directory string
The directory from which the IncludeFile paths will be resolved. By default, this is the current working directory.
-verbose
Print internal state before each line is processed.
-whitespace
Report on trailing space or tab characters.
$ ./ezproxy-config-lint ../config.txt
../config.txt:4: URL https://www.ebmedicine.net ← URL directive is out of order
../config.txt:6: ↑ Stanza "EB Medicine (updated 20190614)" has "Option DomainCookieOnly" or "Option CookiePassthrough" but doesn't have a corresponding "Option Cookie" line at the end of the stanza
$ ./ezproxy-config-lint -annotate ../config.txt
../config.txt:1: Option DomainCookieOnly
../config.txt:2: Title EB Medicine (updated 20190614)
../config.txt:3: HJ http://www.ebmedicine.net
../config.txt:4: URL https://www.ebmedicine.net ← URL directive is out of order
../config.txt:5: DJ ebmedicine.net
../config.txt:6: NeverProxy cdnjs.cloudflare.com
../config.txt:6: ↑ Stanza "EB Medicine (updated 20190614)" has "Option DomainCookieOnly" or "Option CookiePassthrough" but doesn't have a corresponding "Option Cookie" line at the end of the stanza