ejabberd icon indicating copy to clipboard operation
ejabberd copied to clipboard

http upload issue 18.01 and certain clients

Open ar4121 opened this issue 8 years ago • 6 comments

What version of ejabberd are you using?

18.01

What operating system (version) are you using?

Centos 7

How did you install ejabberd (source, package, distribution)?

Binary Installer

What did not work as expected? Are there error messages in the log? What was the unexpected behavior? What was the expected result?

I'm having a problem with a specific client being able to use mod_http_upload.. The client is chatsecure on an iOS device, iphone 8+

I thought it might be a ChatSecure issue, so using the same iPhone, I registered on another server (conversations.im) and used the device to send photo files via mod_http_upload to accounts on my server and another account a different server. It should be noted the Conversations.im server is one release previous though, not current (I think it is 17.12).

So I'm trying to understand if this is a misconfiguration on my part or a bug I've run across in the newest version.

The iOS device never seems to request a slot, it can chat and send text fine, only with files. I thought that perhaps it might be a host problem, since I'm using the fqdn.

The summary of where it works and doesn't: Conversations to Conversations OK Gajim to Conversations OK Conversations to ChatSecure OK Chatsecure to Anything Fail

Here is some of my config. I can upload the rest if it would help. I will also upload a log file.

##'  LOGGING
loglevel: 5
##
log_rotate_size: 10485760
log_rotate_date: ""
log_rotate_count: 2

log_rate_limit: 100

###.  ===============
###'  SERVED HOSTNAMES
##
hosts:
  - "MY-DOMAIN.COM"
##route_subdomains: s2s

###'  Certificates

certfiles:
  - "/opt/jabber/conf/MY-DOMAIN-ejabberd.pem"
ca_file: "/etc/pki/tls/cert.pem"

###'  TLS configuration

define_macro:
  'TLS_OPTIONS' :
     - "no_sslv2"
     - "no_sslv3"
     - "no_compression"
     - "cipher_server_preference"
  'DH_FILE': "/opt/jabber/conf/dhparams.pem"
  'TLS_CIPHERS': "HIGH:!aNULL:!eNULL:!3DES:@STRENGTH"
  ##  'TLS_CIPHERS': "!aNULL:!eNULL:!3DES:!EDH-RSA-DES-CBC3-SHA:!ECDHE-RSA-DES-CBC3-SHA:!DES-CBC3-SHA:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256"

c2s_dhfile: 'DH_FILE'
s2s_dhfile: 'DH_FILE'
c2s_ciphers: 'TLS_CIPHERS'
s2s_ciphers: 'TLS_CIPHERS'
c2s_protocol_options: 'TLS_OPTIONS'
s2s_protocol_options: 'TLS_OPTIONS'

##s2s_access: s2s 
s2s_use_starttls: required
outgoing_s2s_families:
  - ipv4
  - ipv6

fqdn: "xmpp.MY-DOMAIN.COM"

###.  ==============
###'  AUTHENTICATION
auth_method: internal
auth_password_format: plain

disable_sasl_mechanisms:
  - "DIGEST-MD5" 
  - "X-OAUTH2"
  - "SCRAM-SHA-1" ## I disabled all of these to troubleshoot chatsecure issue, enable SCRAM once chatsecure is working TODO:FIX

###.  ===============
###'  ACCESS RULES

access_rules:
  local:
    - allow: local
  c2s:
    - deny: blocked
    - allow
  announce:
    - allow: admin
    - allow: direction
  configure:
    - allow: admin
  muc_create:
    - allow: local
  pubsub_createnode:
    - allow: local
  register:
    - deny: shortname
    - allow: all
  trusted_network:
    - allow: loopback
  registration_timeout: 45

listen:
  -
    port: 5443
    module: ejabberd_http
    request_handlers:
      "shared": mod_http_upload
    tls: true
    certfile: "/opt/jabber/conf/MY-DOMAIN-ejabberd.pem"
    protocol_options: 'TLS_OPTIONS'
    dhfile: 'DH_FILE'
    ciphers: 'TLS_CIPHERS'

modules:
  mod_http_upload:
    docroot: "@HOME@/uploads"
    #dir_mode: "0744"
    put_url: "https://@HOST@:5443/shared"  # this should reflect the string in the request handler for the module (in listener)
    #access: local
    max_size: infinity
    thumbnail: false #Imagemagick is required to be installed
    jid_in_url: node

The only things that I can particularly see of any curiosity in my ejabberd.log is:

