]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
rgw: use DEFER_DROP_PRIVILEGES flag unconditionally
authorCasey Bodley <cbodley@redhat.com>
Fri, 17 Apr 2020 14:50:55 +0000 (10:50 -0400)
committerCasey Bodley <cbodley@redhat.com>
Fri, 17 Apr 2020 14:50:59 +0000 (10:50 -0400)
this flag doesn't take effect unless its set before global_init()

Fixes: https://tracker.ceph.com/issues/44661
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_main.cc

index f9fd8bbb270638d19fa032ac7c6495d372425e5c..e50b5a7161a66ecf94b71c1e4bd70eb7fa428d0a 100644 (file)
@@ -203,6 +203,10 @@ int radosgw_Main(int argc, const char **argv)
   }
 
   int flags = CINIT_FLAG_UNPRIVILEGED_DAEMON_DEFAULTS;
+  // Prevent global_init() from dropping permissions until frontends can bind
+  // privileged ports
+  flags |= CINIT_FLAG_DEFER_DROP_PRIVILEGES;
+
   auto cct = global_init(&defaults, args, CEPH_ENTITY_TYPE_CLIENT,
                         CODE_ENVIRONMENT_DAEMON,
                         flags, "rgw_data");
@@ -221,9 +225,6 @@ int radosgw_Main(int argc, const char **argv)
     string& f = *iter;
 
     if (f.find("civetweb") != string::npos || f.find("beast") != string::npos) {
-      // If civetweb or beast is configured as a frontend, prevent global_init() from
-      // dropping permissions by setting the appropriate flag.
-      flags |= CINIT_FLAG_DEFER_DROP_PRIVILEGES;
       if (f.find("port") != string::npos) {
         // check for the most common ws problems
         if ((f.find("port=") == string::npos) ||