OPNsense Forum

Archive => 22.1 Legacy Series => Topic started by: Souljacker on June 24, 2022, 08:08:45 am

Title: os-ddclient 1.7 - PHP Error
Post by: Souljacker on June 24, 2022, 08:08:45 am
Hello!

Just updated OPNsense to 22.1.9-amd64. Then i was trying to add a new service to os-ddclient-1.7. Resulted in an PHP-Error. Anyone else facing this issue?

[24-Jun-2022 08:05:09 Europe/Berlin] Exception: Error at /usr/local/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php:55 - Undefined index: ip (errno=8) in /usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:152
Stack trace:
#0 /usr/local/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php(55): OPNsense\Base\ApiControllerBase->APIErrorHandler(8, 'Undefined index...', '/usr/local/opns...', 55, Array)
#1 /usr/local/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php(76): OPNsense\DynDNS\FieldTypes\AccountField->addStatsFields(Object(OPNsense\Base\FieldTypes\ContainerField))
#2 /usr/local/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php(193): OPNsense\DynDNS\FieldTypes\AccountField->actionPostLoadingEvent()
#3 /usr/local/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php(191): OPNsense\Base\FieldTypes\BaseField->eventPostLoading()
#4 /usr/local/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php(191): OPNsense\Base\FieldTypes\BaseField->eventPostLoading()
#5 /usr/local/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php(361): OPNsense\Base\FieldTypes\BaseField->eventPostLoading()
#6 [internal function]: OPNsense\Base\BaseModel->__construct()
#7 /usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableServiceControllerBase.php(96): ReflectionClass->newInstance()
#8 /usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableServiceControllerBase.php(207): OPNsense\Base\ApiMutableServiceControllerBase->getModel()
#9 [internal function]: OPNsense\Base\ApiMutableServiceControllerBase->statusAction()
#10 [internal function]: Phalcon\Dispatcher\AbstractDispatcher->callActionMethod(Object(OPNsense\DynDNS\Api\ServiceController), 'statusAction', Array)
#11 [internal function]: Phalcon\Dispatcher\AbstractDispatcher->dispatch()
#12 /usr/local/opnsense/www/api.php(26): Phalcon\Mvc\Application->handle('/api/dyndns/ser...')
#13 {main}
Title: Re: os-ddclient 1.7 - PHP Error
Post by: JamesFrisch on June 24, 2022, 03:28:01 pm
Some issue here.

Opening Dynamic DNS gives me three popups with this warning:

An API exception occured
/usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:152: Error at /usr/local/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php:55 - Undefined index: ip (errno=8)

while the Log File shows:
52682 - [meta sequenceId="1"] WARNING: found neither ipv4 nor ipv6 address


Dynamic DNS is not even enabled. Dynamic DNS (legacy) is still active if that makes a difference.

Enabling Dynamic DNS results in a issue report.
Title: Re: os-ddclient 1.7 - PHP Error
Post by: arevamp on June 24, 2022, 08:13:59 pm
I had the same error today after updating OPNSense to 22.1.9 and installing os-ddclient 1.7.
I added a DynDNS account and realized, that the ip address was not updated, I tried to reload the service and from there on I always get the PHP Error message, the account I had added has disappeared and I'm not able to add a new account.
All dropdown fields in the mask for adding a new account are empty.
Deinstalling and Reinstalling os-ddclient didn't help.
Title: Re: os-ddclient 1.7 - PHP Error
Post by: AdSchellevis on June 24, 2022, 08:26:37 pm
can you try https://github.com/opnsense/plugins/commit/339993680de4453962d21546a181550bd1cc0f0f ?

To install via a console, use the following command:

Code: [Select]
opnsense-patch -c plugins 33999368

the /var/tmp/ddclient.cache  file likely contains incomplete data.

Best regards,

Ad
Title: Re: os-ddclient 1.7 - PHP Error
Post by: edjosh on June 24, 2022, 08:43:39 pm
I had the same issue and this fixed it.  Thanks!
Title: Re: os-ddclient 1.7 - PHP Error
Post by: Hambone on June 25, 2022, 04:10:12 pm
This patch also fixed the issue for me, thanks AdSchellevis! Now all we need is Cloudflare API token functionality and a dashboard widget like the legacy Dynamic DNS and ddclient *might* become usable  ;)
Title: Re: os-ddclient 1.7 - PHP Error
Post by: pewpewpow on June 26, 2022, 12:58:49 pm
This fixed my issue, too. Looks like I have to issue the command each time I add a service.

