vines-agent 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -9,6 +9,8 @@ Users may run commands as any unix account, to which they've been granted access
9
9
  on the system. While the agent runs as root, user commands run as less privileged
10
10
  accounts.
11
11
 
12
+ Additional documentation can be found at www.getvines.com.
13
+
12
14
  == Usage
13
15
 
14
16
  1. gem install vines-agent
@@ -17,9 +19,8 @@ accounts.
17
19
 
18
20
  == Dependencies
19
21
 
20
- * blather >= 0.5.4
22
+ * blather >= 0.5.8
21
23
  * eventmachine >= 0.12.10
22
- * nokogiri >= 1.4.4
23
24
  * ruby >= 1.9.2
24
25
 
25
26
  == Ubuntu setup
@@ -27,8 +28,7 @@ $ sudo apt-get install build-essential ruby1.9.1 ruby1.9.1-dev libxml2-dev libxs
27
28
 
28
29
  == Contact
29
30
 
30
- * David Graham <david@negativecode.com>
31
- * Chris Johnson <chris@negativecode.com>
31
+ * David Graham <david@negativecode.com>
32
32
 
33
33
  == License
34
34
 
data/Rakefile CHANGED
@@ -7,15 +7,14 @@ require_relative 'lib/vines/agent/version'
7
7
  spec = Gem::Specification.new do |s|
8
8
  s.name = "vines-agent"
9
9
  s.version = Vines::Agent::VERSION
10
- s.date = Time.now.strftime("%Y-%m-%d")
11
10
 
12
11
  s.summary = "An XMPP bot that runs shell commands on remote machines."
13
12
  s.description = "Vines Agent executes shell commands sent by users after
14
13
  authorizing them against an access control list, provided by the Vines Services
15
14
  component. Manage a server as easily as chatting with a friend."
16
15
 
17
- s.authors = ["David Graham", "Chris Johnson"]
18
- s.email = %w[david@negativecode.com chris@negativecode.com]
16
+ s.authors = ["David Graham"]
17
+ s.email = %w[david@negativecode.com]
19
18
  s.homepage = "http://www.getvines.com"
20
19
 
21
20
  s.files = FileList['[A-Z]*', '{bin,lib,conf}/**/*']
@@ -23,10 +22,10 @@ component. Manage a server as easily as chatting with a friend."
23
22
  s.executables = %w[vines-agent]
24
23
  s.require_path = "lib"
25
24
 
26
- s.add_dependency "blather", "~> 0.5.4"
27
- s.add_dependency "ohai", "~> 0.6.4"
25
+ s.add_dependency "blather", "~> 0.5.8"
26
+ s.add_dependency "ohai", "~> 0.6.8"
28
27
  s.add_dependency "session", "~> 3.1.0"
29
- s.add_dependency "slave", "~> 1.2.1"
28
+ s.add_dependency "slave", "~> 1.3.0"
30
29
  s.add_dependency "vines", "~> 0.3"
31
30
 
32
31
  s.add_development_dependency "minitest"
data/lib/vines/agent.rb CHANGED
@@ -14,6 +14,7 @@
14
14
 
15
15
  blather/client/client
16
16
 
17
+ vines/kit
17
18
  vines/log
18
19
  vines/daemon
19
20
 
@@ -37,19 +37,11 @@ module Vines
37
37
  File.open(config, 'w') do |f|
38
38
  replaced = text
39
39
  .gsub('wonderland.lit', domain.downcase)
40
- .gsub('secr3t', password)
40
+ .gsub('secr3t', Kit.auth_token)
41
41
  f.write(replaced)
42
42
  end
43
43
  end
44
-
45
- # Create a large, random password with which to authenticate the
46
- # agent bot's JID.
47
- def password
48
- hash = Digest::SHA512.new
49
- 1024.times { hash << rand.to_s }
50
- hash.hexdigest
51
- end
52
44
  end
53
45
  end
54
46
  end
55
- end
47
+ end
@@ -34,9 +34,13 @@ module Vines
34
34
  log.level = const
35
35
  end
36
36
 
