From d8e12839af13c3cdad06df9efdb71ad9c6f448b1 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Kashyap Date: Thu, 31 May 2018 16:02:48 +0530 Subject: [PATCH 1/2] Option for IBM IAM auth endpoint --- doc/man/s3fs.1 | 3 +++ src/s3fs.cpp | 11 +++++++++++ src/s3fs_util.cpp | 3 +++ 3 files changed, 17 insertions(+) diff --git a/doc/man/s3fs.1 b/doc/man/s3fs.1 index 3e2d91e..4e60e5f 100644 --- a/doc/man/s3fs.1 +++ b/doc/man/s3fs.1 @@ -225,6 +225,9 @@ This option requires the IAM role name or "auto". If you specify "auto", s3fs wi \fB\-o\fR ibm_iam_auth ( default is not using IBM IAM authentication ) This option instructs s3fs to use IBM IAM authentication. In this mode, the AWSAccessKey and AWSSecretKey will be used as IBM's Service-Instance-ID and APIKey, respectively. .TP +\fB\-o\fR ibm_iam_endpoint ( default is https://iam.bluemix.net ) +Set the URL to use for IBM IAM authentication. +.TP \fB\-o\fR use_xattr ( default is not handling the extended attribute ) Enable to handle the extended attribute(xattrs). If you set this option, you can use the extended attribute. diff --git a/src/s3fs.cpp b/src/s3fs.cpp index 098f1a1..98bf578 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -4523,6 +4523,17 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar is_ibm_iam_auth = true; return 0; } + if(0 == STR2NCMP(arg, "ibm_iam_endpoint=")){ + std::string endpoint_url = ""; + std::string iam_endpoint = strchr(arg, '=') + sizeof(char); + // Check url for http / https protocol string + if((iam_endpoint.compare(0, 8, "https://") != 0) && (iam_endpoint.compare(0, 7, "http://") != 0)) { + S3FS_PRN_EXIT("option ibm_iam_endpoint has invalid format, missing http / https protocol"); + return -1; + } + endpoint_url = iam_endpoint + "/oidc/token"; + S3fsCurl::SetIAMCredentialsURL(endpoint_url.c_str()); + } if(0 == strcmp(arg, "ecs")){ if (is_ibm_iam_auth) { S3FS_PRN_EXIT("option ecs cannot be used in conjunction with ibm"); diff --git a/src/s3fs_util.cpp b/src/s3fs_util.cpp index dacd5e8..69cfc37 100644 --- a/src/s3fs_util.cpp +++ b/src/s3fs_util.cpp @@ -1209,6 +1209,9 @@ void show_help (void) " In this mode, the AWSAccessKey and AWSSecretKey will be used as\n" " IBM's Service-Instance-ID and APIKey, respectively.\n" "\n" + " ibm_iam_endpoint (default is https://iam.bluemix.net)\n" + " - sets the url to use for IBM IAM authentication.\n" + "\n" " use_xattr (default is not handling the extended attribute)\n" " Enable to handle the extended attribute(xattrs).\n" " If you set this option, you can use the extended attribute.\n" From 5a481e6a01ca05301d57972aeea669ba6f182b62 Mon Sep 17 00:00:00 2001 From: Neeraj Kumar Kashyap Date: Mon, 4 Jun 2018 16:44:14 +0530 Subject: [PATCH 2/2] Option for IBM IAM auth endpoint added return --- src/s3fs.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/s3fs.cpp b/src/s3fs.cpp index 98bf578..e9ca317 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -4533,6 +4533,7 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar } endpoint_url = iam_endpoint + "/oidc/token"; S3fsCurl::SetIAMCredentialsURL(endpoint_url.c_str()); + return 0; } if(0 == strcmp(arg, "ecs")){ if (is_ibm_iam_auth) {