social_stream-presence 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -88,7 +88,7 @@
88
88
  %% You can define one or several, for example:
89
89
  %% {hosts, ["example.net", "example.com", "example.org"]}.
90
90
  %%
91
- {hosts, ["localhost"]}.
91
+ {hosts, ["example.com"]}.
92
92
 
93
93
  %%
94
94
  %% route_subdomains: Delegate subdomains to other XMPP servers.
@@ -115,8 +115,7 @@
115
115
  %% certificate, specify the full path to the
116
116
  %% file and uncomment this line:
117
117
  %%
118
- %%{certfile, "/path/to/ssl.pem"}, starttls,
119
- {certfile, "/etc/ejabberd/server.pem"}, starttls,
118
+ %%{certfile, "/path/to/your_ssl_certificate.pem"}, starttls,
120
119
 
121
120
  {access, c2s},
122
121
  {shaper, c2s_shaper},
@@ -235,13 +234,10 @@
235
234
  %% Exauth Response Timeout is a extauth module constant and its value is 60 seconds.
236
235
  %%
237
236
  {auth_method, external}.
238
- {extauth_program, "/home/aldo/ejabberd-2.1.8_scripts/authentication_script"}.
237
+ {extauth_program, "/scripts_path/authentication_script"}.
239
238
  {extauth_instances, 3}.
240
239
 
241
240
 
242
- %%{auth_method, external}.
243
- %%{extauth_program, "/home/aldo/ejabberd-2.1.8_scripts/authentication_script"}.
244
-
245
241
  %%
246
242
  %% Authentication using ODBC
247
243
  %% Remember to setup a database in the next section.
@@ -0,0 +1,32 @@
1
+ #Social Stream Presence: ejabberd config
2
+
3
+ #Ejabberd node server domain
4
+ server_domain=domain.example.com
5
+
6
+ #Scripts Path
7
+ scripts_path=/my_scripts_path
8
+
9
+ #Source path: uncomment to compile ejabberd social stream module
10
+ #source_path=/.../ejabberd_source/src
11
+
12
+ #It is also necessary to modify the file: /etc/ejabberd/ejabberd.cfg
13
+ #%%{auth_method, external}.
14
+ #%%{extauth_program, "scripts_path/authentication_script"}.
15
+
16
+ #API REST
17
+ auth_api=http://localhost/users/sign_in
18
+ set_connection_api=http://localhost/xmpp/setConnection
19
+ unset_connection_api=http://localhost/xmpp/unsetConnection
20
+ reset_connection_api=http://localhost/xmpp/resetConnection
21
+ synchronize_presence_api=http://localhost/xmpp/synchronizePresence
22
+ set_presence_api=http://localhost/xmpp/setPresence
23
+ unset_presence_api=http://localhost/xmpp/unsetPresence
24
+
25
+ #Social Stream Login
26
+ ss_login=social_stream-presence
27
+
28
+ #Social Stream PASSWORD
29
+ ss_password=password
30
+
31
+ #Ejabberd Server Password
32
+ ejabberd_password=password
@@ -87,7 +87,7 @@ loop do
87
87
 
88
88
  when "auth"
89
89
  $logger.info "#{Process.pid}: Authenticating #{data[0]}@#{data[1]}"
90
- $logger.info "#{Process.pid}: With password #{data[2]}"
90
+ #$logger.info "#{Process.pid}: With password #{data[2]}"
91
91
  #password = data[2]
92
92
 
93
93
  #Authorization condition for LOGIN
@@ -3,14 +3,12 @@
3
3
  echo "Starting Reset logs"
4
4
 
5
5
  rm /var/log/ejabberd/auth.log
6
- rm /var/log/ejabberd/auth_error.log
7
6
  rm /var/log/ejabberd/ejabberd.log
8
7
  rm /var/log/ejabberd/erlang.log
9
8
  rm /var/log/ejabberd/scripts.log
10
9
  rm /var/log/ejabberd/erl_crash_*
11
10
 
12
11
  touch /var/log/ejabberd/auth.log
13
- touch /var/log/ejabberd/auth_error.log
14
12
  touch /var/log/ejabberd/ejabberd.log