37
- def domain(name, &block)
38
- raise 'multiple domains not allowed' if @domain
39
- @domain = Domain.new(name, &block)
37
+ def domain(name=nil, &block)
38
+ if name
39
+ raise 'multiple domains not allowed' if @domain
40
+ @domain = Domain.new(name, &block)
41
+ else
42
+ @domain
43
+ end
40
44
  end
41
45
 
42
46
  def start
@@ -46,6 +50,7 @@ module Vines
46
50
  class Domain
47
51
  def initialize(name, &block)
48
52
  @name, @password, @upstream = name, nil, []
53
+ @conf = File.expand_path('conf')
49
54
  instance_eval(&block) if block
50
55
  validate_domain(@name)
51
56
  raise "password required" unless @password && !@password.strip.empty?
@@ -56,8 +61,12 @@ module Vines
56
61
  end
57
62
  end
58
63
 
59
- def password(password)
60
- @password = password
64
+ def password(password=nil)
65
+ if password
66
+ @password = password
67
+ else
68
+ @password
69
+ end
61
70
  end
62
71
 
63
72
  def download(dir)
@@ -78,7 +87,8 @@ module Vines
78
87
  base = {
79
88
  password: @password,
80
89
  domain: @name,
81
- download: @download
90
+ download: @download,
91
+ conf: @conf
82
92
  }
83
93
  options = @upstream.map do |info|
84
94
  base.clone.tap do |opts|
@@ -13,14 +13,15 @@ module Vines
13
13
  SYSTEMS = 'http://getvines.com/protocol/systems'.freeze
14
14
 
15
15
  def initialize(options)
16
- domain, password, host, port, download =
17
- *options.values_at(:domain, :password, :host, :port, :download)
16
+ domain, password, host, port, download, conf =
17
+ *options.values_at(:domain, :password, :host, :port, :download, :conf)
18
18
 
19
+ certs = File.expand_path('certs', conf)
19
20
  @permissions, @services, @sessions, @component = {}, {}, {}, nil
20
21
  @ready = false
21
22
 
22
23
  jid = Blather::JID.new(fqdn, domain, 'vines')
23
- @stream = Blather::Client.setup(jid, password, host, port)
24
+ @stream = Blather::Client.setup(jid, password, host, port, certs)
24
25
 
25
26
  @stream.register_handler(:disconnected) do
26
27
  log.info("Stream disconnected, reconnecting . . .")
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Vines
4
4
  module Agent
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
data/test/config_test.rb CHANGED
@@ -43,6 +43,7 @@ class ConfigTest < MiniTest::Unit::TestCase
43
43
  end
44
44
  refute_nil config
45
45
  assert_same config, Vines::Agent::Config.instance
46
+ assert_equal 'secr3t', config.domain.password
46
47
  end
47
48
 
48
49
  def test_default_download_directory
metadata CHANGED
@@ -1,109 +1,105 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: vines-agent
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
4
5
  prerelease:
5
- version: 0.1.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - David Graham
9
- - Chris Johnson
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
-
14
- date: 2011-09-28 00:00:00 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
12
+ date: 2011-10-20 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
17
15
  name: blather
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70352868783740 !ruby/object:Gem::Requirement
20
17
  none: false
21
- requirements:
18
+ requirements:
22
19
  - - ~>
23
- - !ruby/object:Gem::Version
24
- version: 0.5.4
20
+ - !ruby/object:Gem::Version
21
+ version: 0.5.8
25
22
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: ohai
29
23
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70352868783740
25
+ - !ruby/object:Gem::Dependency
26
+ name: ohai
27
+ requirement: &70352868782180 !ruby/object:Gem::Requirement
31
28
  none: false
32
- requirements:
29
+ requirements:
33
30
  - - ~>
34
- - !ruby/object:Gem::Version
35
- version: 0.6.4
31
+ - !ruby/object:Gem::Version
32
+ version: 0.6.8
36
33
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: session
40
34
  prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70352868782180
36
+ - !ruby/object:Gem::Dependency
37
+ name: session
38
+ requirement: &70352868780480 !ruby/object:Gem::Requirement
42
39
  none: false
