Gitorious + ActiveDirectory authentication

779 views
Skip to first unread message

Federico Don

unread,
Jun 11, 2012, 9:08:23 AM6/11/12
to gito...@googlegroups.com
hello,

I have gitorious running on centos and authenticating with local users

someone can make the settings for authenticating with active directory?

can share information for this?

Thanks for your time

Regards,

Thomas Kjeldahl Nilsson

unread,
Jun 11, 2012, 9:32:03 AM6/11/12
to gito...@googlegroups.com
Hello,

you will find a sample ldap configuration in
config/authentication.sample.yml

There is also a quick script for testing your setup, see
/scripts/test_ldap_connection.

cheers,
Thomas
> --
> To post to this group, send email to gito...@googlegroups.com
> To unsubscribe from this group, send email to
> gitorious+...@googlegroups.com


--
best regards,
Thomas Kjeldahl Nilsson
http://gitorious.com

Federico Don

unread,
Jun 11, 2012, 9:47:38 AM6/11/12
to gito...@googlegroups.com
thanks, the test is well

# bundle exec script/test_ldap_connection USER PASSWORD
All good, your credentials are correct

but when I want to authenticate via web access .... I can not imagine why reason can this happen.....help me please!!?

Regards,

2012/6/11 Thomas Kjeldahl Nilsson <tho...@gitorious.org>
Hello,

you will find a sample ldap configuration in config/authentication.sample.yml

There is also a quick script for testing your setup, see /scripts/test_ldap_connection.

cheers,
Thomas

On 06/11/2012 03:08 PM, Federico Don wrote:
hello,

I have gitorious running on centos and authenticating with local users

someone can make the settings for authenticating with active directory?

can share information for this?

Thanks for your time

Regards,
--
To post to this group, send email to gito...@googlegroups.com
To unsubscribe from this group, send email to


--
best regards,
Thomas Kjeldahl Nilsson
http://gitorious.com

--
To post to this group, send email to gito...@googlegroups.com
To unsubscribe from this group, send email to

Thomas Kjeldahl Nilsson

unread,
Jun 11, 2012, 9:42:03 AM6/11/12
to gito...@googlegroups.com
Is there already an existing user with similar credentials in the db before you configured ldap/AD? The ldap support in Gitorious will try to provision a new user with credentials matching the ldap entry, if there already is a user there that might be a problem...

cheers,
Thomas


On 06/11/2012 03:47 PM, Federico Don wrote:
thanks, the test is well

# bundle exec script/test_ldap_connection USER PASSWORD
All good, your credentials are correct

but when I want to authenticate via web access .... I can not imagine why reason can this happen.....help me please!!?

Regards,
2012/6/11 Thomas Kjeldahl Nilsson <tho...@gitorious.org>
Hello,

you will find a sample ldap configuration in config/authentication.sample.yml

There is also a quick script for testing your setup, see /scripts/test_ldap_connection.

cheers,
Thomas

On 06/11/2012 03:08 PM, Federico Don wrote:
hello,

I have gitorious running on centos and authenticating with local users

someone can make the settings for authenticating with active directory?

can share information for this?

Thanks for your time

Regards,
--
To post to this group, send email to gito...@googlegroups.com
To unsubscribe from this group, send email to


--
best regards,
Thomas Kjeldahl Nilsson
http://gitorious.com

--
To post to this group, send email to gito...@googlegroups.com
To unsubscribe from this group, send email to
--
To post to this group, send email to gito...@googlegroups.com
To unsubscribe from this group, send email to

Diep Pham Van

unread,
Jun 11, 2012, 9:55:54 AM6/11/12
to gito...@googlegroups.com
Make sure that you have email and your email is collected the right way.

On Mon, 11 Jun 2012 10:47:38 -0300
Federico Don <federic...@gmail.com> wrote:

> thanks, the test is well
>
> # bundle exec script/test_ldap_connection USER PASSWORD
> All good, your credentials are correct
>
> but when I want to authenticate via web access .... I can not imagine
> why reason can this happen.....help me please!!?
>
> Regards,
>
> 2012/6/11 Thomas Kjeldahl Nilsson <tho...@gitorious.org>
>
> > Hello,
> >
> > you will find a sample ldap configuration in
> > config/authentication.sample. **yml
> >
> > There is also a quick script for testing your setup, see
> > /scripts/test_ldap_connection.
> >
> > cheers,
> > Thomas
> >
> > On 06/11/2012 03:08 PM, Federico Don wrote:
> >
> >> hello,
> >>
> >> I have gitorious running on centos and authenticating with local
> >> users
> >>
> >> someone can make the settings for authenticating with active
> >> directory?
> >>
> >> can share information for this?
> >>
> >> Thanks for your time
> >>
> >> Regards,
> >> --
> >> To post to this group, send email to gito...@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> gitorious+unsubscribe@**googlegroups.com<gitorious%2Bunsu...@googlegroups.com>
> >>
> >
> >
> > --
> > best regards,
> > Thomas Kjeldahl Nilsson
> > http://gitorious.com
> >
> > --
> > To post to this group, send email to gito...@googlegroups.com
> > To unsubscribe from this group, send email to
> > gitorious+unsubscribe@**googlegroups.com<gitorious%2Bunsu...@googlegroups.com>
> >
>

