Skip to content

Commit fc57ec7

Browse files
rgw/sts: removing default value of rgw sts key and
adding checks to return error when it is not set in config options. Signed-off-by: Pritha Srivastava <[email protected]>
1 parent 04893ca commit fc57ec7

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

src/common/options/rgw.yaml.in

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3470,7 +3470,6 @@ options:
34703470
generated by the command 'openssl rand -hex 16'. All radosgw instances
34713471
in a zone should use the same key. In multisite configurations, all
34723472
zones in a realm should use the same key.
3473-
default: sts
34743473
services:
34753474
- rgw
34763475
with_legacy: true

src/rgw/rgw_rest_s3.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6986,6 +6986,10 @@ rgw::auth::s3::STSEngine::get_session_token(const DoutPrefixProvider* dpp, const
69866986
return -EINVAL;
69876987
}
69886988
string secret_s = cct->_conf->rgw_sts_key;
6989+
if (secret_s.empty()) {
6990+
ldpp_dout(dpp, 1) << "ERROR: rgw sts key not set" << dendl;
6991+
return -EINVAL;
6992+
}
69896993
buffer::ptr secret(secret_s.c_str(), secret_s.length());
69906994
int ret = 0;
69916995
if (ret = cryptohandler->validate_secret(secret); ret < 0) {

src/rgw/rgw_sts.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ int Credentials::generateCredentials(const DoutPrefixProvider *dpp,
7777
return -EINVAL;
7878
}
7979
string secret_s = cct->_conf->rgw_sts_key;
80+
if (secret_s.empty()) {
81+
ldpp_dout(dpp, 1) << "ERROR: rgw sts key not set" << dendl;
82+
return -EINVAL;
83+
}
84+
8085
buffer::ptr secret(secret_s.c_str(), secret_s.length());
8186
int ret = 0;
8287
if (ret = cryptohandler->validate_secret(secret); ret < 0) {

0 commit comments

Comments
 (0)