Enable service_url in ejabberd using mod_http_upload - ejabberd

I'm using ejabberd 15.09 and mod_http_upload.
According to https://github.com/weiss/mod_http_upload , if service_url is defined then, upload service should be forwarded to the given link.
However, even though I have define the service_url link, it still reverts to put_url.
How do I configure mod_http_upload to use service_url ?

The cause could be the mod_http_upload read its own conf file instead of your ejabberd.yml.
The mod_http_upload conf file can be found under ejabberd_folder_home/.ejabberd-modules/mode_http_upload/conf
You can delete this file and mod_http_upload will read your ejabberd.yml.
Source: https://github.com/processone/ejabberd-contrib/issues/122

Related

Unable to resolve .local domains with getent even though avahi-resolve-host-name succeeds

Trying to set up a network printer with CUPS.
Followed online documentation that stated:
To discover or share printers using DNS-SD/mDNS, setup .local hostname
resolution with Avahi and restart cups.service.
Followed directions for setting up Avahi to the point where avahi-browse --all --ignore-local --resolve --terminate and avahi-resolve-host-name my-domain.local are both working.
But getent hosts my-domain.local fails to resolve. This results in CUPS failing to print because it can't find my-printer.local.
I read the mdns Github page and saw a note that made me think I didn't need a /etc/mdns.allow file.
nss-mdns has a simple configuration file /etc/mdns.allow for enabling
name lookups via mDNS in other domains than .local.
Note: The "minimal" version of nss-mdns does not read /etc/mdns.allow under any circumstances. It behaves as if the file
does not exist.
In the recommended configuration, no /etc/mdns.allow file is present.
But then I saw the last note in that section:
If, during a request, the system-configured unicast DNS (specified in
/etc/resolv.conf) reports an SOA record for the top-level local name,
the request is rejected. Example: host -t SOA local returns something
other than Host local not found: 3(NXDOMAIN). This is the unicast SOA
heuristic.
I tested that out on my machine and sure enough, I was getting something OTHER than Host local not found....
Adding a /etc/mdns.allow file with a line for .local. and for .local and now I can ping my-printer.local.

How to upload files on ejabberd server?

I followed the documentation to and viewed multiple links to learn how to upload a file on the ejabberd server but still cannot upload files on the ejabberd server. My motive is to upload a file from android application before that I tried with the postman. I am using the default ejabberd configuration with a slite change by making tls false to use http not https.
hosts:
- "faiqkhan-VirtualBox"
listen:
-
port: 5443
ip: "::"
module: ejabberd_http
tls: false
request_handlers:
"/upload": mod_http_upload
modules:
mod_http_upload:
put_url: "http://#HOST#:5443/upload"
I am using like this: http://faiqkhan-VirtualBox:5443/api/mod_http_upload but getting 400 bad requests
Did I miss something? Or do the whole thing wrong?
The configuration is correct but your URL is incorrect format.
http://yourservername:5443/upload/
or
https://yourservername:5443/upload/
in your case it will be,
http://faiqkhan-VirtualBox:5443/upload/
You should get 'Not found. from the server
/upload is the url parameter which is been specified in your
mod_http_upload module configuration
mod_http_upload is the module that handle http file transfer or https file transfer if certificate is config
hope this is helpful

How do setup mod_http_upload in ejabberd

