lumberg 2.0.0.pre4 → 2.0.0.pre5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +49 -49
- data/lib/lumberg/cpanel.rb +2 -0
- data/lib/lumberg/cpanel/addon_domain.rb +3 -3
- data/lib/lumberg/cpanel/backups.rb +1 -1
- data/lib/lumberg/cpanel/base.rb +5 -5
- data/lib/lumberg/cpanel/box_trapper.rb +1 -1
- data/lib/lumberg/cpanel/branding.rb +5 -5
- data/lib/lumberg/cpanel/contact.rb +2 -2
- data/lib/lumberg/cpanel/cron.rb +6 -6
- data/lib/lumberg/cpanel/dns_lookup.rb +1 -1
- data/lib/lumberg/cpanel/domain_keys.rb +4 -4
- data/lib/lumberg/cpanel/domain_lookup.rb +4 -4
- data/lib/lumberg/cpanel/email.rb +40 -40
- data/lib/lumberg/cpanel/file_manager.rb +5 -5
- data/lib/lumberg/cpanel/ftp.rb +101 -0
- data/lib/lumberg/cpanel/gpg.rb +4 -4
- data/lib/lumberg/cpanel/locale.rb +1 -1
- data/lib/lumberg/cpanel/mime.rb +2 -2
- data/lib/lumberg/cpanel/mysql.rb +6 -6
- data/lib/lumberg/cpanel/net.rb +2 -2
- data/lib/lumberg/cpanel/park.rb +4 -4
- data/lib/lumberg/cpanel/password.rb +2 -2
- data/lib/lumberg/cpanel/password_strength.rb +63 -0
- data/lib/lumberg/cpanel/random_data.rb +1 -1
- data/lib/lumberg/cpanel/redirect.rb +2 -2
- data/lib/lumberg/cpanel/ssl.rb +23 -23
- data/lib/lumberg/cpanel/sub_domain.rb +4 -4
- data/lib/lumberg/cpanel/support.rb +2 -2
- data/lib/lumberg/cpanel/zone_edit.rb +8 -8
- data/lib/lumberg/format_whm.rb +7 -7
- data/lib/lumberg/version.rb +1 -1
- data/lib/lumberg/whm/account.rb +5 -5
- data/lib/lumberg/whm/cert.rb +1 -1
- data/lib/lumberg/whm/dns.rb +6 -6
- data/lib/lumberg/whm/reseller.rb +5 -5
- data/lib/lumberg/whm/server.rb +26 -26
- data/spec/cpanel/addon_domain_spec.rb +13 -13
- data/spec/cpanel/backups_spec.rb +3 -3
- data/spec/cpanel/base_spec.rb +19 -19
- data/spec/cpanel/box_trapper_spec.rb +3 -3
- data/spec/cpanel/branding_spec.rb +3 -3
- data/spec/cpanel/contact_spec.rb +6 -6
- data/spec/cpanel/cron_spec.rb +51 -51
- data/spec/cpanel/dns_lookup_spec.rb +4 -4
- data/spec/cpanel/domain_keys_spec.rb +3 -3
- data/spec/cpanel/domain_lookup_spec.rb +5 -5
- data/spec/cpanel/email_spec.rb +116 -116
- data/spec/cpanel/file_manager_spec.rb +11 -11
- data/spec/cpanel/ftp_spec.rb +71 -0
- data/spec/cpanel/gpg_spec.rb +3 -3
- data/spec/cpanel/locale_spec.rb +3 -3
- data/spec/cpanel/net_spec.rb +4 -4
- data/spec/cpanel/park_spec.rb +7 -7
- data/spec/cpanel/password_spec.rb +5 -5
- data/spec/cpanel/password_strength_spec.rb +50 -0
- data/spec/cpanel/random_data_spec.rb +4 -4
- data/spec/cpanel/ssl_spec.rb +27 -27
- data/spec/cpanel/sub_domain_spec.rb +8 -8
- data/spec/cpanel/support_spec.rb +4 -4
- data/spec/spec_helper.rb +1 -1
- data/spec/vcr_cassettes/cpanel/ftp/addftp.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/delftp.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/listftp.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/listftpsessions.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/listftpwithdisk.yml +95 -0
- data/spec/vcr_cassettes/cpanel/ftp/passwd.yml +43 -0
- data/spec/vcr_cassettes/cpanel/ftp/setquota.yml +43 -0
- data/spec/vcr_cassettes/cpanel/password_strength/all_required_strengths.yml +43 -0
- data/spec/vcr_cassettes/cpanel/password_strength/required_strength.yml +43 -0
- data/spec/vcr_cassettes/cpanel/password_strength/strength.yml +83 -0
- data/spec/whm/account_spec.rb +69 -69
- data/spec/whm/base_spec.rb +3 -3
- data/spec/whm/cert_spec.rb +24 -24
- data/spec/whm/dns_spec.rb +36 -36
- data/spec/whm/reseller_spec.rb +36 -36
- data/spec/whm/server_spec.rb +22 -22
- data/spec/whm/whm_spec.rb +8 -8
- metadata +29 -2
data/lib/lumberg/cpanel/gpg.rb
CHANGED
@@ -6,7 +6,7 @@ module Lumberg
|
|
6
6
|
#
|
7
7
|
# Returns Hash API response
|
8
8
|
def list
|
9
|
-
perform_request({ :
|
9
|
+
perform_request({ api_function: 'listgpgkeys' })
|
10
10
|
end
|
11
11
|
|
12
12
|
# Public: Count the number of public GPG keys installed for a user. You
|
@@ -14,21 +14,21 @@ module Lumberg
|
|
14
14
|
#
|
15
15
|
# Returns Hash API response
|
16
16
|
def count
|
17
|
-
perform_request({ :
|
17
|
+
perform_request({ api_function: 'number_of_public_keys' })
|
18
18
|
end
|
19
19
|
|
20
20
|
# Public: List GPG private (secret) keys associated with a user
|
21
21
|
#
|
22
22
|
# Returns Hash API response
|
23
23
|
def list_private
|
24
|
-
perform_request({ :
|
24
|
+
perform_request({ api_function: 'listsecretgpgkeys' })
|
25
25
|
end
|
26
26
|
|
27
27
|
# Public: Count the number of private GPG keys installed for a user
|
28
28
|
#
|
29
29
|
# Returns Hash API response
|
30
30
|
def count_private
|
31
|
-
perform_request({ :
|
31
|
+
perform_request({ api_function: 'number_of_private_keys' })
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
data/lib/lumberg/cpanel/mime.rb
CHANGED
@@ -12,7 +12,7 @@ module Lumberg
|
|
12
12
|
#
|
13
13
|
# Returns Hash API response
|
14
14
|
def list(options = {})
|
15
|
-
perform_request({ :
|
15
|
+
perform_request({ api_function: 'listmime' }.merge(options))
|
16
16
|
end
|
17
17
|
|
18
18
|
# Public: List handlers associated with Apache
|
@@ -25,7 +25,7 @@ module Lumberg
|
|
25
25
|
#
|
26
26
|
# Returns Hash API response
|
27
27
|
def handlers(options = {})
|
28
|
-
perform_request({ :
|
28
|
+
perform_request({ api_function: 'listhandlers' }.merge(options))
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
data/lib/lumberg/cpanel/mysql.rb
CHANGED
@@ -11,28 +11,28 @@ module Lumberg
|
|
11
11
|
#
|
12
12
|
# Returns Hash API response
|
13
13
|
def list(options = {})
|
14
|
-
perform_request({ :
|
14
|
+
perform_request({ api_function: 'listdbs' }.merge(options))
|
15
15
|
end
|
16
16
|
|
17
17
|
# Public: List all of the MySQL users available to a cPanel account
|
18
18
|
#
|
19
19
|
# Returns Hash API response
|
20
20
|
def accounts
|
21
|
-
perform_request({ :
|
21
|
+
perform_request({ api_function: 'listusers' })
|
22
22
|
end
|
23
23
|
|
24
24
|
# Public: Retrieve a list of remote MySQL connection hosts
|
25
25
|
#
|
26
26
|
# Returns Hash API response
|
27
27
|
def remote_hosts
|
28
|
-
perform_request({ :
|
28
|
+
perform_request({ api_function: 'listhosts' })
|
29
29
|
end
|
30
30
|
|
31
31
|
# Public: Retrieve a list of existing database backups
|
32
32
|
#
|
33
33
|
# Returns Hash API response
|
34
34
|
def backups
|
35
|
-
perform_request({ :
|
35
|
+
perform_request({ api_function: 'listdbsbackup' })
|
36
36
|
end
|
37
37
|
|
38
38
|
# Public: List users who can access a particular database
|
@@ -44,7 +44,7 @@ module Lumberg
|
|
44
44
|
#
|
45
45
|
# Returns Hash API response
|
46
46
|
def usernames_for_db(options = {})
|
47
|
-
perform_request({ :
|
47
|
+
perform_request({ api_function: 'listusersindb' })
|
48
48
|
end
|
49
49
|
|
50
50
|
# Public: Retrieve a list of permissions that correspond to a specific
|
@@ -57,7 +57,7 @@ module Lumberg
|
|
57
57
|
#
|
58
58
|
# Returns Hash API response
|
59
59
|
def permissions(options = {})
|
60
|
-
perform_request({ :
|
60
|
+
perform_request({ api_function: 'userdbprivs' }.merge(options))
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
data/lib/lumberg/cpanel/net.rb
CHANGED
@@ -7,7 +7,7 @@ module Lumberg
|
|
7
7
|
#
|
8
8
|
# Returns Hash API response
|
9
9
|
def traceroute
|
10
|
-
perform_request({ :
|
10
|
+
perform_request({ api_function: 'traceroute' })
|
11
11
|
end
|
12
12
|
|
13
13
|
# Public: Performs an A record DNS query for the hostname presented via
|
@@ -20,7 +20,7 @@ module Lumberg
|
|
20
20
|
#
|
21
21
|
# Returns Hash API response
|
22
22
|
def query_hostname(options = {})
|
23
|
-
perform_request({ :
|
23
|
+
perform_request({ api_function: 'dnszone' }.merge(options))
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
data/lib/lumberg/cpanel/park.rb
CHANGED
@@ -11,7 +11,7 @@ module Lumberg
|
|
11
11
|
# Returns Hash API response.
|
12
12
|
def add(options = {})
|
13
13
|
perform_request({
|
14
|
-
:
|
14
|
+
api_function: "park"
|
15
15
|
}.merge(options))
|
16
16
|
end
|
17
17
|
|
@@ -23,7 +23,7 @@ module Lumberg
|
|
23
23
|
# Returns Hash API response.
|
24
24
|
def remove(options = {})
|
25
25
|
perform_request({
|
26
|
-
:
|
26
|
+
api_function: "unpark"
|
27
27
|
}.merge(options))
|
28
28
|
end
|
29
29
|
|
@@ -36,7 +36,7 @@ module Lumberg
|
|
36
36
|
# Returns Hash API response.
|
37
37
|
def list(options = {})
|
38
38
|
perform_request({
|
39
|
-
:
|
39
|
+
api_function: "listparkeddomains"
|
40
40
|
}.merge(options))
|
41
41
|
end
|
42
42
|
|
@@ -49,7 +49,7 @@ module Lumberg
|
|
49
49
|
# Returns Hash API response.
|
50
50
|
def list_addon_domains(options = {})
|
51
51
|
perform_request({
|
52
|
-
:
|
52
|
+
api_function: "listaddondomains"
|
53
53
|
}.merge(options))
|
54
54
|
end
|
55
55
|
|
@@ -19,7 +19,7 @@ module Lumberg
|
|
19
19
|
#
|
20
20
|
# Returns Hash API response.
|
21
21
|
def modify(options = {})
|
22
|
-
perform_request({ :
|
22
|
+
perform_request({ api_function: 'change_password' }.merge(options))
|
23
23
|
end
|
24
24
|
|
25
25
|
# Public: Enables or disables Digest Authentication for an account.
|
@@ -44,7 +44,7 @@ module Lumberg
|
|
44
44
|
# Returns Hash API response.
|
45
45
|
def digest_authentication(options = {})
|
46
46
|
options[:enabledigest] = options.delete([:enable]) ? 1 : 0
|
47
|
-
perform_request({ :
|
47
|
+
perform_request({ api_function: 'set_digest_auth' }.merge(options))
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Lumberg
|
2
|
+
module Cpanel
|
3
|
+
# Public: This module provides access to cPanel's password scoring system.
|
4
|
+
class PasswordStrength < Base
|
5
|
+
def self.api_module; "PasswdStrength"; end
|
6
|
+
|
7
|
+
# Public: Retrieve the strength of a specified password. This API call
|
8
|
+
# is only available in cPanel & WHM 11.32.
|
9
|
+
#
|
10
|
+
# options - Hash options for API call params (default: {})
|
11
|
+
# :password - String password to test strength
|
12
|
+
#
|
13
|
+
# Examples
|
14
|
+
# api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
|
15
|
+
# passwd_strength = Lumberg::Cpanel::PasswordStrength.new(api_args.dup)
|
16
|
+
#
|
17
|
+
# passwd_strength.strength(password: "weakpass")
|
18
|
+
#
|
19
|
+
# Returns Hash API response.
|
20
|
+
def strength(options = {})
|
21
|
+
perform_request(options.merge(api_function: 'get_password_strength'))
|
22
|
+
end
|
23
|
+
|
24
|
+
# Public: Return the required password strength for a specific
|
25
|
+
# application.
|
26
|
+
#
|
27
|
+
# options - Hash options for API call params (default: {})
|
28
|
+
# :app - String The application corresponding to the password strength
|
29
|
+
# you would like to retrieve. Accepted values include 'htaccess',
|
30
|
+
# 'passwd', 'ftp', 'createacct', 'bandmin', 'cpaddons', 'pop',
|
31
|
+
# 'sshkey', 'postgres', 'webdisk', and 'mysql'.
|
32
|
+
#
|
33
|
+
# Examples
|
34
|
+
# api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
|
35
|
+
# password_strength = Lumberg::Cpanel::PasswordStrength.new(api_args.dup)
|
36
|
+
#
|
37
|
+
# password_strength.required_strength(app: 'htaccess')
|
38
|
+
#
|
39
|
+
# Returns Hash API response.
|
40
|
+
def required_strength(options = {})
|
41
|
+
perform_request(options.merge(api_function: 'get_required_strength'))
|
42
|
+
end
|
43
|
+
|
44
|
+
# Public: Return password strength settings set in WHM's 'Main >>
|
45
|
+
# Security Center >> Password Strength Configuration' section.
|
46
|
+
# If this requirement is in place, this function will return
|
47
|
+
# all password strength requirements on a per-application basis.
|
48
|
+
#
|
49
|
+
# options - Hash options for API call params (default: {})
|
50
|
+
#
|
51
|
+
# Examples
|
52
|
+
# api_args = { host: "x.x.x.x", hash: "pass", api_username: "user" }
|
53
|
+
# password_strength = Lumberg::Cpanel::PasswordStrength.new(api_args.dup)
|
54
|
+
#
|
55
|
+
# password_strength.all_required_strengths
|
56
|
+
#
|
57
|
+
# Returns Hash API response.
|
58
|
+
def all_required_strengths(options = {})
|
59
|
+
perform_request(options.merge(api_function: 'appstrengths'))
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -14,7 +14,7 @@ module Lumberg
|
|
14
14
|
#
|
15
15
|
# Returns Hash API response
|
16
16
|
def list(options = {})
|
17
|
-
perform_request({ :
|
17
|
+
perform_request({ api_function: 'listredirects' }.merge(options))
|
18
18
|
end
|
19
19
|
|
20
20
|
# Public: This function returns either the domain name entered or '** All
|
@@ -35,7 +35,7 @@ module Lumberg
|
|
35
35
|
"#{self.class.name}##{__method__} cannot accept both `:url` and `:domain`"
|
36
36
|
end
|
37
37
|
function = options[:domain].present? ? 'redirectname' : 'redirecturlname'
|
38
|
-
perform_request({ :
|
38
|
+
perform_request({ api_function: function }.merge(options))
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
data/lib/lumberg/cpanel/ssl.rb
CHANGED
@@ -15,7 +15,7 @@ module Lumberg
|
|
15
15
|
# Returns Hash API response.
|
16
16
|
def installssl(options = {})
|
17
17
|
perform_request({
|
18
|
-
:
|
18
|
+
api_function: "installssl"
|
19
19
|
}.merge(options))
|
20
20
|
end
|
21
21
|
|
@@ -26,7 +26,7 @@ module Lumberg
|
|
26
26
|
# Returns Hash API response.
|
27
27
|
def listcsrs(options = {})
|
28
28
|
perform_request({
|
29
|
-
:
|
29
|
+
api_function: "listcsrs",
|
30
30
|
}.merge(options))
|
31
31
|
end
|
32
32
|
|
@@ -39,10 +39,10 @@ module Lumberg
|
|
39
39
|
# Returns Hash API response.
|
40
40
|
def showcsr(options = {})
|
41
41
|
perform_request({
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
42
|
+
api_function: "showcsr",
|
43
|
+
api_version: 1,
|
44
|
+
user: options[:user],
|
45
|
+
response_key: "data",
|
46
46
|
"arg-0" => options[:domain],
|
47
47
|
"arg-1" => options[:textmode]
|
48
48
|
})
|
@@ -57,10 +57,10 @@ module Lumberg
|
|
57
57
|
# Returns Hash API response.
|
58
58
|
def showkey(options = {})
|
59
59
|
perform_request({
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
60
|
+
api_function: "showkey",
|
61
|
+
api_version: 1,
|
62
|
+
user: options[:user],
|
63
|
+
response_key: "data",
|
64
64
|
"arg-0" => options[:domain],
|
65
65
|
"arg-1" => options[:textmode]
|
66
66
|
})
|
@@ -73,10 +73,10 @@ module Lumberg
|
|
73
73
|
# Returns Hash API response.
|
74
74
|
def showcrt(options = {})
|
75
75
|
perform_request({
|
76
|
-
:
|
77
|
-
:
|
78
|
-
:
|
79
|
-
:
|
76
|
+
api_function: "showcrt",
|
77
|
+
api_version: 1,
|
78
|
+
user: options[:user],
|
79
|
+
response_key: "data",
|
80
80
|
"arg-0" => options[:domain],
|
81
81
|
"arg-1" => options[:textmode]
|
82
82
|
})
|
@@ -89,7 +89,7 @@ module Lumberg
|
|
89
89
|
# Returns Hash API response.
|
90
90
|
def listcrts(options = {})
|
91
91
|
perform_request({
|
92
|
-
:
|
92
|
+
api_function: "listcrts",
|
93
93
|
}.merge(options))
|
94
94
|
end
|
95
95
|
|
@@ -100,7 +100,7 @@ module Lumberg
|
|
100
100
|
# Returns Hash API response.
|
101
101
|
def listkeys(options = {})
|
102
102
|
perform_request({
|
103
|
-
:
|
103
|
+
api_function: "listkeys",
|
104
104
|
}.merge(options))
|
105
105
|
end
|
106
106
|
|
@@ -112,7 +112,7 @@ module Lumberg
|
|
112
112
|
# Returns Hash API response.
|
113
113
|
def fetchcabundle(options = {})
|
114
114
|
perform_request({
|
115
|
-
:
|
115
|
+
api_function: "fetchcabundle",
|
116
116
|
}.merge(options))
|
117
117
|
end
|
118
118
|
|
@@ -126,7 +126,7 @@ module Lumberg
|
|
126
126
|
# Returns Hash API response.
|
127
127
|
def listsslitems(options = {})
|
128
128
|
perform_request({
|
129
|
-
:
|
129
|
+
api_function: "listsslitems",
|
130
130
|
}.merge(options))
|
131
131
|
end
|
132
132
|
|
@@ -149,8 +149,8 @@ module Lumberg
|
|
149
149
|
options[:companydivision] = options.delete(:company_division)
|
150
150
|
|
151
151
|
perform_request({
|
152
|
-
:
|
153
|
-
:
|
152
|
+
api_function: "gencsr",
|
153
|
+
response_key: "cpanelresult",
|
154
154
|
}.merge(options))
|
155
155
|
end
|
156
156
|
|
@@ -172,7 +172,7 @@ module Lumberg
|
|
172
172
|
options[:companydivision] = options.delete(:company_division)
|
173
173
|
|
174
174
|
perform_request({
|
175
|
-
:
|
175
|
+
api_function: "gencrt",
|
176
176
|
}.merge(options))
|
177
177
|
end
|
178
178
|
|
@@ -186,7 +186,7 @@ module Lumberg
|
|
186
186
|
# Returns Hash API response.
|
187
187
|
def genkey(options = {})
|
188
188
|
perform_request({
|
189
|
-
:
|
189
|
+
api_function: "genkey",
|
190
190
|
}.merge(options))
|
191
191
|
end
|
192
192
|
|
@@ -198,7 +198,7 @@ module Lumberg
|
|
198
198
|
# Returns Hash API response.
|
199
199
|
def uploadcrt(options = {})
|
200
200
|
perform_request({
|
201
|
-
:
|
201
|
+
api_function: "uploadcrt",
|
202
202
|
}.merge(options))
|
203
203
|
end
|
204
204
|
end
|
@@ -15,7 +15,7 @@ module Lumberg
|
|
15
15
|
# Returns Hash API response.
|
16
16
|
def add(options = {})
|
17
17
|
perform_request({
|
18
|
-
:
|
18
|
+
api_function: "addsubdomain"
|
19
19
|
}.merge(options))
|
20
20
|
end
|
21
21
|
|
@@ -27,7 +27,7 @@ module Lumberg
|
|
27
27
|
# Returns Hash API response.
|
28
28
|
def remove(options = {})
|
29
29
|
perform_request({
|
30
|
-
:
|
30
|
+
api_function: "delsubdomain"
|
31
31
|
}.merge(options))
|
32
32
|
end
|
33
33
|
|
@@ -39,7 +39,7 @@ module Lumberg
|
|
39
39
|
# Returns Hash API response.
|
40
40
|
def list(options = {})
|
41
41
|
perform_request({
|
42
|
-
:
|
42
|
+
api_function: "listsubdomains"
|
43
43
|
}.merge(options))
|
44
44
|
end
|
45
45
|
|
@@ -53,7 +53,7 @@ module Lumberg
|
|
53
53
|
# Returns Hash API response
|
54
54
|
def modify(options = {})
|
55
55
|
perform_request({
|
56
|
-
:
|
56
|
+
api_function: "changedocroot"
|
57
57
|
}.merge(options))
|
58
58
|
end
|
59
59
|
end
|
@@ -13,7 +13,7 @@ module Lumberg
|
|
13
13
|
# Returns Hash API response.
|
14
14
|
def open_ticket(options = {})
|
15
15
|
perform_request({
|
16
|
-
:
|
16
|
+
api_function: "sendcontact"
|
17
17
|
}.merge(options))
|
18
18
|
end
|
19
19
|
|
@@ -22,7 +22,7 @@ module Lumberg
|
|
22
22
|
#
|
23
23
|
# Returns Hash API response
|
24
24
|
def contactable
|
25
|
-
perform_request({ :
|
25
|
+
perform_request({ api_function: "isenabled" })
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|