{"id":15395473,"url":"https://github.com/stef/putbag","last_synced_at":"2025-03-27T20:44:52.705Z","repository":{"id":4377436,"uuid":"5514152","full_name":"stef/putbag","owner":"stef","description":"provides expiration of access to files served by webservers","archived":false,"fork":false,"pushed_at":"2012-08-27T12:18:53.000Z","size":172,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-01T23:17:19.260Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stef.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-08-22T19:17:51.000Z","updated_at":"2023-09-08T16:34:54.000Z","dependencies_parsed_at":"2022-08-27T14:47:10.473Z","dependency_job_id":null,"html_url":"https://github.com/stef/putbag","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stef%2Fputbag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stef%2Fputbag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stef%2Fputbag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stef%2Fputbag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stef","download_url":"https://codeload.github.com/stef/putbag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245924494,"owners_count":20694728,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T15:28:28.165Z","updated_at":"2025-03-27T20:44:52.682Z","avatar_url":"https://github.com/stef.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"* putbag\na set of small scripts allowing to share files easily using a remote\nserver which handles ssh and http. putbag consists of 2 components\n - *publish* for uploading files to the share\n - *alimit* and *tlimit* for cleaning the files after specified number\n   of successful access or expiration of a timelimit\n\ndepends on: srm\n\n** publish\nA tool that publishes files and directories to a webserver via ssh,\nsupports alimit/tlimit for a clean putbag.\n*** Parameters\n    - [-a \u003caccess ttl\u003e]\n    - [-t \u003ctime expiry\u003e] - can handle input like \"2 weeks\"\n    - [-d \u003cssh path\u003e ] - where to upload to\n    - [-u \u003cpublishing url\u003e] - the url prepended to the published\n      content\n\n   These parameters can also be set in /etc/putbagrc, ~/.putbagrc and ./.putbagrc\n#+BEGIN_SRC sh\n   sshpath=my.server.org:share\n   desturl=http://my.server.org/putbag/\n   alimit=10 # default always to 10 downloads\n   tlimit=1 week # default to share only briefly\n#+END_SRC\n\n#+BEGIN_SRC sh\n# publish -a 10 -t \"2 weeks\" funnyimage.png\nhttp://my.server.org/putbag/funnyimage.png\n#+END_SRC\n\nThe result url is not only displayed, but also automatically copied to\nthe clipboard.\n** alimit.sh\n... monitors ncsa logfiles for requests to limited files which after\nexceeding their TTL are deleted from the disk. This is useful for\nsharing files for a limited amount of downloads.\n\nTo alimit a file create a .\u003cfilename\u003e.alimit file containing the\nnumber of allowed (and successful) downloads.\n\nassuming you are publishing your files under an aliased directory to\n/putbag/ run:\n#+BEGIN_SRC sh\nalimit.sh -r ~/share/ -l /var/log/nginx/access.log -a /putbag/\n#+END_SRC\n\nalimit will log to stdout its activities.\n\n*** Limitations\nOnly handles HTTP 200 responses, continuation, redirects, etc are not\ncovered\n\n*** example\nCreate a file and set the limit to 3 downloads (assuming you have a\nwebserver running on localhost):\n#+BEGIN_SRC sh\nsudo sh -c 'rm alimit.log; echo 'asdf' \u003e/var/www/limited; echo 3 \u003e/var/www/.limited.alimit'\n#+END_SRC\nRun alimit\n#+BEGIN_SRC sh\nsudo ./alimit.sh\n#+END_SRC\nExecute 4 times:\n#+BEGIN_SRC sh\n# curl localhost/limited; curl localhost/.limited.alimit\n#+END_SRC\nCheck out the log\n#+BEGIN_SRC sh\n# cat alimit.log\n#+END_SRC\n\n** tlimit.sh\nA small cronjob that weeds out expired files from the monitored directory structure.\nuse something similar in your crontab:\n#+BEGIN_SRC\n*/3 * * * * /home/user/putbag/tlimit.sh /home/user/public/\n#+END_SRC\n* nginx\nYou might want to limit access to the .alimit files themselves. Do so using:\n#+BEGIN_SRC\n        location ~ \\..*\\.[at]limit$ {\n                deny all;\n        }\n#+END_SRC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstef%2Fputbag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstef%2Fputbag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstef%2Fputbag/lists"}