config.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. /*@flow*/
  2. /*
  3. globals module
  4. */
  5. var _domain = 'http://pad.cisti.org:2000/';
  6. // You can `kill -USR2` the node process and it will write out a heap dump.
  7. // If your system doesn't support dumping, comment this out and install with
  8. // `npm install --production`
  9. // See: https://strongloop.github.io/strongloop.com/strongblog/how-to-heap-snapshots/
  10. // to enable this feature, uncomment the line below:
  11. // require('heapdump');
  12. // we prepend a space because every usage expects it
  13. // requiring admins to preserve it is unnecessarily confusing
  14. var domain = ' ' + _domain;
  15. module.exports = {
  16. // the address you want to bind to, :: means all ipv4 and ipv6 addresses
  17. // this may not work on all operating systems
  18. httpAddress: '::',
  19. // the port on which your httpd will listen
  20. /* CryptPad can be configured to send customized HTTP Headers
  21. * These settings may vary widely depending on your needs
  22. * Examples are provided below
  23. */
  24. httpHeaders: {
  25. "X-XSS-Protection": "1; mode=block",
  26. "X-Content-Type-Options": "nosniff",
  27. "Access-Control-Allow-Origin": "*"
  28. },
  29. contentSecurity: [
  30. "default-src 'none'",
  31. "style-src 'unsafe-inline' 'self' " + domain,
  32. "script-src 'self'" + domain,
  33. "font-src 'self' data:" + domain,
  34. /* child-src is used to restrict iframes to a set of allowed domains.
  35. * connect-src is used to restrict what domains can connect to the websocket.
  36. *
  37. * it is recommended that you configure these fields to match the
  38. * domain which will serve your CryptPad instance.
  39. */
  40. "child-src blob: *",
  41. // IE/Edge
  42. "frame-src blob: *",
  43. "media-src * blob:",
  44. /* this allows connections over secure or insecure websockets
  45. if you are deploying to production, you'll probably want to remove
  46. the ws://* directive, and change '*' to your domain
  47. */
  48. "connect-src 'self' ws: wss: blob:" + domain,
  49. // data: is used by codemirror
  50. "img-src 'self' data: blob:" + domain,
  51. // for accounts.cryptpad.fr authentication and pad2 cross-domain iframe sandbox
  52. "frame-ancestors *",
  53. ].join('; '),
  54. // CKEditor requires significantly more lax content security policy in order to function.
  55. padContentSecurity: [
  56. "default-src 'none'",
  57. "style-src 'unsafe-inline' 'self'" + domain,
  58. // Unsafe inline, unsafe-eval are needed for ckeditor :(
  59. "script-src 'self' 'unsafe-eval' 'unsafe-inline'" + domain,
  60. "font-src 'self'" + domain,
  61. /* See above under 'contentSecurity' as to how these values should be
  62. * configured for best effect.
  63. */
  64. "child-src *",
  65. // IE/Edge
  66. "frame-src *",
  67. // see the comment above in the 'contentSecurity' section
  68. "connect-src 'self' ws: wss:" + domain,
  69. // (insecure remote) images are included by users of the wysiwyg who embed photos in their pads
  70. "img-src * blob:",
  71. ].join('; '),
  72. // OnlyOffice requires even more lax content security policy in order to function.
  73. ooContentSecurity: [
  74. "default-src 'none'",
  75. "style-src 'unsafe-inline' 'self'" + domain,
  76. // Unsafe inline, unsafe-eval are needed for ckeditor :(
  77. "script-src 'self' 'unsafe-eval' 'unsafe-inline'" + domain,
  78. "font-src 'self'" + domain,
  79. /* See above under 'contentSecurity' as to how these values should be
  80. * configured for best effect.
  81. */
  82. "child-src *",
  83. // IE/Edge
  84. "frame-src *",
  85. // see the comment above in the 'contentSecurity' section
  86. "connect-src 'self' blob: ws: wss:" + domain,
  87. // (insecure remote) images are included by users of the wysiwyg who embed photos in their pads
  88. "img-src * blob: data:",
  89. ].join('; '),
  90. httpPort: 2000,
  91. // This is for allowing the cross-domain iframe to function when developing
  92. httpSafePort: 2001,
  93. // This is for deployment in production, CryptPad uses a separate origin (domain) to host the
  94. // cross-domain iframe. It can simply host the same content as CryptPad.
  95. // httpSafeOrigin: "https://some-other-domain.xyz",
  96. httpUnsafeOrigin: domain,
  97. /* your server's websocket url is configurable
  98. * (default: '/cryptpad_websocket')
  99. *
  100. * websocketPath can be relative, of the form '/path/to/websocket'
  101. * or absolute, specifying a particular URL
  102. *
  103. * 'wss://cryptpad.fr:3000/cryptpad_websocket'
  104. */
  105. websocketPath: '/cryptpad_websocket',
  106. /* CryptPad can log activity to stdout
  107. * This may be useful for debugging
  108. */
  109. logToStdout: true,
  110. /* CryptPad supports verbose logging
  111. * (false by default)
  112. */
  113. verbose: false,
  114. /* Main pages
  115. * add exceptions to the router so that we can access /privacy.html
  116. * and other odd pages
  117. */
  118. mainPages: [
  119. 'index',
  120. // 'privacy',
  121. // 'terms',
  122. // 'about',
  123. // 'contact',
  124. // 'what-is-cryptpad',
  125. // 'features',
  126. // 'faq'
  127. ],
  128. /* Limits, Donations, Subscriptions and Contact
  129. *
  130. * By default, CryptPad limits every registered user to 50MB of storage. It also shows a
  131. * subscribe button which allows them to upgrade to a paid account. We handle payment,
  132. * and keep 50% of the proceeds to fund ongoing development.
  133. *
  134. * You can:
  135. * A: leave things as they are
  136. * B: disable accounts but display a donate button
  137. * C: hide any reference to paid accounts or donation
  138. *
  139. * If you chose A then there's nothing to do.
  140. * If you chose B, set 'allowSubscriptions' to false.
  141. * If you chose C, set 'removeDonateButton' to true
  142. */
  143. allowSubscriptions: true,
  144. removeDonateButton: true,
  145. /* Sales coming from your server will be identified by your domain
  146. *
  147. * If you are using CryptPad in a business context, please consider taking a support contract
  148. * by contacting sales@cryptpad.fr
  149. */
  150. myDomain: _domain,
  151. /*
  152. * If you are using CryptPad internally and you want to increase the per-user storage limit,
  153. * change the following value.
  154. *
  155. * Please note: This limit is what makes people subscribe and what pays for CryptPad
  156. * development. Running a public instance that provides a "better deal" than cryptpad.fr
  157. * is effectively using the project against itself.
  158. */
  159. defaultStorageLimit: 50 * 1024 * 1024,
  160. /*
  161. * CryptPad allows administrators to give custom limits to their friends.
  162. * add an entry for each friend, identified by their user id,
  163. * which can be found on the settings page. Include a 'limit' (number of bytes),
  164. * a 'plan' (string), and a 'note' (string).
  165. *
  166. * hint: 1GB is 1024 * 1024 * 1024 bytes
  167. */
  168. customLimits: {
  169. /*
  170. "https://my.awesome.website/user/#/1/cryptpad-user1/YZgXQxKR0Rcb6r6CmxHPdAGLVludrAF2lEnkbx1vVOo=": {
  171. limit: 20 * 1024 * 1024 * 1024,
  172. plan: 'insider',
  173. note: 'storage space donated by my.awesome.website'
  174. },
  175. "https://my.awesome.website/user/#/1/cryptpad-user2/GdflkgdlkjeworijfkldfsdflkjeEAsdlEnkbx1vVOo=": {
  176. limit: 10 * 1024 * 1024 * 1024,
  177. plan: 'insider',
  178. note: 'storage space donated by my.awesome.website'
  179. }
  180. */
  181. },
  182. /* some features may require that the server be able to schedule tasks
  183. far into the future, such as:
  184. > "three months from now, this channel should expire"
  185. To disable these features, set 'enableTaskScheduling' to false
  186. */
  187. enableTaskScheduling: true,
  188. /* if you would like the list of scheduled tasks to be stored in
  189. a custom location, change the path below:
  190. */
  191. taskPath: './tasks',
  192. /* if you would like users' authenticated blocks to be stored in
  193. a custom location, change the path below:
  194. */
  195. blockPath: './block',
  196. /*
  197. * By default, CryptPad also contacts our accounts server once a day to check for changes in
  198. * the people who have accounts. This check-in will also send the version of your CryptPad
  199. * instance and your email so we can reach you if we are aware of a serious problem. We will
  200. * never sell it or send you marketing mail. If you want to block this check-in and remain
  201. * completely invisible, set this and allowSubscriptions both to false.
  202. */
  203. adminEmail: 'admin@cisti.org',
  204. /*
  205. You have the option of specifying an alternative storage adaptor.
  206. These status of these alternatives are specified in their READMEs,
  207. which are available at the following URLs:
  208. mongodb: a noSQL database
  209. https://github.com/xwiki-labs/cryptpad-mongo-store
  210. amnesiadb: in memory storage
  211. https://github.com/xwiki-labs/cryptpad-amnesia-store
  212. leveldb: a simple, fast, key-value store
  213. https://github.com/xwiki-labs/cryptpad-level-store
  214. sql: an adaptor for a variety of sql databases via knexjs
  215. https://github.com/xwiki-labs/cryptpad-sql-store
  216. For the most up to date solution, use the default storage adaptor.
  217. */
  218. storage: './storage/file',
  219. /*
  220. CryptPad stores each document in an individual file on your hard drive.
  221. Specify a directory where files should be stored.
  222. It will be created automatically if it does not already exist.
  223. */
  224. filePath: './datastore/',
  225. /* CryptPad allows logged in users to request that particular documents be
  226. * stored by the server indefinitely. This is called 'pinning'.
  227. * Pin requests are stored in a pin-store. The location of this store is
  228. * defined here.
  229. */
  230. pinPath: './pins',
  231. /* Pads that are not 'pinned' by any registered user can be set to expire
  232. * after a configurable number of days of inactivity (default 90 days).
  233. * The value can be changed or set to false to remove expiration.
  234. * Expired pads can then be removed using a cron job calling the
  235. * `delete-inactive.js` script with node
  236. */
  237. inactiveTime: 90, // days
  238. /* CryptPad allows logged in users to upload encrypted files. Files/blobs
  239. * are stored in a 'blob-store'. Set its location here.
  240. */
  241. blobPath: './blob',
  242. /* CryptPad stores incomplete blobs in a 'staging' area until they are
  243. * fully uploaded. Set its location here.
  244. */
  245. blobStagingPath: './blobstage',
  246. /* CryptPad's file storage adaptor closes unused files after a configurable
  247. * number of milliseconds (default 30000 (30 seconds))
  248. */
  249. channelExpirationMs: 30000,
  250. /* CryptPad's file storage adaptor is limited by the number of open files.
  251. * When the adaptor reaches openFileLimit, it will clean up older files
  252. */
  253. openFileLimit: 2048,
  254. /* CryptPad's socket server can be extended to respond to RPC calls
  255. * you can configure it to respond to custom RPC calls if you like.
  256. * provide the path to your RPC module here, or `false` if you would
  257. * like to disable the RPC interface completely
  258. */
  259. rpc: './rpc.js',
  260. /* RPC errors are shown by default, but if you really don't care,
  261. * you can suppress them
  262. */
  263. suppressRPCErrors: false,
  264. /* Setting this value to anything other than true will cause file upload
  265. * attempts to be rejected outright.
  266. */
  267. enableUploads: true,
  268. /* If you have enabled file upload, you have the option of restricting it
  269. * to a list of users identified by their public keys. If this value is set
  270. * to true, your server will query a file (cryptpad/privileged.conf) when
  271. * users connect via RPC. Only users whose public keys can be found within
  272. * the file will be allowed to upload.
  273. *
  274. * privileged.conf uses '#' for line comments, and splits keys by newline.
  275. * This is a temporary measure until a better quota system is in place.
  276. * registered users' public keys can be found on the settings page.
  277. */
  278. //restrictUploads: false,
  279. /* Max Upload Size (bytes)
  280. * this sets the maximum size of any one file uploaded to the server.
  281. * anything larger than this size will be rejected
  282. */
  283. maxUploadSize: 20 * 1024 * 1024,
  284. /* clients can use the /settings/ app to opt out of usage feedback
  285. * which informs the server of things like how much each app is being
  286. * used, and whether certain clientside features are supported by
  287. * the client's browser. The intent is to provide feedback to the admin
  288. * such that the service can be improved. Enable this with `true`
  289. * and ignore feedback with `false` or by commenting the attribute
  290. */
  291. //logFeedback: true,
  292. /* If you wish to see which remote procedure calls clients request,
  293. * set this to true
  294. */
  295. //logRPC: true,
  296. /* it is recommended that you serve CryptPad over https
  297. * the filepaths below are used to configure your certificates
  298. */
  299. //privKeyAndCertFiles: [
  300. // '/etc/apache2/ssl/my_secret.key',
  301. // '/etc/apache2/ssl/my_public_cert.crt',
  302. // '/etc/apache2/ssl/my_certificate_authorities_cert_chain.ca'
  303. //],
  304. /* You can get a repl for debugging the server if you want it.
  305. * to enable this, specify the debugReplName and then you can
  306. * connect to it with `nc -U /tmp/repl/<your name>.sock`
  307. * If you run multiple cryptpad servers, you need to use different
  308. * repl names.
  309. */
  310. //debugReplName: "cryptpad"
  311. };