Plugins: net/relayd: /var/etc/relayd.conf generation error

Created on 5 Dec 2017  路  12Comments  路  Source: opnsense/plugins

Issue

I have just recently built relayd on another instance of OPNsense 17.7.8 and have noticed that the relayd configuration file /var/etc/relayd.conf was incorrectly generated which prevents relayd from starting.

Replicating

  1. Install relayd plugin version 1.1_1
  2. Install new patch opnsense-patch -c plugins cfda7cd
  3. Configure pool entry with
Name: SMTP
Mode: Manual Failover
Port: 25
Monitor: SMTP
Server IP Address: 10.0.0.1
  1. Configure Virtual Server entry with
Name: SMTP
IP Address: 192.168.0.1
Port: 25
Mode: Relay
  1. relayd fails to start
  2. /var/etc/relayd.conf looks like:
log updates
timeout 1000
table <SMTP> {
        10.0.0.1
}
protocol "tcp" {
        tcp { nodelay, socket buffer 65536 }
}

relay "SMTP" {
  listen on 192.168.0.1 port 25
  protocol "tcp"
  forward to <> port
}
  1. Change Virtual Server mode from Relay to Redirect
  2. /var/etc/relayd.conf looks like:
log updates
timeout 1000
table <SMTP> {
        10.0.0.1
}
redirect "SMTP" {
  listen on 192.168.0.1 port 25
  forward to <SMTP> port 25 check send "" expect "220 *"
}
  1. Change Virtual Server mode from Redirect back to Relay
  2. Relayd STARTS
  3. /var/etc/relayd.conf looks like:
log updates
timeout 1000
table <SMTP> {
        10.0.0.1
}
protocol "tcp" {
        tcp { nodelay, socket buffer 65536 }
}

relay "SMTP" {
  listen on 192.168.0.1 port 25
  protocol "tcp"
  forward to <SMTP> port 25  check send "" expect "220 *"
}
bug

All 12 comments

It's true that relayd fails to start in step 5, but it also prompts to apply the configuration after which it seemed to work without doing 7 and 9 ?

BTW, why are you not using the better maintained HAProxy plugin? :)

Cheers,
Franco

Hmm, I could not get it to work after applying the configuration, I applied when prompted so maybe that caused the issue? I will need to check my own steps to replicate.

This is not the first time I have seen this problem, I saw it on my other test box where I found the first problem.

I actually started to use relayd for three reasons:

  1. I noticed you were the plugin maintainer so I thought that it would be rock solid;
  2. I only need it to relay SMTP; and
  3. I liked relayd's project goals (mainly "lean" "clean" and "secure")

I can change to HAProxy if recommended.

Sorry when I mean "caused the issue", should I make all the config changes and then apply the configuration rather than apply them every time prompted?

It looks like it did not save correctly for another reason in the form, maybe the configuration wasn't written correctly, but that seems to be a problem of the GUI page, not a problem of the code writing the config file with invalid data. That would explain why I did not see it and saving again from your end helped as well. But what triggered the faulty save in the form is not clear?

I only maintain this because it used to be core functionality and we wanted to remove it there but still keep it around for users. There are no plans to modernise the code or add new features, but all bug reports are still welcome.

I agree on the lean, clean and secure front. It's perfectly viable for use, just want to note that this plugin is not something that will make huge leaps forward anymore without a maintainer who uses it in real world deployments.

For anyone reading this now or in the future: If anybody wants the job, just let me know. :)

Cheers,
Franco

Sorry when I mean "caused the issue", should I make all the config changes and then apply the configuration rather than apply them every time prompted?

It doesn't matter. It probably saves a bit of time to not hit apply until all is done, but that's it. :)

Thanks for the tips.

I think I will stick with relayd as it fits my requirements as HAProxy is way overkill when I just tested it out.

I might have to fire up a few VMs and test a bit more as this was the second time I saw this and the resolution I performed was the same.

@shezzski when you hit this issue, please go to System: Configuration: History and try to diff the last changes made in the virtual server page. It will give hints as to if the settings were written correctly to the config.xml prior to reload.

@shezzski

I have heard that someone is going to rewrite relayd in MVC in 2018, which would make this issue obsolete.

Did this happen again? Should we close?

For reference: #451

Hi @fichtner I have seen this happen again, but have had not time to fully debug, due to the Holiday Season. I am happy for it to be closed due to the pending rewrite of relayd.

@shezzski thanks for the follow-up. @fbrendel will take good care of relayd in the future :)

A new version is on the way #492 :smile:

Was this page helpful?
0 / 5 - 0 ratings