{"id":23138223,"url":"https://github.com/softlayer/swftp","last_synced_at":"2025-08-17T11:32:49.927Z","repository":{"id":6397993,"uuid":"7636010","full_name":"softlayer/swftp","owner":"softlayer","description":" An FTP and SFTP interface for OpenStack Object Storage (swift).","archived":false,"fork":false,"pushed_at":"2017-11-17T17:47:51.000Z","size":191,"stargazers_count":56,"open_issues_count":13,"forks_count":25,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-11-18T14:57:50.129Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/softlayer.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-01-16T00:14:29.000Z","updated_at":"2024-10-25T15:53:42.000Z","dependencies_parsed_at":"2022-08-30T19:10:26.095Z","dependency_job_id":null,"html_url":"https://github.com/softlayer/swftp","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softlayer%2Fswftp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softlayer%2Fswftp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softlayer%2Fswftp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/softlayer%2Fswftp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/softlayer","download_url":"https://codeload.github.com/softlayer/swftp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230121666,"owners_count":18176477,"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-12-17T13:10:11.073Z","updated_at":"2024-12-17T13:10:11.730Z","avatar_url":"https://github.com/softlayer.png","language":"Python","readme":"SwFTP\n=====\nSwFTP is an FTP and SFTP interface for Openstack Object Storage (swift). It will act as a proxy between the FTP/SFTP protocols and OpenStack Object Storage.\n\nFeatures\n--------\n* Configurable auth endpoint to use any OpenStack Swift installation\n* Server-wide Configurable HTTP Connection Pool for Swift Communications (size and timeout)\n* Support for HTTPS communication to the backend OpenStack Object Storage cluster\n* Simple Installation `pip install swftp`\n* StatsD Support\n* Stats Web Interface\n* Chef Cookbook: https://github.com/softlayer/chef-swftp\n\nRequirements\n------------\n* Python 2.6-2.7\n* OpenSSL/pycrypto\n* Twisted/Twisted-Conch\n* pyasn1\n\nGetting Started\n---------------\n### Installing\nInstall via pip:\n```bash\n$ pip install swftp\n```\nNote: If you don't have pip [here's how to install it](http://www.pip-installer.org/en/latest/installing.html).\n\nInstall using git/pip:\n```bash\n$ pip install -U git+git://github.com/softlayer/swftp.git\n```\n\nInstall from source:\n```bash\n$ python setup.py install\n```\n\n### Start FTP Server\nTo run the FTP server, simply run this command. \n```bash\n$ swftp-ftp -a http://127.0.0.1:8080/auth/v1.0\n2013-02-18 16:28:50-0600 [-] Log opened.\n2013-02-18 16:28:50-0600 [-] FTPFactory starting on 5021\n2013-02-18 16:28:50-0600 [-] Starting factory \u003ctwisted.protocols.ftp.FTPFactory instance at 0x1103fcf80\u003e\n```\n\n### Start SFTP Server\nThe SFTP requires a bit of setup the first time.\n\n\nYou'll need to create a public/private key pair for SSH and move them to the /etc/swftp directory (this location is configurable).\n```bash\n$ mkdir /etc/swftp\n$ ssh-keygen -h -b 2048 -N \"\" -t rsa -f /etc/swftp/id_rsa\n```\n\nAfter placing the required files, the command to start the server is similar to the FTP one.\n```bash\n$ swftp-sftp -a http://127.0.0.1:8080/auth/v1.0\n2013-02-18 16:29:14-0600 [-] Log opened.\n2013-02-18 22:29:14+0000 [-] SSHFactory starting on 5022\n```\n\nConfiguration\n-------------\n### Command Line\nThe command line configuration allows you to speficfy a custom OpenStack Swift Auth URL, as well as the location of the config file (detailed later).\n\nFTP Command-line options:\n```bash\n$ swftp-ftp --help\nUsage: swftp-ftp [options]\nOptions:\n  -c, --config_file=  Location of the swftp config file. [default:\n                      /etc/swftp/swftp.conf]\n  -a, --auth_url=     Auth Url to use. Defaults to the config file value if it\n                      exists. [default: http://127.0.0.1:8080/auth/v1.0]\n  -p, --port=         Port to bind to.\n  -h, --host=         IP to bind to.\n      --version       Display Twisted version and exit.\n      --help          Display this help and exit.\n```\n\nSFTP Command-line options:\n```bash\n$ swftp-sftp --help\nUsage: swftp-sftp [options]\nOptions:\n  -c, --config_file=  Location of the swftp config file. [default:\n                      /etc/swftp/swftp.conf]\n  -a, --auth_url=     Auth Url to use. Defaults to the config file value if it\n                      exists.[default: http://127.0.0.1:8080/auth/v1.0]\n  -p, --port=         Port to bind to.\n  -h, --host=         IP to bind to.\n      --priv_key=     Private Key Location.\n      --pub_key=      Public Key Location.\n      --version       Display Twisted version and exit.\n      --help          Display this help and exit.\n```\n\n### Config File\nThe default location for the config file is /etc/swftp/swftp.conf.\n\nHere is an example swftp.conf with all defaults:\n```\n[sftp]\nhost = 0.0.0.0\nport = 5022\npriv_key = /etc/swftp/id_rsa\npub_key = /etc/swftp/id_rsa.pub\nconnection_timeout = 240\n\nauth_url = http://127.0.0.1:8080/auth/v1.0\nnum_persistent_connections = 20\nnum_connections_per_session = 10\nrewrite_storage_scheme =\nrewrite_storage_netloc =\nextra_headers = X-Swftp: true, X-Forwarded-Proto: SFTP\n\nlog_statsd_host =\nlog_statsd_port = 8125\nlog_statsd_sample_rate = 10\nlog_statsd_metric_prefix = sftp\n\nstats_host =\nstats_port = 38022\n\n[ftp]\nhost = 0.0.0.0\nport = 5021\nsessions_per_user = 10\nconnection_timeout = 240\nwelcome_message = Welcome to SwFTP - An FTP/SFTP interface for Openstack Swift\n\nauth_url = http://127.0.0.1:8080/auth/v1.0\nnum_persistent_connections = 20\nnum_connections_per_session = 10\nrewrite_storage_scheme =\nrewrite_storage_netloc =\nextra_headers = X-Swftp: true, X-Forwarded-Proto: SFTP\n\nlog_statsd_host =\nlog_statsd_port = 8125\nlog_statsd_sample_rate = 10\nlog_statsd_metric_prefix = ftp\n\nstats_host = \nstats_port = 38021\n```\n\n**Server Options**\n\n* **host** - Address that the FTP/SFTP server will listen on.\n* **port** - Port that the FTP/SFTP server will listen on.\n* **sessions_per_user** - Number of FTP/SFTP sessions per unique swift username to allow.\n* **priv_key** - (SFTP Only) - File path to the private SSH key that the SFTP server will use.\n* **pub_key** - (SFTP Only) - File path to the public SSH key generated from the private key.\n* **session_timeout** - (FTP Only) - Session timeout in seconds. Idle sessions will be closed after this much time.\n* **welcome_message** - (FTP Only) - Custom FTP welcome message.\n\n**Swift Options**\n\n* **auth_url** - Auth URL to use to authenticate with the backend swift cluster.\n* **num_persistent_connections** - Number of persistent connections to the backend swift cluster for an entire swftp instance.\n* **num_connections_per_session** - Number of persistent connections to the backend swift cluster per FTP/SFTP session.\n* **connection_timeout** - Connection timeout in seconds to the backend swift cluster.\n* **extra_headers** - Extra HTTP headers that are sent to swift cluster.\n    * e.g.: extra_headers = X-Swftp: true, X-Forwarded-Proto: SFTP\n* **rewrite_storage_scheme** - Rewrite the URL scheme of each storage URL returned from Swift auth to this value.\n    * e.g.: rewrite_storage_scheme = https\n* **rewrite_storage_netloc** - Rewrite the URL netloc (hostname:port) of each storage URL returned from Swift auth to this value.\n    * e.g.: rewrite_storage_netloc = 127.0.0.1:12345\n\n**Stats Options**\n\n* **stats_host** - Address that the HTTP stats interface will listen on.\n* **stats_port** - Port that the HTTP stats interface will listen on.\n* **log_statsd_host** - statsd hostname.\n* **log_statsd_port** - statsd port.\n* **log_statsd_sample_rate** - How often in seconds to send metrics to the statsd server.\n* **log_statsd_metric_prefix** - Prefix appended to each stat sent to statsd.\n\n\nCaveats\n-------\n* You cannot create top-level files, just directories (because the top level are containers).\n* You cannot rename any non-empty directory.\n* No recursive delete. Most clients will explicitly delete each file/directory recursively anyway.\n* Fake-directories and real objects of the same name will simply display the directory. A lot of FTP/SFTP clients [actually explode](http://gifsoup.com/webroot/animatedgifs2/1095919_o.gif) if a directory listing has duplicates.\n\nProject Organization\n--------------------\n* etc/: Sample config files\n* swftp/: Core/shared code\n    * ftp/: FTP server\n    * sftp/: SFTP server\n    * test/: Unit and functional tests\n* twisted/: For the Twisted Plugin System\n\nPackaging/Creating Init Scripts\n-------------------------------\nPackaged with SwFTP are a set of example init scripts, upstart scripts. They are all located within the /etc/ directory in the source.\n\n* Upstart\n    * /etc/init/swftp-ftp.conf\n    * /etc/init/swftp-sftp.conf\n* init.d\n    * /etc/init.d/swftp-ftp\n    * /etc/init.d/swftp-sftp\n* Supervisor\n    * /etc/supervisor/conf.d/swftp.conf\n* Example swftp.conf file\n    * /etc/swftp/swftp.conf.sample\n\nStats Web Interface\n-------------------\nThe web interface is an HTTP interface that provides a way to get more app-specific metrics. The only format supported currently is JSON. If the 'stats_host' config value is set, the server will listen to that interface.\n\n**http://{stats_host}:{stats_port}/stats.json**\n\n```bash\n$ curl http://127.0.0.1:38022/stats.json | python -mjson.tool\n{\n    \"rates\": {\n        \"auth.fail\": 0,\n        \"auth.succeed\": 0,\n        \"command.getAttrs\": 0,\n        \"command.login\": 0,\n        \"command.logout\": 9,\n        \"command.makeDirectory\": 0,\n        \"command.openDirectory\": 0,\n        \"command.openFile\": 0,\n        \"command.removeDirectory\": 0,\n        \"command.removeFile\": 0,\n        \"command.renameFile\": 0,\n        \"num_clients\": -9,\n        \"transfer.egress_bytes\": 0,\n        \"transfer.ingress_bytes\": 47662\n    },\n    \"totals\": {\n        \"auth.fail\": 0,\n        \"auth.succeed\": 91,\n        \"command.getAttrs\": 15,\n        \"command.login\": 91,\n        \"command.logout\": 91,\n        \"command.makeDirectory\": 0,\n        \"command.openDirectory\": 7,\n        \"command.openFile\": 8,\n        \"command.removeDirectory\": 3,\n        \"command.removeFile\": 0,\n        \"command.renameFile\": 7,\n        \"num_clients\": 0,\n        \"transfer.egress_bytes\": 11567105,\n        \"transfer.ingress_bytes\": 11567105\n    }\n}\n```\n\nStatsd Support\n--------------\nStatsd support relies on [txStatsD](https://pypi.python.org/pypi/txStatsD). If the 'log_statsd_host' config value is set, the following paths will be emited into statsd.\n\n### General\n\n* stats.[prefix].egress_bytes\n* stats.[prefix].ingress_bytes\n* stats.gauges.[prefix].clients\n* stats.gauges.[prefix].proc.threads\n* stats.gauges.[prefix].proc.cpu.percent\n* stats.gauges.[prefix].proc.cpu.system\n* stats.gauges.[prefix].proc.cpu.user\n* stats.gauges.[prefix].proc.memory.percent\n* stats.gauges.[prefix].proc.memory.rss\n* stats.gauges.[prefix].proc.memory.vsize\n* stats.gauges.[prefix].proc.net.status.[tcp_state]\n\n### SFTP-related\n\n* stats.[prefix].command.getAttrs\n* stats.[prefix].command.login\n* stats.[prefix].command.logout\n* stats.[prefix].command.makeDirectory\n* stats.[prefix].command.openDirectory\n* stats.[prefix].command.openFile\n* stats.[prefix].command.removeDirectory\n* stats.[prefix].command.removeFile\n* stats.[prefix].command.renameFile\n\n### FTP-related\n\n* stats.[prefix].command.access\n* stats.[prefix].command.list\n* stats.[prefix].command.login\n* stats.[prefix].command.logout\n* stats.[prefix].command.makeDirectory\n* stats.[prefix].command.openForReading\n* stats.[prefix].command.openForWriting\n* stats.[prefix].command.removeDirectory\n* stats.[prefix].command.removeFile\n* stats.[prefix].command.rename\n* stats.[prefix].command.stat\n\nDevelopment\n-----------\nDevelopment works with a fork and pull request process. Feel free submit pull requests.\n\nTo run the tests, run\n```bash\n$ trial swftp\n```\n\nTo run tests against live swftp servers (ftp and sftp) it requires a test config. The default location is `/etc/swftp/test.conf` but can be set with the SWFTP_TEST_CONFIG_FILE environmental variable. Here is a sample test config\n\n```\n[func_test]\nauth_host = 127.0.0.1\nauth_port = 8080\nauth_ssl = no\nauth_prefix = /auth/\n\naccount = test\nusername = tester\npassword = testing\n\nsftp_host = 127.0.0.1\nsftp_port = 5022\n\nftp_host = 127.0.0.1\nftp_port = 5021\n\n```\n\nLicense\n-------\nCopyright (c) 2014 SoftLayer Technologies, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftlayer%2Fswftp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftlayer%2Fswftp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftlayer%2Fswftp/lists"}