httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Browder <tom.brow...@gmail.com>
Subject [users@httpd] Error trying to use 'mod_auth_form' and 'mod_dbd' with sqlite3
Date Tue, 25 Apr 2017 17:03:00 GMT
Host: httpd version 2.4.25, Debian 8, 64-bit

I am so close but getting the following error:

[dbd:error] [pid 14137:tid 140512755222272] (20014)Internal error:
AH00632: failed to prepare SQL statements: near "authn_query": syntax
error
[dbd:error] [pid 14137:tid 140512755222272] (20014)Internal error:
AH00633: failed to initialise
[authn_dbd:error] [pid 14137:tid 140512755222272] [client
76.3.0.179:43269] AH01653: Failed to acquire database connection to
look up user 'Browder', referer:
https://canterburycircle.us/login.html

The chunk of my http.conf that I believe may be the problem is here
It's an include file in the main httpd.conf file):

#### TLS SITES ####
<Macro VHOST_CLASS2_CERT_TLS ${PROJECT} ${TLD}>
  <VirtualHost *:80>
    ServerName  ${PROJECT}.${TLD}
    ServerAlias www.${PROJECT}.${TLD}
    # enforce ssl/tls
    Redirect Permanent / https://${PROJECT}.${TLD}/
  </VirtualHost>

  ##### BEGIN TLS OPERATIONS #####
  <VirtualHost *:443>
    SSLEngine on
    ServerName  ${PROJECT}.${TLD}
    ServerAlias www.${PROJECT}.${TLD}
    DocumentRoot /home/web-server/${PROJECT}.${TLD}/public
    <Directory /home/web-server/${PROJECT}.${TLD}/public>
      SSLRequireSSL
    </Directory>

    # cgi directory
    ScriptAlias     /cgi-bin/       /home/web-server/${PROJECT}.${TLD}/cgi-bin
    # data directory
    Alias           /data/          /home/web-server/${PROJECT}.${TLD}/data

    # server SSL/TLS certificate data
    SSLCertificateFile
/home/tbrowde/letsencrypt-certs/${PROJECT}.${TLD}/fullchain.cer
    SSLCertificateKeyFile
/home/tbrowde/letsencrypt-certs/${PROJECT}.${TLD}/${PROJECT}.${TLD}.key

    # dbd params in virtual host server context
    # for SQLite
    DBDriver sqlite3
    # params string for SQLite3 is passed through as is
    # pass in the dbd absolute file name
    DBDParams  /home/web-server/passwords/${PROJECT}.${TLD}.sqlite3
    # following are set to defaults
    DBDExptime 300
    DBDKeep 2
    DBDMax 10
    DBDMin 1
    DBDPersist On
    # for authentication
    # DBDPrepareSQL "SQL statement" label
    DBDPrepareSQL "SELECT password FROM authn WHERE user = '%s';" authn_query

    # The following belongs in the virtual host server context inside
    # a Directory directive (may be a macro later).
    <Directory /home/web-server/${PROJECT}.${TLD}/public/private>

      AuthType form
      AuthName ${PROJECT}.${TLD}
      AuthBasicProvider socache dbd
      AuthnCacheProvideFor dbd
      AuthnCacheContext server
      AuthDBDUserPWQuery authn_query

      Require valid-user
      # 60 min max
      SessionMaxAge 3600

    </Directory>

    # The following is the login handler, the login form needs to
    # point to this handler in its action!
    <Location /dologin>
      SetHandler form-login-handler
      AuthFormLoginRequiredLocation https://${PROJECT}.${TLD}/login.html
      AuthFormLoginSuccessLocation https://${PROJECT}.${TLD}/private/index.html

      #--- following varies for file or dbd
      AuthFormProvider dbd

      AuthType form
      AuthName ${PROJECT}.${TLD}
      Session On
      SessionCookieName session path=/

      # The following requires mod_crypto, pass phrase considerations
      # (use Last Pass to generate a strong one and put it in a file).
      SessionCryptoPassphraseFile
/home/web-server/passwords/${PROJECT}.${TLD}.secret
    </Location>

    # This is the location setting: When a user comes to this location
    # unauthorised, he will be redirected to the login form This happens
    # as the ErrorDoucment gets overwritten with the login page.
    <Location /private/index.html>
      Require valid-user
      AuthFormProvider dbd
      ErrorDocument 401 /login.html

      #--- following varies for file or dbd
      AuthType form

      AuthName ${PROJECT}.${TLD}
      AuthFormLoginRequiredLocation https://${PROJECT}.${TLD}/login.html
      Session On
      SessionCookieName session path=/

      # The following requires mod_crypto, pass phrase considerations
      # (use Last Pass to generate a strong one and put it in a file).
      SessionCryptoPassphraseFile
/home/web-server/passwords/${PROJECT}.${TLD}.secret
    </Location>

  </VirtualHost>
  ##### END TLS OPERATIONS #####
</Macro>
Use VHOST_CLASS2_CERT_TLS  canterburycircle us
UndefMacro VHOST_CLASS2_CERT_TLS

I can post the entire http.conf and its includes if needed.

Note that I can use sqlite3 directly and get a good select as shown in
the code above.

Best regards,

-Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message