can you try https://github.com/opnsense/plugins/commit/339993680de4453962d21546a181550bd1cc0f0f ?

To install via a console, use the following command:

Code: [Select]
opnsense-patch -c plugins 33999368

the /var/tmp/ddclient.cache  file likely contains incomplete data.

Best regards,

Ad
Title: Re: os-ddclient 1.7 - PHP Error
Post by: AdSchellevis on June 26, 2022, 02:00:25 pm
Quote
....  I have to issue the command each time I add a service.

No you don't, executing it again will revert the change...
Title: Re: os-ddclient 1.7 - PHP Error
Post by: nodakbarnes on June 27, 2022, 01:13:28 am
The patch applied from console fixed it for me as well...thanks!
Title: Re: os-ddclient 1.7 - PHP Error
Post by: pewpewpow on June 28, 2022, 07:37:56 pm
Quote
....  I have to issue the command each time I add a service.

No you don't, executing it again will revert the change...

Hmm...Well I don't know then. I guess I added a second service, had the PHP errors, then I must have issued the command twice or something to that effect. Anyhoo, I managed to get three working DDNS services added, so I'm good.  :D

Thanks
Title: Re: os-ddclient 1.7 - PHP Error
Post by: MBfromOK on June 28, 2022, 08:36:07 pm
can you try https://github.com/opnsense/plugins/commit/339993680de4453962d21546a181550bd1cc0f0f ?

To install via a console, use the following command:

Code: [Select]
opnsense-patch -c plugins 33999368

the /var/tmp/ddclient.cache  file likely contains incomplete data.

Best regards,

Ad


