Skip to content

[HELP] : Cannot make it work. #29

Description

@ericxuo

Hi,

I'd like to add a 2FA authentication for some specific applications (subsonic for ex) on my web site.
Currently, I've got some Letsencrypt certificates for all my subdomains.
Here is my current subsonic.conf file :

<VirtualHost *:443>

    <IfModule mod_headers.c>
	    Header always set Strict-Transport-Security "max-age=15768000; includeSubDomains; preload"
    </IfModule>

    <IfModule mod_proxy_http.c>
	ProxyRequests Off
	ProxyPreserveHost On
	ServerName subsonic.my_domain.fr
	RequestHeader unset Accept-Encoding
    
	<Location />
	    Order allow,deny
	    Allow from all
	    ProxyPass http://192.168.0.14:4040/
	    ProxyPassReverse http://192.168.0.14:4040/
	</Location>

    </IfModule>

</VirtualHost>

192.168.0.14 is the local ip of wy Web server on which Apache is running.

Here is the apache_2fa.conf file :

<VirtualHost *:443>
    
    RewriteEngine On

    RewriteCond %{REQUEST_URI} ^/subsonic/
    RewriteCond %{REQUEST_URI} !^/auth/
    RewriteCond %{HTTP_COOKIE} !^.*2FA_Auth=([a-zA-Z0-9]+)
    RewriteRule ^(.*)$ /auth/auth?$1?%{QUERY_STRING} [L,R=302]

    RewriteCond %{REQUEST_URI} !^/auth/
    RewriteCond %{HTTP_COOKIE} ^.*2FA_Auth=([a-zA-Z0-9]+)
    RewriteCond /usr/share/apache_2fa/state/%1 !-f
    RewriteRule ^(.*)$ /auth/auth?$1?%{QUERY_STRING} [L,R=302]

    ScriptAlias /auth/ /usr/share/apache_2fa/

    <Directory /usr/share/apache_2fa>
	AuthType Digest
	AuthName "my_domain.fr"
	AuthDigestDomain /
	AuthDigestProvider file
	AuthUserFile /usr/share/apache_2fa/apache_credentials
	Require valid-user
    </Directory>

    <Directory /usr/share/subsonic>
	AuthType Digest
	AuthName "my_domain.fr"
	AuthDigestDomain /
	AuthDigestProvider file
	AuthUserFile /usr/share/apache_2fa/apache_credentials
	Require valid-user
    </Directory>
    
</VirtualHost>

After I've :

systemctl restart httpd

I'm not asked for any auth.

Do you have any idea to help me to solve this issue ?

Regards.

Xuo.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions