You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by jayapalu <gi...@git.apache.org> on 2017/03/09 09:35:27 UTC
[GitHub] cloudstack pull request #1996: CLOUDSTACK-9099: SecretKey is returned from t...
GitHub user jayapalu opened a pull request:
https://github.com/apache/cloudstack/pull/1996
CLOUDSTACK-9099: SecretKey is returned from the APIs
This PR closes the PR #1152
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Accelerite/cloudstack secretkey
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/cloudstack/pull/1996.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1996
----
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request #1996: CLOUDSTACK-9099: SecretKey is returned from t...
Posted by kishankavala <gi...@git.apache.org>.
Github user kishankavala commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/1996#discussion_r109835294
--- Diff: server/src/com/cloud/user/AccountManager.java ---
@@ -198,4 +200,11 @@ void buildACLViewSearchCriteria(SearchCriteria<? extends ControlledViewEntity> s
public static final String MESSAGE_ADD_ACCOUNT_EVENT = "Message.AddAccount.Event";
public static final String MESSAGE_REMOVE_ACCOUNT_EVENT = "Message.RemoveAccount.Event";
+ public static final ConfigKey<Boolean> UseSecretKeyInResponse = new ConfigKey<Boolean>(
+ "Advanced",
+ Boolean.class,
+ "use.secret.key.in.response",
+ "true",
--- End diff --
As per discussion in PR # 1152, default value should be false. Any failing tests due to this change have to be fixed.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack issue #1996: CLOUDSTACK-9099: SecretKey is returned from the APIs
Posted by jayapalu <gi...@git.apache.org>.
Github user jayapalu commented on the issue:
https://github.com/apache/cloudstack/pull/1996
In the travis ci the tests are failing it could be because of timeout. But when I run some of the test locally it is passing.
The same test test_invalid_gw_nm is failing in travis ci.
=====my local xenserver setup test run ==========
nosetests-2.7 --with-marvin --marvin-config=/Users/jayapal_uradi/dev/advanced.cfg --with-xunit --xunit-file=/tmp/test/testslog /Users/jayapal_uradi/dev/github/cloudstack/test/integration/component/test_invalid_gw_nm.py --zone=zone1 --hypervisor=xenserver
==== Marvin Init Started ====
=== Marvin Parse Config Successful ===
=== Marvin Setting TestData Successful===
==== Log Folder Path: /tmp//MarvinLogs//Apr_14_2017_10_30_49_WKRPUW. All logs will be available here ====
=== Marvin Init Logging Successful===
==== Marvin Init Successful ====
===final results are now copied to: /tmp//MarvinLogs/test_invalid_gw_nm_XQRFQU===
HSL007948:cloudstack jayapal_uradi$ vi /tmp//MarvinLogs/test_invalid_gw_nm_XQRFQU/
failed_plus_exceptions.txt results.txt runinfo.txt
HSL007948:cloudstack jayapal_uradi$ vi /tmp//MarvinLogs/test_invalid_gw_nm_XQRFQU/results.txt
HSL007948:cloudstack jayapal_uradi$ cat /tmp//MarvinLogs/test_invalid_gw_nm_XQRFQU/results.txt
test_isolated_nw_invalid_gw (integration.component.test_invalid_gw_nm.TestIsolatedNetworkInvalidGw) ... === TestName: test_isolated_nw_invalid_gw | Status : SUCCESS ===
ok
----------------------------------------------------------------------
Ran 1 test in 5.837s
OK
================== End of my local setup test run ==================
https://travis-ci.org/apache/cloudstack/jobs/221647779
The command ./tools/travis/script.sh component/test_cpu_max_limits component/test_cpu_project_limits component/test_deploy_vm_userdata_multi_nic component/test_egress_fw_rules component/test_invalid_gw_nm component/test_ip_reservation component/test_lb_secondary_ip exited with 1
ContextSuite context=TestIsolatedNetw | exceptions.T | 0 | test_invalid_gw_nm |
| orkInvalidGw>:setup | ypeError | |
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack issue #1996: CLOUDSTACK-9099: SecretKey is returned from the APIs
Posted by rhtyd <gi...@git.apache.org>.
Github user rhtyd commented on the issue:
https://github.com/apache/cloudstack/pull/1996
@jayapalu this is a useful security fix for 4.9 as well, can you please rebase against the 4.9 branch and edit the base branch of the PR to 4.9?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request #1996: CLOUDSTACK-9099: SecretKey is returned from t...
Posted by koushik-das <gi...@git.apache.org>.
Github user koushik-das commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/1996#discussion_r111075302
--- Diff: api/src/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java ---
@@ -0,0 +1,76 @@
+// 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 org.apache.cloudstack.api.command.admin.user;
+
+
+import com.cloud.user.Account;
+import com.cloud.user.User;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.RegisterResponse;
+import org.apache.cloudstack.api.response.UserResponse;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+@APICommand(name = "getUserKeys",
+ description = "This command allows the user to query the seceret and API keys for the account",
+ responseObject = RegisterResponse.class,
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = true,
+ authorized = {RoleType.User})
+
+public class GetUserKeysCmd extends BaseCmd{
+
+ @Parameter(name= ApiConstants.ID, type = CommandType.UUID, entityType = UserResponse.class, required = true, description = "ID of the user whose keys are required")
+ private Long id;
+
+ public static final Logger s_logger = Logger.getLogger(RegisterCmd.class.getName());
+ public static final String s_name = "getuserkeysresponse";
+
+ public Long getID(){
+ return id;
+ }
+
+ public String getCommandName(){
+ return s_name;
+ }
+
+ public long getEntityOwnerId(){
+ User user = _entityMgr.findById(User.class, getID());
+ if(user != null){
+ return user.getAccountId();
+ }
+ else return Account.ACCOUNT_ID_SYSTEM;
+ }
+ public void execute(){
+ List<String> keys = _accountService.getKeys(this);
+ RegisterResponse response = new RegisterResponse();
+ if(keys != null){
+ response.setApiKey(keys.get(0));
+ response.setSecretKey(keys.get(1));
+ }
+
+ response.setObjectName("listkeys");
--- End diff --
Should this be 'userKeys'?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request #1996: CLOUDSTACK-9099: SecretKey is returned from t...
Posted by koushik-das <gi...@git.apache.org>.
Github user koushik-das commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/1996#discussion_r111078382
--- Diff: server/src/com/cloud/api/ApiDBUtils.java ---
@@ -559,6 +561,8 @@
@Inject
private VpcManager vpcMgr;
@Inject
+ private AccountManager accountManager;
--- End diff --
Why there is a need to inject AccountManager? If the config key is a static it can be accessed as AccountManager.<static config key>
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack issue #1996: CLOUDSTACK-9099: SecretKey is returned from the APIs
Posted by jayapalu <gi...@git.apache.org>.
Github user jayapalu commented on the issue:
https://github.com/apache/cloudstack/pull/1996
@rhtyd Once this PR got the LGTMs, I can rebase it on 4.9. Can you please review this PR
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack pull request #1996: CLOUDSTACK-9099: SecretKey is returned from t...
Posted by koushik-das <gi...@git.apache.org>.
Github user koushik-das commented on a diff in the pull request:
https://github.com/apache/cloudstack/pull/1996#discussion_r111075076
--- Diff: api/src/org/apache/cloudstack/api/command/admin/user/GetUserKeysCmd.java ---
@@ -0,0 +1,76 @@
+// 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 org.apache.cloudstack.api.command.admin.user;
+
+
+import com.cloud.user.Account;
+import com.cloud.user.User;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.RegisterResponse;
+import org.apache.cloudstack.api.response.UserResponse;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+@APICommand(name = "getUserKeys",
+ description = "This command allows the user to query the seceret and API keys for the account",
+ responseObject = RegisterResponse.class,
+ requestHasSensitiveInfo = false,
+ responseHasSensitiveInfo = true,
+ authorized = {RoleType.User})
--- End diff --
Can you add the 'since' parameter?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack issue #1996: CLOUDSTACK-9099: SecretKey is returned from the APIs
Posted by jayapalu <gi...@git.apache.org>.
Github user jayapalu commented on the issue:
https://github.com/apache/cloudstack/pull/1996
@koushik-das I have updated for your review comments.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack issue #1996: CLOUDSTACK-9099: SecretKey is returned from the APIs
Posted by jayapalu <gi...@git.apache.org>.
Github user jayapalu commented on the issue:
https://github.com/apache/cloudstack/pull/1996
It seems there is issue in CI due to that test are failing.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] cloudstack issue #1996: CLOUDSTACK-9099: SecretKey is returned from the APIs
Posted by rhtyd <gi...@git.apache.org>.
Github user rhtyd commented on the issue:
https://github.com/apache/cloudstack/pull/1996
@jayapalu can you push -f to kick Travis?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---