[ 
https://issues.apache.org/jira/browse/BROOKLYN-15?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14090582#comment-14090582
 ] 

ASF GitHub Bot commented on BROOKLYN-15:
----------------------------------------

Github user sjcorbett commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/112#discussion_r15986103
  
    --- Diff: 
usage/rest-server/src/main/java/brooklyn/rest/security/PasswordHasher.java ---
    @@ -0,0 +1,31 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing,
    + * software distributed under the License is distributed on an
    + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    + * KIND, either express or implied.  See the License for the
    + * specific language governing permissions and limitations
    + * under the License.
    + */
    +package brooklyn.rest.security;
    +
    +import com.google.common.base.Charsets;
    +import com.google.common.hash.HashCode;
    +import com.google.common.hash.Hashing;
    +
    +public class PasswordHasher {
    --- End diff --
    
    Could consider including the MD5 part of `Jboss7SshDriver.hashPassword` 
here too. 


> web-console authentication: store hashed passwords in brooklyn.properties
> -------------------------------------------------------------------------
>
>                 Key: BROOKLYN-15
>                 URL: https://issues.apache.org/jira/browse/BROOKLYN-15
>             Project: Brooklyn
>          Issue Type: New Feature
>            Reporter: Aled Sage
>            Assignee: Aled Sage
>
> The brooklyn web-console can do user authentication - this can point at an 
> enterprise LDAP server, or can use the quick-and-easy username:password 
> defined in the ~/.brooklyn/brooklyn.properties file.
> However, the passwords in brooklyn.properties are currently stored in plain 
> text. Instead, it should be hashed (using the username as a salt).
> I suggest we use SHA 256 for now. One can generate the password from the 
> (linux / OSX) command line with:
>     echo -n aled:mypassword | shasum -a 256
> In our code, we can then use guava's Hashing with something like:
>     
> Hashing.sha256().hashBytes(Charsets.US_ASCII.encode("aled:mypassword").array())
> (but note that UTF_8 is appending an extra `0` to the bytes, so gives a 
> different sha256! Is using US_ASCII going to be a bad idea?!)
> The brooklyn.properties file could have:
>     brooklyn.webconsole.security.users=aled
>     
> brooklyn.webconsole.security.user.admin.sha256=0dfecb1ab5426c781ec42e1c7cc98468975aed0dd28f9d9668237a9c7996862d
>     
> Much longer term, we could consider using https://shiro.apache.org/ or 
> equivalent (but that is out of scope for this feature request).



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to