Federico Don

unread,
Jun 11, 2012, 10:04:22 AM6/11/12
to gito...@googlegroups.com
apparently I can not login with Active Directory users via web ..... but I have the following error:

"Sorry, something went wrong

Gitorious Encountered an server error. We are Automatically Notified of errors and will look into it. If the mistake Persists beyond what's reasonable, let us know. "

I dont have this problem with local users.....

help me please!!!

2012/6/11 Diep Pham Van <im...@favadi.com>

Federico Don

unread,
Jun 11, 2012, 10:41:04 AM6/11/12
to gito...@googlegroups.com
Apparently I can not login with Active Directory users via web ..... but I have the following error:

"Sorry, something went wrong
Gitorious Encountered an server error. We are Automatically Notified of errors and will look into it. If the mistake Persists beyond what's reasonable, let us know. "

When this happens I can see on the server this error:

A NoMethodError occurred in sessions#create:

 undefined method `username_filter' for #<Gitorious::Authentication::LDAPAuthentication:0x128a5860>
 [RAILS_ROOT]/lib/gitorious/authentication/ldap_authentication.rb:85:in `authenticate'

I dont have this problem with local users.....

help me please!!!

Regards,
2012/6/11 Federico Don <federic...@gmail.com>

Kelketek Titikilik Rritaa

unread,
Jun 11, 2012, 10:45:04 AM6/11/12
to gito...@googlegroups.com

Active directory is just Microsoft's implementation of LDAP/Kerberos. Here's a half decent chance that the existing plugin wil work, or if not, it should work with only a few tweaks.

--

Ken Dreyer

unread,
Jun 11, 2012, 10:56:21 AM6/11/12
to gito...@googlegroups.com
On Mon, Jun 11, 2012 at 8:41 AM, Federico Don <federic...@gmail.com> wrote:
> A NoMethodError occurred in sessions#create:
>
>  undefined method `username_filter' for
> #<Gitorious::Authentication::LDAPAuthentication:0x128a5860>
>  [RAILS_ROOT]/lib/gitorious/authentication/ldap_authentication.rb:85:in
> `authenticate'

The username_filter function was added a month ago to master, so this
is a recent change. It might be possible that it was not
fully-backwards compatible with existing configurations.

I'm curious what you've defined as the callback_class parameter in
your authentication.yml?

- Ken

Federico Don

unread,
Jun 11, 2012, 11:05:02 AM6/11/12
to gito...@googlegroups.com
this is my  authentication.yml :

production:
    methods:
    - adapter: Gitorious::Authentication::LDAPAuthentication
      host: SERVER.ACTIVE.DIRECTORY
      port: 389
      base_dn: DC=COMPANY,DC=com
      bind_username: USER_BIND
      bind_password: PASSWORD_BIND
      username_attribute: sAMAccountName
      encryption: none
      login_attribute: uid
      distinguished_name_template: "uid={},OU=allusers,DC=synapse,DC=com"
      attribute_mapping:
      mail: email

Regards,

2012/6/11 Ken Dreyer <ktdr...@ktdreyer.com>

- Ken

Ken Dreyer

unread,
Jun 11, 2012, 11:46:42 AM6/11/12
to gito...@googlegroups.com
On Mon, Jun 11, 2012 at 9:05 AM, Federico Don <federic...@gmail.com> wrote:
>       bind_username: USER_BIND
>       bind_password: PASSWORD_BIND

As I understand it, the problem is that
https://gitorious.org/gitorious/mainline/merge_requests/181 has not
been updated with the changes that happened in commit 570f36e.

(By the way, it is probably a good idea to mention earlier in the
mailing list thread that you're using code that's not in mainline yet,
to help the people who are helping you :)

- Ken

Federico Don

unread,
Jun 11, 2012, 2:45:04 PM6/11/12
to gito...@googlegroups.com
Hello, 

I have this configuration, thanks to this update could authenticate with the test_ldap_connection .....but I can not authenticate via web....

I need help!!

Regards,

2012/6/11 Ken Dreyer <ktdr...@ktdreyer.com>
On Mon, Jun 11, 2012 at 9:05 AM, Federico Don <federic...@gmail.com> wrote:

- Ken

Federico Don

unread,
Jun 21, 2012, 3:29:52 PM6/21/12
to gito...@googlegroups.com
Hello for all,

I still have this problem....someone could you login via web on gitorious private with Active Directory Credentials!?

Regards,

2012/6/11 Federico Don <federic...@gmail.com>
Hello, 

Federico Don

