Return-Path: X-Original-To: apmail-cloudstack-dev-archive@www.apache.org Delivered-To: apmail-cloudstack-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 57B5E116A3 for ; Tue, 12 Aug 2014 21:50:53 +0000 (UTC) Received: (qmail 43524 invoked by uid 500); 12 Aug 2014 21:50:52 -0000 Delivered-To: apmail-cloudstack-dev-archive@cloudstack.apache.org Received: (qmail 43476 invoked by uid 500); 12 Aug 2014 21:50:52 -0000 Mailing-List: contact dev-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list dev@cloudstack.apache.org Received: (qmail 43461 invoked by uid 99); 12 Aug 2014 21:50:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Aug 2014 21:50:52 +0000 X-ASF-Spam-Status: No, hits=-0.1 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of silvano@corp.globo.com designates 74.125.149.205 as permitted sender) Received: from [74.125.149.205] (HELO na3sys009aog111.obsmtp.com) (74.125.149.205) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 12 Aug 2014 21:50:26 +0000 Received: from mail-vc0-f180.google.com ([209.85.220.180]) (using TLSv1) by na3sys009aob111.postini.com ([74.125.148.12]) with SMTP ID DSNKU+qMH5ndA+AHdoxYRBNJ9zVmbbclEuQN@postini.com; Tue, 12 Aug 2014 14:50:24 PDT Received: by mail-vc0-f180.google.com with SMTP id ij19so14104392vcb.11 for ; Tue, 12 Aug 2014 14:50:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=qQgDzgC9t6SixLigHigZunXrj+Q9ja+QMYvA/HhCizY=; b=GoRqO60etYXJwhKcvqxtEggjjJ3taDVVRyEwCRyXwint+9bt75ULfBRBrK0941zjmX bFbwyLU5dJSANoX2l1pNyIHI56Hpb6LcrHu6gtsq9yZOEh36AqSsn70EaLJlFCzitX0X QkjTPyh7sh7SxMqmGPgDHdj1QTrkKmLzeZ/P5uGrishhG2UAQPH20dqVJVa6i0twapBq Ehr2qzPllC1dffIq2UvjLdJgZjQiaRJqkqCr1CFwdI5ODpULQqH5k+qKtcFQQHFzxYBs O7NJbEcOQUpEMMO5434BPgqo2MrlrZB4dHNMwEh4kIw9L6HNicD89/lhoR+kyRw8+Kzq SwMA== X-Received: by 10.220.174.137 with SMTP id t9mr317448vcz.12.1407880222265; Tue, 12 Aug 2014 14:50:22 -0700 (PDT) X-Gm-Message-State: ALoCoQmOyeNXdRb/hMajiZJuoXqtpxS3V9Pvv+KfrEeBgBVfV5f0hOtJr/nhnKZjoVT7y7E/8DrJ2v5ZZ4Skk48bJAydMEnW8O4rDp1CGimD0s3721U7VmmzJPM1qYdZAzDhtZ5wf2th X-Received: by 10.220.174.137 with SMTP id t9mr317434vcz.12.1407880222064; Tue, 12 Aug 2014 14:50:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.221.50.202 with HTTP; Tue, 12 Aug 2014 14:50:02 -0700 (PDT) In-Reply-To: References: <85B56B1AEDD2674A82DEC8B61E1218294208C1@AMSPEX01CL01.citrite.net> <31F89D57-DBA8-4EC9-B9BD-B641805F784A@shapeblue.com> <360a49dff74b04ab81bbf83dc6820092@mail.gmail.com> From: Silvano Nogueira Buback Date: Tue, 12 Aug 2014 18:50:02 -0300 Message-ID: Subject: Re: [SHOW] Authentication refactoring To: dev@cloudstack.apache.org Content-Type: multipart/alternative; boundary=089e0149c59485d666050075a8a1 X-Virus-Checked: Checked by ClamAV on apache.org --089e0149c59485d666050075a8a1 Content-Type: text/plain; charset=UTF-8 Rohit, When I started implementing OAuth2 integration I faced this problem, but I had other things to do first, now I am back to this problem too. I took a look at your implementation and it's almost fit for OAuth2. I have a few comments: Some authentication mechanisms may not work as a command. I proposed to use commands to implement OAuth2 to not change ApiServlet (before knowing the real problem with unauthenticated command), but I think this is not a good implementation (for OAuth2). If the idea is to refactor to support multiple authentication mechanisms, maybe a filter can be better. Take a look in Spring Security implementation [1]. So, using your implementation, I would suggest: 1. When a new request arrives, If user is not authenticated, APIAuthenticatorManager is called and should iterate over all APIAuthenticator instances, one by one, in the order specified by user.authenticators.order global setting (do not forget this, please). 1. In each APIAuthenticator, it can analyze the HttpRequest and if it should authenticate, it must return an UserAccount object. If the authenticator doesn't authenticate it raises some exception like Spring does. 2. As all existed authenticators inheriting today from DefaultUserAuthenticator, this authenticator can implement the APIAuthenticator interface and if there is a parameter with command=login, username, password the abstract method "authenticate" from UserAuthenticator must be called. So, all existing authentication mechanisms will work as today, respecting the order from user.authenticators.order global setting. 2. After authentication, the name of the APIAuthenticator that authenticated must be kept in session. User, and other objects must be kept as well. In logout, the APIAuthenticator used can be called. 3. When a new request arrives, if user is authenticated, it works as today. If everybody agrees on the solution I can work together with you to finish this if you want. I need to finish OAuth2 integration in the next 15 days... and I don't want to change my implementation later on. If it's possible to work together, we need do this in a separated fork of ACS, since I'm not a committer yet. Regards, Silvano Buback [1] http://docs.spring.io/spring-security/site/docs/3.2.4.RELEASE/apidocs/org/springframework/security/web/authentication/AbstractAuthenticationProcessingFilter.html On Tue, Aug 12, 2014 at 11:20 AM, Carlos Reategui wrote: > > > > On Aug 12, 2014, at 5:12 AM, Adrian Lewis > wrote: > > > > Hi Rohit, > > > > Not a very constructive email I'm afraid but I too would be very > > interested in one-time password authentication for CS. Is anyone that you > > know of working on RADIUS auth as this would be a relatively easy way to > > integrate a wide number of OTP systems that rely on a secondary auth > > challenge for the OTP. This secondary auth mechanism is part of the > RADIUS > > standard and would cover RSA as well as the system that I'm interested in > > implementing (Fortinet's FortiAuthenticator) and many other > > enterprise-focussed OTP systems. > > > > Not sure if OTP/2FA would be suitable for API access so a second question > > is: Would it be feasible to use different auth backends for the GUI vs > the > > API? As I understand it, the GUI is simply a 'wrapper' for the API so > > perhaps not but I'm sure I'm not alone here in wanting OTP/2FA, perhaps > > even at the expense of API access. Contrary to popular belief within the > > CS community, not everyone uses the API (shock horror!). Maybe OTP/2FA is > > not an issue for API access but I assume it would be a problem for the > use > > of Puppet/Ansible/Salt etc. Perhaps a source IP ACL so that only > specified > > IPs can use a standard auth method but all other access mandates OTP/2FA? > > Not sure how AWS works with their MFA feature - anyone? > MFA is used for accessing UI console where you manage your keys for API > usage. > API access is controlled via IAM or key/secret which you manage from the UI > > > > I'm afraid I'm just a (ab)user and couldn't program anything myself - > just > > curious to see if anyone has any thoughts or existing efforts in this > > area? > > > > Cheers, > > > > Adrian > > > > -----Original Message----- > > From: Rohit Yadav [mailto:rohit.yadav@shapeblue.com] > > Sent: 12 August 2014 11:41 > > To: dev@cloudstack.apache.org > > Subject: Re: [SHOW] Authentication refactoring > > > > From the user end there is no change, not in UI or any change expected in > > clients except one: > > Since login and logout are now implemented like your regular api, we > don't > > allow uses to call login and logout and other such AuthenticatorAPIs > > directly like via integration port > > > > Stephen, I'm not sure if we natively support RSA and other things at > > present we only have our custom login auth mechanism, signature/key based > > auth and a simple SSO (pre-shared key) methods. This refactoring will > open > > doors for saml, oauth and possibly others. > > > > This is merged on master now, even though I did testing at my end please > > let me know if something got broke? From the outside world nothing should > > break, i.e. refactoring. > > > > Cheers. > > > > On 12-Aug-2014, at 12:32 pm, Stephen Turner > > wrote: > > > >> Are there any UI changes? Some auth mechanisms might need more than just > > username and password (RSA token, for example, or even just "give the > 1st, > > 4th and 5th characters"). > >> > >> -- > >> Stephen Turner > >> > >> > >> -----Original Message----- > >> From: Rohit Yadav [mailto:rohit.yadav@shapeblue.com] > >> Sent: 12 August 2014 04:51 > >> To: dev > >> Subject: [SHOW] Authentication refactoring > >> > >> Hi, > >> > >> The way we handle login and logout is hardcoded and since there is no > > APICommand/BaseCmd implementation the apidoc, apidiscovery and other > don't > > discover these apis. For supporting SAML as an authentication mechanism, > > I've refactored the Auth mechanism as a pluggable service that loads with > > api-server artifact and both login and logout are now implemented as a > > pseduo BaseCmd classes. > >> > >> I call them pseudo because their execute() is never called, the > > authentication guards in ApiServlet class make sure we call an > > authenticate method of such classes. Since, they are tightly coupled with > > cloud-server's ApiServlet it only made sense to have the interface > > definition and implementation within the same package/artifact as well. > > This also solves the apidoc issue for login/logout and saml related auth > > apis. > >> > >> I'll merge them after sometime and continue working on saml stuff. Will > > push the code in the branch "auth-refactor" in an hour for review/testing > > now. This does not break anything and should not cause any auth related > > issues for all existing clients. > >> > >> Any suggestions, feedback welcome! Refactoring was pretty straight > > forward but I'll make sure to write a wiki page on this before merging to > > master. > >> > >> Regards, > >> Rohit Yadav > >> Software Architect, ShapeBlue > >> M. +41 779015219 | rohit.yadav@shapeblue.com > >> Blog: bhaisaab.org | Twitter: @_bhaisaab > >> > >> > >> > >> Find out more about ShapeBlue and our range of CloudStack related > > services > >> > >> IaaS Cloud Design & > > Build > >> CSForge - rapid IaaS deployment framework > > >> CloudStack Consulting > >> CloudStack Infrastructure > > Support > >> CloudStack Bootcamp Training > > Courses > >> > >> This email and any attachments to it may be confidential and are > > intended solely for the use of the individual to whom it is addressed. > Any > > views or opinions expressed are solely those of the author and do not > > necessarily represent those of Shape Blue Ltd or related companies. If > you > > are not the intended recipient of this email, you must neither take any > > action based upon its contents, nor copy or show it to anyone. Please > > contact the sender if you believe you have received this email in error. > > Shape Blue Ltd is a company incorporated in England & Wales. ShapeBlue > > Services India LLP is a company incorporated in India and is operated > > under license from Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is > a > > company incorporated in Brasil and is operated under license from Shape > > Blue Ltd. ShapeBlue SA Pty Ltd is a company registered by The Republic of > > South Africa and is traded under license from Shape Blue Ltd. ShapeBlue > is > > a registered trademark. > > > > Regards, > > Rohit Yadav > > Software Architect, ShapeBlue > > M. +41 779015219 | rohit.yadav@shapeblue.com > > Blog: bhaisaab.org | Twitter: @_bhaisaab > > > > > > > > Find out more about ShapeBlue and our range of CloudStack related > services > > > > IaaS Cloud Design & > > Build > > CSForge - rapid IaaS deployment framework > > CloudStack Consulting > > CloudStack Infrastructure > > Support > > CloudStack Bootcamp Training > > Courses > > > > This email and any attachments to it may be confidential and are intended > > solely for the use of the individual to whom it is addressed. Any views > or > > opinions expressed are solely those of the author and do not necessarily > > represent those of Shape Blue Ltd or related companies. If you are not > the > > intended recipient of this email, you must neither take any action based > > upon its contents, nor copy or show it to anyone. Please contact the > > sender if you believe you have received this email in error. Shape Blue > > Ltd is a company incorporated in England & Wales. ShapeBlue Services > India > > LLP is a company incorporated in India and is operated under license from > > Shape Blue Ltd. Shape Blue Brasil Consultoria Ltda is a company > > incorporated in Brasil and is operated under license from Shape Blue Ltd. > > ShapeBlue SA Pty Ltd is a company registered by The Republic of South > > Africa and is traded under license from Shape Blue Ltd. ShapeBlue is a > > registered trademark. > --089e0149c59485d666050075a8a1--