43
- requirements:
40
+ requirements:
44
41
  - - ~>
45
- - !ruby/object:Gem::Version
42
+ - !ruby/object:Gem::Version
46
43
  version: 3.1.0
47
44
  type: :runtime
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: slave
51
45
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70352868780480
47
+ - !ruby/object:Gem::Dependency
48
+ name: slave
49
+ requirement: &70352868778940 !ruby/object:Gem::Requirement
53
50
  none: false
54
- requirements:
51
+ requirements:
55
52
  - - ~>
56
- - !ruby/object:Gem::Version
57
- version: 1.2.1
53
+ - !ruby/object:Gem::Version
54
+ version: 1.3.0
58
55
  type: :runtime
59
- version_requirements: *id004
60
- - !ruby/object:Gem::Dependency
61
- name: vines
62
56
  prerelease: false
63
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70352868778940
58
+ - !ruby/object:Gem::Dependency
59
+ name: vines
60
+ requirement: &70352868777680 !ruby/object:Gem::Requirement
64
61
  none: false
65
- requirements:
62
+ requirements:
66
63
  - - ~>
67
- - !ruby/object:Gem::Version
68
- version: "0.3"
64
+ - !ruby/object:Gem::Version
65
+ version: '0.3'
69
66
  type: :runtime
70
- version_requirements: *id005
71
- - !ruby/object:Gem::Dependency
72
- name: minitest
73
67
  prerelease: false
74
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *70352868777680
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: &70352865325120 !ruby/object:Gem::Requirement
75
72
  none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- version: "0"
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
80
77
  type: :development
81
- version_requirements: *id006
82
- - !ruby/object:Gem::Dependency
83
- name: rake
84
78
  prerelease: false
85
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ version_requirements: *70352865325120
80
+ - !ruby/object:Gem::Dependency
81
+ name: rake
82
+ requirement: &70352865324580 !ruby/object:Gem::Requirement
86
83
  none: false
87
- requirements:
88
- - - ">="
89
- - !ruby/object:Gem::Version
90
- version: "0"
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
91
88
  type: :development
92
- version_requirements: *id007
93
- description: |-
94
- Vines Agent executes shell commands sent by users after
89
+ prerelease: false
90
+ version_requirements: *70352865324580
91
+ description: ! 'Vines Agent executes shell commands sent by users after
92
+
95
93
  authorizing them against an access control list, provided by the Vines Services
96
- component. Manage a server as easily as chatting with a friend.
97
- email:
94
+
95
+ component. Manage a server as easily as chatting with a friend.'
96
+ email:
98
97
  - david@negativecode.com
99
- - chris@negativecode.com
100
- executables:
98
+ executables:
101
99
  - vines-agent
102
100
  extensions: []
103
-
104
101
  extra_rdoc_files: []
105
-
106
- files:
102
+ files:
107
103
  - LICENSE
108
104
  - Rakefile
109
105
  - README
@@ -125,31 +121,28 @@ files:
125
121
  - test/rake_test_loader.rb
126
122
  homepage: http://www.getvines.com
127
123
  licenses: []
128
-
129
124
  post_install_message:
130
125
  rdoc_options: []
131
-
132
- require_paths:
126
+ require_paths:
133
127
  - lib
134
- required_ruby_version: !ruby/object:Gem::Requirement
128
+ required_ruby_version: !ruby/object:Gem::Requirement
135
129
  none: false
136
- requirements:
137
- - - ">="
138
- - !ruby/object:Gem::Version
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
139
133
  version: 1.9.2
140
- required_rubygems_version: !ruby/object:Gem::Requirement
134
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
135
  none: false
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: "0"
136
+ requirements:
137
+ - - ! '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
146
140
  requirements: []
147
-
148
141
  rubyforge_project:
149
142
  rubygems_version: 1.8.10
150
143
  signing_key:
151
144
  specification_version: 3
152
145
  summary: An XMPP bot that runs shell commands on remote machines.
153
- test_files:
146
+ test_files:
154
147
  - test/config_test.rb
155
148
  - test/rake_test_loader.rb