FOGProject / fogproject

An open source computer cloning & management system
https://fogproject.org
GNU General Public License v3.0
1.14k stars 222 forks source link

Updating the MAC list ignores proxy settings, times out, zero's out MAC list #446

Closed jmechalas closed 2 years ago

jmechalas commented 2 years ago

If you try to manually update the MACs from the FOG configuration page, your proxy settings are ignored and it tries to fetch them directly which results in a timeout, and zero's out your existing MAC list.

The issue seems to be the call to open() in fogconfigurationpage.class.php. It is not creating a context for a proxy if a proxy is defined. Manually adding this code resolves the issue:

        $context= stream_context_create(array(
            'http' => array(
                'proxy' => 'tcp://PROXY_ADDRESS_HERE',
                'request_fulluri' => true
            )
        ));
        $url = 'http://standards-oui.ieee.org/oui.txt';
        if (($fh = fopen($url, 'rb', false, $context)) === false) {
            throw new Exception(_('Could not read temp file'));
        }

This of course is hardcoding a proxy so it's not a "proper" fix, but it does confirm the issue.

Sebastian-Roth commented 2 years ago

@jmechalas Thanks for open this issue report, posting the details and sorry for the long delay.

I think what you are looking for is already done in dev-branch: https://github.com/FOGProject/fogproject/commit/cff7a50ce439bbe0e7d1d8f0f7281c003018f67e