OPNsense Forum

Archive => 19.1 Legacy Series => Topic started by: chrismarkovic on February 10, 2019, 04:56:35 pm

Title: 19.1.1 Alias API fails to retain data or create new alias
Post by: chrismarkovic on February 10, 2019, 04:56:35 pm
When using the alias_util api for Add / List, I am able to add an address to an existing alias list which is visible in the web interface. The additional entry will be added and will be visible via the API if "list"ing the alias, but after 10 - 20 seconds it will drop every entry in the list except the new one I just added. The

Existing Alias:

name: myalias
Hosts: 100.100.100.100

POST details:
addurl = 'https://fw/api/firewall/alias_util/add/myalias'

```
addalias = requests.post(addurl,
                verify=False,
                auth=(api_key, api_secret),
                json={'address': '200.200.200.200'})
```
i.e: listing the alias:
{u'current': 1, u'rowCount': 9999, u'total': 2, u'rows': [{u'ip': u'100.100.100.100'}, {u'ip': u'200.200.200.200'}]
}

after 10 seconds or so:
{u'current': 1, u'rowCount': 9999, u'total': 1, u'rows': [{u'ip': u'200.200.200.200'}]}

Additionally, when adding a NEW alias via the API, the alias is not visible in the web interface, nor selectable for any rules.

Please let me know if you require any further info or if I'm doing something wrong :)
Title: Re: 19.1.1 Alias API fails to retain data or create new alias
Post by: franco on February 10, 2019, 05:33:47 pm
It might be a bug, but then alias_util is no substitute for the actual alias endpoint which was written for general add / remove / edit.


Cheers,
Franco
Title: Re: 19.1.1 Alias API fails to retain data or create new alias
Post by: franco on February 10, 2019, 05:37:58 pm
Nevermind, see https://github.com/opnsense/core/issues/3214

I'd just want to ask posting references to forum on GitHub and GitHub references in the forum. It's much easier to follow and help (especially for others later on).
Title: Re: 19.1.1 Alias API fails to retain data or create new alias
Post by: seized on February 11, 2019, 04:54:30 am
It might be a bug, but then alias_util is no substitute for the actual alias endpoint which was written for general add / remove / edit.


Cheers,
Franco

Might be a dumb question, but SHOULD one be used over the other? This is for external scripts/etc.
Title: Re: 19.1.1 Alias API fails to retain data or create new alias
Post by: franco on February 11, 2019, 08:24:30 am
"alias" is the base implementation which was built to add, view, modify and delete aliases.

"alias_util" is a diagnostics tool for working with aliases where "alias" is not well-suited.


Cheers,
Franco