|
74 | 74 | import com.cloud.network.NetworkManager; |
75 | 75 | import com.cloud.network.NetworkVO; |
76 | 76 | import com.cloud.network.RemoteAccessVpnVO; |
77 | | -import com.cloud.network.Site2SiteCustomerGatewayVO; |
78 | | -import com.cloud.network.Site2SiteVpnConnectionVO; |
79 | 77 | import com.cloud.network.VpnUserVO; |
80 | 78 | import com.cloud.network.dao.IPAddressDao; |
81 | 79 | import com.cloud.network.dao.NetworkDao; |
82 | 80 | import com.cloud.network.dao.RemoteAccessVpnDao; |
83 | | -import com.cloud.network.dao.Site2SiteCustomerGatewayDao; |
84 | | -import com.cloud.network.dao.Site2SiteVpnConnectionDao; |
85 | | -import com.cloud.network.dao.Site2SiteVpnGatewayDao; |
86 | 81 | import com.cloud.network.dao.VpnUserDao; |
87 | 82 | import com.cloud.network.security.SecurityGroupManager; |
88 | 83 | import com.cloud.network.security.dao.SecurityGroupDao; |
@@ -881,6 +876,7 @@ public UserAccount updateUser(UpdateUserCmd cmd) { |
881 | 876 | throw new InvalidParameterValueException("unable to find user by id"); |
882 | 877 | } |
883 | 878 |
|
| 879 | + //don't allow updating system account |
884 | 880 | if (account != null && (account.getId() == Account.ACCOUNT_ID_SYSTEM)) { |
885 | 881 | throw new PermissionDeniedException("user id : " + id + " is system account, update is not allowed"); |
886 | 882 | } |
@@ -1713,7 +1709,7 @@ public UserAccount authenticateUser(String username, String password, Long domai |
1713 | 1709 | String singleSignOnTolerance = _configDao.getValue("security.singlesignon.tolerance.millis"); |
1714 | 1710 | if (singleSignOnTolerance == null) { |
1715 | 1711 | // the SSO tolerance is gone (how much time before/after system time we'll allow the login request to be |
1716 | | -// valid), |
| 1712 | + // valid), |
1717 | 1713 | // don't authenticate |
1718 | 1714 | return null; |
1719 | 1715 | } |
@@ -1798,6 +1794,12 @@ public UserAccount authenticateUser(String username, String password, Long domai |
1798 | 1794 | } |
1799 | 1795 |
|
1800 | 1796 | if (user != null) { |
| 1797 | + //don't allow to authenticate system user |
| 1798 | + if (user.getId() == User.UID_SYSTEM) { |
| 1799 | + s_logger.error("Failed to authenticate user: " + username + " in domain " + domainId); |
| 1800 | + return null; |
| 1801 | + } |
| 1802 | + |
1801 | 1803 | if (s_logger.isDebugEnabled()) { |
1802 | 1804 | s_logger.debug("User: " + username + " in domain " + domainId + " has successfully logged in"); |
1803 | 1805 | } |
@@ -1895,8 +1897,14 @@ public Pair<User, Account> findUserByApiKey(String apiKey) { |
1895 | 1897 | public String[] createApiKeyAndSecretKey(RegisterCmd cmd) { |
1896 | 1898 | Long userId = cmd.getId(); |
1897 | 1899 |
|
1898 | | - if (getUserIncludingRemoved(userId) == null) { |
1899 | | - throw new InvalidParameterValueException("unable to find user for id : " + userId); |
| 1900 | + User user = getUserIncludingRemoved(userId); |
| 1901 | + if (user == null) { |
| 1902 | + throw new InvalidParameterValueException("unable to find user by id"); |
| 1903 | + } |
| 1904 | + |
| 1905 | + //don't allow updating system user |
| 1906 | + if (user.getId() == User.UID_SYSTEM) { |
| 1907 | + throw new PermissionDeniedException("user id : " + user.getId() + " is system account, update is not allowed"); |
1900 | 1908 | } |
1901 | 1909 |
|
1902 | 1910 | // generate both an api key and a secret key, update the user table with the keys, return the keys to the user |
|
0 commit comments