15
13
  touch /var/log/ejabberd/erlang.log
16
14
  touch /var/log/ejabberd/scripts.log
@@ -19,12 +19,15 @@ puts "############### Ejabberd Configuration ###############"
19
19
  puts "Config file for Social Stream Presence: /etc/ejabberd/ssconfig.cfg"
20
20
  puts "Scripts Path: #{getOption("scripts_path=")}"
21
21
  puts "mod_sspresence Path: #{getOption("source_path=")}"
22
+ puts "Server domain: #{getOption("server_domain=")}"
22
23
  puts "API REST URLs"
23
24
  puts "Authentication: #{getOption("auth_api=")}"
24
25
  puts "onRegisterConnection: #{getOption("set_connection_api=")}"
25
26
  puts "onRemoveConnection: #{getOption("unset_connection_api=")}"
26
27
  puts "onPresence: #{getOption("set_presence_api=")}"
27
28
  puts "onUnsetPresence: #{getOption("unset_presence_api=")}"
29
+ puts "ResetConnection: #{getOption("reset_connection_api=")}"
30
+ puts "SynchronizePresence: #{getOption("synchronize_presence_api=")}"
28
31
  puts "Social Stream Presence logs in var/log/ejabberd/"
29
32
  puts "######################################################"
30
33
  puts ""
@@ -121,8 +121,8 @@ def setBidireccionalBuddys(usernameA,usernameB,nickA,nickB)
121
121
  #addBuddyToRoster(username,buddy,buddyNick,buddyGroup,subscription_type)
122
122
  addBuddyToRoster(usernameA,usernameB,nickB,"SocialStream","both")
123
123
  addBuddyToRoster(usernameB,usernameA,nickA,"SocialStream","both")
124
- sendPresence(usernameA,"chat")
125
- sendPresence(usernameB,"chat")
124
+ #sendPresence(usernameA,"chat")
125
+ #sendPresence(usernameB,"chat")
126
126
  return "Done"
127
127
  end
128
128
 
@@ -13,8 +13,8 @@ start(Host, _Opts) ->
13
13
  ejabberd_hooks:add(set_presence_hook, Host, ?MODULE, on_presence, 50),
14
14
  ejabberd_hooks:add(unset_presence_hook, Host, ?MODULE, on_unset_presence, 50),
15
15
  ejabberd_hooks:add(user_send_packet, Host, ?MODULE, on_packet_send, 50),
16
- %Uncomment to reset connected users directly when module sspresence starts.
17
- %reset_connections(),
16
+ %Reset connected users when module sspresence starts.
17
+ reset_connections(),
18
18
  ok.
19
19
 
20
20
  stop(Host) ->
@@ -169,7 +169,11 @@ execute(Message) ->
169
169
  %frank-williamson@trapo adds demo@trapo to its roster with subscription from, in the group SocialStream with the name Nickname
170
170
  %%
171
171
  addItemToRoster(UserSlug,UserDomain,BuddySlug,BuddyDomain,ContactName,Group,Subscription_type) ->
172
- Command = lists:concat(["ejabberdctl add_rosteritem ", UserSlug , " ", UserDomain, " ", BuddySlug, " ", BuddyDomain , " \\'", ContactName , "\\' ", Group , " ", Subscription_type]),
172
+ %%Command = lists:concat(["ejabberdctl add_rosteritem ", UserSlug , " ", UserDomain, " ", BuddySlug, " ", BuddyDomain , " \\'", ContactName , "\\' ", Group , " ", Subscription_type]),
173
+ %%Command = lists:concat(["ejabberdctl add_rosteritem ", UserSlug , " ", UserDomain, " ", BuddySlug, " ", BuddyDomain , " \'", ContactName , "\' ", Group , " ", Subscription_type]),
174
+
175
+ [UserName|_R] = string:tokens(ContactName, " "),
176
+ Command = lists:concat(["ejabberdctl add_rosteritem ", UserSlug , " ", UserDomain, " ", BuddySlug, " ", BuddyDomain , " ", UserName , " ", Group , " ", Subscription_type]),
173
177
  os:cmd(Command),