In ejabberd 18.01-2, installed in lxc container Ubuntu 18.04 Bionic LTS using apt, I'm trying to setup mod_http_upload.
In the section listen, I have
listen:
-
port: 5444
module: ejabberd_http
tls: true
request_handlers:
"/upload": mod_http_upload
In the configuration file, commented port was 5444, however, in the current documentation, it is 5443, so I am not sure which one is right.
In the modules section, I have
modules:
mod_http_upload:
host: "upload.ejabberd.forumanalogue.fr"
max_size: infinity
thumbnail: true
put_url: "https://ejabberd.forumanalogue.fr:5444/upload"
docroot: "/ejabberd/upload"
When I start the service, I can see an odd message in the logs
2019-11-11 21:02:35.287 [warning] <0.367.0>#ejabberd_pkix:handle_call:255 No certificate found matching 'upload.ejabberd.forumanalogue.fr': strictly configured clients or servers will reject connections with this host; obtain a certificate for this (sub)domain from any trusted CA such as Let's Encrypt (www.letsencrypt.org)
It is strange because I have a signed wildcard certificate.
certfiles:
- "/etc/letsencrypt/live/forumanalogue.fr/*.pem"
I can see the service with my client (Gajim) but when I try to send a file to another local account, I receive an error Access denied by service policy, see the complete log:
<iq xml:lang='en' to='foo#forumanalogue.fr/gajim.HCLJ4BZI' from='upload.ejabberd.forumanalogue.fr' type='error' id='1dd35274-90e9-4b3b-9608-0fab59afe34e'>
<request xmlns='urn:xmpp:http:upload'>
<filename>a.out</filename>
<size>27232</size>
<content-type>application/octet-stream</content-type>
</request>
<error code='403' type='auth'>
<forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
<text xml:lang='en' xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Access denied by service policy</text>
</error>
</iq>
I had to enable debug logging in order to see something. It is quite verbose, but I think that the relevant part, which is non redundant with the client message, is
2019-11-11 20:53:08.329 [debug] <0.501.0>#mod_http_upload:process_slot_request:544 Denying HTTP upload slot request from foo#forumanalogue.fr/gajim.HCLJ4BZI
Thank you for your help.
I tried with ejabberd 18.01, a configuration similar to yours, and it works for me.
Looking at the source code, that "process_slot_request:544 " error means that the account attempting to use the upload feature is not allowed by the "local" Access rule in the vhost it sended it to. Probably it's a remote account. Remote to that upload service. In other words, the service upload.whatever can only be used by accounts like user12#whatever.
In your case, you are attempting to use upload.ejabberd.forumanalogue.fr from account foo#forumanalogue.fr, which is not local to that upload service.
Several ideas, I hope one of them suits your specific setup:
A) don't mess with vhosts. If it's forumanalogue.fr, keep it that everywhere
B) use #HOST# in host and put_url options
C) Or if you really want to mess with hosts, then add Access rights so accounts in that vhost are considered "local" to the upload service.

SFTP transfer using Execute Process Task and WinSCP in SSIS

I am having a User_file.txt file placed at WinSCP root folder USERDATA, which I am trying to download to the given location C:\User\Local\.
Executable- C:\Program Files (x86)\WinSCP\WinSCP.exe
Arguments - /log=c:\path\to\log\winscp.log /command "open ftp://username:password#example.com/" "get /USERDATA/User_file.txt C:\User\Local\" "exit"
I am facing below error:
No connection could be made the target machine actively refused it
Not sure what I am missing. I took reference from couple of related post on Stack Overflow.
You want to use SFTP, but use FTP (ftp://) protocol in the session URL.
Use sftp:// instead:
... "open sftp://username:password#example.com/" ...
WinSCP GUI can generate a correct script/command-line template for you.

plotly dash: change default port

Following plotly dash getting started guide but when trying to run python app.py get message:
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
Seems the default address: http://127.0.0.1:8050/ is already being used. How can the default port be changed so I can get this to work?
As we can see in Dash.run_server method definition, port can be passed as parameter:
def run_server(self,
port=8050,
debug=True,
threaded=True,
**flask_run_options):
self.server.run(port=port, debug=debug, **flask_run_options)
So, if you need to use another port:
if __name__ == '__main__':
app.run_server(debug=True, port=8051) # or whatever you choose
Note that in Julia, you can change the port by specifying the port number in the run_server arguments without specifying "port=". For example,
run_server(app, "0.0.0.0", 8000, debug = true)
You can also set the environment variable PORT in your terminal before launching the Dash app:
https://github.com/plotly/dash/blob/c77912a3183adfccfd4ef84df91eca7fa9c7d543/dash/_configs.py#L34
In the place of port = 8050 type your own port number
I was running it on a Jupyter notebook, and all I had to do was go to runtime and select factory reset runtime, pip install all dependencies (like jupyter-dash), and I was good to go...