I am in the process of configuring the ejabber server for one of our project.In this we need to configure the mod_rest module (https://github.com/processone/ejabberd-contrib) from ejabberd-contrib. Below are my configuration (YAML)
in listen
port: 5280
module: ejabberd_http
request_handlers:
"/rest": mod_rest
web_admin: true
http_poll: true
http_bind: true
## register: true
captcha: true
modules:
mod_rest:
allowed_ips:
- "host_one_ip"
- "host_one_ip"
access_commands:
- "registered_users"
- "connected_users"
allowed_destinations:
- "all"
But whenever i am trying to hit the ejabberd command using the rest (curl call) its giving me "TryPOSTING Stanza"
prompt# curl --data 'registered_users domain' -X POST http://host:5280/rest/
Try POSTing a stanza.
I tried to go though the forum but couldn't find ...anything helpful
I am new to ejabber and erlang. Any pointer in this direction will be very helpful. Please let me know if any more details are required.
Guys i have figured out the issue for this. I have installed Ejabberd 14.05 version. The mod_rest module
was including the ejabberd_http.hrl file for its dev_include directories.In the Ejabberd 14.05 the record for ejabberd_http.hrl are changed. "opts = [] :: list()," is an extra header in the ejabber-contrib`s include folder. I adjusted the header location accordingly and compile the module. It worked for me :) with this i got the ejabberd commands working using the mod_rest.
Now my i facing problem to consumes Stanzas using mod_rest :(. If anyone have any thoughts on the same please let me know.
I try this, and worked:
In my case I use ejabberd binary installation, and the installation folder in
/lib/ejabberd/xxxx
Compile the mod_rest.erl from ejabberd-contrib, here is the reference, https://www.ejabberd.im/ejabberd-contrib
I compiled using this command :
erlc -I /lib/ejabberd/include your_mod_rest_source_file
if success, you will have .beam file, after that copy the mod_rest.beam to ejabberd installation folder
cp ~/ejabberd-contrib/mod_rest/src/mod_rest.beam /lib/ejabberd/ebin/
than configure ejabberd.yml in my case the yml reside in (/etc/ejabberd/ejabberd.yml) like this:
https://github.com/processone/ejabberd-contrib/issues/45#issuecomment-69767670
I think you misunderstand the purpose of the ReST module.
From the doc, you are supposed to send XMPP stanza to it:
https://github.com/processone/ejabberd-contrib/tree/master/mod_rest
However, you are sending plain text, not XMPP stanza (not even XML).
Related
we want to build a simple server component for ejabberd which receives all messages sent to MUC rooms (we have many rooms and new ones are being created all the time) and, after processing some of these messages, performs some operations.
We don't want our server component to act like a bot, so we don't want it to reply to messages or things like that, we just want it to receive copies of all messages in order to process some of them.
To do so, we have followed the tutorial available here: https://sleekxmpp.readthedocs.io/en/latest/getting_started/component.html
The problem is that the component seems to receive only some of the messages (approximately 1 out of 5).
Also, we are observing a weird behavior: message delivery seems to be "exclusive", meaning that a message is delivered either to clients connected to the room or to the server component, which is weird to be honest. In other words, 1 message out of 5 is delivered to the server component, and the other 4 are delivered to clients as usual.
Here's our component code (we have tried with both sleekxmpp and slixmpp but we always have the same behavior):
import sys
import logging
#import sleekxmpp
#from sleekxmpp.componentxmpp import ComponentXMPP
import slixmpp
from slixmpp.componentxmpp import ComponentXMPP
if sys.version_info < (3, 0):
from sleekxmpp.util.misc_ops import setdefaultencoding
setdefaultencoding('utf8')
else:
raw_input = input
class NotificationsComponent(ComponentXMPP):
def __init__(self):
ComponentXMPP.__init__(self, "muc.ourservice.it", "secret", "jabber.ourservice.it", 5233)
# add handler
self.add_event_handler("message", self.message)
#self.add_event_handler("groupchat_message", self.message)
def message(self, msg):
if msg['type'] == 'groupchat':
print('Received group chat message')
print(msg)
#msg.reply('Well received').send()
else:
print('Received another message')
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG,format='%(levelname)-8s %(message)s')
xmpp = NotificationsComponent()
xmpp.register_plugin('xep_0030') # Service Discovery
#xmpp.register_plugin('xep_0004') # Data Forms
#xmpp.register_plugin('xep_0060') # PubSub
xmpp.register_plugin('xep_0199') # XMPP Ping
#xmpp.register_plugin('xep_0045') # MUC
# Connect to the XMPP server and start processing XMPP stanzas.
xmpp.connect()
xmpp.process()
and here's a snippet of our ejabberd 18.03 configuration:
listen:
-
port: 5222
ip: "::"
module: ejabberd_c2s
starttls: true
certfile: 'CERTFILE'
protocol_options: 'TLSOPTS'
## dhfile: 'DHFILE'
## ciphers: 'CIPHERS'
##
## To enforce TLS encryption for client connections,
## use this instead of the "starttls" option:
##
starttls_required: true
##
## Stream compression
##
zlib: true
##
max_stanza_size: 65536
shaper: none
access: c2s
-
port: 5280
ip: "::"
module: ejabberd_http
request_handlers:
"/admin": ejabberd_web_admin
"/bosh": mod_bosh
#request_handlers:
# "/ws": ejabberd_http_ws
# "/bosh": mod_bosh
# "/api": mod_http_api
## "/pub/archive": mod_http_fileserver
web_admin: true
http_bind: true
## register: true
captcha: false
certfile: 'CERTFILE'
tls: true
-
port: 5233
ip: "::"
module: ejabberd_service
access: all
privilege_access:
message: "outgoing"
password: "secret"
shaper: none
we have also tried to play with access, privilege_access and things like that but no luck.
Do you have any idea what might cause this weird behavior? Is there any particular plugin or module that should be enabled?
Of course, we have enabled debug logs on both sleekxmpp and ejabberd, but we don't see any errors, it's just that messages are missing.
We also did one more test. Even by using the official "echo component" example available in the slixmpp repository, we have the same issue. So it looks like there is some issue at our server, maybe on the message routing part, we don't know.
Thanks
I think you mixed a couple of things here. The component you created here seems to connect to ejabber as External Component (see https://xmpp.org/extensions/xep-0114.html or https://xmpp.org/extensions/xep-0225.html) judging from http://sleekxmpp.com/getting_started/component.html which means that ejabber (seems to at least) routes some messages to it's internal component and some to your (external) component. This would explain why your component receives only certain messages.
You have two options:
use SleekXMPP but connect as regular user (you can use "bot" example and simply listen for messages without responding)
create dedicated component/handler within ejabberd that would receive all messages and process them accordingly.
Both options has pros and cons:
client-in-room - easier (for you, it seems) development, but require to be constantly connected and may loose some messages if connection is dropped
dedicated handler in ejabberd - most likely slightly more difficult to implement.
It turns out I totally misunderstood the purpose of Jabber external components.
I was expecting to receive a "copy" of all events occurring within ejabberd, but I was wrong.
To achieve the result I was expecting, I'm using a module called "mod_post_log" which sends an HTTP request for every message sent by user. That works for me.
when i paste this link
http://localhost/wordpress/wp-json/wc/v2/products?consumer_key=ck_*******************&consumer_secret=cs_********************
it show for me this error message
{"code":"woocommerce_rest_cannot_view","message":"D\u00e9sol\u00e9, vous ne pouvez pas lister les ressources.","data":{"status":401}}
by the way the cosumers key & secret are correct
Your connection must be throw https
and add this lines to your woocommerce init :
{
....
verifySsl: false,
queryStringAuth: true
}
every post request require ssl
dublicate from this link
Ionic 3 WP-REST API Post request 401 (unauthorized) error
&
WooCommerce REST API "woocommerce_rest_cannot_view "
Here are 2 possible solutions:
Add the following variable in the index.php page of your WordPress installation (Worked for me on my localhost without having to restart the server):
$_SERVER['HTTPS'] = 'on'; //------> Add this line under the line that says: define( 'WP_USE_THEMES', true );
Set the environment variable in the .htaccess file when using Apache:
SetEnv HTTPS on
401 is unauthorized error
if key and secret are correct, it could be todo with SSL
other people report similar problems
https://github.com/woocommerce/woocommerce/issues/19649
Problem solved by adding this line below to the end of .htaccess file
All you need to add this line to .htaccess , this work with me
SetEnv HTTPS on
And make sure use OAuth 1.0 for Authorization
add false in end of creating RestAPI like this...
RestAPI rest = new RestAPI(URL, ConsumerKey, ConsumerSecret, false);
it should by "authorizedHeader"
answer from https://github.com/XiaoFaye/WooCommerce.NET/issues/211
None of the suggestions helped me, so I deleted my previous API credentials and created new ones. This made the change for me.
I don't want to say "just delete your credentials" as you have to make sure to not break any necessary connections, please note that! I'm just sharing my experience on this.
My server configuration is a TYPO3 installation Vs. 6.2.31 combined with a reverse proxy. The system is running fine with http.
When we try to switch to https we geht this Error Message in the backend:
"Connection Problem
Sorry, but an error occurred while connecting to the server. Please check your network connection."
And the page tree is not loading.
When switching back to http all is working one again.
Our settings:
[SYS][reverseProxyIP] = (IP of our reverse Proxy)
[SYS][reverseProxyHeaderMultiValue] = last
[SYS][reverseProxySSL] = *
What i tried:
deactivate all extensions apart from the system extensions
no entry in syslog (error reporting is on development)
no entries in the server logs
lockSSL in install tool 3 results in never ending 302 redirects
lockSSL with option 2 results in this error message:
Fatal error: Uncaught exception 'RuntimeException' with message 'TYPO3 Backend not accessed via SSL: TYPO3 Backend is configured to only be accessible through SSL. Change the URL in your browser and try again.' in /srv/httpd/sites/fland_ww1/typo3_src-6.2.31/typo3/sysext/core/Classes/Core/Bootstrap.php:897 Stack trace: #0 /srv/httpd/sites/fland_ww1/typo3_src-6.2.31/typo3/init.php(54): TYPO3\CMS\Core\Core\Bootstrap->checkSslBackendAndRedirectIfNeeded() #1 /srv/httpd/sites/fland_ww1/typo3_src-6.2.31/typo3/index.php(21): require('/srv/httpd/site...') #2 {main} thrown in /srv/httpd/sites/fland_ww1/typo3_src-6.2.31/typo3/sysext/core/Classes/Core/Bootstrap.php on line 897
It seems that some requests e.g. for the page tree are made without ssl - ajax calls i presume - but i dont have a clue how to debug it.
Andy ideas?
Thanks!
I have the same version at a customer and with a load balancer / proxy.
The only difference is [SYS][reverseProxyHeaderMultiValue] = first.
Also, [BE][lockSSL] = 1 is set.
Maybe it helps?
This thread is quite old, but because many people do read until now i will try an answer. We could solve the problem (and once again in a different installation) with the following settings:
[SYS][reverseProxyIP] = (IP of our reverse Proxy)
[SYS][reverseProxyHeaderMultiValue] = firt
[SYS][reverseProxySSL] = *
AND - that is important - changes in the server config too:
RequestHeader set X-Forwarded-Proto "https"
SetEnv proxy-nokeepalive 1
SetEnv proxy-initial-not-pooled 1
I assume it was the first:
RequestHeader set X-Forwarded-Proto "https"
So in the end the problem was in the server config.
Since I've changed the Website from http to use https instead, the Newsletter can not be generated anymore in TYPO3.
I'm using following Extension to send the newsletter:
http://typo3.org/extensions/repository/view/direct_mail
Following error message turns up:
FEHLER
Die HTML Inhalten können nicht ausgelesen werden.
I've checked following Settings:
- Error Logs (php and apache), nothing in there
- php settings (allow_url_fopen http://php.net/manual/en/filesystem.configuration.php), setup the way it should
- checked the www's blogs but didn't find a working solution
- the changes for ssl: domain record changed in typo3
- htaccess forward from http to https
- tried to send an external link (didn't work either)
- checked for the boundries
- checked for the right domain-settings
- deprecation log didn't contain anything either
- switched errors on (no alert or message concerning this issue)
- typo3 configuration (curl is still on)
Any Idea how to solve that issue?
I've actually tried several forum settings to solve the issues but didn't get along so far.
is the backend also using https? basically, direct_mail uses the same protocol as TYPO3 BE, except if UseHttpToFetch is activated.
Please check following:
fetch the page manually using wget or curl directly from the server (SSH to the server)
check in the extension config if "UseHttpToFetch" is set.
Last but not least my college once more solved this issue:
There seemed a Core-Bug in:
2328: // PATCH
2329: // CURRENT FILE: typo3/sysext/core/Classes/Utility/GeneralUtility.php
2330: // CONCERNING: typo3_src-6.1.5
2331: curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
The message now is: Seite ist erfolgreich ausgelesen.
Thanks for your help guys!
Thanks Nico for that patch!
In my case Direct Mail reported this problem, when I used a HTAccess password.
The easiest way to test it, was to remove this password access for a minute. :)
It seems that mod_logxml module is not compatible with ejabberd 13.12 version. Ejabberd fails to start when this module is installed.
My question is - is there another way how to log (file, database, etc) all the XMPP packets send and received by ejabberd?
Yes, you can make your own log module if you cannot find anything that fits your needs.
You can use a module I developed as a reference. This module which would intercept stanza with the type "chat" or "groupchat" and send a acknowledgement back to the sender.
You can modify this module by removing the type so it intercepts all stanza types and log whatever you want into a DB instead of sending a message back to the sender.
https://github.com/Mingism/ejabberd-stanza-ack
I've changed mod_logxml.erl that it will work with eJabberd 13.12. You have to put in
ejabberd/src/
Configs are for ejabberd.yml format:
mod_logxml:
stanza: [message, other]
direction: [external]
orientation: [send, recv]
logdir: "/var/jabber/logs/"
timezone: universal
rotate_days: 1
rotate_megs: 100
rotate_kpackets: no
check_rotate_kpackets: 1
Repository