CernVM-FS  2.11.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
settings.cc
Go to the documentation of this file.
1 
5 #include "cvmfs_config.h"
6 #include "publish/settings.h"
7 
8 #include <unistd.h>
9 
10 #include <cstdlib>
11 #include <string>
12 #include <vector>
13 
14 #include "crypto/hash.h"
15 #include "options.h"
16 #include "publish/except.h"
17 #include "publish/repository.h"
18 #include "sanitizer.h"
19 #include "util/pointer.h"
20 #include "util/posix.h"
21 #include "util/string.h"
22 
23 namespace publish {
24 
26  if (getenv("TMPDIR") != NULL)
27  tmp_dir_ = getenv("TMPDIR");
28  else
29  tmp_dir_ = "/tmp";
30 }
31 
32 void SettingsSpoolArea::SetSpoolArea(const std::string &path) {
33  workspace_ = path;
34  tmp_dir_ = workspace_() + "/tmp";
35 }
36 
37 void SettingsSpoolArea::SetUnionMount(const std::string &path) {
38  union_mnt_ = path;
39 }
40 
42  repair_mode_ = val;
43 }
44 
46  std::vector<std::string> targets;
47  targets.push_back(tmp_dir());
48  targets.push_back(readonly_mnt());
49  targets.push_back(scratch_dir());
50  targets.push_back(cache_dir());
51  targets.push_back(log_dir());
52  targets.push_back(ovl_work_dir());
53 
54  for (unsigned i = 0; i < targets.size(); ++i) {
55  bool rv = MkdirDeep(targets[i], 0700, true /* veryfy_writable */);
56  if (!rv)
57  throw publish::EPublish("cannot create directory " + targets[i]);
58  }
59 }
60 
61 
62 //------------------------------------------------------------------------------
63 
64 
65 void SettingsTransaction::SetLayoutRevision(const unsigned revision) {
66  layout_revision_ = revision;
67 }
68 
70  in_enter_session_ = value;
71 }
72 
74  base_hash_ = hash;
75 }
76 
79 }
80 
82 {
84 }
85 
87  enforce_limits_ = value;
88 }
89 
92 }
93 
96 }
97 
99  limit_file_size_mb_ = value;
100 }
101 
103  use_catalog_autobalance_ = value;
104 }
105 
107  autobalance_max_weight_ = value;
108 }
109 
111  autobalance_min_weight_ = value;
112 }
113 
115  print_changeset_ = value;
116 }
117 
119  dry_run_ = value;
120 }
121 
122 void SettingsTransaction::SetUnionFsType(const std::string &union_fs) {
123  if (union_fs == "aufs") {
125  } else if ((union_fs == "overlay") || (union_fs == "overlayfs")) {
127  } else if (union_fs == "tarball") {
129  } else {
130  throw EPublish("unsupported union file system: " + union_fs);
131  }
132 }
133 
135  // TODO(jblomer): shall we switch the order?
136  if (DirectoryExists("/sys/fs/aufs")) {
138  return;
139  }
140  // TODO(jblomer): modprobe aufs, try again
141  if (DirectoryExists("/sys/module/overlay")) {
143  return;
144  }
145  // TODO(jblomer): modprobe overlay, try again
146  throw EPublish("neither AUFS nor OverlayFS detected on the system");
147 }
148 
150  // TODO(jblomer)
151  return true;
152 }
153 
154 void SettingsTransaction::SetTimeout(unsigned seconds) {
155  timeout_s_ = seconds;
156 }
157 
159  if (timeout_s_.is_default())
160  return -1;
161  return timeout_s_();
162 }
163 
164 void SettingsTransaction::SetLeasePath(const std::string &path) {
165  lease_path_ = path;
166 }
167 
169  const std::string &from, const std::string &to)
170 {
171  if (from.empty())
172  throw EPublish("template transaction's 'from' path must not be empty");
173  if (to.empty())
174  throw EPublish("template transaction's 'to' path must not be empty");
175  template_from_ = (from[0] == '/') ? from.substr(1) : from;
176  template_to_ = (to[0] == '/') ? to.substr(1) : to;
177 }
178 
179 //------------------------------------------------------------------------------
180 
181 
182 std::string SettingsStorage::GetLocator() const {
183  return std::string(upload::SpoolerDefinition::kDriverNames[type_()]) +
184  "," + tmp_dir_() +
185  "," + endpoint_();
186 }
187 
189  const std::string &s3_config,
190  const std::string &tmp_dir)
191 {
193  tmp_dir_ = tmp_dir;
194  endpoint_ = "cvmfs/" + fqrn_() + "@" + s3_config;
195 }
196 
197 void SettingsStorage::MakeLocal(const std::string &path) {
199  endpoint_ = path;
200  tmp_dir_ = path + "/data/txn";
201 }
202 
204  const std::string &host,
205  unsigned int port,
206  const std::string &tmp_dir)
207 {
209  endpoint_ = "http://" + host + ":" + StringifyInt(port) + "/api/v1";
210  tmp_dir_ = tmp_dir_;
211 }
212 
213 void SettingsStorage::SetLocator(const std::string &locator) {
214  std::vector<std::string> tokens = SplitString(locator, ',');
215  if (tokens.size() != 3) {
216  throw EPublish("malformed storage locator, expected format is "
217  "<type>,<temporary directory>,<endpoint>");
218  }
219  if (tokens[0] == "local") {
221  } else if (tokens[0] == "S3") {
223  } else if (tokens[0] == "gw") {
225  } else {
226  throw EPublish("unsupported storage type: " + tokens[0]);
227  }
228  tmp_dir_ = tokens[1];
229  endpoint_ = tokens[2];
230 }
231 
232 
233 //------------------------------------------------------------------------------
234 
235 void SettingsKeychain::SetKeychainDir(const std::string &keychain_dir) {
237  master_private_key_path_ = keychain_dir + "/" + fqrn_() + ".masterkey";
238  master_public_key_path_ = keychain_dir + "/" + fqrn_() + ".pub";
239  private_key_path_ = keychain_dir + "/" + fqrn_() + ".key";
240  certificate_path_ = keychain_dir + "/" + fqrn_() + ".crt";
241  gw_key_path_ = keychain_dir + "/" + fqrn_() + ".gw";
242 }
243 
244 
250 }
251 
252 
256 }
257 
258 
260  return (FileExists(private_key_path_()) &&
264 }
265 
266 
268  return FileExists(private_key_path_()) &&
270 }
271 
273  return FileExists(gw_key_path_());
274 }
275 
276 //------------------------------------------------------------------------------
277 
278 
280  const SettingsPublisher &settings_publisher)
281  : fqrn_(settings_publisher.fqrn())
282  , url_(settings_publisher.url())
283  , proxy_(settings_publisher.proxy())
284  , tmp_dir_(settings_publisher.transaction().spool_area().tmp_dir())
285  , keychain_(settings_publisher.fqrn())
286 {
287  keychain_.SetKeychainDir(settings_publisher.keychain().keychain_dir());
288 }
289 
290 
292  const SettingsReplica &settings_replica)
293  : fqrn_(settings_replica.fqrn())
294  , url_(settings_replica.url())
295  , keychain_(settings_replica.fqrn())
296 {
297 }
298 
299 
300 void SettingsRepository::SetUrl(const std::string &url) {
301  // TODO(jblomer): sanitiation, check availability
302  url_ = url;
303 }
304 
305 
306 void SettingsRepository::SetProxy(const std::string &proxy) {
307  proxy_ = proxy;
308 }
309 
310 
311 void SettingsRepository::SetTmpDir(const std::string &tmp_dir) {
312  tmp_dir_ = tmp_dir;
313 }
314 
315 
316 void SettingsRepository::SetCertBundle(const std::string &cert_bundle) {
318 }
319 
320 
321 //------------------------------------------------------------------------------
322 
323 
325 
326 
328  const SettingsRepository &settings_repository)
329  : fqrn_(settings_repository.fqrn())
330  , url_(settings_repository.url())
331  , proxy_(settings_repository.proxy())
332  , owner_uid_(0)
333  , owner_gid_(0)
334  , whitelist_validity_days_(kDefaultWhitelistValidity)
335  , is_silent_(false)
336  , is_managed_(false)
337  , storage_(fqrn_())
338  , transaction_(fqrn_())
339  , keychain_(fqrn_())
340 {
341  keychain_.SetKeychainDir(settings_repository.keychain().keychain_dir());
342 }
343 
344 
345 void SettingsPublisher::SetUrl(const std::string &url) {
346  // TODO(jblomer): sanitiation, check availability
347  url_ = url;
348 }
349 
350 
351 void SettingsPublisher::SetProxy(const std::string &proxy) {
352  proxy_ = proxy;
353 }
354 
355 
356 void SettingsPublisher::SetOwner(const std::string &user_name) {
357  bool retval = GetUidOf(user_name, owner_uid_.GetPtr(), owner_gid_.GetPtr());
358  if (!retval) {
359  throw EPublish("unknown user name for repository owner: " + user_name);
360  }
361 }
362 
363 void SettingsPublisher::SetOwner(uid_t uid, gid_t gid) {
364  owner_uid_ = uid;
365  owner_gid_ = gid;
366 }
367 
369  is_silent_ = value;
370 }
371 
373  is_managed_ = value;
374 }
375 
377  ignore_invalid_lease_ = value;
378 }
379 
380 
381 //------------------------------------------------------------------------------
382 
383 
385  delete options_mgr_;
386 }
387 
388 
389 std::map<std::string, std::string> SettingsBuilder::GetSessionEnvironment() {
390  std::map<std::string, std::string> result;
391  std::string session_dir = Env::GetEnterSessionDir();
392  if (session_dir.empty())
393  return result;
394 
395  // Get the repository name from the ephemeral writable shell
396  BashOptionsManager omgr;
397  omgr.set_taint_environment(false);
398  omgr.ParsePath(session_dir + "/env.conf", false /* external */);
399 
400  // We require at least CVMFS_FQRN to be set
401  std::string fqrn;
402  if (!omgr.GetValue("CVMFS_FQRN", &fqrn)) {
403  throw EPublish("no repositories found in ephemeral writable shell",
405  }
406 
407  std::vector<std::string> keys = omgr.GetAllKeys();
408  for (unsigned i = 0; i < keys.size(); ++i) {
409  result[keys[i]] = omgr.GetValueOrDie(keys[i]);
410  }
411  return result;
412 }
413 
414 
416  std::map<std::string, std::string> session_env = GetSessionEnvironment();
417  if (!session_env.empty())
418  return session_env["CVMFS_FQRN"];
419 
420  std::vector<std::string> repositories = FindDirectories(config_path_);
421  if (repositories.empty()) {
422  throw EPublish("no repositories available in " + config_path_,
424  }
425 
426  for (unsigned i = 0; i < repositories.size(); ++i) {
427  repositories[i] = GetFileName(repositories[i]);
428  }
429  if (repositories.size() > 1) {
430  throw EPublish("multiple repositories available in " + config_path_ +
431  ":\n " + JoinStrings(repositories, "\n "),
433  }
434  return repositories[0];
435 }
436 
437 
439  const std::string &ident)
440 {
441  if (HasPrefix(ident, "http://", true /* ignore case */) ||
442  HasPrefix(ident, "https://", true /* ignore case */) ||
443  HasPrefix(ident, "file://", true /* ignore case */))
444  {
445  std::string fqrn = Repository::GetFqrnFromUrl(ident);
447  if (!sanitizer.IsValid(fqrn)) {
448  throw EPublish("malformed repository name: " + fqrn);
449  }
451  settings.SetUrl(ident);
452  return settings;
453  }
454 
455  std::string alias = ident.empty() ? GetSingleAlias() : ident;
456  std::string repo_path = config_path_ + "/" + alias;
457  std::string server_path = repo_path + "/server.conf";
458  std::string replica_path = repo_path + "/replica.conf";
459  std::string fqrn = alias;
460 
461  delete options_mgr_;
463  std::string arg;
465  options_mgr_->ParsePath("/etc/cvmfs/server.local", false /* external */);
466  options_mgr_->ParsePath(server_path, false /* external */);
467  options_mgr_->ParsePath(replica_path, false /* external */);
468  if (options_mgr_->GetValue("CVMFS_REPOSITORY_NAME", &arg))
469  fqrn = arg;
471 
472  if (options_mgr_->GetValue("CVMFS_PUBLIC_KEY", &arg))
473  settings.GetKeychain()->SetKeychainDir(arg);
474  if (options_mgr_->GetValue("CVMFS_STRATUM0", &arg))
475  settings.SetUrl(arg);
476  if (options_mgr_->GetValue("CVMFS_SERVER_PROXY", &arg))
477  settings.SetProxy(arg);
478  // For a replica, the stratum 1 url is the "local" location, hence it takes
479  // precedence over the stratum 0 url
480  if (options_mgr_->GetValue("CVMFS_STRATUM1", &arg))
481  settings.SetUrl(arg);
482  if (options_mgr_->GetValue("CVMFS_SPOOL_DIR", &arg))
483  settings.SetTmpDir(arg + "/tmp");
484  if (options_mgr_->GetValue("X509_CERT_BUNDLE", &arg))
485  settings.SetCertBundle(arg);
486 
487  return settings;
488 }
489 
490 std::string SettingsPublisher::GetReadOnlyXAttr(const std::string &attr) {
491  std::string value;
492  bool rvb = platform_getxattr(this->transaction().spool_area().readonly_mnt(),
493  attr, &value);
494  if (!rvb) {
495  throw EPublish("cannot get extended attribute " + attr);
496  }
497  return value;
498 }
499 
501  std::string session_dir = Env::GetEnterSessionDir();
502  std::map<std::string, std::string> session_env = GetSessionEnvironment();
503  std::string fqrn = session_env["CVMFS_FQRN"];
504 
505  UniquePtr<SettingsPublisher> settings_publisher(
507  // TODO(jblomer): work in progress
508  settings_publisher->GetTransaction()->SetInEnterSession(true);
509  settings_publisher->GetTransaction()->GetSpoolArea()->SetSpoolArea(
510  session_dir);
511 
512  std::string base_hash =
513  settings_publisher->GetReadOnlyXAttr("user.root_hash");
514 
515  BashOptionsManager omgr;
516  omgr.set_taint_environment(false);
517  omgr.ParsePath(settings_publisher->transaction().spool_area().client_config(),
518  false /* external */);
519 
520  std::string arg;
521  settings_publisher->SetUrl(settings_publisher->GetReadOnlyXAttr("user.host"));
522  settings_publisher->SetProxy(
523  settings_publisher->GetReadOnlyXAttr("user.proxy"));
524  if (omgr.GetValue("CVMFS_KEYS_DIR", &arg))
525  settings_publisher->GetKeychain()->SetKeychainDir(arg);
526  settings_publisher->GetTransaction()->SetLayoutRevision(
528  settings_publisher->GetTransaction()->SetBaseHash(shash::MkFromHexPtr(
529  shash::HexPtr(base_hash), shash::kSuffixCatalog));
530  settings_publisher->GetTransaction()->SetUnionFsType("overlayfs");
531  settings_publisher->SetOwner(geteuid(), getegid());
532 
533  return settings_publisher.Release();
534 }
535 
538  SettingsPublisher* settings_publisher) {
539  std::string arg;
540  if (options_mgr_.GetValue("CVMFS_CREATOR_VERSION", &arg)) {
541  settings_publisher->GetTransaction()->SetLayoutRevision(String2Uint64(arg));
542  }
543  if (options_mgr_.GetValue("CVMFS_UNION_FS_TYPE", &arg)) {
544  settings_publisher->GetTransaction()->SetUnionFsType(arg);
545  }
546  if (options_mgr_.GetValue("CVMFS_HASH_ALGORITHM", &arg)) {
547  settings_publisher->GetTransaction()->SetHashAlgorithm(arg);
548  }
549  if (options_mgr_.GetValue("CVMFS_UPSTREAM_STORAGE", &arg)) {
550  settings_publisher->GetStorage()->SetLocator(arg);
551  }
552  if (options_mgr_.GetValue("CVMFS_KEYS_DIR", &arg)) {
553  settings_publisher->GetKeychain()->SetKeychainDir(arg);
554  }
555  if (options_mgr_.GetValue("CVMFS_COMPRESSION_ALGORITHM", &arg)) {
556  settings_publisher->GetTransaction()->SetCompressionAlgorithm(arg);
557  }
558  if (options_mgr_.GetValue("CVMFS_ENFORCE_LIMITS", &arg)) {
559  settings_publisher->GetTransaction()->SetEnforceLimits(
560  options_mgr_.IsOn(arg));
561  }
562  if (options_mgr_.GetValue("CVMFS_NESTED_KCATALOG_LIMIT", &arg)) {
563  settings_publisher->GetTransaction()->SetLimitNestedCatalogKentries(
564  String2Uint64(arg));
565  }
566  if (options_mgr_.GetValue("CVMFS_ROOT_KCATALOG_LIMIT", &arg)) {
567  settings_publisher->GetTransaction()->SetLimitRootCatalogKentries(
568  String2Uint64(arg));
569  }
570  if (options_mgr_.GetValue("CVMFS_FILE_MBYTE_LIMIT", &arg)) {
571  settings_publisher->GetTransaction()->SetLimitFileSizeMb(
572  String2Uint64(arg));
573  }
574  if (options_mgr_.GetValue("CVMFS_AUTOCATALOGS", &arg)) {
575  settings_publisher->GetTransaction()->SetUseCatalogAutobalance(
576  options_mgr_.IsOn(arg));
577  }
578  if (options_mgr_.GetValue("CVMFS_AUTOCATALOGS_MAX_WEIGHT", &arg)) {
579  settings_publisher->GetTransaction()->SetAutobalanceMaxWeight(
580  String2Uint64(arg));
581  }
582  if (options_mgr_.GetValue("CVMFS_AUTOCATALOGS_MIN_WEIGHT", &arg)) {
583  settings_publisher->GetTransaction()->SetAutobalanceMinWeight(
584  String2Uint64(arg));
585  }
586  if (options_mgr_.GetValue("CVMFS_AUTO_REPAIR_MOUNTPOINT", &arg)) {
587  if (!options_mgr_.IsOn(arg)) {
588  settings_publisher->GetTransaction()->GetSpoolArea()->SetRepairMode(
590  }
591  }
592 }
593 
595  const std::string &ident, bool needs_managed)
596 {
597  // we are creating a publisher, it need to have the `server.conf` file
598  // present, otherwise something is wrong and we should exit early
599  const std::string alias(ident.empty() ? GetSingleAlias() : ident);
600 
601  std::map<std::string, std::string> session_env = GetSessionEnvironment();
602  // We can be in an ephemeral writable shell but interested in a different
603  // repository
604 
605  const std::string server_path = config_path_ + "/" + alias + "/server.conf";
606 
607  // Instead of returning the Settings from session, we need more processing
608  if (!session_env.empty() && (session_env["CVMFS_FQRN"] == alias)) {
609  SettingsPublisher *settings_publisher =
611  if (FileExists(server_path)) {
612  delete options_mgr_;
615  options_mgr_->ParsePath(server_path, false /* external */);
616  ApplyOptionsFromServerPath(*options_mgr_, settings_publisher);
617  }
618  return settings_publisher;
619  }
620 
621  if (FileExists(server_path) == false) {
622  throw EPublish(
623  "Unable to find the configuration file `server.conf` for the cvmfs "
624  "publisher: " + alias,
626  }
627 
628  SettingsRepository settings_repository = CreateSettingsRepository(alias);
629  if (needs_managed && !IsManagedRepository())
630  throw EPublish("remote repositories are not supported in this context");
631 
632  if (options_mgr_->GetValueOrDie("CVMFS_REPOSITORY_TYPE") != "stratum0") {
633  throw EPublish("Repository " + alias + " is not a stratum 0 repository",
635  }
636 
637  UniquePtr<SettingsPublisher> settings_publisher(
638  new SettingsPublisher(settings_repository));
639 
640  try {
641  std::string xattr = settings_publisher->GetReadOnlyXAttr("user.root_hash");
642  settings_publisher->GetTransaction()->SetBaseHash(
644  } catch (const EPublish& e) {
645  // We ignore the exception.
646  // In case of exception, the base hash remains unset.
647  }
648 
649  settings_publisher->SetIsManaged(IsManagedRepository());
650  settings_publisher->SetOwner(options_mgr_->GetValueOrDie("CVMFS_USER"));
651  settings_publisher->GetStorage()->SetLocator(
652  options_mgr_->GetValueOrDie("CVMFS_UPSTREAM_STORAGE"));
653 
654  ApplyOptionsFromServerPath(*options_mgr_, &*settings_publisher);
655 
656  // TODO(jblomer): process other parameters
657  return settings_publisher.Release();
658 }
659 
660 } // namespace publish
void SetUnionFsType(const std::string &union_fs)
Definition: settings.cc:122
SettingsKeychain * GetKeychain()
Definition: settings.h:377
std::string GetValueOrDie(const std::string &key)
Definition: options.cc:387
Setting< std::string > keychain_dir_
Definition: settings.h:338
void SetIgnoreInvalidLease(bool value)
Definition: settings.cc:376
Algorithms ParseCompressionAlgorithm(const std::string &algorithm_option)
Definition: compression.cc:148
std::string config_path_
Definition: settings.h:541
std::string readonly_mnt() const
Definition: settings.h:95
bool HasGatewayKey() const
Definition: settings.cc:272
Setting< unsigned > timeout_s_
Definition: settings.h:261
virtual void ParsePath(const std::string &config_file, const bool external)=0
SettingsPublisher * CreateSettingsPublisher(const std::string &ident, bool needs_managed=false)
Definition: settings.cc:594
SettingsTransaction * GetTransaction()
Definition: settings.h:441
void SetUrl(const std::string &url)
Definition: settings.cc:300
void SetUnionMount(const std::string &path)
Definition: settings.cc:37
void MakeGateway(const std::string &host, unsigned port, const std::string &tmp_dir)
Definition: settings.cc:203
NameString GetFileName(const PathString &path)
Definition: shortstring.cc:29
Setting< bool > is_managed_
Definition: settings.h:452
void SetTimeout(unsigned seconds)
Definition: settings.cc:154
SettingsKeychain * GetKeychain()
Definition: settings.h:442
void SetKeychainDir(const std::string &keychain_dir)
Definition: settings.cc:235
Setting< gid_t > owner_gid_
Definition: settings.h:449
std::string keychain_dir() const
Definition: settings.h:325
void SetLimitNestedCatalogKentries(unsigned value)
Definition: settings.cc:90
EUnionMountRepairMode
Definition: settings.h:64
void SetAutobalanceMaxWeight(unsigned value)
Definition: settings.cc:106
string JoinStrings(const vector< string > &strings, const string &joint)
Definition: string.cc:325
void SetIsSilent(bool value)
Definition: settings.cc:368
void set_taint_environment(bool value)
Definition: options.h:193
Setting< UnionFsType > union_fs_
Definition: settings.h:257
bool IsOn(const std::string &param_value) const
Definition: options.cc:409
Setting< upload::SpoolerDefinition::DriverType > type_
Definition: settings.h:299
void SetTemplate(const std::string &from, const std::string &to)
Definition: settings.cc:168
const SettingsPublisher & settings() const
Definition: repository.h:317
Setting< bool > enforce_limits_
Definition: settings.h:247
std::string GetSingleAlias()
Definition: settings.cc:415
Setting< std::string > union_mnt_
Definition: settings.h:125
SettingsRepository(const std::string &fqrn)
Definition: settings.h:355
void SetLayoutRevision(const unsigned revision)
Definition: settings.cc:65
std::string log_dir() const
Definition: settings.h:103
Setting< bool > ignore_invalid_lease_
Definition: settings.h:455
void SetLeasePath(const std::string &path)
Definition: settings.cc:164
Setting< std::string > tmp_dir_
Definition: settings.h:383
static const char * kDriverNames[]
corresponds to DriverType
std::string cert_bundle() const
Definition: settings.h:374
std::vector< std::string > FindDirectories(const std::string &parent_dir)
Definition: posix.cc:1175
Setting< unsigned > layout_revision_
Definition: settings.h:228
void SetAutobalanceMinWeight(unsigned value)
Definition: settings.cc:110
char algorithm
SettingsPublisher(const std::string &fqrn)
Definition: settings.h:399
OptionsManager * options_mgr_
Definition: settings.h:547
Setting< bool > is_silent_
Definition: settings.h:451
bool HasMasterKeys() const
Definition: settings.cc:253
void ApplyOptionsFromServerPath(const OptionsManager &options_mgr_, SettingsPublisher *settings_publisher)
Definition: settings.cc:536
Setting< shash::Any > base_hash_
Definition: settings.h:241
bool IsValid(const std::string &input) const
Definition: sanitizer.cc:114
Setting< unsigned > limit_root_catalog_kentries_
Definition: settings.h:249
bool FileExists(const std::string &path)
Definition: posix.cc:787
std::string cache_dir() const
Definition: settings.h:108
bool HasRepositoryKeys() const
Definition: settings.cc:267
std::string proxy() const
Definition: settings.h:372
const SettingsKeychain & keychain() const
Definition: settings.h:439
void SetTmpDir(const std::string &tmp_dir)
Definition: settings.cc:311
bool IsManagedRepository() const
Definition: settings.h:524
Setting< bool > in_enter_session_
Definition: settings.h:233
vector< string > SplitString(const string &str, char delim)
Definition: string.cc:290
void SetDryRun(bool value)
Definition: settings.cc:118
bool platform_getxattr(const std::string &path, const std::string &name, std::string *value)
Setting< std::string > template_from_
Definition: settings.h:267
Setting< uid_t > owner_uid_
Definition: settings.h:448
Setting< bool > use_catalog_autobalance_
Definition: settings.h:251
void SetProxy(const std::string &proxy)
Definition: settings.cc:351
const char kSuffixCatalog
Definition: hash.h:54
std::string GetReadOnlyXAttr(const std::string &attr)
Definition: settings.cc:490
void SetUrl(const std::string &url)
Definition: settings.cc:345
std::vector< std::string > GetAllKeys()
Definition: options.cc:423
std::string ovl_work_dir() const
Definition: settings.h:109
SettingsRepository CreateSettingsRepository(const std::string &ident)
Definition: settings.cc:438
Setting< unsigned > autobalance_max_weight_
Definition: settings.h:252
void SetLimitRootCatalogKentries(unsigned value)
Definition: settings.cc:94
bool MkdirDeep(const std::string &path, const mode_t mode, bool verify_writable)
Definition: posix.cc:842
void SetIsManaged(bool value)
Definition: settings.cc:372
Setting< std::string > workspace_
Definition: settings.h:123
const SettingsTransaction & transaction() const
Definition: settings.h:438
SettingsPublisher * CreateSettingsPublisherFromSession()
Definition: settings.cc:500
SettingsKeychain keychain_
Definition: settings.h:459
bool is_default() const
Definition: settings.h:51
std::string proxy() const
Definition: settings.h:427
void SetHashAlgorithm(const std::string &algorithm)
Definition: settings.cc:77
string StringifyInt(const int64_t value)
Definition: string.cc:78
void SetLocator(const std::string &locator)
Definition: settings.cc:213
Setting< std::string > fqrn_
Definition: settings.h:298
void SetCertBundle(const std::string &cert_bundle)
Definition: settings.cc:316
Setting< bool > print_changeset_
Definition: settings.h:254
SettingsStorage * GetStorage()
Definition: settings.h:440
bool HasPrefix(const string &str, const string &prefix, const bool ignore_case)
Definition: string.cc:267
Setting< zlib::Algorithms > compression_algorithm_
Definition: settings.h:243
bool GetValue(const std::string &key, std::string *value) const
Definition: options.cc:376
OptionsManager * options_mgr_
Definition: cvmfs.cc:147
Setting< std::string > fqrn_
Definition: settings.h:337
bool DirectoryExists(const std::string &path)
Definition: posix.cc:809
Setting< std::string > cert_bundle_
Definition: settings.h:386
void SetLimitFileSizeMb(unsigned value)
Definition: settings.cc:98
Setting< std::string > url_
Definition: settings.h:446
Setting< std::string > template_to_
Definition: settings.h:268
void SetUseCatalogAutobalance(bool value)
Definition: settings.cc:102
Setting< EUnionMountRepairMode > repair_mode_
Definition: settings.h:129
Setting< unsigned > autobalance_min_weight_
Definition: settings.h:253
void SetCompressionAlgorithm(const std::string &algorithm)
Definition: settings.cc:81
Setting< std::string > private_key_path_
Definition: settings.h:341
void SetSpoolArea(const std::string &path)
Definition: settings.cc:32
Setting< shash::Algorithms > hash_algorithm_
Definition: settings.h:242
void SetEnforceLimits(bool value)
Definition: settings.cc:86
Setting< std::string > tmp_dir_
Definition: settings.h:300
void ParsePath(const std::string &config_file, const bool external)
Definition: options.cc:146
void SetProxy(const std::string &proxy)
Definition: settings.cc:306
Setting< std::string > master_private_key_path_
Definition: settings.h:339
const SettingsKeychain & keychain() const
Definition: settings.h:376
static const unsigned kDefaultWhitelistValidity
Definition: settings.h:397
std::string tmp_dir() const
Definition: settings.h:94
Setting< std::string > proxy_
Definition: settings.h:447
void SetBaseHash(const shash::Any &hash)
Definition: settings.cc:73
Setting< std::string > endpoint_
Definition: settings.h:301
uint64_t String2Uint64(const string &value)
Definition: string.cc:228
void SetPrintChangeset(bool value)
Definition: settings.cc:114
bool GetUidOf(const std::string &username, uid_t *uid, gid_t *main_gid)
Definition: posix.cc:1340
Algorithms ParseHashAlgorithm(const string &algorithm_option)
Definition: hash.cc:72
std::string scratch_dir() const
Definition: settings.h:101
std::map< std::string, std::string > GetSessionEnvironment()
Definition: settings.cc:389
SettingsSpoolArea * GetSpoolArea()
Definition: settings.h:218
bool HasDanglingRepositoryKeys() const
Definition: settings.cc:259
Any MkFromHexPtr(const HexPtr hex, const char suffix)
Definition: hash.cc:83
Setting< unsigned > limit_file_size_mb_
Definition: settings.h:250
void MakeLocal(const std::string &path)
Definition: settings.cc:197
Setting< std::string > master_public_key_path_
Definition: settings.h:340
void SetOwner(const std::string &user_name)
Definition: settings.cc:356
void SetRepairMode(const EUnionMountRepairMode val)
Definition: settings.cc:41
Setting< unsigned > limit_nested_catalog_kentries_
Definition: settings.h:248
SettingsKeychain keychain_
Definition: settings.h:388
Setting< bool > dry_run_
Definition: settings.h:255
Setting< std::string > certificate_path_
Definition: settings.h:342
std::string url() const
Definition: settings.h:371
Setting< std::string > proxy_
Definition: settings.h:382
void MakeS3(const std::string &s3_config, const std::string &tmp_dir)
Definition: settings.cc:188
std::string url() const
Definition: settings.h:426
Setting< std::string > tmp_dir_
Definition: settings.h:124
std::string GetLocator() const
Definition: settings.cc:182
Setting< std::string > url_
Definition: settings.h:381
void SetInEnterSession(const bool value)
Definition: settings.cc:69
Setting< std::string > gw_key_path_
Definition: settings.h:343
Setting< std::string > lease_path_
Definition: settings.h:262
std::string tmp_dir() const
Definition: settings.h:373
static const unsigned kRequiredLayoutRevision
Definition: repository.h:278
class static __attribute__((visibility("default"))) Repository std::string GetFqrnFromUrl(const std::string &url)
Definition: repository.cc:231
bool HasDanglingMasterKeys() const
Definition: settings.cc:245