Gitorious 无法连接到 Active Directory(authentication.yml)

Gitorious 无法连接到 Active Directory(authentication.yml)

我已经设置了 Gitorious。使用本地数据库,一切都运行良好。我的所有日​​志和配置文件都包含在内。问题是,当我将 Gitorious 配置为使用活动目录进行身份验证时,我想访问 gitorious.localdomain。我从 nginx 收到 502 Bad Gateway 错误。

更新:如果我重命名或删除authentication.yml文件。我不会收到错误,并且可以连接到本地数据库。所以我认为错误一定在authentication.yml中,但我仍然无法解决它。

这是我的authentication.yml

production:
disable_default: true
methods:
    - adapter: Gitorious::Authentication::LDAPAuthentication
    host: activedirectory.lab

    # Override the default port (389)
    #port: 1999

    # The base DN to search
    #base_dn: DC=domain,DC=local

    # The base DN when searching for groups (for authorization)
    # If unspecified, base_dn is used
    group_search_dn: OU=ouname,dc=domainname,dc=local

    # What LDAP attribute to use for user authentication. Default is CN
    # login_attribute: uid  

    # How to build a user's DN. Default: $LOGIN_ATTRIBUTE={},$BASE_DN,
    # e.g. CN=chris,DC=gitorious,DC=org
    distinguished_name_template: "{}@thename.local"

    bind_user:
    username: [email protected]
    password: Password

    # When using LDAP authorization: which attribute in a user
    # record specifies groups a user is member of
    # This will depend on your schema/LDAP server implementation
    # but in 9/10 cases, it will be memberof
    membership_attribute_name: memberof

    # When using LDAP authorization: which attribute in a group
    # record specifies users that are member of the group
    # This will depend on your  LDAP schema, but will usually be
    # member or uniquemember
    members_attribute_name: member

在文件 gitorious.yml 中,我取消了下一条规则的注释:

使用 ldap 授权:true

“/var/log/nginx/access.log”的输出:

10.203.40.148 - - [08/Apr/2013:12:12:56 +0200] "GET / HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML,如 Gecko) Chrome/26.0.1410.43 Safari/537.31" "-" 10.203.40.148 - - [08/Apr/2013:12:12:56 +0200] "GET /favicon.ico HTTP/1.1" 502 575 "-" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.31 (KHTML,如 Gecko) Chrome/26.0.1410.43 Safari/537.31“ “-”

“/var/log/nginx/error.log” 的输出

2013/04/08 12:12:56 [错误] 1571#0:*9 connect()到 unix:///var/www/gitorious/app/tmp/pids/unicorn.sock 失败(111:连接被拒绝)连接到上游,客户端:10.203.40.148,服务器:gitorious.localdomain,请求:“GET / HTTP/1.1”,上游:“http://unix:///var/www/gitorious/app/tmp/pids/unicorn.sock:/",主机:“10.203.40.150”2013/04/08 12:12:56 [错误] 1571#0:*9 connect()到 unix:///var/www/gitorious/app/tmp/pids/unicorn.sock 失败(111:连接被拒绝)同时连接到上游,客户端:10.203.40.148,服务器:gitorious.localdomain,请求:“GET /favicon.ico HTTP/1.1”,上游:“http://unix:///var/www/gitorious/app/tmp/pids/unicorn.sock:/favicon.ico",主机:“10.203.40.150”

“bundle exec rails c RAILS_ENV=production script/test_ldap_connection username password”的输出

[root@Gitorious app]# 存在 存在 app/controllers 存在 app/helpers 存在 app/models 存在 app/views/layouts 存在 config/environments 存在 config/initializers 存在 config/locales 存在 db 存在 doc 存在 lib 存在 lib/tasks 存在 log 存在 public/images 存在 public/javascripts 存在 public/stylesheets 存在 script/performance 存在 test/fixtures 存在 test/function 存在 test/integration 存在 test/performance 存在 test/unit 存在 vendor 存在 vendor/plugins 存在 tmp/sessions 存在 tmp/sockets 存在 tmp/cache 存在 tmp/pids 相同 Rakefile 相同 README 相同 app/controllers/application_controller.rb 相同 app/helpers/application_helper.rb 相同 config/database.yml 相同 config/routes.rb 相同 config/locales/en.yml 相同 db/seeds.rb 相同 config/initializers/backtrace_silencers.rb 相同config/initializers/inflections.rb 相同 config/initializers/mime_types.rb 相同 config/initializers/new_rails_defaults.rb 是否覆盖 config/initializers/session_store.rb?(输入“h”获取帮助)[Ynaqdh] y 强制 config/initializers/session_store.rb 是否覆盖 config/initializers/cookie_verification_secret.rb? (输入“h”获取帮助)[Ynaqdh] y 强制 config/initializers/cookie_verification_secret.rb 相同 config/environment.rb 相同 config/boot.rb 相同 config/environments/production.rb 相同 config/environments/development.rb 相同 config/environments/test.rb 相同 script/about 相同 script/console 相同 script/dbconsole 相同 script/destroy 相同 script/generate 相同 script/runner 相同 script/server 相同 script/plugin 相同 script/performance/benchmarker 相同 script/performance/profiler 相同 test/test_helper.rb 相同 test/performance/browsing_test.rb 相同 public/404.html 相同 public/422.html 相同 public/500.html 相同 public/index.html 相同 public/favicon.ico 相同 public/robots.txt 相同 public/images/rails.png 相同 public/javascripts/prototype.js 相同public/javascripts/effects.js 相同 public/javascripts/dragdrop.js 相同 public/javascripts/controls.js 相同 public/javascripts/application.js 相同 doc/README_FOR_APP 相同 log/server.log 相同 log/production.log 相同 log/development.log 相同 log/test.log

log/production.log 的输出

[root@Gitorious app]# tail log/production.log # 日志文件创建于 2013 年 4 月 8 日星期一 11:35:56 +0200 [root@Gitorious app]#

答案1

在 authentication.yml 中,您的 base_dn 行已被注释掉,您是否尝试过使用此设置并取消注释?

取消注释后,尝试从应用程序目录运行“RAILS_ENV=production script/test_ldap_connection username password”。

相关内容