]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: deny writes to a secondary zone by non-system users
authorYehuda Sadeh <yehuda@inktank.com>
Tue, 5 Nov 2013 22:54:20 +0000 (14:54 -0800)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 8 Apr 2014 17:48:25 +0000 (10:48 -0700)
Fixes: #6678
We don't want to allow regular users to write to secondary zones,
otherwise we'd end up with data inconsistencies.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
(cherry picked from commit 6961b5254f16ac3362c3a51f5490328d23640dbf)

Conflicts:
src/rgw/rgw_rados.h

src/rgw/rgw_op.cc
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index c9601f90dbbca9ed4c7d77bb1e7c7b904d57b15a..c1bfc2c5fb8951c5cf7c93fea6f35737f3555e62 100644 (file)
@@ -418,6 +418,13 @@ int RGWOp::verify_op_mask()
     return -EPERM;
   }
 
+  if (!s->system_request &&
+      (required_mask & (RGW_OP_TYPE_WRITE | RGW_OP_TYPE_DELETE)) &&
+      !store->zone.is_master)  {
+    ldout(s->cct, 5) << "NOTICE: modify request to a non-master zone by a non-system user, permission denied"  << dendl;
+    return -EPERM;
+  }
+
   return 0;
 }
 
index dcc3a435345b5cfa761fcee17f01984713ad6cf0..0be95c36a69135da09018fcac586db10b13055e3 100644 (file)
@@ -337,6 +337,10 @@ int RGWZoneParams::init(CephContext *cct, RGWRados *store, RGWRegion& region)
     return -EIO;
   }
 
+  is_master = (name == region.master_zone) || (region.master_zone.empty() && name == "default");
+
+  ldout(cct, 2) << "zone " << name << " is " << (is_master ? "" : "NOT ") << "master" << dendl;
+
   return 0;
 }
 
index 9aa6060e2a64cbb300c96c148bded247ab892821..1a590718030d6b865359b432b308d450522ff421 100644 (file)
@@ -428,11 +428,14 @@ struct RGWZoneParams {
   rgw_bucket user_uid_pool;
 
   string name;
+  bool is_master;
 
   RGWAccessKey system_key;
 
   map<string, RGWZonePlacementInfo> placement_pools;
 
+  RGWZoneParams() : is_master(false) {}
+
   static string get_pool_name(CephContext *cct);
   void init_name(CephContext *cct, RGWRegion& region);
   int init(CephContext *cct, RGWRados *store, RGWRegion& region);