174
178
  ?INFO_MSG("Execute command: ~p", [Command]),
175
179
  ok.
@@ -248,10 +252,10 @@ ok.
248
252
 
249
253
 
250
254
  %Reset all connections
251
- %reset_connections() ->
252
- % Reset_path = string:concat(getOptionValue("scripts_path="), "/reset_connection_script "),
253
- % os:cmd(Reset_path),
254
- %ok.
255
+ reset_connections() ->
256
+ Reset_path = string:concat(getOptionValue("scripts_path="), "/reset_connection_script "),
257
+ os:cmd(Reset_path),
258
+ ok.
255
259
 
256
260
 
257
261
 
@@ -4,11 +4,15 @@ SocialStream::Presence.setup do |config|
4
4
  #Configures Bosh Service Path
5
5
  #config.bosh_service = "http://xmpp-proxy/http-bind"
6
6
  #Configures Social Stream Rails App Password
7
- config.password = "DnVCB8G|R$VGmZ@2?5=CYS8z)NrL@LuQ&LTCUh^9B(DF4gC&sQpfbCMbaNKEdNrGYkT4L5zxM0wNWs5q3?ww(b&0d5fK87z^BmgJMMF2SKXT9pEk^UEcch!GX!Avf5GT9)j@FpHe)4RH)BK7J98u!sUmJHUN(Je6aBmn!FtZ4Ab5h8$|nsvUt3Jkq?21HOH$r0sDyJZZvGOCgFS2EKw@0wXsJRHYVRPBe&Eb!1X55e55bQ^h2AW&^R70TK0m)Fu8"
7
+ config.password = "password"
8
8
  #Configures XMPP Server Password
9
- config.xmpp_server_password = "G&s6GBnO)anw2Ene%K12Cb=0quj@uDmA"
10
- #Username of the the Social Stream Admin sid
9
+ config.xmpp_server_password = "password"
10
+ #Username of the Social Stream Admin sid
11
11
  config.social_stream_presence_username = "social_stream-presence"
12
+ #Scripts path, only to execute local ejabberd commands
13
+ config.scripts_path = "/scripts_path"
14
+ #Remote or local mode
15
+ config.remote_xmpp_server = false
12
16
  #False to disable Social Stream Presence
13
17
  #config.enable = false
14
18
  end
@@ -1,5 +1,5 @@
1
1
  module Socialstream
2
2
  module Presence
3
- VERSION = "0.0.9"
3
+ VERSION = "0.0.10"
4
4
  end
5
5
  end
@@ -3,6 +3,8 @@ require 'social_stream-base'
3
3
  module SocialStream
4
4
  module Presence
5
5
 
6
+ autoload :XmppServerComunication, 'social_stream/presence/xmpp_server_comunication'
7
+
6
8
  module Models
7
9
  autoload :BuddyManager, 'social_stream/presence/models/buddy_manager'
8
10
  end
@@ -11,9 +13,12 @@ module SocialStream
11
13
  mattr_accessor :bosh_service
12
14
  mattr_accessor :password
13
15
  mattr_accessor :xmpp_server_password
16
+ mattr_accessor :remote_xmpp_server
17
+ mattr_accessor :scripts_path
14
18
  mattr_accessor :social_stream_presence_username
15
19
  mattr_accessor :enable
16
20
  @@enable = true
21
+ @@remote_xmpp_server = false
17
22
 
18
23
  class << self
19
24
  def setup
@@ -50,49 +50,79 @@ namespace :presence do
50
50
  task :rosters => :environment do
51
51
  puts "Starting presence:synchronize:rosters"
52
52
 
53
- #XMPP DOMAIN
54
- domain = SocialStream::Presence.domain
55
- #PASSWORD
56
- password= SocialStream::Presence.password
57
- #SS Username
58
- ss_name = SocialStream::Presence.social_stream_presence_username
59
- ss_sid = ss_name + "@" + domain
53
+
54
+ if SocialStream::Presence.remote_xmpp_server
60
55
 