(FROM: https://github.com/opnsense/plugins/issues/3019)

Thanks AdSchellevis,

Running the patch (at the visible level) had the temporary effect of making the entry visible.
There were no errors displayed, and it didn't look like there was a need to add / change anything.

Now, several minutes later I am getting this:

An API exception has occured
/usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:152: Error at /usr/local/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php:55 - Undefined index: ip (errno=8)

Secondarily: I keep seeing that the GUI doesn't support CloudFlare tokens (and tried to use one here), do you know if that is that still true?

Also, it seems like you told us to install a patch without telling us what it was or why we needed it... I chose to trust your input, but it would be great to know why you are recommending the patch and what you expect it to do (to help make sure it works and to establish expectations)
Title: Re: os-ddclient 1.7 - PHP Error
Post by: MBfromOK on June 28, 2022, 08:42:04 pm
I ran the patch again, got the following in the console, and can now see the Service entry in the list:
Code: [Select]
Found local copy of 33999368, skipping fetch.
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|From 339993680de4453962d21546a181550bd1cc0f0f Mon Sep 17 00:00:00 2001
|From: Ad Schellevis <ad@opnsense.org>
|Date: Fri, 24 Jun 2022 20:11:31 +0200
|Subject: [PATCH] dns/ddclient - validate statistics before usage to prevent
| missing fields, for now let's assume mtime is always filled, ip apparantly
| isn't. ref https://forum.opnsense.org/index.php?topic=28835.msg140355
|
|---
| dns/ddclient/Makefile                                           | 1 +
| .../mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php  | 2 +-
| 2 files changed, 2 insertions(+), 1 deletion(-)
|
|diff --git a/dns/ddclient/src/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php b/dns/ddclient/src/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php
|index 24d856e99e..b11bcaf7c0 100644
|--- a/dns/ddclient/src/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php
|+++ b/dns/ddclient/src/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php
--------------------------
Patching file opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php using Plan A...
Hunk #1 succeeded at 50.
done
All patches have been applied successfully.  Have a nice day.

In Github issue 361 https://github.com/ddclient/ddclient/issues/361 (https://github.com/ddclient/ddclient/issues/361) ddclient 3.10.0 is being recommended for install by SuperSandro2000 in response to https://github.com/ddclient/ddclient/issues/361#issuecomment-1149646988 (https://github.com/ddclient/ddclient/issues/361#issuecomment-1149646988).

The releases page (https://github.com/ddclient/ddclient/tree/release/release-3.10.0 (https://github.com/ddclient/ddclient/tree/release/release-3.10.0))shows that it has been built / uploaded to FreeBSD.ports.

Title: Re: os-ddclient 1.7 - PHP Error
Post by: MBfromOK on June 28, 2022, 09:52:38 pm
Is there a path to get this release added to the OPNsense plugins (or whatever the appropriate description is) library (or get the plugin modified to use the release version instead of 3.9.1)
Title: Re: os-ddclient 1.7 - PHP Error
Post by: franco on June 29, 2022, 09:19:29 am
I'll update the port today and it'll be in 22.1.10 then, but I'm unsure if there are any upstream issues with it. We just have to do it to see it. I don't think FreeBSD ports is moving forward at the moment so we might as well update it there too.


Cheers,
Franco
Title: Re: os-ddclient 1.7 - PHP Error
Post by: franco on June 29, 2022, 09:22:27 am
Actually, 3.10.0_1 and 3.10.0_2 are pre-release versions but we might as well use it.


Cheers,
Franco
Title: Re: os-ddclient 1.7 - PHP Error
Post by: franco on June 29, 2022, 01:20:43 pm
I've done the update, fixed a few oddities in our plugin and finally tested version 0.3.10 and it break my duckdns test case:

FAILED:   updating xxx.duckdns.org: Server said: '0'

On the currently available version:

SUCCESS:  updating xxx.duckdns.org: good: IP address set to x.y.z.a

For anyone who wants to try the commit for ports is https://github.com/opnsense/ports/commit/34c7fd00d8f1c


Cheers,
Franco
Title: Re: os-ddclient 1.7 - PHP Error
Post by: hamadabsi on June 29, 2022, 04:50:59 pm

This one solve the issue but when you update or add a new domain error message shows again.

can you try https://github.com/opnsense/plugins/commit/339993680de4453962d21546a181550bd1cc0f0f ?

To install via a console, use the following command:

Code: [Select]
opnsense-patch -c plugins 33999368

the /var/tmp/ddclient.cache  file likely contains incomplete data.

Best regards,

Ad
Title: Re: os-ddclient 1.7 - PHP Error
Post by: dcol on June 29, 2022, 11:39:15 pm
ddclient does not work for me. the older legacy work fine for a couple years
I did the update to 1.7_2 which did fix the PHP errors.

Here is what I get now
2022-06-29T14:34:28-07:00   Notice   ddclient[96998]   34730 - [meta sequenceId="4"] WARNING: found neither ipv4 nor ipv6 address   
2022-06-29T14:34:17-07:00   Notice   ddclient[9503]   24521 - [meta sequenceId="3"] WARNING: file /usr/local/etc/ddclient.conf: file /usr/local/etc/ddclient.conf must be accessible only by its owner (fixed).

How to fix?
Title: Re: os-ddclient 1.7 - PHP Error
Post by: franco on June 30, 2022, 09:03:50 am
dyndns checkip service with forced TLS doesn't yield an address it seems, e.g. freedns checkip service works fine. legacy plugin never used https for checkip so "it" wasn't an "issue".


Cheers,
Franco
Title: Re: os-ddclient 1.7 - PHP Error
Post by: dcol on June 30, 2022, 05:37:33 pm
What about the other item 'must be accessible only by its owner (fixed)'
Is this something I need to address?

What really concerns me is that ddclient is not presenting itself to my Dynamic DNS service. Updates are not occurring. There are no log entries for this either.
Title: Re: os-ddclient 1.7 - PHP Error
Post by: WN1X on June 30, 2022, 09:05:40 pm
I am seeing the same "file /usr/local/etc/ddclient.conf must be accessible only by its owner (fixed)" error messages. When I check the file I see:

Code: [Select]
root@OPNsense:/usr/local/etc # ll ddclient.conf
-rw-------  1 root  wheel  239 Jun 29 06:26 ddclient.conf

ddclient appears to be running as "root", so I believe the message is bogus.
Title: Re: os-ddclient 1.7 - PHP Error
Post by: franco on June 30, 2022, 09:53:06 pm
I've added a "fix" for the permission to the next version, but I agree that it is more or less esoteric.

https://github.com/opnsense/plugins/commit/8e7ec17828f3


Cheers,
Franco