Gitorious can not connect to Active Directory (authentication.yml)

1

1

I have set up Gitorious. With the local database, everything worked fine. All my log and configurationfiles are included. The problem is when I want to visit gitorious.localdomain when I have configured Gitorious to authenticate using the active directory. I receive a 502 Bad Gateway error from nginx.

Update: If I rename or delete the authentication.yml file. I don't get an error and I can connect with the local database. So I think the error must be inside the authentication.yml, but I'm still not able to solve it.

This is my 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: user@thename.local
    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

In the file gitorious.yml. I have uncommented the next rule:

use_ldap_authorization: true

The output of "/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, like 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, like Gecko) Chrome/26.0.1410.43 Safari/537.31" "-"

the output of "/var/log/nginx/error.log"

2013/04/08 12:12:56 [error] 1571#0: *9 connect() to u.n.i.x.:///var/www/gitorious/app/tmp/pids/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 10.203.40.148, server: gitorious.localdomain, request: "GET / HTTP/1.1", upstream: "http://u.n.i.x.:///var/www/gitorious/app/tmp/pids/unicorn.sock:/", host: "10.203.40.150" 2013/04/08 12:12:56 [error] 1571#0: *9 connect() to u.n.i.x.:///var/www/gitorious/app/tmp/pids/unicorn.sock failed (111: Connection refused) while connecting to upstream, client: 10.203.40.148, server: gitorious.localdomain, request: "GET /favicon.ico HTTP/1.1", upstream: "http://u.n.i.x.:///var/www/gitorious/app/tmp/pids/unicorn.sock:/favicon.ico", host: "10.203.40.150"

the output of "bundle exec rails c RAILS_ENV=production script/test_ldap_connection username password"

[root@Gitorious app]# exists exists app/controllers exists app/helpers exists app/models exists app/views/layouts exists config/environments exists config/initializers exists config/locales exists db exists doc exists lib exists lib/tasks exists log exists public/images exists public/javascripts exists public/stylesheets exists script/performance exists test/fixtures exists test/functional exists test/integration exists test/performance exists test/unit exists vendor exists vendor/plugins exists tmp/sessions exists tmp/sockets exists tmp/cache exists tmp/pids identical Rakefile identical README identical app/controllers/application_controller.rb identical app/helpers/application_helper.rb identical config/database.yml identical config/routes.rb identical config/locales/en.yml identical db/seeds.rb identical config/initializers/backtrace_silencers.rb identical config/initializers/inflections.rb identical config/initializers/mime_types.rb identical config/initializers/new_rails_defaults.rb overwrite config/initializers/session_store.rb? (enter "h" for help) [Ynaqdh] y force config/initializers/session_store.rb overwrite config/initializers/cookie_verification_secret.rb? (enter "h" for help) [Ynaqdh] y force config/initializers/cookie_verification_secret.rb identical config/environment.rb identical config/boot.rb identical config/environments/production.rb identical config/environments/development.rb identical config/environments/test.rb identical script/about identical script/console identical script/dbconsole identical script/destroy identical script/generate identical script/runner identical script/server identical script/plugin identical script/performance/benchmarker identical script/performance/profiler identical test/test_helper.rb identical test/performance/browsing_test.rb identical public/404.html identical public/422.html identical public/500.html identical public/index.html identical public/favicon.ico identical public/robots.txt identical public/images/rails.png identical public/javascripts/prototype.js identical public/javascripts/effects.js identical public/javascripts/dragdrop.js identical public/javascripts/controls.js identical public/javascripts/application.js identical doc/README_FOR_APP identical log/server.log identical log/production.log identical log/development.log identical log/test.log

The output of log/production.log

[root@Gitorious app]# tail log/production.log # Logfile created on Mon Apr 08 11:35:56 +0200 2013[root@Gitorious app]#

user210529

Posted 2013-04-08T13:52:28.103

Reputation: 43

Answers

0

In authentication.yml, your base_dn line is commented out, have you tried with this set and uncommented?

After uncommenting that, try run "RAILS_ENV=production script/test_ldap_connection username password" from the app directory.

dtucny

Posted 2013-04-08T13:52:28.103

Reputation: 1