gerrit http 身份验证

发布于 2024-12-20 06:28:34 字数 365 浏览 1 评论 0原文

我正在尝试设置 gerrit HTTP 身份验证。 我正在阅读 gerrit http 身份验证 上的文档其中简要讨论了如何设置apache,但是我到底应该在哪里放置这段代码并配置apache tomcat?

除此之外,我研究并发现了用于 http 身份验证的“siteminder”;我应该用它来代替吗?

我的要求是,我在自定义系统中拥有自己的一组用户帐户,并且我需要每个用户帐户都能够与 gerrit 交互,因此我认为 http 将允许自定义创建/复制每个帐户。

I'm trying to setup gerrit HTTP authentication.
I am reading the documentation at gerrit http authentication which briefly talks about how to setup apache but where exactly do I put this piece of code and configure apache tomcat?

Otherwise, I researched and found out about "siteminder" for http authentication; am I supposed to be using that instead?

My requirements are that I have my own set of user accounts in my custom system and I need each of my user accounts to be able to interact with gerrit so I figured http would allow custom creation/duplicate of each.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

臻嫒无言 2024-12-27 06:28:34

我花了一段时间才弄清楚这一点。

Tomcat已安装并测试。

然后我复制了 gerrit war 文件并将其放入 tomcat/webapps 中。然后从 tomcat 管理器 http://[host]:8080/manager/ 我安装了它(通过单击开始按钮)

然后我必须安装 mysql J Connector。基本上从 Mysql 下载它并将 jar 文件复制到 tomcat/lib

接下来,我在 tomcat/webapps/gerrit/META-INF 中创建了一个名为 Context.xml 的文件,

<Context>
  <Resource name="jdbc/ReviewDb" auth="Container" type="javax.sql.DataSource"
            maxActive="100" maxIdle="30" maxWait="10000"
            username="****" password="******" driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/reviewdb"/>
</Context>

因为我在守护进程中使用了 bouncy castle,所以我必须复制 .jar 文件从原始安装到 tomcat/webapps/gerrit/WEB-INF/lib

然后我设法启动 gerrit 以查看它是否正常工作。尝试访问 http://[host]:8080/gerrit 这应该会给你一个来自 gerrit 的关于错误的 Apache conf 的错误。

然后我像这样重新配置了我的 apache 虚拟主机。因此,我使用 http://gerrit/gerrit 访问 gerrit

,然后在将请求传递到 tomcat 服务器之前使用 http auth。

<VirtualHost *:80>
    ServerAdmin adrian@iceweasel
    ServerName gerrit
    ServerAlias gerrit
    ErrorLog "logs/error_log"
    CustomLog "logs/access_log" vcommon

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

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

    <Location /gerrit/login/>
       AuthType Basic
       AuthName "Gerrit Code Review"
       AuthUserFile /rddata/www/gerrit/users
       AuthGroupFile /rddata/www/gerrit/groups
       Require group review
       Order Deny,Allow
       Allow from all
    </Location>

    ProxyPass /gerrit/ http://127.0.0.1:8080/gerrit/
</VirtualHost>

Took me a while to figure this out.

Tomcat was installed and tested.

Then I copied gerrit war file over and put it in tomcat/webapps. Then from the tomcat manager http://[host]:8080/manager/ I installed it (by clicking the start button)

Then I had to install mysql J Connector. Basically download it from Mysql and copy the jar file into tomcat/lib

Next I created a file in tomcat/webapps/gerrit/META-INF called Context.xml

<Context>
  <Resource name="jdbc/ReviewDb" auth="Container" type="javax.sql.DataSource"
            maxActive="100" maxIdle="30" maxWait="10000"
            username="****" password="******" driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/reviewdb"/>
</Context>

Because I had used bouncy castle with the daemon I had to copy the .jar file from original install to tomcat/webapps/gerrit/WEB-INF/lib

Then I managed to start gerrit to see if it was working. Try accessing http://[host]:8080/gerrit This should give you an error from gerrit about bad Apache conf.

Than I reconfigured my apache virtual host like this. So I access gerrit with http://gerrit/gerrit

This then uses http auth before passing your request onto the tomcat server.

<VirtualHost *:80>
    ServerAdmin adrian@iceweasel
    ServerName gerrit
    ServerAlias gerrit
    ErrorLog "logs/error_log"
    CustomLog "logs/access_log" vcommon

    ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On

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

    <Location /gerrit/login/>
       AuthType Basic
       AuthName "Gerrit Code Review"
       AuthUserFile /rddata/www/gerrit/users
       AuthGroupFile /rddata/www/gerrit/groups
       Require group review
       Order Deny,Allow
       Allow from all
    </Location>

    ProxyPass /gerrit/ http://127.0.0.1:8080/gerrit/
</VirtualHost>
焚却相思 2024-12-27 06:28:34

试试这个(不需要 tomcat)

  • 下载 gerrit.war
  • 初始化一个新项目

    java -jar gerrit.war init -d 审查
    
  • 将 auth 方法设置为“HTTP”,
  • 检查 gerrit 和 apache 的配置文件

etc/gerrit.config

[gerrit]
    ...
    canonicalWebUrl = http://hostname:9091/
    ...
[httpd]
    listenUrl = http://*:9090/
    ...

vhost 配置 apache

Listen 9091
<VirtualHost *:9091>
  ProxyRequests Off
  ProxyVia Off
  ProxyPreserveHost On

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

  <Location /login/>
    AuthType Basic
    AuthName "Gerrit Code Review"
    AuthUserFile /path/to/gerrit-users
    Require valid-user
    Order Deny,Allow
    Allow from all
  </Location>

  ProxyPass / http://127.0.0.1:9090/
</VirtualHost>

Try this (no tomcat is needed)

  • download gerrit.war
  • initialize a new project

    java -jar gerrit.war init -d review
    
  • set auth method to "HTTP"
  • check config files of gerrit and apache

etc/gerrit.config

[gerrit]
    ...
    canonicalWebUrl = http://hostname:9091/
    ...
[httpd]
    listenUrl = http://*:9090/
    ...

vhost config for apache

Listen 9091
<VirtualHost *:9091>
  ProxyRequests Off
  ProxyVia Off
  ProxyPreserveHost On

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

  <Location /login/>
    AuthType Basic
    AuthName "Gerrit Code Review"
    AuthUserFile /path/to/gerrit-users
    Require valid-user
    Order Deny,Allow
    Allow from all
  </Location>

  ProxyPass / http://127.0.0.1:9090/
</VirtualHost>
意中人 2024-12-27 06:28:34

我知道这是一个旧线程,但我提供了一个关于 serverfault 的教程,用于在 tomcat 下设置 Gerrit。如果您仍然感兴趣,请访问:

https:// /serverfault.com/questions/383573/how-do-i-install-gerrit-under-tomcat-with-ldap

I know this is an old thread, but I've provided a tutorial on serverfault for setting up Gerrit under tomcat. If you're still interested, here it is:

https://serverfault.com/questions/383573/how-do-i-install-gerrit-under-tomcat-with-ldap

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文