61
- puts "Connecting to Xmpp Server"
62
- client = Jabber::Client.new(Jabber::JID.new(ss_sid))
63
- client.connect
64
- puts "Authentication..."
65
- client.auth(password)
66
- puts "Connected to Xmpp Server"
56
+ #XMPP DOMAIN
57
+ domain = SocialStream::Presence.domain
58
+ #PASSWORD
59
+ password= SocialStream::Presence.password
60
+ #SS Username
61
+ ss_name = SocialStream::Presence.social_stream_presence_username
62
+ ss_sid = ss_name + "@" + domain
63
+
64
+ puts "Connecting to Xmpp Server"
65
+ client = Jabber::Client.new(Jabber::JID.new(ss_sid))
66
+ client.connect
67
+ puts "Authentication..."
68
+ client.auth(password)
69
+ puts "Connected to Xmpp Server"
70
+
71
+ puts "Remove all rosters"
72
+ msg = Jabber::Message::new(ss_sid, "SynchronizeRosters")
73
+ msg.type=:chat
74
+ client.send(msg)
75
+
76
+
77
+ puts "Populate rosters"
78
+ users = User.all
79
+ checkedUsers = []
67
80
 
68
- puts "Remove all rosters"
69
- msg = Jabber::Message::new(ss_sid, "SynchronizeRosters")
70
- msg.type=:chat
71
- client.send(msg)
81
+ users.each do |user|
82
+ checkedUsers << user.slug
83
+ contacts = user.contact_actors(:type=>:user)
84
+ contacts.each do |contact|
85
+ unless checkedUsers.include?(contact.slug)
86
+ user_sid = user.slug + "@" + domain
87
+ buddy_sid = contact.slug + "@" + domain
88
+ msg = Jabber::Message::new(ss_sid, "SetRosterForBidirectionalTie&" + user_sid + "&" + buddy_sid + "&" + user.name + "&" + contact.name)
89
+ msg.type=:chat
90
+ client.send(msg)
91
+ end
92
+ end
93
+ end
94
+
95
+ puts "Synchronization complete"
96
+ puts "Closing connection"
97
+ client.close()
98
+ puts "Connection closing"
72
99
 
73
-
74
- puts "Populate rosters"
75
- users = User.all
76
- checkedUsers = []
77
-
78
- users.each do |user|
79
- checkedUsers << user.slug
80
- contacts = user.contact_actors(:type=>:user)
81
- contacts.each do |contact|
82
- unless checkedUsers.include?(contact.slug)
83
- user_sid = user.slug + "@" + domain
84
- buddy_sid = contact.slug + "@" + domain
85
- msg = Jabber::Message::new(ss_sid, "SetRosterForBidirectionalTie&" + user_sid + "&" + buddy_sid + "&" + user.name + "&" + contact.name)
86
- msg.type=:chat
87
- client.send(msg)
100
+ else
101
+ #SocialStream::Presence.remote_xmpp_server=false
102
+
103
+ puts "Removing all rosters"
104
+ system SocialStream::Presence.scripts_path + "/emanagement removeAllRosters"
105
+ puts "Rosters removed"
106
+
107
+ puts "Populate rosters"
108
+ users = User.all
109
+ checkedUsers = []
110
+
111
+ users.each do |user|
112
+ checkedUsers << user.slug
113
+ contacts = user.contact_actors(:type=>:user)
114
+ contacts.each do |contact|
115
+ unless checkedUsers.include?(contact.slug)
116
+ user_nick = user.name.split(" ")[0]
117
+ buddy_nick = contact.name.split(" ")[0]
118
+ command = SocialStream::Presence.scripts_path + "/emanagement setBidireccionalBuddys " + user.slug + " " + contact.slug + " " + user_nick + " " + buddy_nick
119
+ puts command
120
+ system command
121
+ end
88
122
  end
89
123
  end
90
- end
91
-
92
- puts "Synchronization complete"
93
- puts "Closing connection"
94
- client.close()
95
- puts "Connection closing"
124
+
125
+ end
96
126
 
97
127
  end
98
128
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: social_stream-presence
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 9
9
- version: 0.0.9
4
+ prerelease:
5
+ version: 0.0.10
10
6
  platform: ruby
