cifrado 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (361) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.gitignore +18 -0
  3. data/CHANGELOG.md +44 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +247 -0
  7. data/RELEASE.md +10 -0
  8. data/Rakefile +21 -0
  9. data/TODO.md +6 -0
  10. data/bin/cifrado +7 -0
  11. data/cifrado.gemspec +31 -0
  12. data/gem-public_cert.pem +20 -0
  13. data/lib/cifrado.rb +48 -0
  14. data/lib/cifrado/cli.rb +140 -0
  15. data/lib/cifrado/cli/cinema.rb +81 -0
  16. data/lib/cifrado/cli/delete.rb +36 -0
  17. data/lib/cifrado/cli/download.rb +54 -0
  18. data/lib/cifrado/cli/jukebox.rb +94 -0
  19. data/lib/cifrado/cli/list.rb +64 -0
  20. data/lib/cifrado/cli/post.rb +10 -0
  21. data/lib/cifrado/cli/progressbar.rb +86 -0
  22. data/lib/cifrado/cli/saio.rb +11 -0
  23. data/lib/cifrado/cli/saio/base.rb +20 -0
  24. data/lib/cifrado/cli/saio/bootstrap.rb +118 -0
  25. data/lib/cifrado/cli/saio/destroy.rb +16 -0
  26. data/lib/cifrado/cli/saio/scripts/saio.sh.erb +445 -0
  27. data/lib/cifrado/cli/set_acl.rb +10 -0
  28. data/lib/cifrado/cli/setup.rb +64 -0
  29. data/lib/cifrado/cli/stat.rb +41 -0
  30. data/lib/cifrado/cli/upload.rb +269 -0
  31. data/lib/cifrado/config.rb +18 -0
  32. data/lib/cifrado/core_ext/ruby18_base64.rb +15 -0
  33. data/lib/cifrado/crypto_services.rb +218 -0
  34. data/lib/cifrado/file_splitter.rb +67 -0
  35. data/lib/cifrado/rate_limit.rb +23 -0
  36. data/lib/cifrado/streaming_downloader.rb +49 -0
  37. data/lib/cifrado/streaming_uploader.rb +57 -0
  38. data/lib/cifrado/swift_client.rb +313 -0
  39. data/lib/cifrado/utils.rb +59 -0
  40. data/lib/cifrado/version.rb +3 -0
  41. data/tests/cli/list_tests.rb +28 -0
  42. data/tests/cli/upload_multi_tests.rb +94 -0
  43. data/tests/cli/upload_tests.rb +167 -0
  44. data/tests/cli_tests.rb +2 -0
  45. data/tests/crypto_services_tests.rb +145 -0
  46. data/tests/file_splitter_tests.rb +61 -0
  47. data/tests/helper.rb +117 -0
  48. data/tests/swift_client/create_directory.rb +14 -0
  49. data/tests/swift_client/download_tests.rb +208 -0
  50. data/tests/swift_client/file_available.rb +25 -0
  51. data/tests/swift_client/head_tests.rb +34 -0
  52. data/tests/swift_client/match_tests.rb +29 -0
  53. data/tests/swift_client/upload_tests.rb +70 -0
  54. data/tests/swift_client_tests.rb +29 -0
  55. data/tests/utils_tests.rb +33 -0
  56. data/vendor/fog/.document +3 -0
  57. data/vendor/fog/.gitignore +23 -0
  58. data/vendor/fog/.irbrc +82 -0
  59. data/vendor/fog/.travis.yml +21 -0
  60. data/vendor/fog/README.cifrado +3 -0
  61. data/vendor/fog/README.md +156 -0
  62. data/vendor/fog/RELEASE.md +39 -0
  63. data/vendor/fog/changelog.txt +4156 -0
  64. data/vendor/fog/fog.gemspec +70 -0
  65. data/vendor/fog/lib/fog.rb +17 -0
  66. data/vendor/fog/lib/fog/cdn.rb +30 -0
  67. data/vendor/fog/lib/fog/compute.rb +127 -0
  68. data/vendor/fog/lib/fog/compute/models/server.rb +73 -0
  69. data/vendor/fog/lib/fog/core.rb +38 -0
  70. data/vendor/fog/lib/fog/core/attributes.rb +221 -0
  71. data/vendor/fog/lib/fog/core/collection.rb +145 -0
  72. data/vendor/fog/lib/fog/core/connection.rb +36 -0
  73. data/vendor/fog/lib/fog/core/credentials.rb +65 -0
  74. data/vendor/fog/lib/fog/core/current_machine.rb +34 -0
  75. data/vendor/fog/lib/fog/core/deprecated_connection_accessors.rb +41 -0
  76. data/vendor/fog/lib/fog/core/deprecation.rb +23 -0
  77. data/vendor/fog/lib/fog/core/errors.rb +108 -0
  78. data/vendor/fog/lib/fog/core/hmac.rb +48 -0
  79. data/vendor/fog/lib/fog/core/json.rb +34 -0
  80. data/vendor/fog/lib/fog/core/logger.rb +45 -0
  81. data/vendor/fog/lib/fog/core/mock.rb +92 -0
  82. data/vendor/fog/lib/fog/core/model.rb +79 -0
  83. data/vendor/fog/lib/fog/core/parser.rb +116 -0
  84. data/vendor/fog/lib/fog/core/provider.rb +35 -0
  85. data/vendor/fog/lib/fog/core/scp.rb +96 -0
  86. data/vendor/fog/lib/fog/core/service.rb +223 -0
  87. data/vendor/fog/lib/fog/core/ssh.rb +137 -0
  88. data/vendor/fog/lib/fog/core/time.rb +32 -0
  89. data/vendor/fog/lib/fog/core/timeout.rb +11 -0
  90. data/vendor/fog/lib/fog/core/wait_for.rb +15 -0
  91. data/vendor/fog/lib/fog/digitalocean.rb +9 -0
  92. data/vendor/fog/lib/fog/digitalocean/compute.rb +100 -0
  93. data/vendor/fog/lib/fog/digitalocean/examples/getting_started.md +106 -0
  94. data/vendor/fog/lib/fog/digitalocean/models/compute/flavor.rb +14 -0
  95. data/vendor/fog/lib/fog/digitalocean/models/compute/flavors.rb +25 -0
  96. data/vendor/fog/lib/fog/digitalocean/models/compute/image.rb +15 -0
  97. data/vendor/fog/lib/fog/digitalocean/models/compute/images.rb +25 -0
  98. data/vendor/fog/lib/fog/digitalocean/models/compute/region.rb +14 -0
  99. data/vendor/fog/lib/fog/digitalocean/models/compute/regions.rb +25 -0
  100. data/vendor/fog/lib/fog/digitalocean/models/compute/server.rb +150 -0
  101. data/vendor/fog/lib/fog/digitalocean/models/compute/servers.rb +27 -0
  102. data/vendor/fog/lib/fog/digitalocean/requests/compute/create_server.rb +49 -0
  103. data/vendor/fog/lib/fog/digitalocean/requests/compute/create_ssh_key.rb +26 -0
  104. data/vendor/fog/lib/fog/digitalocean/requests/compute/destroy_server.rb +28 -0
  105. data/vendor/fog/lib/fog/digitalocean/requests/compute/get_server_details.rb +25 -0
  106. data/vendor/fog/lib/fog/digitalocean/requests/compute/list_flavors.rb +25 -0
  107. data/vendor/fog/lib/fog/digitalocean/requests/compute/list_images.rb +25 -0
  108. data/vendor/fog/lib/fog/digitalocean/requests/compute/list_regions.rb +25 -0
  109. data/vendor/fog/lib/fog/digitalocean/requests/compute/list_servers.rb +25 -0
  110. data/vendor/fog/lib/fog/digitalocean/requests/compute/list_ssh_keys.rb +25 -0
  111. data/vendor/fog/lib/fog/digitalocean/requests/compute/power_cycle_server.rb +25 -0
  112. data/vendor/fog/lib/fog/digitalocean/requests/compute/power_off_server.rb +25 -0
  113. data/vendor/fog/lib/fog/digitalocean/requests/compute/power_on_server.rb +25 -0
  114. data/vendor/fog/lib/fog/digitalocean/requests/compute/reboot_server.rb +25 -0
  115. data/vendor/fog/lib/fog/digitalocean/requests/compute/shutdown_server.rb +25 -0
  116. data/vendor/fog/lib/fog/dns.rb +59 -0
  117. data/vendor/fog/lib/fog/identity.rb +27 -0
  118. data/vendor/fog/lib/fog/image.rb +24 -0
  119. data/vendor/fog/lib/fog/local.rb +11 -0
  120. data/vendor/fog/lib/fog/local/models/storage/directories.rb +33 -0
  121. data/vendor/fog/lib/fog/local/models/storage/directory.rb +57 -0
  122. data/vendor/fog/lib/fog/local/models/storage/file.rb +131 -0
  123. data/vendor/fog/lib/fog/local/models/storage/files.rb +87 -0
  124. data/vendor/fog/lib/fog/local/storage.rb +103 -0
  125. data/vendor/fog/lib/fog/network.rb +26 -0
  126. data/vendor/fog/lib/fog/openstack.rb +214 -0
  127. data/vendor/fog/lib/fog/openstack/README.identity.md +69 -0
  128. data/vendor/fog/lib/fog/openstack/compute.rb +423 -0
  129. data/vendor/fog/lib/fog/openstack/identity.rb +299 -0
  130. data/vendor/fog/lib/fog/openstack/image.rb +217 -0
  131. data/vendor/fog/lib/fog/openstack/models/compute/address.rb +71 -0
  132. data/vendor/fog/lib/fog/openstack/models/compute/addresses.rb +33 -0
  133. data/vendor/fog/lib/fog/openstack/models/compute/flavor.rb +45 -0
  134. data/vendor/fog/lib/fog/openstack/models/compute/flavors.rb +28 -0
  135. data/vendor/fog/lib/fog/openstack/models/compute/host.rb +29 -0
  136. data/vendor/fog/lib/fog/openstack/models/compute/hosts.rb +32 -0
  137. data/vendor/fog/lib/fog/openstack/models/compute/image.rb +58 -0
  138. data/vendor/fog/lib/fog/openstack/models/compute/images.rb +33 -0
  139. data/vendor/fog/lib/fog/openstack/models/compute/key_pair.rb +60 -0
  140. data/vendor/fog/lib/fog/openstack/models/compute/key_pairs.rb +31 -0
  141. data/vendor/fog/lib/fog/openstack/models/compute/metadata.rb +68 -0
  142. data/vendor/fog/lib/fog/openstack/models/compute/metadatum.rb +29 -0
  143. data/vendor/fog/lib/fog/openstack/models/compute/network.rb +13 -0
  144. data/vendor/fog/lib/fog/openstack/models/compute/networks.rb +29 -0
  145. data/vendor/fog/lib/fog/openstack/models/compute/security_group.rb +44 -0
  146. data/vendor/fog/lib/fog/openstack/models/compute/security_groups.rb +27 -0
  147. data/vendor/fog/lib/fog/openstack/models/compute/server.rb +278 -0
  148. data/vendor/fog/lib/fog/openstack/models/compute/servers.rb +44 -0
  149. data/vendor/fog/lib/fog/openstack/models/compute/snapshot.rb +44 -0
  150. data/vendor/fog/lib/fog/openstack/models/compute/snapshots.rb +26 -0
  151. data/vendor/fog/lib/fog/openstack/models/compute/tenant.rb +24 -0
  152. data/vendor/fog/lib/fog/openstack/models/compute/tenants.rb +24 -0
  153. data/vendor/fog/lib/fog/openstack/models/compute/volume.rb +59 -0
  154. data/vendor/fog/lib/fog/openstack/models/compute/volumes.rb +26 -0
  155. data/vendor/fog/lib/fog/openstack/models/identity/ec2_credential.rb +44 -0
  156. data/vendor/fog/lib/fog/openstack/models/identity/ec2_credentials.rb +53 -0
  157. data/vendor/fog/lib/fog/openstack/models/identity/role.rb +50 -0
  158. data/vendor/fog/lib/fog/openstack/models/identity/roles.rb +21 -0
  159. data/vendor/fog/lib/fog/openstack/models/identity/tenant.rb +62 -0
  160. data/vendor/fog/lib/fog/openstack/models/identity/tenants.rb +29 -0
  161. data/vendor/fog/lib/fog/openstack/models/identity/user.rb +70 -0
  162. data/vendor/fog/lib/fog/openstack/models/identity/users.rb +32 -0
  163. data/vendor/fog/lib/fog/openstack/models/image/image.rb +91 -0
  164. data/vendor/fog/lib/fog/openstack/models/image/images.rb +60 -0
  165. data/vendor/fog/lib/fog/openstack/models/meta_parent.rb +33 -0
  166. data/vendor/fog/lib/fog/openstack/models/network/floating_ip.rb +52 -0
  167. data/vendor/fog/lib/fog/openstack/models/network/floating_ips.rb +34 -0
  168. data/vendor/fog/lib/fog/openstack/models/network/network.rb +47 -0
  169. data/vendor/fog/lib/fog/openstack/models/network/networks.rb +34 -0
  170. data/vendor/fog/lib/fog/openstack/models/network/port.rb +53 -0
  171. data/vendor/fog/lib/fog/openstack/models/network/ports.rb +34 -0
  172. data/vendor/fog/lib/fog/openstack/models/network/subnet.rb +56 -0
  173. data/vendor/fog/lib/fog/openstack/models/network/subnets.rb +34 -0
  174. data/vendor/fog/lib/fog/openstack/models/storage/directories.rb +39 -0
  175. data/vendor/fog/lib/fog/openstack/models/storage/directory.rb +50 -0
  176. data/vendor/fog/lib/fog/openstack/models/storage/file.rb +152 -0
  177. data/vendor/fog/lib/fog/openstack/models/storage/files.rb +94 -0
  178. data/vendor/fog/lib/fog/openstack/models/volume/volume.rb +47 -0
  179. data/vendor/fog/lib/fog/openstack/models/volume/volumes.rb +27 -0
  180. data/vendor/fog/lib/fog/openstack/network.rb +247 -0
  181. data/vendor/fog/lib/fog/openstack/requests/compute/add_fixed_ip.rb +29 -0
  182. data/vendor/fog/lib/fog/openstack/requests/compute/allocate_address.rb +42 -0
  183. data/vendor/fog/lib/fog/openstack/requests/compute/associate_address.rb +27 -0
  184. data/vendor/fog/lib/fog/openstack/requests/compute/attach_volume.rb +38 -0
  185. data/vendor/fog/lib/fog/openstack/requests/compute/boot_from_snapshot.rb +41 -0
  186. data/vendor/fog/lib/fog/openstack/requests/compute/change_server_password.rb +24 -0
  187. data/vendor/fog/lib/fog/openstack/requests/compute/confirm_resize_server.rb +24 -0
  188. data/vendor/fog/lib/fog/openstack/requests/compute/create_flavor.rb +85 -0
  189. data/vendor/fog/lib/fog/openstack/requests/compute/create_image.rb +49 -0
  190. data/vendor/fog/lib/fog/openstack/requests/compute/create_key_pair.rb +49 -0
  191. data/vendor/fog/lib/fog/openstack/requests/compute/create_security_group.rb +52 -0
  192. data/vendor/fog/lib/fog/openstack/requests/compute/create_security_group_rule.rb +59 -0
  193. data/vendor/fog/lib/fog/openstack/requests/compute/create_server.rb +131 -0
  194. data/vendor/fog/lib/fog/openstack/requests/compute/create_volume.rb +54 -0
  195. data/vendor/fog/lib/fog/openstack/requests/compute/create_volume_snapshot.rb +47 -0
  196. data/vendor/fog/lib/fog/openstack/requests/compute/delete_flavor.rb +28 -0
  197. data/vendor/fog/lib/fog/openstack/requests/compute/delete_image.rb +40 -0
  198. data/vendor/fog/lib/fog/openstack/requests/compute/delete_key_pair.rb +31 -0
  199. data/vendor/fog/lib/fog/openstack/requests/compute/delete_metadata.rb +28 -0
  200. data/vendor/fog/lib/fog/openstack/requests/compute/delete_security_group.rb +33 -0
  201. data/vendor/fog/lib/fog/openstack/requests/compute/delete_security_group_rule.rb +31 -0
  202. data/vendor/fog/lib/fog/openstack/requests/compute/delete_server.rb +38 -0
  203. data/vendor/fog/lib/fog/openstack/requests/compute/delete_snapshot.rb +26 -0
  204. data/vendor/fog/lib/fog/openstack/requests/compute/delete_volume.rb +26 -0
  205. data/vendor/fog/lib/fog/openstack/requests/compute/detach_volume.rb +26 -0
  206. data/vendor/fog/lib/fog/openstack/requests/compute/disassociate_address.rb +27 -0
  207. data/vendor/fog/lib/fog/openstack/requests/compute/get_address.rb +41 -0
  208. data/vendor/fog/lib/fog/openstack/requests/compute/get_console_output.rb +28 -0
  209. data/vendor/fog/lib/fog/openstack/requests/compute/get_flavor_details.rb +43 -0
  210. data/vendor/fog/lib/fog/openstack/requests/compute/get_host_details.rb +74 -0
  211. data/vendor/fog/lib/fog/openstack/requests/compute/get_image_details.rb +33 -0
  212. data/vendor/fog/lib/fog/openstack/requests/compute/get_limits.rb +93 -0
  213. data/vendor/fog/lib/fog/openstack/requests/compute/get_metadata.rb +29 -0
  214. data/vendor/fog/lib/fog/openstack/requests/compute/get_quota.rb +31 -0
  215. data/vendor/fog/lib/fog/openstack/requests/compute/get_quota_defaults.rb +31 -0
  216. data/vendor/fog/lib/fog/openstack/requests/compute/get_security_group.rb +49 -0
  217. data/vendor/fog/lib/fog/openstack/requests/compute/get_server_details.rb +32 -0
  218. data/vendor/fog/lib/fog/openstack/requests/compute/get_server_volumes.rb +23 -0
  219. data/vendor/fog/lib/fog/openstack/requests/compute/get_snapshot_details.rb +39 -0
  220. data/vendor/fog/lib/fog/openstack/requests/compute/get_usage.rb +53 -0
  221. data/vendor/fog/lib/fog/openstack/requests/compute/get_vnc_console.rb +40 -0
  222. data/vendor/fog/lib/fog/openstack/requests/compute/get_volume_details.rb +42 -0
  223. data/vendor/fog/lib/fog/openstack/requests/compute/list_address_pools.rb +23 -0
  224. data/vendor/fog/lib/fog/openstack/requests/compute/list_addresses.rb +32 -0
  225. data/vendor/fog/lib/fog/openstack/requests/compute/list_all_addresses.rb +64 -0
  226. data/vendor/fog/lib/fog/openstack/requests/compute/list_flavors.rb +38 -0
  227. data/vendor/fog/lib/fog/openstack/requests/compute/list_flavors_detail.rb +38 -0
  228. data/vendor/fog/lib/fog/openstack/requests/compute/list_hosts.rb +32 -0
  229. data/vendor/fog/lib/fog/openstack/requests/compute/list_images.rb +33 -0
  230. data/vendor/fog/lib/fog/openstack/requests/compute/list_images_detail.rb +39 -0
  231. data/vendor/fog/lib/fog/openstack/requests/compute/list_key_pairs.rb +39 -0
  232. data/vendor/fog/lib/fog/openstack/requests/compute/list_metadata.rb +28 -0
  233. data/vendor/fog/lib/fog/openstack/requests/compute/list_private_addresses.rb +32 -0
  234. data/vendor/fog/lib/fog/openstack/requests/compute/list_public_addresses.rb +32 -0
  235. data/vendor/fog/lib/fog/openstack/requests/compute/list_security_groups.rb +50 -0
  236. data/vendor/fog/lib/fog/openstack/requests/compute/list_servers.rb +37 -0
  237. data/vendor/fog/lib/fog/openstack/requests/compute/list_servers_detail.rb +44 -0
  238. data/vendor/fog/lib/fog/openstack/requests/compute/list_snapshots.rb +32 -0
  239. data/vendor/fog/lib/fog/openstack/requests/compute/list_tenants.rb +45 -0
  240. data/vendor/fog/lib/fog/openstack/requests/compute/list_usages.rb +43 -0
  241. data/vendor/fog/lib/fog/openstack/requests/compute/list_volumes.rb +51 -0
  242. data/vendor/fog/lib/fog/openstack/requests/compute/live_migrate_server.rb +31 -0
  243. data/vendor/fog/lib/fog/openstack/requests/compute/migrate_server.rb +24 -0
  244. data/vendor/fog/lib/fog/openstack/requests/compute/pause_server.rb +24 -0
  245. data/vendor/fog/lib/fog/openstack/requests/compute/reboot_server.rb +24 -0
  246. data/vendor/fog/lib/fog/openstack/requests/compute/rebuild_server.rb +31 -0
  247. data/vendor/fog/lib/fog/openstack/requests/compute/release_address.rb +34 -0
  248. data/vendor/fog/lib/fog/openstack/requests/compute/remove_fixed_ip.rb +29 -0
  249. data/vendor/fog/lib/fog/openstack/requests/compute/rescue_server.rb +24 -0
  250. data/vendor/fog/lib/fog/openstack/requests/compute/reset_server_state.rb +24 -0
  251. data/vendor/fog/lib/fog/openstack/requests/compute/resize_server.rb +24 -0
  252. data/vendor/fog/lib/fog/openstack/requests/compute/resume_server.rb +24 -0
  253. data/vendor/fog/lib/fog/openstack/requests/compute/revert_resize_server.rb +30 -0
  254. data/vendor/fog/lib/fog/openstack/requests/compute/server_action.rb +18 -0
  255. data/vendor/fog/lib/fog/openstack/requests/compute/server_actions.rb +27 -0
  256. data/vendor/fog/lib/fog/openstack/requests/compute/server_diagnostics.rb +25 -0
  257. data/vendor/fog/lib/fog/openstack/requests/compute/set_metadata.rb +45 -0
  258. data/vendor/fog/lib/fog/openstack/requests/compute/set_tenant.rb +21 -0
  259. data/vendor/fog/lib/fog/openstack/requests/compute/suspend_server.rb +24 -0
  260. data/vendor/fog/lib/fog/openstack/requests/compute/unpause_server.rb +24 -0
  261. data/vendor/fog/lib/fog/openstack/requests/compute/update_metadata.rb +46 -0
  262. data/vendor/fog/lib/fog/openstack/requests/compute/update_quota.rb +32 -0
  263. data/vendor/fog/lib/fog/openstack/requests/compute/update_server.rb +35 -0
  264. data/vendor/fog/lib/fog/openstack/requests/identity/add_user_to_tenant.rb +34 -0
  265. data/vendor/fog/lib/fog/openstack/requests/identity/check_token.rb +23 -0
  266. data/vendor/fog/lib/fog/openstack/requests/identity/create_ec2_credential.rb +58 -0
  267. data/vendor/fog/lib/fog/openstack/requests/identity/create_role.rb +37 -0
  268. data/vendor/fog/lib/fog/openstack/requests/identity/create_tenant.rb +32 -0
  269. data/vendor/fog/lib/fog/openstack/requests/identity/create_user.rb +47 -0
  270. data/vendor/fog/lib/fog/openstack/requests/identity/create_user_role.rb +26 -0
  271. data/vendor/fog/lib/fog/openstack/requests/identity/delete_ec2_credential.rb +44 -0
  272. data/vendor/fog/lib/fog/openstack/requests/identity/delete_role.rb +32 -0
  273. data/vendor/fog/lib/fog/openstack/requests/identity/delete_tenant.rb +31 -0
  274. data/vendor/fog/lib/fog/openstack/requests/identity/delete_user.rb +32 -0
  275. data/vendor/fog/lib/fog/openstack/requests/identity/delete_user_role.rb +26 -0
  276. data/vendor/fog/lib/fog/openstack/requests/identity/get_ec2_credential.rb +49 -0
  277. data/vendor/fog/lib/fog/openstack/requests/identity/get_role.rb +28 -0
  278. data/vendor/fog/lib/fog/openstack/requests/identity/get_tenant.rb +31 -0
  279. data/vendor/fog/lib/fog/openstack/requests/identity/get_tenants_by_id.rb +23 -0
  280. data/vendor/fog/lib/fog/openstack/requests/identity/get_tenants_by_name.rb +23 -0
  281. data/vendor/fog/lib/fog/openstack/requests/identity/get_user_by_id.rb +34 -0
  282. data/vendor/fog/lib/fog/openstack/requests/identity/get_user_by_name.rb +31 -0
  283. data/vendor/fog/lib/fog/openstack/requests/identity/list_ec2_credentials.rb +44 -0
  284. data/vendor/fog/lib/fog/openstack/requests/identity/list_endpoints_for_token.rb +23 -0
  285. data/vendor/fog/lib/fog/openstack/requests/identity/list_roles.rb +36 -0
  286. data/vendor/fog/lib/fog/openstack/requests/identity/list_roles_for_user_on_tenant.rb +30 -0
  287. data/vendor/fog/lib/fog/openstack/requests/identity/list_tenants.rb +45 -0
  288. data/vendor/fog/lib/fog/openstack/requests/identity/list_user_global_roles.rb +22 -0
  289. data/vendor/fog/lib/fog/openstack/requests/identity/list_users.rb +34 -0
  290. data/vendor/fog/lib/fog/openstack/requests/identity/remove_user_from_tenant.rb +20 -0
  291. data/vendor/fog/lib/fog/openstack/requests/identity/set_tenant.rb +21 -0
  292. data/vendor/fog/lib/fog/openstack/requests/identity/update_tenant.rb +28 -0
  293. data/vendor/fog/lib/fog/openstack/requests/identity/update_user.rb +36 -0
  294. data/vendor/fog/lib/fog/openstack/requests/identity/validate_token.rb +23 -0
  295. data/vendor/fog/lib/fog/openstack/requests/image/add_member_to_image.rb +23 -0
  296. data/vendor/fog/lib/fog/openstack/requests/image/create_image.rb +79 -0
  297. data/vendor/fog/lib/fog/openstack/requests/image/delete_image.rb +25 -0
  298. data/vendor/fog/lib/fog/openstack/requests/image/get_image.rb +45 -0
  299. data/vendor/fog/lib/fog/openstack/requests/image/get_image_by_id.rb +32 -0
  300. data/vendor/fog/lib/fog/openstack/requests/image/get_image_members.rb +29 -0
  301. data/vendor/fog/lib/fog/openstack/requests/image/get_shared_images.rb +29 -0
  302. data/vendor/fog/lib/fog/openstack/requests/image/list_public_images.rb +32 -0
  303. data/vendor/fog/lib/fog/openstack/requests/image/list_public_images_detailed.rb +31 -0
  304. data/vendor/fog/lib/fog/openstack/requests/image/remove_member_from_image.rb +23 -0
  305. data/vendor/fog/lib/fog/openstack/requests/image/set_tenant.rb +21 -0
  306. data/vendor/fog/lib/fog/openstack/requests/image/update_image.rb +70 -0
  307. data/vendor/fog/lib/fog/openstack/requests/image/update_image_members.rb +37 -0
  308. data/vendor/fog/lib/fog/openstack/requests/network/associate_floating_ip.rb +49 -0
  309. data/vendor/fog/lib/fog/openstack/requests/network/create_floating_ip.rb +50 -0
  310. data/vendor/fog/lib/fog/openstack/requests/network/create_network.rb +44 -0
  311. data/vendor/fog/lib/fog/openstack/requests/network/create_port.rb +52 -0
  312. data/vendor/fog/lib/fog/openstack/requests/network/create_subnet.rb +56 -0
  313. data/vendor/fog/lib/fog/openstack/requests/network/delete_floating_ip.rb +30 -0
  314. data/vendor/fog/lib/fog/openstack/requests/network/delete_network.rb +30 -0
  315. data/vendor/fog/lib/fog/openstack/requests/network/delete_port.rb +30 -0
  316. data/vendor/fog/lib/fog/openstack/requests/network/delete_subnet.rb +30 -0
  317. data/vendor/fog/lib/fog/openstack/requests/network/disassociate_floating_ip.rb +49 -0
  318. data/vendor/fog/lib/fog/openstack/requests/network/get_floating_ip.rb +42 -0
  319. data/vendor/fog/lib/fog/openstack/requests/network/get_network.rb +42 -0
  320. data/vendor/fog/lib/fog/openstack/requests/network/get_port.rb +48 -0
  321. data/vendor/fog/lib/fog/openstack/requests/network/get_subnet.rb +49 -0
  322. data/vendor/fog/lib/fog/openstack/requests/network/list_floating_ips.rb +27 -0
  323. data/vendor/fog/lib/fog/openstack/requests/network/list_networks.rb +27 -0
  324. data/vendor/fog/lib/fog/openstack/requests/network/list_ports.rb +27 -0
  325. data/vendor/fog/lib/fog/openstack/requests/network/list_subnets.rb +27 -0
  326. data/vendor/fog/lib/fog/openstack/requests/network/set_tenant.rb +21 -0
  327. data/vendor/fog/lib/fog/openstack/requests/network/update_network.rb +41 -0
  328. data/vendor/fog/lib/fog/openstack/requests/network/update_port.rb +44 -0
  329. data/vendor/fog/lib/fog/openstack/requests/network/update_subnet.rb +44 -0
  330. data/vendor/fog/lib/fog/openstack/requests/storage/copy_object.rb +27 -0
  331. data/vendor/fog/lib/fog/openstack/requests/storage/delete_container.rb +22 -0
  332. data/vendor/fog/lib/fog/openstack/requests/storage/delete_object.rb +23 -0
  333. data/vendor/fog/lib/fog/openstack/requests/storage/get_container.rb +44 -0
  334. data/vendor/fog/lib/fog/openstack/requests/storage/get_containers.rb +33 -0
  335. data/vendor/fog/lib/fog/openstack/requests/storage/get_object.rb +29 -0
  336. data/vendor/fog/lib/fog/openstack/requests/storage/get_object_https_url.rb +51 -0
  337. data/vendor/fog/lib/fog/openstack/requests/storage/head_container.rb +28 -0
  338. data/vendor/fog/lib/fog/openstack/requests/storage/head_containers.rb +25 -0
  339. data/vendor/fog/lib/fog/openstack/requests/storage/head_object.rb +23 -0
  340. data/vendor/fog/lib/fog/openstack/requests/storage/post_set_meta_temp_url_key.rb +37 -0
  341. data/vendor/fog/lib/fog/openstack/requests/storage/put_container.rb +22 -0
  342. data/vendor/fog/lib/fog/openstack/requests/storage/put_object.rb +30 -0
  343. data/vendor/fog/lib/fog/openstack/requests/storage/put_object_manifest.rb +25 -0
  344. data/vendor/fog/lib/fog/openstack/requests/volume/create_volume.rb +54 -0
  345. data/vendor/fog/lib/fog/openstack/requests/volume/create_volume_snapshot.rb +47 -0
  346. data/vendor/fog/lib/fog/openstack/requests/volume/delete_snapshot.rb +26 -0
  347. data/vendor/fog/lib/fog/openstack/requests/volume/delete_volume.rb +26 -0
  348. data/vendor/fog/lib/fog/openstack/requests/volume/get_snapshot_details.rb +39 -0
  349. data/vendor/fog/lib/fog/openstack/requests/volume/get_volume_details.rb +42 -0
  350. data/vendor/fog/lib/fog/openstack/requests/volume/list_snapshots.rb +32 -0
  351. data/vendor/fog/lib/fog/openstack/requests/volume/list_volumes.rb +55 -0
  352. data/vendor/fog/lib/fog/openstack/requests/volume/set_tenant.rb +21 -0
  353. data/vendor/fog/lib/fog/openstack/storage.rb +162 -0
  354. data/vendor/fog/lib/fog/openstack/volume.rb +219 -0
  355. data/vendor/fog/lib/fog/providers.rb +2 -0
  356. data/vendor/fog/lib/fog/schema/data_validator.rb +154 -0
  357. data/vendor/fog/lib/fog/storage.rb +97 -0
  358. data/vendor/fog/lib/fog/version.rb +3 -0
  359. data/vendor/fog/lib/fog/volume.rb +25 -0
  360. metadata +576 -0
  361. metadata.gz.sig +0 -0
