| 1 | // -------------------------------------------------------------------------- |
|---|
| 2 | // |
|---|
| 3 | // File |
|---|
| 4 | // Name: BackupDaemonConfigVerify.cpp |
|---|
| 5 | // Purpose: Configuration file definition for bbackupd |
|---|
| 6 | // Created: 2003/10/10 |
|---|
| 7 | // |
|---|
| 8 | // -------------------------------------------------------------------------- |
|---|
| 9 | |
|---|
| 10 | #include "Box.h" |
|---|
| 11 | #include "BackupDaemonConfigVerify.h" |
|---|
| 12 | #include "Daemon.h" |
|---|
| 13 | #include "BoxPortsAndFiles.h" |
|---|
| 14 | |
|---|
| 15 | #include "MemLeakFindOn.h" |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | static const ConfigurationVerifyKey backuplocationkeys[] = |
|---|
| 19 | { |
|---|
| 20 | ConfigurationVerifyKey("ExcludeFile", ConfigTest_MultiValueAllowed), |
|---|
| 21 | ConfigurationVerifyKey("ExcludeFilesRegex", ConfigTest_MultiValueAllowed), |
|---|
| 22 | ConfigurationVerifyKey("ExcludeDir", ConfigTest_MultiValueAllowed), |
|---|
| 23 | ConfigurationVerifyKey("ExcludeDirsRegex", ConfigTest_MultiValueAllowed), |
|---|
| 24 | ConfigurationVerifyKey("AlwaysIncludeFile", ConfigTest_MultiValueAllowed), |
|---|
| 25 | ConfigurationVerifyKey("AlwaysIncludeFilesRegex", ConfigTest_MultiValueAllowed), |
|---|
| 26 | ConfigurationVerifyKey("AlwaysIncludeDir", ConfigTest_MultiValueAllowed), |
|---|
| 27 | ConfigurationVerifyKey("AlwaysIncludeDirsRegex", ConfigTest_MultiValueAllowed), |
|---|
| 28 | ConfigurationVerifyKey("Path", ConfigTest_Exists | ConfigTest_LastEntry) |
|---|
| 29 | }; |
|---|
| 30 | |
|---|
| 31 | static const ConfigurationVerify backuplocations[] = |
|---|
| 32 | { |
|---|
| 33 | { |
|---|
| 34 | "*", |
|---|
| 35 | 0, |
|---|
| 36 | backuplocationkeys, |
|---|
| 37 | ConfigTest_LastEntry, |
|---|
| 38 | 0 |
|---|
| 39 | } |
|---|
| 40 | }; |
|---|
| 41 | |
|---|
| 42 | static const ConfigurationVerifyKey verifyserverkeys[] = |
|---|
| 43 | { |
|---|
| 44 | DAEMON_VERIFY_SERVER_KEYS |
|---|
| 45 | }; |
|---|
| 46 | |
|---|
| 47 | static const ConfigurationVerify verifyserver[] = |
|---|
| 48 | { |
|---|
| 49 | { |
|---|
| 50 | "Server", |
|---|
| 51 | 0, |
|---|
| 52 | verifyserverkeys, |
|---|
| 53 | ConfigTest_Exists, |
|---|
| 54 | 0 |
|---|
| 55 | }, |
|---|
| 56 | { |
|---|
| 57 | "BackupLocations", |
|---|
| 58 | backuplocations, |
|---|
| 59 | 0, |
|---|
| 60 | ConfigTest_Exists | ConfigTest_LastEntry, |
|---|
| 61 | 0 |
|---|
| 62 | } |
|---|
| 63 | }; |
|---|
| 64 | |
|---|
| 65 | static const ConfigurationVerifyKey verifyrootkeys[] = |
|---|
| 66 | { |
|---|
| 67 | ConfigurationVerifyKey("AccountNumber", |
|---|
| 68 | ConfigTest_Exists | ConfigTest_IsUint32), |
|---|
| 69 | ConfigurationVerifyKey("UpdateStoreInterval", |
|---|
| 70 | ConfigTest_Exists | ConfigTest_IsInt), |
|---|
| 71 | ConfigurationVerifyKey("MinimumFileAge", |
|---|
| 72 | ConfigTest_Exists | ConfigTest_IsInt), |
|---|
| 73 | ConfigurationVerifyKey("MaxUploadWait", |
|---|
| 74 | ConfigTest_Exists | ConfigTest_IsInt), |
|---|
| 75 | ConfigurationVerifyKey("MaxFileTimeInFuture", ConfigTest_IsInt, 172800), |
|---|
| 76 | // file is uploaded if the file is this much in the future |
|---|
| 77 | // (2 days default) |
|---|
| 78 | ConfigurationVerifyKey("AutomaticBackup", ConfigTest_IsBool, true), |
|---|
| 79 | |
|---|
| 80 | ConfigurationVerifyKey("SyncAllowScript", 0), |
|---|
| 81 | // script that returns "now" if backup is allowed now, or a number |
|---|
| 82 | // of seconds to wait before trying again if not |
|---|
| 83 | |
|---|
| 84 | ConfigurationVerifyKey("MaximumDiffingTime", ConfigTest_IsInt), |
|---|
| 85 | ConfigurationVerifyKey("DeleteRedundantLocationsAfter", |
|---|
| 86 | ConfigTest_IsInt, 172800), |
|---|
| 87 | |
|---|
| 88 | ConfigurationVerifyKey("FileTrackingSizeThreshold", |
|---|
| 89 | ConfigTest_Exists | ConfigTest_IsInt), |
|---|
| 90 | ConfigurationVerifyKey("DiffingUploadSizeThreshold", |
|---|
| 91 | ConfigTest_Exists | ConfigTest_IsInt), |
|---|
| 92 | ConfigurationVerifyKey("StoreHostname", ConfigTest_Exists), |
|---|
| 93 | ConfigurationVerifyKey("StorePort", ConfigTest_IsInt, |
|---|
| 94 | BOX_PORT_BBSTORED), |
|---|
| 95 | ConfigurationVerifyKey("ExtendedLogging", ConfigTest_IsBool, false), |
|---|
| 96 | // extended log to syslog |
|---|
| 97 | ConfigurationVerifyKey("ExtendedLogFile", 0), |
|---|
| 98 | // extended log to a file |
|---|
| 99 | ConfigurationVerifyKey("LogAllFileAccess", ConfigTest_IsBool, false), |
|---|
| 100 | // enable logging reasons why each file is backed up or not |
|---|
| 101 | ConfigurationVerifyKey("LogFile", 0), |
|---|
| 102 | // enable logging to a file |
|---|
| 103 | ConfigurationVerifyKey("LogFileLevel", 0), |
|---|
| 104 | // set the level of verbosity of file logging |
|---|
| 105 | ConfigurationVerifyKey("CommandSocket", 0), |
|---|
| 106 | // not compulsory to have this |
|---|
| 107 | ConfigurationVerifyKey("KeepAliveTime", ConfigTest_IsInt), |
|---|
| 108 | ConfigurationVerifyKey("StoreObjectInfoFile", 0), |
|---|
| 109 | // optional |
|---|
| 110 | |
|---|
| 111 | ConfigurationVerifyKey("NotifyScript", 0), |
|---|
| 112 | // optional script to run when backup needs attention, eg store full |
|---|
| 113 | |
|---|
| 114 | ConfigurationVerifyKey("NotifyAlways", ConfigTest_IsBool, false), |
|---|
| 115 | // option to disable the suppression of duplicate notifications |
|---|
| 116 | |
|---|
| 117 | ConfigurationVerifyKey("MaxUploadRate", ConfigTest_IsInt), |
|---|
| 118 | // optional maximum speed of uploads in kbytes per second |
|---|
| 119 | |
|---|
| 120 | ConfigurationVerifyKey("TcpNice", ConfigTest_IsBool, false), |
|---|
| 121 | // optional enable of tcp nice/background mode |
|---|
| 122 | |
|---|
| 123 | ConfigurationVerifyKey("CertificateFile", ConfigTest_Exists), |
|---|
| 124 | ConfigurationVerifyKey("PrivateKeyFile", ConfigTest_Exists), |
|---|
| 125 | ConfigurationVerifyKey("TrustedCAsFile", ConfigTest_Exists), |
|---|
| 126 | ConfigurationVerifyKey("KeysFile", ConfigTest_Exists), |
|---|
| 127 | ConfigurationVerifyKey("DataDirectory", |
|---|
| 128 | ConfigTest_Exists | ConfigTest_LastEntry), |
|---|
| 129 | |
|---|
| 130 | }; |
|---|
| 131 | |
|---|
| 132 | const ConfigurationVerify BackupDaemonConfigVerify = |
|---|
| 133 | { |
|---|
| 134 | "root", |
|---|
| 135 | verifyserver, |
|---|
| 136 | verifyrootkeys, |
|---|
| 137 | ConfigTest_Exists | ConfigTest_LastEntry, |
|---|
| 138 | 0 |
|---|
| 139 | }; |
|---|