11
7
  authors:
12
8
  - Aldo Gordillo
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-10-24 00:00:00 +02:00
13
+ date: 2011-10-25 00:00:00 +02:00
18
14
  default_executable:
19
15
  dependencies:
20
16
  - !ruby/object:Gem::Dependency
@@ -25,10 +21,6 @@ dependencies:
25
21
  requirements:
26
22
  - - ~>
27
23
  - !ruby/object:Gem::Version
28
- segments:
29
- - 0
30
- - 9
31
- - 18
32
24
  version: 0.9.18
33
25
  type: :runtime
34
26
  version_requirements: *id001
@@ -40,8 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- segments:
44
- - 0
45
35
  version: "0"
46
36
  type: :runtime
47
37
  version_requirements: *id002
@@ -53,8 +43,6 @@ dependencies:
53
43
  requirements:
54
44
  - - ">="
55
45
  - !ruby/object:Gem::Version
56
- segments:
57
- - 0
58
46
  version: "0"
59
47
  type: :development
60
48
  version_requirements: *id003
@@ -101,23 +89,20 @@ files:
101
89
  - config/routes.rb
102
90
  - db/migrate/20110711111408_add_connected_column_to_user.rb
103
91
  - db/migrate/20110928135031_add_status_column_to_user.rb
104
- - ejabberd/conf/ejabberd.cfg
105
- - ejabberd/conf/ejabberdctl.cfg
106
- - ejabberd/conf/inetrc
107
- - ejabberd/conf/ssconfig.cfg
92
+ - ejabberd/conf/ejabberd_example.cfg
93
+ - ejabberd/conf/ssconfig_example.cfg
108
94
  - ejabberd/ejabberd_scripts/authentication_script
109
- - ejabberd/ejabberd_scripts/authentication_script_org
110
- - ejabberd/ejabberd_scripts/compile_module
95
+ - ejabberd/ejabberd_scripts/development_scripts/compile_module
96
+ - ejabberd/ejabberd_scripts/development_scripts/generate_random_password
97
+ - ejabberd/ejabberd_scripts/development_scripts/kill_authentication_script.sh
98
+ - ejabberd/ejabberd_scripts/development_scripts/reset_logs.sh
99
+ - ejabberd/ejabberd_scripts/development_scripts/show_config.sh
100
+ - ejabberd/ejabberd_scripts/development_scripts/start_ejabberd.sh
101
+ - ejabberd/ejabberd_scripts/development_scripts/stop_ejabberd.sh
111
102
  - ejabberd/ejabberd_scripts/emanagement
112
- - ejabberd/ejabberd_scripts/generate_random_password
113
- - ejabberd/ejabberd_scripts/kill_authentication_script.sh
114
103
  - ejabberd/ejabberd_scripts/reset_connection_script
115
- - ejabberd/ejabberd_scripts/reset_logs.sh
116
104
  - ejabberd/ejabberd_scripts/set_connection_script
117
105
  - ejabberd/ejabberd_scripts/set_presence_script
118
- - ejabberd/ejabberd_scripts/show_config.sh
119
- - ejabberd/ejabberd_scripts/start_ejabberd.sh
120
- - ejabberd/ejabberd_scripts/stop_ejabberd.sh
121
106
  - ejabberd/ejabberd_scripts/synchronize_presence_script
122
107
  - ejabberd/ejabberd_scripts/unset_connection_script
123
108
  - ejabberd/mod_admin_extra/mod_admin_extra.beam
@@ -198,21 +183,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
198
183
  requirements:
199
184
  - - ">="
200
185
  - !ruby/object:Gem::Version
201
- segments:
202
- - 0
203
186
  version: "0"
204
187
  required_rubygems_version: !ruby/object:Gem::Requirement
205
188
  none: false
206
189
  requirements:
207
190
  - - ">="
208
191
  - !ruby/object:Gem::Version
209
- segments:
210
- - 0
211
192
  version: "0"
212
193
  requirements: []
213
194
 
214
195
  rubyforge_project: social_stream-presence
