Add test-suite using simpletest

Not much of robustness in this, if the simpletest-library is missing, it
will fail brutally, the same goes for required files for
test_csr_upload.php.

Signed-off-by: Henrik Austad <henrik@austad.us>
Framework: harden site against clickjacks

From ticket #320, using X-Frame-Options will prevent this. Confirmed by OWASP.

Signed-off-by: Henrik Austad <henrik@austad.us>
Add missing support-files for the test-harness

Signed-off-by: Henrik Austad <henrik@austad.us>
upload_csr: use popen() to handle openssl-vulnkey

Dropping to shell is dangerous, to avoid shell-injections we do the
following:
- use popen()
- only allow base64 characters into the string
- escape known shell arguments

Signed-off-by: Henrik Austad <henrik@austad.us>
CSRUpload: allow for CSRs to be pasted into the form.

This functionality had dropped out, but is now reintroduced. A user can
now paste a CSR into to the window and Confusa will handle it.

Signed-off-by: Henrik Austad <henrik@austad.us>
tests: update CSR-tests

Signed-off-by: Henrik Austad <henrik@austad.us>
When returning a cert from the cache, use the Certificate container.

Signed-off-by: Henrik Austad <henrik@austad.us>
Make sure $subject is an array in match_dn

If the subject is empty, or not an array, this will fail. Wrap in
is_array() to protect the key-lookup.

Signed-off-by: Henrik Austad <henrik@austad.us>
Update certificate API to use the CSR wrapper.

Signed-off-by: Henrik Austad <henrik@austad.us>
tests: update mocks

Signed-off-by: Henrik Austad <henrik@austad.us>
Add test for NRENAccount

Bug #324 triggers when one NREN has several CA accounts as the query
does not correctly limit this to the 'active' account. This test
reproduces this error.

Signed-off-by: Henrik Austad <henrik@austad.us>
NRENAccount: fix for #324

Signed-off-by: Henrik Austad <henrik@austad.us>
stylist: improve error-reporting when writing CSS to file fails.

- log to file
- add error-code
- use translation-tag for message displayed to user

Signed-off-by: Henrik Austad <henrik@austad.us>
menu: add "My certificates" to translation dictionary

Signed-off-by: Henrik Austad <henrik@austad.us>
Fix for ticket #327

Signed-off-by: Henrik Austad <henrik@austad.us>
NREN: add function for returning the contact-email.

This can be retrieved via getData(), but in some cases, that would be
overkill.

Signed-off-by: Henrik Austad <henrik@austad.us>
NREN: filter out NULL-values for custom text-fields in the database

about_nren, privacy-notice and help can all be NULL, and the query
should be strict about defining this. Furthermore, if these fields are
null, an empty value should be returned, not a pre-formatted string
(this is not the responsibility for the NREN-actor, but the presentation
layer).

Signed-off-by: Henrik Austad <henrik@austad.us>
NREN: wrapper-functions for testing if help/about/privnotice is set

Signed-off-by: Henrik Austad <henrik@austad.us>
privacy-notice: display different msg if pn is not set for AuthN user.

Signed-off-by: Henrik Austad <henrik@austad.us>
Framework: add triggerAdmIssues()

This will display warnings if different elements is not properly
set. For now, it will display msg and link to fix for:

- missing privacy notice
- missing help
- missing about NREN

Signed-off-by: Henrik Austad <henrik@austad.us>