unread,
Jun 22, 2012, 2:43:58 PM6/22/12
to gito...@googlegroups.com
Any update on this

Thanks,

2012/6/21 Federico Don <federic...@gmail.com>

Ken Dreyer

unread,
Jun 22, 2012, 11:53:42 PM6/22/12
to gito...@googlegroups.com
Hi Federico,

I recommend that you just revert the changes from merge request #181,
and ensure that you're using what's in mainline. Active Directory
works quite well with the LDAPAuthentication plugin from mainline.

- Ken

Martin Sandiford

unread,
Jun 23, 2012, 12:53:58 AM6/23/12
to gito...@googlegroups.com
Hi Federico,

It doesn't look to me as if you need the bind_user functionality.
From your configuration, it appears that all your users are in the
same container (allusers), so you should be able to bind directly with
the user credentials as you can correctly build a DN for the user from
static data.

The bind_user configuration and search stuff is only needed if you
have users in varying containers and it isn't possible to build a
suitable DN to bind with from static configuration.

I would agree with Ken's suggestion that you revert to mainline and
try to configure a working system from there.

Cheers,
Martin

Federico Don

unread,
Jun 25, 2012, 4:13:45 PM6/25/12
to gito...@googlegroups.com
this is the error when I try to login via browser:

-------------------------------
Backtrace:
-------------------------------


 [RAILS_ROOT]/lib/gitorious/authentication/ldap_authentication.rb:85:in `authenticate'
 [RAILS_ROOT]/lib/gitorious/authentication.rb:25:in `authenticate'
 [RAILS_ROOT]/lib/gitorious/authentication.rb:24:in `each'
 [RAILS_ROOT]/lib/gitorious/authentication.rb:24:in `authenticate'
 [RAILS_ROOT]/app/controllers/sessions_controller.rb:96:in `password_authentication'
 [RAILS_ROOT]/app/controllers/sessions_controller.rb:42:in `create'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:1331:in `send'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:1331:in `perform_action_without_filters'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
 [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/1.8/benchmark.rb:308:in `realtime'
 [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/core_ext/benchmark.rb:17:in `ms'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/flash.rb:146:in `perform_action'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `send'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:532:in `process_without_filters'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:391:in `process'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:386:in `call'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:437:in `call'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:87:in `dispatch'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:121:in `_call'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'
 [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
 [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/query_cache.rb:29:in `call'
 [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
 [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/query_cache.rb:9:in `cache'
 [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/query_cache.rb:28:in `call'
 [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/string_coercion.rb:25:in `call'
 [RAILS_ROOT]/vendor/cache/ruby/1.8/gems/rack-1.0.1/lib/rack/head.rb:9:in `call'
 [RAILS_ROOT]/vendor/cache/ruby/1.8/gems/rack-1.0.1/lib/rack/methodoverride.rb:24:in `call'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/params_parser.rb:15:in `call'
 [RAILS_ROOT]/vendor/rails/railties/lib/rails/rack/metal.rb:47:in `call'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/session/cookie_store.rb:93:in `call'
 [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/cache/strategy/local_cache.rb:24:in `call'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/failsafe.rb:26:in `call'
 [RAILS_ROOT]/vendor/cache/ruby/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'
 [RAILS_ROOT]/vendor/cache/ruby/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `synchronize'
 [RAILS_ROOT]/vendor/cache/ruby/1.8/gems/rack-1.0.1/lib/rack/lock.rb:11:in `call'
 [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:106:in `call'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/rack/request_handler.rb:96:in `process_request'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_request_handler.rb:513:in `accept_and_process_next_request'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_request_handler.rb:274:in `main_loop'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/classic_rails/application_spawner.rb:321:in `start_request_handler'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `send'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/classic_rails/application_spawner.rb:275:in `handle_spawn_application'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/utils.rb:479:in `safe_fork'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/classic_rails/application_spawner.rb:270:in `handle_spawn_application'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:180:in `start'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/classic_rails/application_spawner.rb:149:in `start'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:219:in `spawn_rails_application'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb:132:in `lookup_or_add'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:214:in `spawn_rails_application'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb:82:in `synchronize'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:213:in `spawn_rails_application'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:132:in `spawn_application'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/spawn_manager.rb:275:in `handle_spawn_application'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:357:in `__send__'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:357:in `server_main_loop'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/lib/phusion_passenger/abstract_server.rb:206:in `start_synchronously'
 /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.12/helper-scripts/passenger-spawn-server:99


I can see this in "lib/gitorious/authentication/ldap_authentication.rb":

82        return unless post_authenticate({
83            :connection => connection,
84            :username => username,
85            :user_filter => username_filter(username),
86            :base_dn => base_dn})
87        user
88      end


I need to add the option "user_filter:" on "config/authentication.yml" ???

Thanks for yours time!!

Regards,

2012/6/23 Martin Sandiford <m...@mcdev.com.au>
Reply all
Reply to author
Forward
0 new messages