How to upload files on ejabberd server? - ejabberd

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

Related

Unable to load the pictures from MySQL in laravel on google cloud app engine

I deploy a laravel project on google cloud app engine everting is working fine expect 'pictures' that am fetching from products table in MySQL database.
The images are broken, all the thing are working fine on the localhost.
Here's my app.yaml:
runtime: php73
handlers:
- url: /assets
static_dir: public/assets
- url: /(.+\.(gif|png|jpg))$
static_files: public/uploads
upload: .+\.(gif|png|jpg)$
runtime_config:
document_root: public
env_variables:
## Put production environment variables here.
APP_KEY: Already Get this from .env
APP_STORAGE: /tmp
VIEW_COMPILED_PATH: /tmp
SESSION_DRIVER: cookie
CACHE_DRIVER: database
## Set these environment variables according to your CloudSQL configuration.
DB_DATABASE: ufurnitures
DB_USERNAME: ufurnitures
DB_PASSWORD: Already set the pass
DB_SOCKET: /cloudsql/ufurniture:us-central1:ufurnitures
## To use Stackdriver logging in your Laravel application, copy
## "app/Logging/CreateStackdriverLogger.php" and "config/logging.php"
## into your Laravel application. Then uncomment the following line:
# LOG_CHANNEL: stackdriver
beta_settings:
# for Cloud SQL, set this value to the Cloud SQL connection name,
# e.g. "project:region:cloudsql-instance"
cloud_sql_instances: ufurniture:us-central1:ufurnitures
I have an 'uploads' folder in a public directory where pictures are getting saved.
Just change this:
- url: /(.+\.(gif|png|jpg))$
static_files: public/uploads
upload: .+\.(gif|png|jpg)$
To this!
- url: /uploads
static_dir: public/uploads
And hurry it worked! ^_^

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.

Configure JsonProcessingExceptionMapper to log in Dropwizard

I am working on a dropwizard application. I need to configure it to log the exception from JsonProcessingExceptionMapper.
Some of my config.yml file:
server:
type: simple
connector:
type: http
port: 0
requestLog:
appenders: []
registerDefaultExceptionMappers: true
Been looking at JsonProcessingExceptionMapper and it's showDetail property but cannot figure it out. I am using dropwizard version 1.2.3
Found it. I was missing the property detailedJsonProcessingExceptionMapper:
server
registerDefaultExceptionMappers: true
detailedJsonProcessingExceptionMapper: true
Could not find this in the documentation. Could anyone point me to the right place?

Enable service_url in ejabberd using mod_http_upload

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

redmine email notifications with my own postfix server

I can't get redmine's email notifications to work. I am running my own mailserver with postfix using some mysql backend for the accounts. I added an account for redmine and tested it successfully using thunderbird. It is configured on port 25 using STARTTLS.
This is my config/configuration.yml of redmine:
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
tls: true
address: www.mydomain.org
port: 25
authentication: :login
domain: mydomain.org
user_name: tracker#mydomain.org
password: PASSWORD
As I said, the credentials work for sure. The port is 25 and the address is correct as well. Redmine is running on the same server, but using localhost as address doesn't work either.
The error message redmine is giving me reads
... (Connection timed out - connect(2)).
In the postfix log files, I can find nothing, not even an attempt to login or send an email. I am using Ruby 1.8.7 patchlevel 3xx and Rails 2.3.5. It seems like there is a problem with the connection in general, and not with my mailserver.
What can I do to find the source of the problem? I am not very familiar with how ruby works.
I figured it out... Below the commented, suggested configuration blocks in the configuration.xml file is another, uncommented email block, that reads
default:
email_delivery: ...
Even though I thought that by uncommenting the production: block these settings would be overridden, it started working the moment I inserted the email settings into this default block. This is a bit weird, but anyway - it does work now like a charm.