2018-01-22 21:06:25.035 [debug] <0.4555.0>@mod_client_state:filter_other:267 Won't add stanza for [email protected]/chatsecure20376 to CSI queue
2018-01-22 21:06:25.035 [debug] <0.4555.0>@mod_client_state:dequeue_sender:318 Flushing packets of [email protected] from CSI queue of [email protected]/chatsecure20376
2018-01-22 21:06:25.035 [debug] <0.4555.0>@xmpp_socket:send:218 (tls|<0.4555.0>) Send XML on stream = <<"<iq xml:lang='en' to='[email protected]/chatsecure20376' from='[email protected]' type='result' id='2667E770-4E7F-4B27-A094-94A12AC3F0B5'><query xmlns='jabber:iq:roster'><item subscription='both' jid='[email protected]'/></query></iq>">>
2018-01-22 21:06:25.041 [debug] <0.4555.0>@ejabberd_router:do_route:357 route:

The CSI issue filter_other and the dequeue sender "flushing packets" usually corresponds around the same time that I try to upload a file.

The only thing in the error.log is:

2018-01-22 17:52:48.787 [error] <0.1873.0> backend port not found: inotifywait

So, I'm not sure where to go. Is there a way to determine why the Chatsecure client does not request a http upload slot? I've tried numerous methods, including getting an account on Conversatoins.im, only to determine that Chatsecure in fact does work (albeit, as I stated, the server version that Conversations.im is running is an older version). Monal on the same iphone requests and gets an upload slot.

Thanks Additionally, the server passes the ComplianceTester-0.2.2 The client and server get an A using https://check.messaging.one The certificate is a wildcard ssl from comodo, which seems to work fine. the logfile UPLOAD-LOG.txt

ar4121 avatar Jan 23 '18 07:01 ar4121

It should be noted the Conversations.im server is one release previous though, not current

That server is now updated (just in case you want to test again).

So I'm trying to understand if this is a misconfiguration on my part or a bug I've run across in the newest version.

Your configuration looks fine to me, but I'd also rule out an ejabberd bug. If ChatSecure reports HTTP Upload as supported by the server (does it?) but doesn't request a slot, it sounds like a ChatSecure issue which for some reason is triggered by something specific to your environment.

Is there a way to determine why the Chatsecure client does not request a http upload slot?

You'd have to ask the ChatSecure developers, I'm afraid.

weiss avatar Jan 24 '18 17:01 weiss

You'd have to ask the ChatSecure developers, I'm afraid.

I did submit an issue with ChatSecure, https://github.com/ChatSecure/ChatSecure-iOS/issues/932 At the time, I hadn't completely eliminated every possible error from my logs. The dev did ultimately say that the request for an upload slot goes through an existing stream.

Your configuration looks fine to me, but I'd also rule out an ejabberd bug. If ChatSecure reports HTTP Upload as supported by the server (does it?) but doesn't request a slot, it sounds like a ChatSecure issue which for some reason is triggered by something specific to your environment.

Chatsecure reports all green checkmarks. When the dev mentioned the request slot goes through an existing stream, that is when I noticed that ejabberd was dropping some stanzas. (those I highlighted above).

Thanks again, I will hopefully have access to that device this evening or tomorrow morning to test on, I will test again on Conversations.im to my server. I'll let you know what I find!

ar4121 avatar Jan 24 '18 18:01 ar4121

when I noticed that ejabberd was dropping some stanzas.

Your log snippet doesn't actually mention dropped traffic, but mod_client_state sometimes does drop certain non-essential (redundant) stanzas on purpose to avoid waking ChatSecure while the app is in the background. This is unrelated to the upload issue (mod_client_state will never drop a slot request received from the client).

weiss avatar Jan 24 '18 19:01 weiss

It doesn't appear to be an ejabberd problem. The upload worked fine from the conversations.im server to mine. It must be in my configuration and I'm at a loss to understand what error I have made.

Late last night I installed ejabberd in a separate VPS, still Centos7, that doesn't have SELinux or Firewall/iptables, different domain name (but same config). Still didn't work. I tried using a self signed certificate, thinking it might be the wildcard certificate, still didn't work. I haven't tried letsencrypt cert, I tend to think if self signed and published cert fails, lets encrypt most certainly would.

Conversations.im appears to put the uploads on a separate server. Is it possible that the port issue in the configuration could be causing problems, or a sub-domain / certificate problem? I noticed that ejabberd threw a warning that I should have certificates for individual domain names (conference, xmpp, vjud, upload, etc) even though the certificate I used was a different wildcard cert.

In any case, thanks for any advice you can give on how to proceed. I suppose you can probably close this ticket as the problem seems to lie in my configuration somewhere.

ar4121 avatar Jan 25 '18 16:01 ar4121

So I am narrowing this down further, it appears that when I keep web registration off the same host, it works.
For example, at present, the captcha host was the default "https://my-domain.com:5280/" (or whatever it is in that config).
When I move it to "https://register.my-domain.com:5280/" I'm still able to continue to send photos from the iphone/ipad.

The same with registration. If I enable register on the listener, I then become unable to send photos. Is there any reason you surmise for this type of behaviour?
I'm going to continue to test and figure out exactly what the problem is.

ar4121 avatar Jan 30 '18 19:01 ar4121

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jun 09 '19 20:06 lock[bot]