Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config_set does update but new Virtual IP is not added #80

Open
maltere opened this issue Jun 7, 2021 · 1 comment
Open

config_set does update but new Virtual IP is not added #80

maltere opened this issue Jun 7, 2021 · 1 comment

Comments

@maltere
Copy link

maltere commented Jun 7, 2021

I try to update the Virtual IPs using the FauxAPI, but added IPs are not actually assigned to the interface.

I can add or remove the configuration of new Virtual IPs. The IPs are shown in the WebGUI and are also shown in the API call using config_get.
However, these IPs are not added nor removed after an successful API call. If I update the Virtual IP in the Web GUI the IP is added to the Interface. (click the edit button and save without changes)

api = PfsenseFauxapi(config.PFSENSE_IP,
                     config.FAUXAPI_KEY,
                     config.FAUXAPI_SECRET)

vips_raw = ['192.168.50.5'] # example ip

new_vips = [
    {
        'mode': 'ipalias',
        'interface': 'wan',
        'uniqid': '60be5980e1c0d',
        'descr': '',
        'type': 'single',
        'subnet_bits': '32',
        'subnet': ip
    }
    for ip in vips_raw
]

api.config_set({ 'vip': new_vips }, 'virtualip')

I tried additionally:

api.config_reload()
api.send_event('interface reconfigure all')

What else can I try to add the Virtual IP via the FauxAPI?

@maltere
Copy link
Author

maltere commented Jun 8, 2021

In case someone wonders:

Not setting the param uniqid or setting it uniquely computed based on the IP is also not helping.

def uniqueid(ip):
    length = 13
    _hashable = f'salt-vip {ip}'
    _hash = sha256(_hashable.encode('utf-8')).hexdigest()
    return _hash[:length].lower()

new_vips = [
    {
        'mode': 'ipalias',
        'interface': 'wan',
        'uniqid': uniqueid(ip),
        'descr': 'Added by DB Listen',
        'type': 'single',
        'subnet_bits': '32',
        'subnet': ip
    }
    for ip in vips_raw
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant