Koozali.org: home of the SME Server

[NEW HOWTO] Rocket.Chat

guest22

Re: [NEW HOWTO] Rocket.Chat
« Reply #45 on: May 04, 2016, 03:50:19 PM »
Got that, still npm under SCL still installs ONLY in the SCL environment. So as far as stock SME Server concerns, it is not effected AFAIK. Hence the enable command.

Offline Daniel B.

  • *
  • 1,699
  • +0/-0
    • Firewall Services, la sécurité des réseaux
Re: [NEW HOWTO] Rocket.Chat
« Reply #46 on: May 04, 2016, 03:52:31 PM »
It's not the fact that you use SCL. Npm install dependencies in the working directory of your project, not system wide. So indeed, you won't polute the system. But updates won't be managed automatically with yum, you'll have to use npm to do that
C'est la fin du monde !!! :lol:

guest22

Re: [NEW HOWTO] Rocket.Chat
« Reply #47 on: May 04, 2016, 03:53:30 PM »
It's not the fact that you use SCL. Npm install dependencies in the working directory of your project, not system wide. So indeed, you won't polute the system. But updates won't be managed automatically with yum, you'll have to use npm to do that


Agree. One of the downsides of the upside of using SCL.

Offline Daniel B.

  • *
  • 1,699
  • +0/-0
    • Firewall Services, la sécurité des réseaux
Re: [NEW HOWTO] Rocket.Chat
« Reply #48 on: May 04, 2016, 03:55:11 PM »
It'd be the same without SCL (with the stock nodejs/npm). Here, SCL only gets a new enough node environment
C'est la fin du monde !!! :lol:

guest22

Re: [NEW HOWTO] Rocket.Chat
« Reply #49 on: May 04, 2016, 03:56:36 PM »
Not completely correct. NPM packages are installed under the SCL environment (thus /opt/rh) structure. Stock SME Server will still not be effected.

Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: [NEW HOWTO] Rocket.Chat
« Reply #50 on: May 04, 2016, 08:25:55 PM »
Quick update.

My contrib vaguely works.

However, after thinking I had written crap code it transpires that there are issues with email.js not sending mails in a RFC compliant format, or at least one that SME is happy with.

Two issues....

First is the'From' header is not set by email.js on the default install.... this can be modified once you have logged in. So your initial setup mail won't go through even though the account is setup.

Second is that email.js does not set a Date header. Double whammy... !

If I can figure some JS I'll try a patch and see if I can get it merged.

Onwards and upwards.... albeit slowly !
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: [NEW HOWTO] Rocket.Chat
« Reply #51 on: May 04, 2016, 10:58:38 PM »
OK - just posted at the meteor forums

https://forums.meteor.com/t/email-flagged-as-spam/5576/8

I don't get JS so any help gratefully received :-)

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Daniel B.

  • *
  • 1,699
  • +0/-0
    • Firewall Services, la sécurité des réseaux
Re: [NEW HOWTO] Rocket.Chat
« Reply #52 on: May 04, 2016, 11:13:14 PM »
Unfortunately, even if required, this missing Date headers rejects more and more valid email. Newer version of qpsmtpd, and its headers checker plugin has disabled this requirement by default because too many legitimate email forget this one
C'est la fin du monde !!! :lol:

Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: [NEW HOWTO] Rocket.Chat
« Reply #53 on: May 05, 2016, 01:17:40 AM »
Well, I'm kind of getting there a bit but...

Code: [Select]
    mc = new MailComposer();

    # Set up the date
    var dateObj = new Date();

    # Convert to UTC - all good so far
    dateObj = dateObj.toUTCString();

    # Convert the date to a string (we could probably add it direct but..... don't know how)
    var newDate = String (dateObj);

    # Concatenate test and date
    newDate =  "date: " + newDate;

    # Add our header - trouble is knowing what is already in there - I don't know how to add to existing elements ??
    # This seems to work on a JS test but fails in email.js (or at least it fails to send with same error 552) - which I could debug it :-(
    object = {header: [newDate]};
   
    // setup message data
    mc.setMessageOption({
      from: options.from,
      to: options.to,
      cc: options.cc,
      bcc: options.bcc,
      replyTo: options.replyTo,
      subject: options.subject,
      text: options.text,
      html: options.html
    });

    _.each(options.headers, function (value, name) {
      mc.addHeader(name, value);
    });
    # blah....

Some notes from the JS file

 * @param {Object} options
 * @param {String} options.from "From:" address (required)
 * @param {String|String[]} options.to,cc,bcc,replyTo
 *   "To:", "Cc:", "Bcc:", and "Reply-To:" addresses
 * @param {String} [options.subject]  "Subject:" line
 * @param {String} [options.text|html] Mail body (in plain text and/or HTML)
 * @param {Object} [options.headers] Dictionary of custom headers

Oh for some perl :-)

Time for bed Zebedee.... boinnnnnng
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: [NEW HOWTO] Rocket.Chat
« Reply #54 on: May 05, 2016, 11:36:04 AM »
Bit more thinking on this.... my guess is the object variable is in this type of format:

Code: [Select]
var options = {
    from: 'some person',
    to: 'someone else',
    cc: 'some cc',
    text: 'some text',
    headers: {
        date: 'date now',
        another: 'other data'
    }
};

You then get

options.from
options.to

etc etc

So the question is how do you add another element to the headers without losing what MAY be there ?

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: [NEW HOWTO] Rocket.Chat
« Reply #55 on: May 05, 2016, 01:19:56 PM »
Another issue I just fell over. Trying to enable https. Added webapps. Added the subdomain as per the wiki.

