Обратный прокси Apche2.4, как включить аутентификацию Google - PullRequest
0 голосов
/ 11 февраля 2020

Я пытаюсь включить аутентификацию google на моем обратном прокси Apache 2.4, установленном в CentOS7. Я установил mod_auth_openid c Я создал Идентификаторы клиента OAuth 2.0 на консоли GSUITE

Это мой / etc / httpd / conf / http.conf :

<VirtualHost mtest.mydomain.com:80>    
  ServerName mtest.mydomain.com
  OIDCProviderMetadataURL https://accounts.google.com/.well-known/openid-configuration    
  OIDCClientID xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com
  OIDCClientSecret xxxxxxxxxxxxxxxxxxxxxxxx
  OIDCRedirectURI https://mtest.mydomain.com/    
  OIDCScope "profile openid"    
  OIDCCryptoPassphrase example@3003    
  OIDCCookiePath /    
  OIDCAuthNHeader X-Forwarded-User    
  OIDCRemoteUserClaim sub    
  OIDCClaimPrefix example_

<Location />
  AuthType openid-connect
  Require valid-user    
</Location>

 Redirect / https://mtest.mydomain.com/  

</VirtualHost> <VirtualHost mtest.mydomain.com:443>   
  ServerName mtest.mydomain.com   
  SSLEngine on   
  SSLCertificateFile /etc/httpd/ssl/mydomain.com.crt   
  SSLCertificateKeyFile /etc/httpd/ssl/mydomain.com.key   
  SSLCACertificateFile /etc/httpd/ssl/gd_bundle-g2-g1.crt   
</VirtualHost>

Но когда я набрал git URL: http://mtest.mydomain.com Я не перенаправил на страницу аутентификации Google.

Где мой ошибка?

1 Ответ

0 голосов
/ 13 февраля 2020

Я решил таким образом:

ProxyRequests off

<Proxy *>
        Order deny,allow
        Deny from all
        Allow from all 
</Proxy> ProxyTimeout 300

<VirtualHost test.mydomain.com:80>    
   ServerName test.mydomain.com    
   Redirect / https://test.mydomain.com/ 
</VirtualHost>

<VirtualHost test.mydomain.com:443>
        ServerName test.mydomain.com
        SSLEngine on
        SSLCertificateFile /etc/httpd/ssl/mydomain.crt
        SSLCertificateKeyFile /etc/httpd/ssl/mydomain.key
        SSLCACertificateFile /etc/httpd/ssl/gd_bundle-g2-g1.crt


OIDCProviderMetadataURL https://accounts.google.com/.well-known/openid-configuration
OIDCClientID xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com   
OIDCClientSecret xxxxxxxxxxxxxxxxxxxxx   
OIDCRedirectURI https://test.mydomain.com/home.html   
OIDCScope "profile openid"   
OIDCCryptoPassphrase example@3003   
OIDCCookiePath /   
OIDCAuthNHeader X-Forwarded-User   
OIDCRemoteUserClaim sub   
OIDCClaimPrefix example_
<Location />   
    AuthType openid-connect   
    Require valid-user </Location>

    ProxyPreserveHost On
    ProxyPass / http://192.168.1.1/
    ProxyPassReverse / http://192.168.1.1/ 
</VirtualHost>
...