OS - Ubuntu 14.04.3 git LTCComment mettre en place Gerrit sur tomcat7 avec http auth sur apache
, tomcat7, mysql, apache2 ont été installés.
configuré à tomcat7 pour soutenir SSL: server.xml
<Connector port="4432" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="some_path"
keystorePass="some_pass" />
et base de données MySQL utilisée: context.xml
<Resource name="jdbc/ReviewDb"
auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/gerrit_reviewdb"
username="gerrit"
password="gerrit"
maxActive="20"
maxIdle="10"
maxWait="-1"/>
Je Gerrit sur tomcat7 déployé avec le type auth development_become_any_account.
Ensuite, je créé le fichier gerrit_auth.conf dans le dossier/etc/apache2/sites disponibles
Listen 82
<VirtualHost *:82>
ServerName localhost
ProxyRequests Off
ProxyVia Off
ProxyPreserveHost On
AllowEncodedSlashes On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
<Location /gerrit/login/>
AuthType Basic
AuthName "Gerrit Code Review2"
AuthBasicProvider file
AuthUserFile /var/opt/gerrit/users/passwords
Require valid-user
</Location>
ProxyPass /gerrit/ https://localhost:4432/gerrit/ nocanon
ErrorLog /var/opt/gerrit/apache_errorlog.log
CustomLog /var/opt/gerrit/apache_customlog.log combined
</VirtualHost>
Et chaged type auth à http dans gerrit.config
[gerrit]
basePath = /var/opt/gerrit/repositories
canonicalWebUrl = https://my_gerrit_site:4432/gerrit
[database]
type = mysql
database = gerrit_reviewdb
hostname = localhost
username = gerrit
[index]
type = LUCENE
[auth]
type = http
[receive]
enableSignedPush = false
[sendemail]
smtpServer = localhost
[container]
user = tomcat7
javaHome = /usr/lib/jvm/jdk1.7.0_79/jre
[sshd]
listenAddress = *:29418
[httpd]
listenUrl = proxy-http://localhost:82/
[cache]
directory = cache
et services renouvelées Apache2 et Tomcat7. Maintenant, quand je vais à https: // my_gerrit_site: 4432/Je vois tomcat7
ça marche!
quand je vais à l'adresse https: // my_gerrit_site: 4432/Gerrit Je vois
Erreur de configuration
Vérifiez les paramètres d'authentification du serveur HTTP.
Le serveur HTTP n'a pas indiqué le nom d'utilisateur dans l'en-tête Autorisation lorsqu'il a transmis la demande à Gerrit Code Review.
Si le serveur HTTP est Apache, vérifiez la configuration du proxy comprend une directive d'autorisation à l'emplacement approprié, assurant se termine par '/':
ServerName my_gerrit_site
ProxyRequests Off ProxyVia Off ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy> <Location /gerrit/login/> AuthType Basic AuthName "Gerrit Code Review" Require valid-user ... </Location> AllowEncodedSlashes On ProxyPass /gerrit/ http://.../gerrit/ nodecode </VirtualHost>
quand je vais à http: // my_gerrit_site: 82/je vois
Index of/
Apache/2.4.7 (Ubuntu) serveur à Port my_gerrit_site 82
quand je vais à http: // my_gerrit_site: 82/Gerrit/login/je vois fenêtre avec authentification, et quand je me connecte, je vois
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [no address given] to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Apache/2.4.7 (Ubuntu) Server at my_gerrit_site Port 82
apache_errorlog.log
[Tue Jul 19 20:18:39.067497 2016] [proxy:warn] [pid 6382:tid 140713740175104] [client x.x.x.x:27949] AH01144: No protocol handler was valid for the URL /gerrit/login/. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
catalina.out
[2016-07-19 20:18:18,855] [http-bio-4432-exec-6] ERROR com.google.gerrit.httpd.auth.container.HttpLoginServlet : Unable to authenticate user by Authorization request header. Check container or server configuration.
Ce que je fais mal? Quels paramètres j'ai besoin de changer?
Merci
Pourquoi utilisez-vous Tomcat? Est-ce nécessaire? Il vaut mieux laisser gerrit travailler seul. – uncletall
Oui, j'utilise tomcat car c'est l'exigence –