@@ -0,0 +1,64 @@
1
+ module Cifrado
2
+ class CLI
3
+ # @returns [Array] a list of Fog::OpenStack::File or
4
+ # Fog::OpenStack::Directory
5
+ #
6
+ desc "list [CONTAINER]", "List containers and objects"
7
+ option :list_segments, :type => :boolean
8
+ option :decrypt_filenames, :type => :boolean
9
+ option :display_hash, :type => :boolean
10
+ def list(container = nil)
11
+ client = client_instance
12
+ list = []
13
+ if container
14
+ dir = client.service.directories.get container
15
+ if dir
16
+ Log.info "Listing objects in '#{container}'"
17
+ files = dir.files
18
+ files.each do |f|
19
+ fname = f.key
20
+ unless options[:decrypt_filenames]
21
+ list << fname
22
+ Log.info fname
23
+ next
24
+ end
25
+ # Skip segments
26
+ next if fname =~ /\/segments\/\d+\.\d{2}\/\d+\/\d+/ and \
27
+ not options[:list_segments]
28
+
29
+ # Raises exception if the object is a
30
+ # manifest but there are no segments available
31
+ begin
32
+ metadata = f.metadata
33
+ rescue Fog::Storage::OpenStack::NotFound
34
+ Log.warn "The file #{fname} is an object manifest, but there are no segments"
35
+ Log.warn "available. I won't be able to decrypt the filename."
36
+ Log.info fname
37
+ list << fname
38
+ next
39
+ end
40
+ if metadata[:encrypted_name]
41
+ fname = decrypt_filename metadata[:encrypted_name],
42
+ @config[:password] + @config[:secure_random]
43
+ Log.info "#{fname.ljust(55)} #{set_color("[encrypted]",:red, :bold)}"
44
+ Log.info " hash: #{f.key}" if options[:display_hash]
45
+ else
46
+ Log.info fname.ljust(55)
47
+ end
48
+ list << fname
49
+ end
50
+ list
51
+ else
52
+ raise "Container '#{container}' not found"
53
+ end
54
+ else
55
+ Log.info "Listing containers"
56
+ directories = client.service.directories
57
+ directories = directories.map { |d| Log.info d.key; d.key }
58
+ directories
59
+ end
60
+ end
61
+ end
62
+ end
63
+
64
+
@@ -0,0 +1,10 @@
1
+ module Cifrado
2
+ class CLI
3
+ desc "post CONTAINER [DESCRIPTION]", "Create a container"
4
+ def post(container, description = '')
5
+ client = client_instance
6
+ client.service.directories.create :key => container,
7
+ :description => description
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,86 @@
1
+ module Cifrado
2
+ class Progressbar
3
+ include Cifrado::Utils
4
+
5
+ def initialize(segments, current_segment, options = {})
6
+ @style = (options[:style] || :fancy).to_sym
7
+ @segments = segments
8
+ @current_segment = current_segment
9
+ end
10
+
11
+ def block
12
+ if @style == :fancy
13
+ fancy
14
+ elsif @style == :fast
15
+ fast
16
+ elsif @style == :infinite
17
+ infinite
18
+ else
19
+ nil
20
+ end
21
+ end
22
+
23
+ private
24
+ def fancy
25
+ require 'ruby-progressbar'
26
+ title = (@segments == 1 ? \
27
+ 'Progress' : "Segment [#{@current_segment}/#{@segments}]")
28
+ progressbar = ProgressBar.create :title => title, :total => 100,
29
+ :format => '%t: |%B| %p%% [%E ]'
30
+ read = 0
31
+ percentage = 0
32
+ time = Time.now.to_f
33
+ last_time = Time.now.to_f
34
+ Proc.new do |total, bytes|
35
+ next if total == 0
36
+ read += bytes
37
+ newt = Time.now.to_f
38
+ if newt - last_time > 1
39
+ last_time = newt
40
+ percentage = (read*100/total)
41
+ kbs = "%0.2f" % (read*8/((Time.now.to_f - time)*1024*1024))
42
+ progressbar.title = " [#{kbs} Mb/s] #{title}"
43
+ progressbar.progress = percentage unless percentage > 100
44
+ end
45
+ progressbar.finish if (progressbar.progress < 100) and \
46
+ read >= total
47
+ end
48
+ end
49
+
50
+ def infinite
51
+ read = 0
52
+ time = Time.now.to_f
53
+ Proc.new do |tbytes, bytes|
54
+ read += bytes
55
+ kbs = "%0.2f" % (read*8/((Time.now.to_f - time)*1024*1024))
56
+ print "Progress (unknown total size): #{humanize_bytes(read).ljust(10)} read (#{kbs} Mb/s)".ljust(60)
57
+ print "\r"
58
+ end
59
+ end
60
+
61
+ def fast
62
+ title = (@segments == 1) ? ' ' : \
63
+ " [#{@current_segment}/#{@segments}]"
64
+
65
+ read = 0
66
+ progressbar_finished = false
67
+ time = Time.now.to_f
68
+ Proc.new do |tbytes, bytes|
69
+ read += bytes
70
+ percentage = ((read*100.0/tbytes))
71
+ kbs = "%0.2f" % (read*8/((Time.now.to_f - time)*1024*1024))
72
+ print "\r"
73
+ print "Progress (#{percentage.round}%) #{kbs} Mb/s#{title}: "
74
+ print "#{humanize_bytes(read)} read"
75
+ if (read + bytes) >= tbytes and !progressbar_finished
76
+ progressbar_finished = true
77
+ percentage = 100
78
+ print "\r"
79
+ print "Progress (#{percentage.round}%) #{title}: "
80
+ puts
81
+ end
82
+ end
83
+ end
84
+
85
+ end
86
+ end
@@ -0,0 +1,11 @@
1
+ require 'cifrado/cli/saio/base'
2
+
3
+ module Cifrado
4
+ class CLI
5
+ desc "saio SUBCOMMAND ...ARGS", "Bootstrap a Swift installation"
6
+ subcommand "saio", Saio
7
+ end
8
+ end
9
+
10
+ require 'cifrado/cli/saio/bootstrap'
11
+ require 'cifrado/cli/saio/destroy'
@@ -0,0 +1,20 @@
1
+ module Cifrado
2
+ class Saio < Thor
3
+ include Cifrado::Utils
4
+
5
+ class_option :provider, :type => :string
6
+ class_option :api_key, :type => :string, :required => true
7
+ class_option :client_id, :type => :string, :required => true
8
+
9
+ private
10
+ def service
11
+ return @service if @service
12
+ client_id = options[:client_id]
13
+ api_key = options[:api_key]
14
+ @service = Fog::Compute.new :provider => 'DigitalOcean',
15
+ :digitalocean_api_key => api_key,
16
+ :digitalocean_client_id => client_id
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,118 @@
1
+ module Cifrado
2
+ class Saio < Thor
3
+
4
+ desc 'bootstrap', 'Bootstrap a Swift All-In-One installation'
5
+ option :server_name, :type => :string, :default => 'cifrado-saio'
6
+ option :ssh_key_name, :type => :string, :required => true
7
+ option :save_settings, :type => :boolean
8
+ option :bootstrap_debug, :type => :boolean
9
+ def bootstrap
10
+ require 'shexy'
11
+
12
+ Log.level = Logger::DEBUG if options[:bootstrap_debug]
13
+
14
+ begin
15
+ available_keys = service.list_ssh_keys.body['ssh_keys']
16
+ key = available_keys.find { |k| k['name'] == options[:ssh_key_name] }
17
+ unless key
18
+ raise "SSH key #{options[:ssh_key_name]} not available."
19
+ end
20
+
21
+ server_name = options[:server_name]
22
+ server = service.servers.find { |s| s.name == server_name }
23
+ if server
24
+ raise "Server #{server_name} is currently running."
25
+ end
26
+
27
+ flavor = service.flavors.find { |f| f.name == '512MB' }
28
+ image = service.images.find { |i| i.name == 'Ubuntu 12.04 x64 Server' }
29
+ region = service.regions.first
30
+ Log.info "Creating server #{server_name}..."
31
+ server = service.servers.create :name => options[:server_name],
32
+ :image_id => image.id,
33
+ :flavor_id => flavor.id,
34
+ :region_id => region.id,
35
+ :ssh_key_ids => key['id']
36
+ Log.info "Server provisioned, waiting for IP..."
37
+ server.wait_for(120) { ip_address }
38
+ Log.info "Server IP: #{server.ip_address}"
39
+
40
+ #
41
+ # Copy the provisioning script to the server
42
+ #
43
+ Shexy.host = server.ip_address
44
+ Shexy.user = 'root'
45
+ Shexy.flags = { :paranoid => false }
46
+ Log.info 'Waiting for SSH...'
47
+ Shexy.wait_for_ssh(90)
48
+ Log.info 'Bootstraping Swift All-In-One (this may take a while)...'
49
+
50
+ if RUBY_VERSION >= '1.9'
51
+ secure_random = SecureRandom.hex.encode('UTF-8')
52
+ user_password = SecureRandom.hex.encode('UTF-8')
53
+ else
54
+ user_password = SecureRandom.hex
55
+ secure_random = SecureRandom.hex
56
+ end
57
+
58
+ script = bootstrap_script(user_password)
59
+ Shexy.copy_to script, '/root/saio.sh'
60
+
61
+ # Provision Swift+Keystone
62
+ Shexy.exe '/bin/bash /root/saio.sh' do |out, err|
63
+ out.each_line { |l| Log.debug l }
64
+ end
65
+
66
+ config = {
67
+ :auth_url => "https://#{server.ip_address}:5000/v2.0/tokens",
68
+ :username => 'admin',
69
+ :tenant => 'admin',
70
+ :password => user_password,
71
+ :secure_random => secure_random
72
+ }
73
+
74
+ # Provisioning finished, print details
75
+ Log.info
76
+ Log.info 'Swift is ready. Login details:'
77
+ Log.info
78
+ Log.info "auth_url: https://#{server.ip_address}:5000/v2.0/tokens"
79
+ Log.info "username: admin"
80
+ Log.info "tenant: admin"
81
+ Log.info "password: #{user_password}"
82
+ Log.info "secure_random: #{secure_random}"
83
+ Log.info
84
+
85
+ save_settings(config) if options[:save_settings]
86
+ rescue Excon::Errors::Found => e
87
+ raise "Authentication failed"
88
+ end
89
+ end
90
+
91
+ private
92
+ def save_settings(config)
93
+ config_file = File.join(ENV['HOME'], '.config/cifrado/cifradorc')
94
+ FileUtils.mkdir_p File.join(ENV['HOME'], '.config/cifrado')
95
+ if File.exist?(config_file)
96
+ raise 'Cifrado config file exists. Refusing to overwrite.'
97
+ else
98
+ Log.info "Saving settings to #{config_file} as requested."
99
+ File.open config_file, 'w' do |f|
100
+ f.puts config.to_yaml
101
+ end
102
+ end
103
+ end
104
+
105
+ def bootstrap_script(password)
106
+ require 'erb'
107
+ template = File.join(File.dirname(__FILE__), 'scripts/saio.sh.erb')
108
+ result = ERB.new(File.read(template)).result(binding)
109
+ tmpfile = "/tmp/#{SecureRandom.hex}"
110
+ File.open tmpfile, 'w' do |f|
111
+ f.puts result
112
+ end
113
+ tmpfile
114
+ end
115
+
116
+ end
117
+ end
118
+
@@ -0,0 +1,16 @@
1
+ module Cifrado
2
+ class Saio < Thor
3
+
4
+ desc 'destroy', 'Destroy bootstrapped server'
5
+ option :server_name, :type => :string, :default => 'cifrado-saio'
6
+ def destroy
7
+ s = service.servers.find {|s| s.name == options[:server_name] }
8
+ if s
9
+ Log.info "Destroying server #{options[:server_name]}."
10
+ s.destroy
11
+ end
12
+ end
13
+
14
+ end
15
+ end
16
+
@@ -0,0 +1,445 @@
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ #
5
+ # SETUP VARIABLES
6
+ #
7
+ # In GB
8
+ SWIFT_DISK_SIZE=15
9
+ # keystone variables
10
+ PASSWORD=<%= password %>
11
+ KROLE=admin
12
+ # user password
13
+ ADMIN_USER=admin
14
+
15
+ # Capture ID when creating stuff
16
+ function get_id () {
17
+ echo `"$@" | awk '/ id / { print $4 }'`
18
+ }
19
+
20
+ echo deb http://ubuntu-cloud.archive.canonical.com/ubuntu precise-updates/folsom main > /etc/apt/sources.list.d/folsom.list
21
+ apt-get update
22
+ apt-get install -y ubuntu-cloud-keyring
23
+ apt-get update
24
+ apt-get install -y keystone python-software-properties telnet xfsprogs pwgen ssl-cert curl wget ca-certificates tcpflow
25
+ add-apt-repository -y ppa:bvox/ppa
26
+ apt-get update
27
+ apt-get install -y swift swift-account swift-object swift-container swift-proxy pwgen ssl-cert curl wget ca-certificates rsync memcached python-keystone stud
28
+
29
+
30
+ export SERVICE_ENDPOINT=http://127.0.0.1:35357/v2.0
31
+ export SERVICE_TOKEN=$(pwgen -s 18 1)
32
+
33
+
34
+ cat > /etc/keystone/keystone.conf << EOF
35
+ [DEFAULT]
36
+ admin_token = $SERVICE_TOKEN
37
+ bind_host = 127.0.0.1
38
+ log_file = keystone.log
39
+ log_dir = /var/log/keystone
40
+ # Use syslog for logging.
41
+ use_syslog = True
42
+ log_config = /etc/keystone/logging.conf
43
+
44
+ [sql]
45
+ connection = sqlite:////var/lib/keystone/keystone.db
46
+
47
+ [identity]
48
+ driver = keystone.identity.backends.sql.Identity
49
+
50
+ [catalog]
51
+ driver = keystone.catalog.backends.sql.Catalog
52
+
53
+ [token]
54
+ driver = keystone.token.backends.sql.Token
55
+
56
+ [policy]
57
+ driver = keystone.policy.backends.rules.Policy
58
+
59
+ [ec2]
60
+ driver = keystone.contrib.ec2.backends.sql.Ec2
61
+
62
+ [ssl]
63
+
64
+ [signing]
65
+
66
+ [ldap]
67
+
68
+ [filter:debug]
69
+ paste.filter_factory = keystone.common.wsgi:Debug.factory
70
+
71
+ [filter:token_auth]
72
+ paste.filter_factory = keystone.middleware:TokenAuthMiddleware.factory
73
+
74
+ [filter:admin_token_auth]
75
+ paste.filter_factory = keystone.middleware:AdminTokenAuthMiddleware.factory
76
+
77
+ [filter:xml_body]
78
+ paste.filter_factory = keystone.middleware:XmlBodyMiddleware.factory
79
+
80
+ [filter:json_body]
81
+ paste.filter_factory = keystone.middleware:JsonBodyMiddleware.factory
82
+
83
+ [filter:user_crud_extension]
84
+ paste.filter_factory = keystone.contrib.user_crud:CrudExtension.factory
85
+
86
+ [filter:crud_extension]
87
+ paste.filter_factory = keystone.contrib.admin_crud:CrudExtension.factory
88
+
89
+ [filter:ec2_extension]
90
+ paste.filter_factory = keystone.contrib.ec2:Ec2Extension.factory
91
+
92
+ [filter:s3_extension]
93
+ paste.filter_factory = keystone.contrib.s3:S3Extension.factory
94
+
95
+ [filter:url_normalize]
96
+ paste.filter_factory = keystone.middleware:NormalizingFilter.factory
97
+
98
+ [filter:stats_monitoring]
99
+ paste.filter_factory = keystone.contrib.stats:StatsMiddleware.factory
100
+
101
+ [filter:stats_reporting]
102
+ paste.filter_factory = keystone.contrib.stats:StatsExtension.factory
103
+
104
+ [app:public_service]
105
+ paste.app_factory = keystone.service:public_app_factory
106
+
107
+ [app:admin_service]
108
+ paste.app_factory = keystone.service:admin_app_factory
109
+
110
+ [pipeline:public_api]
111
+ pipeline = stats_monitoring url_normalize token_auth admin_token_auth xml_body json_body debug ec2_extension user_crud_extension public_service
112
+
113
+ [pipeline:admin_api]
114
+ pipeline = stats_monitoring url_normalize token_auth admin_token_auth xml_body json_body debug stats_reporting ec2_extension s3_extension crud_extension admin_service
115
+
116
+ [app:public_version_service]
117
+ paste.app_factory = keystone.service:public_version_app_factory
118
+
119
+ [app:admin_version_service]
120
+ paste.app_factory = keystone.service:admin_version_app_factory
121
+
122
+ [pipeline:public_version_api]
123
+ pipeline = stats_monitoring url_normalize xml_body public_version_service
124
+
125
+ [pipeline:admin_version_api]
126
+ pipeline = stats_monitoring url_normalize xml_body admin_version_service
127
+
128
+ [composite:main]
129
+ use = egg:Paste#urlmap
130
+ /v2.0 = public_api
131
+ / = public_version_api
132
+
133
+ [composite:admin]
134
+ use = egg:Paste#urlmap
135
+ /v2.0 = admin_api
136
+ / = admin_version_api
137
+ EOF
138
+
139
+ service keystone restart
140
+ # Wait for the dust to settle
141
+ sleep 5
142
+
143
+ #
144
+ # setup keystone user
145
+ #
146
+ IPADDR=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
147
+ ADMIN_ROLE=$(get_id keystone role-create --name=admin)
148
+ TENANT=$(get_id keystone tenant-create --name=$ADMIN_USER)
149
+ KUSER=$(get_id keystone user-create --name=$ADMIN_USER \
150
+ --email=none@devnull.lan \
151
+ --pass=$PASSWORD \
152
+ --tenant_id=$TENANT)
153
+ keystone user-role-add --tenant_id=$TENANT --user-id=$KUSER --role-id=$ADMIN_ROLE
154
+ KSERVICE=$(get_id keystone service-create --name=keystone \
155
+ --type=identity \
156
+ --description="OpenStack Identity")
157
+ keystone endpoint-create --region region1 \
158
+ --service_id $KSERVICE \
159
+ --publicurl "http://$IPADDR:5000/v2.0" \
160
+ --adminurl "http://127.0.0.1:35357/v2.0" \
161
+ --internalurl "http://127.0.0.1:5000/v2.0"
162
+
163
+ ##
164
+ ## Swift service stuff
165
+ ##
166
+ # The password here goes to the Swift proxy server
167
+ # configuration
168
+ # [filter:authtoken]
169
+ # paste.filter_factory = keystone.middleware.auth_token:filter_factory
170
+ # signing_dir = /etc/swift
171
+ # auth_host = keystone
172
+ # auth_port = 35357
173
+ # auth_protocol = http
174
+ # auth_uri = http://keystone:5000
175
+ # admin_tenant_name = service
176
+ # admin_user = swift
177
+ # admin_password = secret
178
+ # delay_auth_decision = 1
179
+ PASSWORD=$(pwgen -s 18 1)
180
+ TENANT=$(get_id keystone tenant-create --name=swift)
181
+ ROLE=$(get_id keystone role-create --name=swiftoperator)
182
+ KUSER=$(get_id keystone user-create --name=swift \
183
+ --pass=$PASSWORD \
184
+ --tenant_id=$TENANT)
185
+ keystone user-role-add --tenant_id=$TENANT --user-id=$KUSER --role-id=$ADMIN_ROLE
186
+ KSERVICE=$(get_id keystone service-create --name=swift \
187
+ --type=object-store \
188
+ --description="Swift Object-store Service")
189
+ keystone endpoint-create --region region1 \
190
+ --service_id $KSERVICE \
191
+ --publicurl "https://$IPADDR/v1/AUTH_\$(tenant_id)s" \
192
+ --adminurl "http://127.0.0.1:8080" \
193
+ --internalurl 'http://127.0.0.1:8080/v1/AUTH_$(tenant_id)s'
194
+
195
+ cat > keystone-env.sh << EOF
196
+ export SERVICE_ENDPOINT=http://127.0.0.1:35357/v2.0
197
+ export SERVICE_TOKEN=$SERVICE_TOKEN
198
+ EOF
199
+
200
+ ##
201
+ ## SWIFT SETUP
202
+ ##
203
+
204
+ IPADDR=$(/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
205
+ SWIFT_HASH=`pwgen -s 18 1`
206
+ mkdir -p /var/cache/swift
207
+ mkdir -p /srv/node/disk1
208
+ truncate -s ${SWIFT_DISK_SIZE}GB /srv/swift-disk
209
+ mkfs.xfs -i size=1024 /srv/swift-disk
210
+
211
+ cat > /etc/rsyncd.conf << EOF
212
+ pid file = /var/run/rsyncd.pid
213
+ uid = swift
214
+ gid = swift
215
+ syslog facility = local3
216
+ address = 127.0.0.1
217
+ reverse lookup = no
218
+
219
+ [ account ]
220
+ path = /srv/node
221
+ read only = false
222
+ max connections = 25
223
+ lock file = /var/lock/account.lock
224
+
225
+ [ container ]
226
+ path = /srv/node
227
+ read only = false
228
+ max connections = 25
229
+ lock file = /var/lock/container.lock
230
+
231
+ # This file is being maintained by Puppet.
232
+ # DO NOT EDIT
233
+
234
+ [ object ]
235
+ path = /srv/node
236
+ read only = false
237
+ max connections = 25
238
+ lock file = /var/lock/object.lock
239
+ EOF
240
+
241
+ cat > /etc/default/rsync << EOF
242
+ RSYNC_ENABLE=true
243
+ RSYNC_NICE=''
244
+ RSYNC_OPTS=''
245
+ EOF
246
+
247
+ service rsync start
248
+
249
+ cat > /etc/swift/swift.conf << EOF
250
+ [swift-hash]
251
+ swift_hash_path_suffix = $SWIFT_HASH
252
+ EOF
253
+
254
+
255
+ cat > /etc/swift/account-server.conf << EOF
256
+ [DEFAULT]
257
+ devices = /srv/node
258
+ bind_ip = 127.0.0.1
259
+ bind_port = 6002
260
+ mount_check = false
261
+ user = swift
262
+ log_facility = LOG_LOCAL2
263
+ workers = 1
264
+ db_preallocation = on
265
+
266
+ [pipeline:main]
267
+ pipeline = recon account-server
268
+
269
+ [app:account-server]
270
+ use = egg:swift#account
271
+
272
+ [account-replicator]
273
+ concurrency = 1
274
+
275
+ [account-auditor]
276
+
277
+ [account-reaper]
278
+ concurrency = 1
279
+ [filter:recon]
280
+ use = egg:swift#recon
281
+ recon_cache_path = /var/cache/swift
282
+ EOF
283
+
284
+ cat > /etc/swift/object-server.conf << EOF
285
+ [DEFAULT]
286
+ devices = /srv/node
287
+ bind_ip = 127.0.0.1
288
+ bind_port = 6000
289
+ mount_check = false
290
+ user = swift
291
+ log_facility = LOG_LOCAL2
292
+ workers = 1
293
+
294
+ [pipeline:main]
295
+ pipeline = recon object-server
296
+
297
+ [app:object-server]
298
+ use = egg:swift#object
299
+
300
+ [object-replicator]
301
+ concurrency = 1
302
+
303
+ [object-updater]
304
+ concurrency = 1
305
+
306
+ [object-auditor]
307
+ [filter:recon]
308
+ use = egg:swift#recon
309
+ recon_cache_path = /var/cache/swift
310
+ EOF
311
+
312
+ cat > /etc/swift/container-server.conf << EOF
313
+ [DEFAULT]
314
+ devices = /srv/node
315
+ bind_ip = 127.0.0.1
316
+ bind_port = 6001
317
+ mount_check = false
318
+ user = swift
319
+ log_facility = LOG_LOCAL2
320
+ workers = 1
321
+ db_preallocation = on
322
+
323
+ [pipeline:main]
324
+ pipeline = recon container-server
325
+
326
+ [app:container-server]
327
+ use = egg:swift#container
328
+
329
+ [container-replicator]
330
+ concurrency = 1
331
+
332
+ [container-updater]
333
+ concurrency = 1
334
+
335
+ [container-auditor]
336
+
337
+ [container-sync]
338
+ [filter:recon]
339
+ use = egg:swift#recon
340
+ recon_cache_path = /var/cache/swift
341
+ EOF
342
+
343
+ cat > /etc/swift/proxy-server.conf << EOF
344
+ [DEFAULT]
345
+ bind_port = 8080
346
+ bind_ip = 127.0.0.1
347
+ workers = 1
348
+ user = swift
349
+ set log_level = INFO
350
+ log_facility = LOG_LOCAL2
351
+
352
+ [pipeline:main]
353
+ pipeline = catch_errors healthcheck cache ratelimit authtoken keystone proxy-logging proxy-server
354
+
355
+ [app:proxy-server]
356
+ use = egg:swift#proxy
357
+ allow_account_management = true
358
+ account_autocreate = true
359
+
360
+ [filter:authtoken]
361
+ paste.filter_factory = keystone.middleware.auth_token:filter_factory
362
+ signing_dir = /etc/swift
363
+ auth_host = localhost
364
+ auth_port = 35357
365
+ auth_protocol = http
366
+ auth_uri = http://localhost:5000
367
+ admin_tenant_name = swift
368
+ admin_user = swift
369
+ admin_password = $PASSWORD
370
+ delay_auth_decision = 1
371
+
372
+ [filter:cache]
373
+ use = egg:swift#memcache
374
+ memcache_servers = 127.0.0.1
375
+
376
+ [filter:catch_errors]
377
+ use = egg:swift#catch_errors
378
+
379
+
380
+ [filter:healthcheck]
381
+ use = egg:swift#healthcheck
382
+
383
+ [filter:ratelimit]
384
+ use = egg:swift#ratelimit
385
+ clock_accuracy = 1000
386
+ max_sleep_time_seconds = 60
387
+ log_sleep_time_seconds = 0
388
+ rate_buffer_seconds = 5
389
+ account_ratelimit = 0
390
+
391
+ [filter:proxy-logging]
392
+ use = egg:swift#proxy_logging
393
+
394
+
395
+ [filter:keystone]
396
+ paste.filter_factory = keystone.middleware.swift_auth:filter_factory
397
+ operator_roles = admin, SwiftOperator
398
+ is_admin = true
399
+ cache = swift.cache
400
+ EOF
401
+
402
+ for t in object container account; do
403
+ swift-ring-builder /etc/swift/$t.builder create 18 1 1
404
+ swift-ring-builder /etc/swift/$t.builder write_ring
405
+ done
406
+
407
+ swift-ring-builder /etc/swift/object.builder add z1-127.0.0.1:6000/disk1 $SWIFT_DISK_SIZE
408
+ swift-ring-builder /etc/swift/container.builder add z1-127.0.0.1:6001/disk1 $SWIFT_DISK_SIZE
409
+ swift-ring-builder /etc/swift/account.builder add z1-127.0.0.1:6002/disk1 $SWIFT_DISK_SIZE
410
+
411
+ for t in object container account; do
412
+ swift-ring-builder /etc/swift/$t.builder rebalance
413
+ done
414
+
415
+ cat > /etc/rc.local << EOF
416
+ mount -t xfs -o noatime,nodiratime,nobarrier,logbufs=8 /srv/swift-disk /srv/node/disk1
417
+ exit 0
418
+ EOF
419
+
420
+ mount -t xfs -o noatime,nodiratime,nobarrier,logbufs=8 /srv/swift-disk /srv/node/disk1
421
+ echo '/srv/swift-disk /srv/node/disk1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 1' >> /etc/fstab
422
+ chown swift:swift -R /etc/swift
423
+ chown swift:swift /var/cache/swift
424
+ chown -R swift:swift /srv/node/*
425
+ swift-init all start
426
+
427
+ #
428
+ # stud setup
429
+ #
430
+ cp /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/stud/cert.pem
431
+ cat /etc/ssl/private/ssl-cert-snakeoil.key >> /etc/stud/cert.pem
432
+ openssl dhparam -rand - 1024 >> /etc/stud/cert.pem
433
+ cat > /etc/stud/keystone.conf << EOF
434
+ OPTIONS="-s -f $IPADDR,5000 -b 127.0.0.1,5000 --ssl -n 1 "
435
+ CERT="/etc/stud/cert.pem"
436
+ EOF
437
+
438
+ cat > /etc/stud/swift.conf << EOF
439
+ OPTIONS="-s -f $IPADDR,443 -b 127.0.0.1,8080 --ssl -n 1 "
440
+ CERT="/etc/stud/cert.pem"
441
+ EOF
442
+
443
+ service stud start
444
+ # stud init script braindamage
445
+ service stud restart