plesk_kit 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/models/plesk_kit/client.rb +91 -1
- data/app/models/plesk_kit/communicator.rb +6 -0
- data/app/models/plesk_kit/service_plan.rb +316 -1
- data/lib/plesk_kit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTkyZTEwYTU5OTA2NzU2MTZiODllZWZjOWYyNDdkYTE4ODRjODQ4Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWZlMTA0YWIwZTQzMmIxYzNkZWM0NTZkMzVhMTQwZDQxZmY5OGQ0ZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZGViMTU3MmExYmYzNTdkZWE0MzU3OTM4ZjkxZmI1NzNlNWM2OTU1ZGE2MDdl
|
10
|
+
ZDc2N2E0NGEzYjViMDgzMDk1NzhkODg3MmZlNGI1NjIyYmU5MTJkN2JjZWNk
|
11
|
+
ZjUxOGQ4NjVmYjQ5NWM0MjUzYzY3MWFlZDc1ODYwNTc2ZGViMGI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OWUwYmQ2MzAyMzBhNGNhZjc3Yzk5YWNjZTE5MDYwZjk0MjkzZTY1YmI0ZDlm
|
14
|
+
MTBmN2Y5Yjc5NzM0ZmY4MWQ0NjM3YTdlOTkyZDJmMmFjODFjMzk1MTBhYjEw
|
15
|
+
ZGI0YzAwMzk2MzJmMjg5ODQxMjM3ZDY2NmVlNGU0MDg3NGFiN2E=
|
@@ -22,4 +22,94 @@ module PleskKit
|
|
22
22
|
return res.body, xml
|
23
23
|
end
|
24
24
|
end
|
25
|
-
end
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
class Client
|
31
|
+
attr_accessor :host, :user, :pass, :timeout, :rpc_version, :xml_response, :xml_target
|
32
|
+
def initialize(host,user,pass)
|
33
|
+
@host, @user, @pass, @timeout = host, user, pass, 30
|
34
|
+
end
|
35
|
+
|
36
|
+
def send
|
37
|
+
http = Net::HTTP.new(@host)
|
38
|
+
puts http.inspect
|
39
|
+
http.use_ssl = true
|
40
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
41
|
+
@headers = {
|
42
|
+
'HTTP_AUTH_LOGIN' => @user,
|
43
|
+
'HTTP_AUTH_PASSWD' => @pass
|
44
|
+
}
|
45
|
+
puts @headers
|
46
|
+
path = "/REST/1.0/NoAuth/mail-gateway"
|
47
|
+
res, data = http.get(path, @headers)
|
48
|
+
puts res
|
49
|
+
return res
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
url = 'https://rt.ahq.net.au/REST/1.0/NoAuth/mail-gateway'
|
55
|
+
'https://rt.ahq.net.au/REST/1.0/NoAuth/mail-gateway'
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
class Client
|
61
|
+
attr_accessor :host, :user, :pass, :timeout, :rpc_version, :xml_response, :xml_target
|
62
|
+
def initialize(host,user,pass)
|
63
|
+
@host, @user, @pass, @timeout = host, user, pass, 30
|
64
|
+
end
|
65
|
+
|
66
|
+
def send(params)
|
67
|
+
http = Net::HTTP.new(@host)
|
68
|
+
puts http.inspect
|
69
|
+
http.use_ssl = true
|
70
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
71
|
+
@headers = {
|
72
|
+
'HTTP_AUTH_LOGIN' => @user,
|
73
|
+
'HTTP_AUTH_PASSWD' => @pass
|
74
|
+
}
|
75
|
+
puts @headers
|
76
|
+
path = "/REST/1.0/NoAuth/mail-gateway"
|
77
|
+
res, data = http.post2(path, params, @headers)
|
78
|
+
puts res
|
79
|
+
return res.body, params
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
// Set the headers and message
|
87
|
+
$msgtext = "From: $msgfrom <$msgemail>\n";
|
88
|
+
$msgtext .= "To: $msgto\n";
|
89
|
+
$msgtext .= "Content-Type: text/plain\n";
|
90
|
+
$msgtext .= "Content-Transfer-Encoding: 7bit\n";
|
91
|
+
$msgtext .= "Mime-Version: 1.0\n";
|
92
|
+
$msgtext .= "Subject: $msgsubject\n";
|
93
|
+
$msgtext .= "Date: ".date("D, d M Y H:i:s O")."\n";
|
94
|
+
$msgtext .= "\n";
|
95
|
+
$msgtext .= "$msgbody";
|
96
|
+
|
97
|
+
'SessionType'=>urlencode("REST"),
|
98
|
+
'action'=>urlencode("correspond"),
|
99
|
+
'queue'=>urlencode($queue),
|
100
|
+
'message'=>urlencode($msgtext)
|
101
|
+
|
102
|
+
msgtext = "From: $msgfrom <$msgemail>\nTo: $msgto\nContent-Type: text/plain\nContent-Transfer-Encoding: 7bit\nMime-Version: 1.0\nSubject: $msgsubject\nSubject: $msgsubject\nDate: ''\).\n\n"
|
103
|
+
|
104
|
+
strr="name=blah&subject=blah&body=foo&email=d.saunders@uber.com.au&SessionType=REST&action=correspond&queue=13&message=#{msgtext}"
|
105
|
+
|
106
|
+
|
107
|
+
<form method='POST',action='https://rt.ahq.net.au/REST/1.0/NoAuth/mail-gateway'>
|
108
|
+
<input name='name' value='x'>
|
109
|
+
<input name='subject' value='x'>
|
110
|
+
<input name='body' value='x'>
|
111
|
+
<input name='email' value='d.saunders@uber.com.au'>
|
112
|
+
<input name='queue' value='13'>
|
113
|
+
<input name='message' value='From: $msgfrom <$msgemail>\nTo: $msgto\nContent-Type: text/plain\nContent-Transfer-Encoding: 7bit\nMime-Version: 1.0\nSubject: $msgsubject\nSubject: $msgsubject\nDate: ''\).\n\n'>
|
114
|
+
|
115
|
+
|
@@ -43,6 +43,12 @@ module PleskKit
|
|
43
43
|
service_plan.analyse response[0], server
|
44
44
|
end
|
45
45
|
|
46
|
+
def self.push_windows_service_plan service_plan, server
|
47
|
+
packet = service_plan.build_windows_xml_for_add shell
|
48
|
+
response = transportation_for packet, server
|
49
|
+
service_plan.analyse response[0], server
|
50
|
+
end
|
51
|
+
|
46
52
|
def self.get_server_stats server
|
47
53
|
packet = server.pack_this shell
|
48
54
|
response = transportation_for(packet,server)
|
@@ -14,7 +14,11 @@ module PleskKit
|
|
14
14
|
puts response_string
|
15
15
|
if xml.root.elements['//get'].present?
|
16
16
|
if status == 'error'
|
17
|
-
|
17
|
+
if server.platform == 'linux'
|
18
|
+
PleskKit::Communicator.push_service_plan self, server
|
19
|
+
elsif server.platform == 'windows'
|
20
|
+
PleskKit::Communicator.push_windows_service_plan self, server
|
21
|
+
end
|
18
22
|
elsif status == 'ok'
|
19
23
|
return true
|
20
24
|
end
|
@@ -355,5 +359,316 @@ module PleskKit
|
|
355
359
|
end
|
356
360
|
|
357
361
|
|
362
|
+
|
363
|
+
|
364
|
+
def build_windows_xml_for_add shell
|
365
|
+
xml = shell
|
366
|
+
xml.instruct!
|
367
|
+
xml.packet(:version => '1.6.3.0') {
|
368
|
+
xml.send(:"service-plan") {
|
369
|
+
xml.add{
|
370
|
+
xml.name("#{self.name.to_s}")
|
371
|
+
xml.mail{
|
372
|
+
xml.webmail('horde')
|
373
|
+
}
|
374
|
+
xml.limits{
|
375
|
+
xml.overuse('block')
|
376
|
+
|
377
|
+
xml.limit{
|
378
|
+
xml.name('max_site')
|
379
|
+
xml.value("#{self.domains.to_s}")
|
380
|
+
}
|
381
|
+
xml.limit{
|
382
|
+
xml.name('max_subdom')
|
383
|
+
xml.value('-1')
|
384
|
+
}
|
385
|
+
xml.limit{
|
386
|
+
xml.name('max_dom_aliases')
|
387
|
+
xml.value('-1')
|
388
|
+
}
|
389
|
+
xml.limit{
|
390
|
+
xml.name('disk_space')
|
391
|
+
xml.value("#{self.storage}") #10gb
|
392
|
+
}
|
393
|
+
xml.limit{
|
394
|
+
xml.name('disk_space_soft')
|
395
|
+
xml.value('0')
|
396
|
+
}
|
397
|
+
xml.limit{
|
398
|
+
xml.name('max_traffic')
|
399
|
+
xml.value("#{self.traffic.to_s}") # unlimited
|
400
|
+
}
|
401
|
+
xml.limit{
|
402
|
+
xml.name('max_traffic_soft')
|
403
|
+
xml.value('0')
|
404
|
+
}
|
405
|
+
xml.limit{
|
406
|
+
xml.name('max_wu')
|
407
|
+
xml.value('-1')
|
408
|
+
}
|
409
|
+
xml.limit{
|
410
|
+
xml.name('max_subftp_users')
|
411
|
+
xml.value('-1')
|
412
|
+
}
|
413
|
+
xml.limit{
|
414
|
+
xml.name('max_db')
|
415
|
+
xml.value('10')
|
416
|
+
}
|
417
|
+
xml.limit{
|
418
|
+
xml.name('max_box')
|
419
|
+
xml.value("#{self.mailboxes.to_s}") # mailboxes
|
420
|
+
}
|
421
|
+
xml.limit{
|
422
|
+
xml.name('mbox_quota')
|
423
|
+
xml.value('1073741824')
|
424
|
+
}
|
425
|
+
xml.limit{
|
426
|
+
xml.name('max_maillists')
|
427
|
+
xml.value('100')
|
428
|
+
}
|
429
|
+
xml.limit{
|
430
|
+
xml.name('max_webapps')
|
431
|
+
xml.value('0')
|
432
|
+
}
|
433
|
+
xml.limit{
|
434
|
+
xml.name('max_site_builder')
|
435
|
+
xml.value('1')
|
436
|
+
}
|
437
|
+
xml.limit{
|
438
|
+
xml.name('max_unity_mobile_sites')
|
439
|
+
xml.value('0')
|
440
|
+
}
|
441
|
+
xml.limit{
|
442
|
+
xml.name('expiration')
|
443
|
+
xml.value('-1')
|
444
|
+
}
|
445
|
+
xml.limit{
|
446
|
+
xml.name('upsell_site_builder')
|
447
|
+
xml.value('0')
|
448
|
+
}
|
449
|
+
|
450
|
+
}
|
451
|
+
xml.send(:"log-rotation"){
|
452
|
+
xml.on{
|
453
|
+
xml.send(:"log-condition"){
|
454
|
+
xml.tag!("log-bysize", "10485760")
|
455
|
+
}
|
456
|
+
xml.tag!("log-max-num-files", "10")
|
457
|
+
xml.tag!("log-compress", "true")
|
458
|
+
}
|
459
|
+
}
|
460
|
+
xml.preferences{
|
461
|
+
xml.stat('3')
|
462
|
+
xml.maillists('false')
|
463
|
+
xml.dns_zone_type('master')
|
464
|
+
}
|
465
|
+
xml.hosting{
|
466
|
+
xml.property{
|
467
|
+
xml.name('ssl')
|
468
|
+
xml.value('false')
|
469
|
+
}
|
470
|
+
xml.property{
|
471
|
+
xml.name('fp')
|
472
|
+
xml.value('false')
|
473
|
+
}
|
474
|
+
xml.property{
|
475
|
+
xml.name('fp_ssl')
|
476
|
+
xml.value('false')
|
477
|
+
}
|
478
|
+
xml.property{
|
479
|
+
xml.name('fp_auth')
|
480
|
+
xml.value('false')
|
481
|
+
}
|
482
|
+
xml.property{
|
483
|
+
xml.name('webstat')
|
484
|
+
xml.value('awstats')
|
485
|
+
}
|
486
|
+
xml.property{
|
487
|
+
xml.name('webstat_protected')
|
488
|
+
xml.value('true')
|
489
|
+
}
|
490
|
+
xml.property{
|
491
|
+
xml.name('wu_script')
|
492
|
+
xml.value('true')
|
493
|
+
}
|
494
|
+
#xml.property{
|
495
|
+
# xml.name('shell')
|
496
|
+
# xml.value('/bin/false')
|
497
|
+
#}
|
498
|
+
xml.property{
|
499
|
+
xml.name('ftp_quota')
|
500
|
+
xml.value('-1')
|
501
|
+
}
|
502
|
+
xml.property{
|
503
|
+
xml.name('php_handler_type')
|
504
|
+
xml.value('fastcgi')
|
505
|
+
}
|
506
|
+
xml.property{
|
507
|
+
xml.name('asp')
|
508
|
+
xml.value('false')
|
509
|
+
}
|
510
|
+
xml.property{
|
511
|
+
xml.name('ssi')
|
512
|
+
xml.value('false')
|
513
|
+
}
|
514
|
+
xml.property{
|
515
|
+
xml.name('php')
|
516
|
+
xml.value('true')
|
517
|
+
}
|
518
|
+
xml.property{
|
519
|
+
xml.name('cgi')
|
520
|
+
xml.value('true')
|
521
|
+
}
|
522
|
+
xml.property{
|
523
|
+
xml.name('perl')
|
524
|
+
xml.value('true')
|
525
|
+
}
|
526
|
+
xml.property{
|
527
|
+
xml.name('python')
|
528
|
+
xml.value('true')
|
529
|
+
}
|
530
|
+
xml.property{
|
531
|
+
xml.name('fastcgi')
|
532
|
+
xml.value('true')
|
533
|
+
}
|
534
|
+
xml.property{
|
535
|
+
xml.name('miva')
|
536
|
+
xml.value('false')
|
537
|
+
}
|
538
|
+
xml.property{
|
539
|
+
xml.name('coldfusion')
|
540
|
+
xml.value('false')
|
541
|
+
}
|
542
|
+
}
|
543
|
+
xml.performance{
|
544
|
+
xml.bandwidth('-1')
|
545
|
+
xml.max_connections('-1')
|
546
|
+
}
|
547
|
+
xml.permissions{
|
548
|
+
xml.permission{
|
549
|
+
xml.name('create_domains')
|
550
|
+
xml.value('true')
|
551
|
+
}
|
552
|
+
xml.permission{
|
553
|
+
xml.name('manage_phosting')
|
554
|
+
xml.value('false')
|
555
|
+
}
|
556
|
+
xml.permission{
|
557
|
+
xml.name('manage_php_settings')
|
558
|
+
xml.value('false')
|
559
|
+
}
|
560
|
+
xml.permission{
|
561
|
+
xml.name('manage_sh_access')
|
562
|
+
xml.value('false')
|
563
|
+
}
|
564
|
+
xml.permission{
|
565
|
+
xml.name('manage_not_chroot_shell')
|
566
|
+
xml.value('false')
|
567
|
+
}
|
568
|
+
xml.permission{
|
569
|
+
xml.name('manage_quota')
|
570
|
+
xml.value('false')
|
571
|
+
}
|
572
|
+
xml.permission{
|
573
|
+
xml.name('manage_subdomains')
|
574
|
+
xml.value('true')
|
575
|
+
}
|
576
|
+
xml.permission{
|
577
|
+
xml.name('manage_domain_aliases')
|
578
|
+
xml.value('false')
|
579
|
+
}
|
580
|
+
xml.permission{
|
581
|
+
xml.name('manage_log')
|
582
|
+
xml.value('true')
|
583
|
+
}
|
584
|
+
xml.permission{
|
585
|
+
xml.name('manage_anonftp')
|
586
|
+
xml.value('false')
|
587
|
+
}
|
588
|
+
xml.permission{
|
589
|
+
xml.name('manage_subftp')
|
590
|
+
xml.value('true')
|
591
|
+
}
|
592
|
+
xml.permission{
|
593
|
+
xml.name('manage_crontab')
|
594
|
+
xml.value('false')
|
595
|
+
}
|
596
|
+
xml.permission{
|
597
|
+
xml.name('manage_dns')
|
598
|
+
xml.value('true')
|
599
|
+
}
|
600
|
+
xml.permission{
|
601
|
+
xml.name('manage_webapps')
|
602
|
+
xml.value('false')
|
603
|
+
}
|
604
|
+
xml.permission{
|
605
|
+
xml.name('manage_webstat')
|
606
|
+
xml.value('true')
|
607
|
+
}
|
608
|
+
xml.permission{
|
609
|
+
xml.name('manage_mail_settings')
|
610
|
+
xml.value('true')
|
611
|
+
}
|
612
|
+
xml.permission{
|
613
|
+
xml.name('manage_maillists')
|
614
|
+
xml.value('true')
|
615
|
+
}
|
616
|
+
xml.permission{
|
617
|
+
xml.name('manage_spamfilter')
|
618
|
+
xml.value('true')
|
619
|
+
}
|
620
|
+
xml.permission{
|
621
|
+
xml.name('manage_virusfilter')
|
622
|
+
xml.value('true')
|
623
|
+
}
|
624
|
+
xml.permission{
|
625
|
+
xml.name('allow_local_backups')
|
626
|
+
xml.value('true')
|
627
|
+
}
|
628
|
+
xml.permission{
|
629
|
+
xml.name('allow_ftp_backups')
|
630
|
+
xml.value('true')
|
631
|
+
}
|
632
|
+
xml.permission{
|
633
|
+
xml.name('manage_performance')
|
634
|
+
xml.value('false')
|
635
|
+
}
|
636
|
+
xml.permission{
|
637
|
+
xml.name('select_db_server')
|
638
|
+
xml.value('false')
|
639
|
+
}
|
640
|
+
xml.permission{
|
641
|
+
xml.name('access_appcatalog')
|
642
|
+
xml.value('true')
|
643
|
+
}
|
644
|
+
xml.permission{
|
645
|
+
xml.name('allow_insecure_sites')
|
646
|
+
xml.value('true')
|
647
|
+
}
|
648
|
+
xml.permission{
|
649
|
+
xml.name('manage_website_maintenance')
|
650
|
+
xml.value('true')
|
651
|
+
}
|
652
|
+
xml.permission{
|
653
|
+
xml.name('manage_protected_dirs')
|
654
|
+
xml.value('true')
|
655
|
+
}
|
656
|
+
xml.permission{
|
657
|
+
xml.name('access_service_users')
|
658
|
+
xml.value('true')
|
659
|
+
}
|
660
|
+
xml.permission{
|
661
|
+
xml.name('allow_license_stubs')
|
662
|
+
xml.value('false')
|
663
|
+
}
|
664
|
+
}
|
665
|
+
}
|
666
|
+
}
|
667
|
+
}
|
668
|
+
puts xml.target!
|
669
|
+
return xml.target!
|
670
|
+
end
|
671
|
+
|
672
|
+
|
358
673
|
end
|
359
674
|
end
|
data/lib/plesk_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plesk_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dionne Saunders
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|