From 37326581851d4983a373b7a9f1ff23dda5591528 Mon Sep 17 00:00:00 2001 From: Musannif Zahir Date: Fri, 25 Oct 2013 15:43:56 +0500 Subject: [PATCH] Add support for cPanel's FTP module --- lib/lumberg/cpanel.rb | 1 + lib/lumberg/cpanel/ftp.rb | 101 ++++++++++++++++++ spec/cpanel/ftp_spec.rb | 71 ++++++++++++ spec/vcr_cassettes/cpanel/ftp/addftp.yml | 43 ++++++++ spec/vcr_cassettes/cpanel/ftp/delftp.yml | 43 ++++++++ spec/vcr_cassettes/cpanel/ftp/listftp.yml | 43 ++++++++ .../cpanel/ftp/listftpsessions.yml | 43 ++++++++ .../cpanel/ftp/listftpwithdisk.yml | 95 ++++++++++++++++ spec/vcr_cassettes/cpanel/ftp/passwd.yml | 43 ++++++++ spec/vcr_cassettes/cpanel/ftp/setquota.yml | 43 ++++++++ 10 files changed, 526 insertions(+) create mode 100644 lib/lumberg/cpanel/ftp.rb create mode 100644 spec/cpanel/ftp_spec.rb create mode 100644 spec/vcr_cassettes/cpanel/ftp/addftp.yml create mode 100644 spec/vcr_cassettes/cpanel/ftp/delftp.yml create mode 100644 spec/vcr_cassettes/cpanel/ftp/listftp.yml create mode 100644 spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml create mode 100644 spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml create mode 100644 spec/vcr_cassettes/cpanel/ftp/passwd.yml create mode 100644 spec/vcr_cassettes/cpanel/ftp/setquota.yml diff --git a/lib/lumberg/cpanel.rb b/lib/lumberg/cpanel.rb index 373a98c7..15d91652 100644 --- a/lib/lumberg/cpanel.rb +++ b/lib/lumberg/cpanel.rb @@ -26,5 +26,6 @@ module Cpanel require "lumberg/cpanel/locale" require "lumberg/cpanel/mysql" require "lumberg/cpanel/domain_keys" + require "lumberg/cpanel/ftp" end end diff --git a/lib/lumberg/cpanel/ftp.rb b/lib/lumberg/cpanel/ftp.rb new file mode 100644 index 00000000..23f0a1f9 --- /dev/null +++ b/lib/lumberg/cpanel/ftp.rb @@ -0,0 +1,101 @@ +module Lumberg + module Cpanel + class Ftp < Base + def self.api_module; "Ftp"; end + + # Public: List FTP accounts associated with the authenticated user's account + # + # options - Hash options for API call params (default: {}): + # :include_acct_types - specify which FTP account types to include + # :skip_acct_types - specify which FTP account types to exclude + # + # Returns Hash API response. + def list_ftp(options = {}) + perform_request({ + api_function: "listftp" + }.merge(options)) + end + + # Public: Retrieve a list of FTP sessions associated with the account + # + # Returns Hash API response. + def list_ftp_sessions(options = {}) + perform_request({ + api_function: "listftpsessions" + }.merge(options)) + end + + # Public: Generate a list of FTP accounts associated with a cPanel account + # The list will contain each account's disk information + # + # options - Hash options for API call params (default: {}): + # :dirhtml - prepend the 'dir' return variable with a URL + # :include_acct_types - specify which FTP account types to include + # :skip_acct_types - specify which FTP account types to exclude + # + # Returns Hash API response. + def list_ftp_with_disk(options = {}) + perform_request({ + api_function: "listftpwithdisk" + }.merge(options)) + end + + # Public: Change an FTP account's password + # + # options - Hash options for API call params (default: {}): + # :user - The username portion of the FTP account + # :pass - The new password for the FTP account + # + # Returns Hash API response. + def passwd(options = {}) + perform_request({ + api_function: "passwd" + }.merge(options)) + end + + # Public: Add a new FTP account + # + # options - Hash options for API call params (default: {}): + # :user - The username portion of the new FTP account, without the domain + # :pass - The password for the new FTP account + # :quota - The new FTP account's quota. The default, 0, indicates that + # the account will not use a quota. + # :homedir - The path to the FTP account's root directory. This value + # should be relative to the account's home directory + # + # Returns Hash API response. + def add_ftp(options = {}) + perform_request({ + api_function: "addftp" + }.merge(options)) + end + + # Public: Change an FTP account's quota + # + # options - Hash options for API call params (default: {}): + # :user - The username portion of the FTP account + # :quota - The new quota (in megabytes) for the FTP account + # + # Returns Hash API response. + def set_quota(options = {}) + perform_request({ + api_function: "setquota" + }.merge(options)) + end + + # Public: Delete an FTP account + # + # options - Hash options for API call params (default: {}): + # :user - The name of the account to be removed + # :destroy - A boolean value that indicates whether or not the FTP account's + # home directory should also be deleted + # + # Returns Hash API response. + def del_ftp(options = {}) + perform_request({ + api_function: "delftp" + }.merge(options)) + end + end + end +end diff --git a/spec/cpanel/ftp_spec.rb b/spec/cpanel/ftp_spec.rb new file mode 100644 index 00000000..3ae4011b --- /dev/null +++ b/spec/cpanel/ftp_spec.rb @@ -0,0 +1,71 @@ +require "spec_helper" + +module Lumberg + describe Cpanel::Ftp do + let(:server) { Whm::Server.new(host: @whm_host, hash: @whm_hash) } + let(:api_username) { "lumberg" } + + let(:ftp) do + described_class.new( + server: server, + api_username: api_username + ) + end + + describe "#list_ftp" do + use_vcr_cassette("cpanel/ftp/listftp") + + it "lists ftp accounts associated to the account" do + ftp.list_ftp[:params][:data][0][:user].should eq("hello") + end + end + + describe "#list_ftp_sessions" do + use_vcr_cassette("cpanel/ftp/listftpsessions") + + it "lists ftp sessions associated to the account" do + ftp.list_ftp_sessions[:params][:data][0][:status].should eq("IDLE") + end + end + + describe "#list_ftp_with_disk" do + use_vcr_cassette("cpanel/ftp/listftpwithdisk") + + it "lists ftp accounts with disk information" do + ftp.list_ftp_with_disk[:params][:data][0][:_diskused].should eq("0") + end + end + + describe "#add_ftp" do + use_vcr_cassette("cpanel/ftp/addftp") + + it "creates the account" do + ftp.add_ftp(user: 'bob', pass: 'boo')[:params][:data][0][:reason].should eq("OK") + end + end + + describe "#passwd" do + use_vcr_cassette("cpanel/ftp/passwd") + + it "changes the password of the account" do + ftp.passwd(user: 'bob', pass: 'boo')[:params][:data][0][:reason].should eq("OK") + end + end + + describe "#setquota" do + use_vcr_cassette("cpanel/ftp/setquota") + + it "sets a quota for the account" do + ftp.set_quota(user: 'bob', quota: '100')[:params][:data][0][:reason].should eq("OK") + end + end + + describe "#del_ftp" do + use_vcr_cassette("cpanel/ftp/delftp") + + it "removes the account" do + ftp.del_ftp(user: 'bob', destroy: '1')[:params][:data][0][:reason].should eq("OK") + end + end + end +end diff --git a/spec/vcr_cassettes/cpanel/ftp/addftp.yml b/spec/vcr_cassettes/cpanel/ftp/addftp.yml new file mode 100644 index 00000000..e7761a27 --- /dev/null +++ b/spec/vcr_cassettes/cpanel/ftp/addftp.yml @@ -0,0 +1,43 @@ +--- +http_interactions: +- request: + method: get + uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=addftp&cpanel_jsonapi_module=Ftp&cpanel_jsonapi_user=lumberg&pass=boo&user=bob + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - WHM root:iscool + User-Agent: + - Faraday v0.8.8 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - '*/*' + response: + status: + code: 200 + message: OK + headers: + Server: + - cpsrvd/11.36.2.0 + X-Keep-Alive-Count: + - '1' + Connection: + - Keep-Alive + Keep-Alive: + - timeout=70, max=200 + Date: + - Fri, 25 Oct 2013 13:23:49 GMT + Content-Type: + - text/plain; charset="utf-8" + Content-Length: + - '116' + body: + encoding: UTF-8 + string: | + {"cpanelresult":{"data":[{"reason":"OK","result":1}],"func":"addftp","module":"Ftp","apiversion":2,"event":{"result":1}}} + http_version: + recorded_at: Fri, 25 Oct 2013 13:23:49 GMT +recorded_with: VCR 2.4.0 diff --git a/spec/vcr_cassettes/cpanel/ftp/delftp.yml b/spec/vcr_cassettes/cpanel/ftp/delftp.yml new file mode 100644 index 00000000..f0c5fc67 --- /dev/null +++ b/spec/vcr_cassettes/cpanel/ftp/delftp.yml @@ -0,0 +1,43 @@ +--- +http_interactions: +- request: + method: get + uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=delftp&cpanel_jsonapi_module=Ftp&cpanel_jsonapi_user=lumberg&destroy=1&user=bob + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - WHM root:iscool + User-Agent: + - Faraday v0.8.8 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - '*/*' + response: + status: + code: 200 + message: OK + headers: + Server: + - cpsrvd/11.36.2.0 + X-Keep-Alive-Count: + - '1' + Connection: + - Keep-Alive + Keep-Alive: + - timeout=70, max=200 + Date: + - Fri, 25 Oct 2013 13:23:53 GMT + Content-Type: + - text/plain; charset="utf-8" + Content-Length: + - '116' + body: + encoding: UTF-8 + string: | + {"cpanelresult":{"func":"delftp","module":"Ftp","apiversion":2,"data":[{"reason":"OK","result":1}],"event":{"result":1}}} + http_version: + recorded_at: Fri, 25 Oct 2013 13:23:53 GMT +recorded_with: VCR 2.4.0 diff --git a/spec/vcr_cassettes/cpanel/ftp/listftp.yml b/spec/vcr_cassettes/cpanel/ftp/listftp.yml new file mode 100644 index 00000000..b00099ed --- /dev/null +++ b/spec/vcr_cassettes/cpanel/ftp/listftp.yml @@ -0,0 +1,43 @@ +--- +http_interactions: +- request: + method: get + uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=listftp&cpanel_jsonapi_module=Ftp&cpanel_jsonapi_user=lumberg + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - WHM root:iscool + User-Agent: + - Faraday v0.8.8 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - '*/*' + response: + status: + code: 200 + message: OK + headers: + Server: + - cpsrvd/11.36.2.0 + X-Keep-Alive-Count: + - '1' + Connection: + - Keep-Alive + Keep-Alive: + - timeout=70, max=200 + Date: + - Fri, 25 Oct 2013 13:23:45 GMT + Content-Type: + - text/plain; charset="utf-8" + Content-Length: + - '242' + body: + encoding: UTF-8 + string: | + {"cpanelresult":{"module":"Ftp","func":"listftp","apiversion":2,"data":[{"homedir":"/home/lumberg/public_html/somethingnew.com","user":"hello","type":"sub"},{"homedir":"/home/lumberg/blah","user":"blah","type":"sub"},{"homedir":"/home/lumberg/moo","user":"moo","type":"sub"},{"homedir":"/home/lumberg","user":"lumberg","type":"main"},{"homedir":"/home/lumberg/public_ftp","user":"ftp","type":"anonymous"},{"homedir":"/home/lumberg/public_ftp","user":"anonymous","type":"anonymous"},{"homedir":"/usr/local/apache/domlogs/lumberg","user":"lumberg_logs","type":"logaccess"}],"event":{"result":1}}} + http_version: + recorded_at: Fri, 25 Oct 2013 13:23:45 GMT +recorded_with: VCR 2.4.0 diff --git a/spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml b/spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml new file mode 100644 index 00000000..753325ba --- /dev/null +++ b/spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml @@ -0,0 +1,43 @@ +--- +http_interactions: +- request: + method: get + uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=listftpsessions&cpanel_jsonapi_module=Ftp&cpanel_jsonapi_user=lumberg + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - WHM root:iscool + User-Agent: + - Faraday v0.8.8 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - '*/*' + response: + status: + code: 200 + message: OK + headers: + Server: + - cpsrvd/11.36.2.0 + X-Keep-Alive-Count: + - '1' + Connection: + - Keep-Alive + Keep-Alive: + - timeout=70, max=200 + Date: + - Fri, 25 Oct 2013 13:23:46 GMT + Content-Type: + - text/plain; charset="utf-8" + Content-Length: + - '226' + body: + encoding: UTF-8 + string: | + {"cpanelresult":{"data":[{"status":"IDLE","login":"Fri Oct 25 08:23:24 2013","cmdline":"pure-ftpd (IDLE) ","pid":"7667","file":"","user":"moo@blah.com","host":"124.195.196.55"}],"func":"listftpsessions","module":"Ftp","event":{"result":1},"apiversion":2}} + http_version: + recorded_at: Fri, 25 Oct 2013 13:23:46 GMT +recorded_with: VCR 2.4.0 diff --git a/spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml b/spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml new file mode 100644 index 00000000..7dccceb1 --- /dev/null +++ b/spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml @@ -0,0 +1,95 @@ +--- +http_interactions: +- request: + method: get + uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=listftpwithdisk&cpanel_jsonapi_module=Ftp&cpanel_jsonapi_user=lumberg + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - WHM root:iscool + User-Agent: + - Faraday v0.8.8 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - '*/*' + response: + status: + code: 200 + message: OK + headers: + Server: + - cpsrvd/11.36.2.0 + X-Keep-Alive-Count: + - '1' + Connection: + - Keep-Alive + Keep-Alive: + - timeout=70, max=200 + Date: + - Fri, 25 Oct 2013 13:23:47 GMT + Content-Type: + - text/plain; charset="utf-8" + Content-Length: + - '455' + body: + encoding: ASCII-8BIT + string: !binary |- + eyJjcGFuZWxyZXN1bHQiOnsiZXZlbnQiOnsicmVzdWx0IjoxfSwibW9kdWxl + IjoiRnRwIiwiYXBpdmVyc2lvbiI6MiwiZGF0YSI6W3sic2VydmVybG9naW4i + OiJhbm9ueW1vdXNAYmxhaC5jb20iLCJkZWxldGVhYmxlIjowLCJfZGlza3Vz + ZWQiOiIwIiwiYWNjdHR5cGUiOiJhbm9ueW1vdXMiLCJkaXNrcXVvdGEiOiJ1 + bmxpbWl0ZWQiLCJkaXNrdXNlZHBlcmNlbnQyMCI6MCwiaHVtYW5kaXNrcXVv + dGEiOiJOb25lIiwicmVsZGlyIjoicHVibGljX2Z0cCIsImxvZ2luIjoiYW5v + bnltb3VzIiwiaHRtbGRpciI6bnVsbCwiX2Rpc2txdW90YSI6IjAiLCJodW1h + bmRpc2t1c2VkIjoiTm9uZSIsImRpciI6Ii9ob21lL211c2FubmlmL3B1Ymxp + Y19mdHAiLCJkaXNrdXNlZHBlcmNlbnQiOjAsImRpc2t1c2VkIjoiMCJ9LHsi + c2VydmVybG9naW4iOiJibGFoQGJsYWguY29tIiwiZGVsZXRlYWJsZSI6MSwi + X2Rpc2t1c2VkIjoiMCIsImFjY3R0eXBlIjoic3ViIiwiZGlza3F1b3Rh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c2t1c2VkcGVyY2VudDIwIjowLCJodW1hbmRpc2txdW90YSI6Ik5vbmUi + LCJyZWxkaXIiOiJ1c3IvbG9jYWwvYXBhY2hlL2RvbWxvZ3MvbXVzYW5uaWYi + LCJsb2dpbiI6Im11c2FubmlmX2xvZ3MiLCJodG1sZGlyIjpudWxsLCJfZGlz + a3F1b3RhIjoiMCIsImh1bWFuZGlza3VzZWQiOiJOb25lIiwiZGlyIjoiL3Vz + ci9sb2NhbC9hcGFjaGUvZG9tbG9ncy9tdXNhbm5pZiIsImRpc2t1c2VkcGVy + Y2VudCI6MCwiZGlza3VzZWQiOiIwIn1dLCJmdW5jIjoibGlzdGZ0cHdpdGhk + aXNrIn19Cg== + http_version: + recorded_at: Fri, 25 Oct 2013 13:23:47 GMT +recorded_with: VCR 2.4.0 diff --git a/spec/vcr_cassettes/cpanel/ftp/passwd.yml b/spec/vcr_cassettes/cpanel/ftp/passwd.yml new file mode 100644 index 00000000..90e05424 --- /dev/null +++ b/spec/vcr_cassettes/cpanel/ftp/passwd.yml @@ -0,0 +1,43 @@ +--- +http_interactions: +- request: + method: get + uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=passwd&cpanel_jsonapi_module=Ftp&cpanel_jsonapi_user=lumberg&pass=boo&user=bob + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - WHM root:iscool + User-Agent: + - Faraday v0.8.8 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - '*/*' + response: + status: + code: 200 + message: OK + headers: + Server: + - cpsrvd/11.36.2.0 + X-Keep-Alive-Count: + - '1' + Connection: + - Keep-Alive + Keep-Alive: + - timeout=70, max=200 + Date: + - Fri, 25 Oct 2013 13:23:50 GMT + Content-Type: + - text/plain; charset="utf-8" + Content-Length: + - '117' + body: + encoding: UTF-8 + string: | + {"cpanelresult":{"data":[{"result":1,"reason":"OK"}],"func":"passwd","module":"Ftp","event":{"result":1},"apiversion":2}} + http_version: + recorded_at: Fri, 25 Oct 2013 13:23:50 GMT +recorded_with: VCR 2.4.0 diff --git a/spec/vcr_cassettes/cpanel/ftp/setquota.yml b/spec/vcr_cassettes/cpanel/ftp/setquota.yml new file mode 100644 index 00000000..43ae668d --- /dev/null +++ b/spec/vcr_cassettes/cpanel/ftp/setquota.yml @@ -0,0 +1,43 @@ +--- +http_interactions: +- request: + method: get + uri: https://myhost.com:2087/json-api/cpanel?cpanel_jsonapi_apiversion=2&cpanel_jsonapi_func=setquota&cpanel_jsonapi_module=Ftp&cpanel_jsonapi_user=lumberg"a=100&user=bob + body: + encoding: US-ASCII + string: '' + headers: + Authorization: + - WHM root:iscool + User-Agent: + - Faraday v0.8.8 + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - '*/*' + response: + status: + code: 200 + message: OK + headers: + Server: + - cpsrvd/11.36.2.0 + X-Keep-Alive-Count: + - '1' + Connection: + - Keep-Alive + Keep-Alive: + - timeout=70, max=200 + Date: + - Fri, 25 Oct 2013 13:23:51 GMT + Content-Type: + - text/plain; charset="utf-8" + Content-Length: + - '118' + body: + encoding: UTF-8 + string: | + {"cpanelresult":{"data":[{"result":1,"reason":"OK"}],"apiversion":2,"func":"setquota","module":"Ftp","event":{"result":1}}} + http_version: + recorded_at: Fri, 25 Oct 2013 13:23:51 GMT +recorded_with: VCR 2.4.0