215
- rubygems_version: 1.3.7
196
+ rubygems_version: 1.6.1
216
197
  signing_key:
217
198
  specification_version: 3
218
199
  summary: Presence capabilities for Social Stream, the core for building social network websites
@@ -1,154 +0,0 @@
1
- #
2
- # In this file you can configure options that are passed by ejabberdctl
3
- # to the erlang runtime system when starting ejabberd
4
- #
5
-
6
- #' POLL: Kernel polling ([true|false])
7
- #
8
- # The kernel polling option requires support in the kernel.
9
- # Additionally, you need to enable this feature while compiling Erlang.
10
- #
11
- # Default: true
12
- #
13
- #POLL=true
14
-
15
- #.
16
- #' SMP: SMP support ([enable|auto|disable])
17
- #
18
- # Explanation in Erlang/OTP documentation:
19
- # enable: starts the Erlang runtime system with SMP support enabled.
20
- # This may fail if no runtime system with SMP support is available.
21
- # auto: starts the Erlang runtime system with SMP support enabled if it
22
- # is available and more than one logical processor are detected.
23
- # disable: starts a runtime system without SMP support.
24
- #
25
- # Default: auto
26
- #
27
- #SMP=auto
28
-
29
- #.
30
- #' ERL_MAX_PORTS: Maximum number of simultaneously open Erlang ports
31
- #
32
- # ejabberd consumes two or three ports for every connection, either
33
- # from a client or from another Jabber server. So take this into
34
- # account when setting this limit.
35
- #
36
- # Default: 32000
37
- # Maximum: 268435456
38
- #
39
- #ERL_MAX_PORTS=32000
40
-
41
- #.
42
- #' FIREWALL_WINDOW: Range of allowed ports to pass through a firewall
43
- #
44
- # If Ejabberd is configured to run in cluster, and a firewall is blocking ports,
45
- # it's possible to make Erlang use a defined range of port (instead of dynamic
46
- # ports) for node communication.
47
- #
48
- # Default: not defined
49
- # Example: 4200-4210
50
- #
51
- #FIREWALL_WINDOW=
52
-
53
- #.
54
- #' INET_DIST_INTERFACE: IP address where this Erlang node listens other nodes
55
- #
56
- # This communication is used by ejabberdctl command line tool,
57
- # and in a cluster of several ejabberd nodes.
58
- # Notice that the IP address must be specified in the Erlang syntax.
59
- #
60
- # Default: {127,0,0,1}
61
- #
62
- INET_DIST_INTERFACE={127,0,0,1}
63
-
64
- #.
65
- #' ERL_EPMD_ADDRESS: IP addresses where epmd listens for connections
66
- #
67
- # IMPORTANT: This option works only in Erlang/OTP R14B03 and newer.
68
- #
69
- # This environment variable may be set to a comma-separated
70
- # list of IP addresses, in which case the epmd daemon
71
- # will listen only on the specified address(es) and on the
72
- # loopback address (which is implicitly added to the list if it
73
- # has not been specified). The default behaviour is to listen on
74
- # all available IP addresses.
75
- #
76
- # Default: 0.0.0.0
77
- #
78
- #ERL_EPMD_ADDRESS=127.0.0.1
79
-
80
- #.
81
- #' ERL_PROCESSES: Maximum number of Erlang processes
82
- #
83
- # Erlang consumes a lot of lightweight processes. If there is a lot of activity
84
- # on ejabberd so that the maximum number of processes is reached, people will
85
- # experience greater latency times. As these processes are implemented in
86
- # Erlang, and therefore not related to the operating system processes, you do
87
- # not have to worry about allowing a huge number of them.
88
- #
89
- # Default: 250000
90
- # Maximum: 268435456
91
- #
92
- #ERL_PROCESSES=250000
93
-
94
- #.
95
- #' ERL_MAX_ETS_TABLES: Maximum number of ETS and Mnesia tables
96
- #
97
- # The number of concurrent ETS and Mnesia tables is limited. When the limit is
98
- # reached, errors will appear in the logs:
99
- # ** Too many db tables **
100
- # You can safely increase this limit when starting ejabberd. It impacts memory
101
- # consumption but the difference will be quite small.
102
- #
103
- # Default: 1400
104
- #
105
- #ERL_MAX_ETS_TABLES=1400
106
-
107
- #.
108
- #' ERL_OPTIONS: Additional Erlang options
109
- #
110
- # The next variable allows to specify additional options passed to erlang while
111
- # starting ejabberd. Some useful options are -noshell, -detached, -heart. When
112
- # ejabberd is started from an init.d script options -noshell and -detached are
113
- # added implicitly. See erl(1) for more info.
114
- #
115
- # It might be useful to add "-pa /usr/local/lib/ejabberd/ebin" if you
116
- # want to add local modules in this path.
117
- #
118
- # Default: ""
119
- #
120
- #ERL_OPTIONS=""
121
-
122
- #.
123
- #' ERLANG_NODE: Erlang node name
124
- #
125
- # The next variable allows to explicitly specify erlang node for ejabberd
126
- # It can be given in different formats:
127
- # ERLANG_NODE=ejabberd
128
- # Lets erlang add hostname to the node (ejabberd uses short name in this case)
129
- # ERLANG_NODE=ejabberd@hostname
130
- # Erlang uses node name as is (so make sure that hostname is a real
131
- # machine hostname or you'll not be able to control ejabberd)
132
- # ERLANG_NODE=ejabberd@hostname.domainname
133
- # The same as previous, but erlang will use long hostname
134
- # (see erl (1) manual for details)
135
- #
136
- # Default: ejabberd
137
- #
138
- #ERLANG_NODE=ejabberd
139
-
140
- #.
141
- #' EJABBERD_PID_PATH: ejabberd PID file
142
- #
143
- # Indicate the full path to the ejabberd Process identifier (PID) file.
144
- # If this variable is defined, ejabberd writes the PID file when starts,
145
- # and deletes it when stops.
146
- # Remember to create the directory and grant write permission to ejabberd.
147
- #
148
- # Default: don't write PID file
149
- #
150
- #EJABBERD_PID_PATH=/var/run/ejabberd/ejabberd.pid
151
-
152
- #.
153
- #'
154
- # vim: foldmarker=#',#. foldmethod=marker:
data/ejabberd/conf/inetrc DELETED
@@ -1,3 +0,0 @@
1
- {lookup,["file","native"]}.
2
- {host,{127,0,0,1}, ["localhost","hostalias"]}.
3
- {file, resolv, "/etc/resolv.conf"}.
@@ -1,32 +0,0 @@
1
- #Social Stream Presence: ejabberd config
2
-
3
- #Ejabberd node server domain
4
- server_domain=localhost
5
-
6
- #Scripts Path
7
- scripts_path=/home/aldo/ejabberd-2.1.8_scripts
8
-
9
- #Source path: uncomment to compile ejabberd social stream module
10
- source_path=/home/aldo/ejabberd-2.1.8_source/src
11
-
12
- #It is also necessary to modify the file: /etc/ejabberd/ejabberd.cfg
13
- #%%{auth_method, external}.
14
- #%%{extauth_program, "scripts_path/authentication_script"}.
15
-
16
- #API REST
17
- auth_api=http://0.0.0.0:3000/users/sign_in
18
- set_connection_api=http://0.0.0.0:3000/xmpp/setConnection
19
- unset_connection_api=http://0.0.0.0:3000/xmpp/unsetConnection
20
- reset_connection_api=http://0.0.0.0:3000/xmpp/resetConnection
21
- synchronize_presence_api=http://0.0.0.0:3000/xmpp/synchronizePresence
22
- set_presence_api=http://0.0.0.0:3000/xmpp/setPresence
23
- unset_presence_api=http://0.0.0.0:3000/xmpp/unsetPresence
24
-
25
- #Social Stream Login
26
- ss_login=social_stream-presence
27
-
28
- #Social Stream PASSWORD
29
- ss_password=DnVCB8G|R$VGmZ@2?5=CYS8z)NrL@LuQ&LTCUh^9B(DF4gC&sQpfbCMbaNKEdNrGYkT4L5zxM0wNWs5q3?ww(b&0d5fK87z^BmgJMMF2SKXT9pEk^UEcch!GX!Avf5GT9)j@FpHe)4RH)BK7J98u!sUmJHUN(Je6aBmn!FtZ4Ab5h8$|nsvUt3Jkq?21HOH$r0sDyJZZvGOCgFS2EKw@0wXsJRHYVRPBe&Eb!1X55e55bQ^h2AW&^R70TK0m)Fu8
30
-
31
- #Ejabberd Server Password
32
- ejabberd_password=G&s6GBnO)anw2Ene%K12Cb=0quj@uDmA
@@ -1,114 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'logger'
4
- require 'rest_client'
5
-
6
- $stdout.sync = true
7
- $stdin.sync = true
8
-
9
- path = "/var/log/ejabberd/auth.log"
10
- file = File.open(path, File::WRONLY | File::APPEND | File::CREAT)
11
- file.sync = true
12
- $logger = Logger.new(file)
13
- $logger.level = Logger::DEBUG
14
-
15
- $logger.info "#{Process.pid}: Starting ejabberd authentication service"
16
-
17
-
18
- def getOption(option)
19
- File.open('/etc/ejabberd/ssconfig.cfg', 'r') do |f1|
20
- while line = f1.gets
21
- line = line.gsub(/\n/,'')
22
- if line.match(/^#/)
23
- #Comments
24
- elsif line.match(/^#{option}/)
25
- return line.gsub(/#{option}/,'')
26
- end
27
- end
28
- end
29
- return "Undefined"
30
- end
31
-
32
- $accessUrl = getOption("auth_api=")
33
- $sslogin = getOption("ss_login=")
34
- $sspass = getOption("ss_password=")
35
-
36
-
37
- def auth(username, password)
38
-
39
- #[TEST] Admin password
40
- if username == "admin" and password == "pass"
41
- return true
42
- end
43
-
44
- #Social Stream password
45
- if username == $sslogin and password == $sspass
46
- return true
47
- end
48
-
49
- begin
50
- response = RestClient.post $accessUrl, :user => { :email => username , :password => password }
51
-
52
- if response.code == 201
53
- return true
54
- else
55
- return false
56
- end
57
-
58
- rescue => e
59
-
60
- unless e.class.name == "RestClient::Unauthorized" and e.message == "401 Unauthorized"
61
- $logger.error "#{Process.pid}: Exception in auth(username, password)"
62
- $logger.error "#{Process.pid}: #{e.class.name}: #{e.message}"
63
- end
64
-
65
- return false
66
- end
67
-
68
- end
69
-
70
-
71
- loop do
72
- begin
73
- $stdin.eof? # wait for input
74
- start = Time.now
75
-
76
- msg = $stdin.read(2)
77
- length = msg.unpack('n').first
78
-
79
- msg = $stdin.read(length)
80
- cmd, *data = msg.split(":")
81
-
82
- $logger.info "#{Process.pid}: Incoming Request: '#{cmd}'"
83
- success = case cmd
84
-
85
- when "auth"
86
- $logger.info "#{Process.pid}: Authenticating #{data[0]}@#{data[1]}"
87
- $logger.info "#{Process.pid}: With password #{data[2]}"
88
- #password = data[2]
89
-
90
- #Authorization condition for LOGIN
91
- auth(data[0], data[2])
92
-
93
-
94
- when "isuser"
95
-
96
- $logger.info "#{Process.pid}: Isuser #{data[0]}@#{data[1]}"
97
-
98
- #Authorization condition for ISUSER (Add buddys)
99
- true
100
-
101
- else
102
- false
103
- end
104
-
105
- bool = success ? 1 : 0
106
- $stdout.write [2, bool].pack("nn")
107
- $logger.info "#{Process.pid}: Response: #{success ? "success" : "failure"}"
108
- rescue => e
109
- $logger.error "#{Process.pid}: #{e.class.name}: #{e.message}"
110
- $logger.error "#{Process.pid}: " + e.backtrace.join("\n\t")
111
- $logger.error "#{Process.pid}: Finish process"
112
- break
113
- end
114
- end