That connects fine through the proxy. However, I cannot generate a letsencrypt certificate for the host/domain

[root@test letsencrypt.sh]# letsencrypt.sh -c
# INFO: Using main config file /etc/letsencrypt.sh/config.sh
Processing chat.reetspetit.info with alternative names: reetspetit.info mail.reetspetit.info test.reetspetit.info www.reetspetit.info
 + Signing domains...
 + Generating private key...
 + Generating signing request...
 + Requesting challenge for chat.reetspetit.info...
 + Requesting challenge for reetspetit.info...
 + Requesting challenge for mail.reetspetit.info...
 + Requesting challenge for test.reetspetit.info...
 + Requesting challenge for www.reetspetit.info...
 + Responding to challenge for chat.reetspetit.info...
ERROR: Challenge is invalid! (returned: invalid) (result: {"type":"http-01","status":"invalid","error":{"type":"urn:acme:error:unauthorized","detail":"Invalid response from http://chat.reetspetit.info/.well-known/acme-challenge/13x4OOCTg8YN8758RU4DK3Atbj2BLta_oslRQCidfgI [212.83.164.73]: 403"},"uri":"https://acme-v01.api.letsencrypt.org/acme/challenge/z8VL-s91k-aiiAKmHX3jUPB3DRwM0NEVuDjDx3R34lk/72772938","token":"13x4OOCTg8YN8758RU4DK3Atbj2BLta_oslRQCidfgI","keyAuthorization":"13x4OOCTg8YN8758RU4DK3Atbj2BLta_oslRQCidfgI._IYt1sNfNVNxGFTcIFNdJOP9E8mKxnAdY8DKER_1h1M","validationRecord":[{"url":"http://chat.reetspetit.info/.well-known/acme-challenge/13x4OOCTg8YN8758RU4DK3Atbj2BLta_oslRQCidfgI","hostname":"chat.reetspetit.info","port":"80","addressesResolved":["212.83.164.73"],"addressUsed":"212.83.164.73"}]})

I guess the proxy is routing the request to something internal in RocketChat rather than to the standard Primary ibay / .well-known/acme-challenge

Any ideas on how to get round this ? Does the reverse proxy need an entire subdomain ? Will a host not do the job ?
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: [NEW HOWTO] Rocket.Chat
« Reply #56 on: May 05, 2016, 03:00:06 PM »
That may have to do with http://gitweb.firewall-services.com/?p=smeserver-webapps-common;a=patch;h=c200387012776f811e0b06408332add8535712eb

I think that is an older patch from looking at the git account and comparing to mine.

Seems with my letsencrypt contrib and webapps I cannot get a cert for chat.reetspetit.net - seems fubar'd

+ Responding to challenge for chat.reetspetit.info...
ERROR: Challenge is invalid! (returned: invalid) (result: {"type":"http-01","status":"invalid","error":{"type":"urn:acme:error:unauthorized","detail":"Invalid response from http://chat.reetspetit.info/.well-known/acme-challenge/3e4wXyIVcpNDXeAZPirqHj624rpOe_xtqAQLDL5tLD8 [212.83.164.73]: 403"},"uri":"https://acme-v01.api.letsencrypt.org/acme/challenge/dTtVq4BkM-wjr0r8nTX68Q2YE0VpuGAHS_IPbuoSBZQ/72935804","token":"3e4wXyIVcpNDXeAZPirqHj624rpOe_xtqAQLDL5tLD8","keyAuthorization":"3e4wXyIVcpNDXeAZPirqHj624rpOe_xtqAQLDL5tLD8._IYt1sNfNVNxGFTcIFNdJOP9E8mKxnAdY8DKER_1h1M","validationRecord":[{"url":"http://chat.reetspetit.info/.well-known/acme-challenge/3e4wXyIVcpNDXeAZPirqHj624rpOe_xtqAQLDL5tLD8","hostname":"chat.reetspetit.info","port":"80","addressesResolved":["212.83.164.73"],"addressUsed":"212.83.164.73"}]})

The section in httpd.conf looks like this

<VirtualHost 0.0.0.0:443>

    ServerName chat.reetspetit.info
    ServerAlias
    SSLEngine on
    RewriteEngine on
    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
    RewriteRule .* - [F]
    # alias for Apache icons
    Alias /icons/ /var/www/icons/
    ProxyPass /.well-known/acme-challenge/ !
    ProxyPass / http://localhost:3000/
    ProxyPassReverse / http://localhost:3000/

I guess the '!' at the end of the line means ignore requests, but it seems it doesn't.

I also think that you should probably set the Content to Primary as that where .well-known/acme-challenge is ?

chat.reetspetit.info=domain
    Content=Primary
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline DanB35

  • ****
  • 764
  • +0/-0
    • http://www.familybrown.org
Re: [NEW HOWTO] Rocket.Chat
« Reply #57 on: May 05, 2016, 08:08:51 PM »
@ReetP

I'm not sure what's going on with your setup (or mine, for that matter), but I was able to get an LE cert, using your RPM, after setting up the proxy.
......

Offline ReetP

  • *
  • 3,731
  • +5/-0
Re: [NEW HOWTO] Rocket.Chat
« Reply #58 on: May 05, 2016, 08:13:31 PM »
Yes I have realised I may have a separate issue.

* ReetP tosses away another VM !
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

guest22

Re: [NEW HOWTO] Rocket.Chat
« Reply #59 on: May 06, 2016, 08:53:25 AM »