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

FreeNAS iocage Plugin #120

Closed
gt2416 opened this issue Jan 28, 2019 · 6 comments
Closed

FreeNAS iocage Plugin #120

gt2416 opened this issue Jan 28, 2019 · 6 comments
Assignees
Milestone

Comments

@gt2416
Copy link

gt2416 commented Jan 28, 2019

Using the plugin, amazon-dash service does not start. It results in this error :

File "/usr/local/lib/python3.6/site-packages/scapy/arch/__init__.py", line 63, in <module>
    conf.use_bpf = True
  File "/usr/local/lib/python3.6/site-packages/scapy/config.py", line 75, in __set__
    self.hook(self.name, val, *self.args, **self.kargs)
  File "/usr/local/lib/python3.6/site-packages/scapy/config.py", line 491, in _socket_changer
    _set_conf_sockets()
  File "/usr/local/lib/python3.6/site-packages/scapy/config.py", line 436, in _set_conf_sockets
    raise ScapyInvalidPlatformException("Darwin (OSX) only !")
scapy.error.ScapyInvalidPlatformException: Darwin (OSX) only !

It also spits out the same error if installed manually.

I think only the last few lines are relevant, I have not touched anything, just installed the plugin and added 1 Homeassistant command in the xml file.

Another question, In the config file, where it says legacy-api for HomeAssistant, is that where you put the newer access token ?
Thanks

@tprelog
Copy link

tprelog commented Jan 29, 2019

@gt2416 I think the error is related to this issue with scapy

I have done a test install of the plugin and got it running by replacing /usr/local/lib/python3.6/site-packages/scapy/config.py with this version from github

I found the easiest approach to install wget and download the file directly using the plugin console

root@amazon-dash:~ #

pkg install wget ca_root_nss
wget -O /usr/local/lib/python3.6/site-packages/scapy/config.py https://raw.githubusercontent.com/secdev/scapy/master/scapy/config.py
service amazon-dash start

service amazon-dash status
amazondash is running as pid 10803.

For a long live access token replace that line with access_token: (obviously include your token)

Note: I also suggest you install ca_root_nss > This is not related to your error but I have just discovered this is required for amazon-dash --version to work correctly

@gt2416
Copy link
Author

gt2416 commented Jan 29, 2019

Thanks for the fast response.
After getting the new scapy.py file, it now errors out with this:

File "/usr/local/lib/python3.6/site-packages/scapy/arch/bpf/supersocket.py", line 58, in __init__
   (self.ins, self.dev_bpf) = get_dev_bpf()
 File "/usr/local/lib/python3.6/site-packages/scapy/arch/bpf/core.py", line 98, in get_dev_bpf
   raise Scapy_Exception("No /dev/bpf handle is available !")
scapy.error.Scapy_Exception: No /dev/bpf handle is available !

I have tried setting the option --ignore-perms --root-allowed to see if this was a permission issue, but it didnt fix it.
The device /dev/bpf does not exits in my file system, even though I double checked that bpf was ticked in the iocage jail settings.
This is on FreeNAS 11.2-RELEASE U1

Edit: I just recreated the plugin and it works. (after using the wget to get the new scapy file)
Not sure why my original jail is spitting out errors. The only difference was that instead of dhcp I assigned it a ipv4 address.

@tprelog
Copy link

tprelog commented Jan 29, 2019

I just recreated the plugin and it works. (after using the wget to get the new scapy file)
Not sure why my original jail is spitting out errors. The only difference was that instead of dhcp I assigned it a ipv4 address

I'm pretty sure this a FreeNAS (iocage) issue. In general I've seen others report issues when trying to set an assigned IP address during creation. It seems like this works just fine for some people but for others it does not. I've always had good luck using the dhcp=on vnet=on bpf=yes options. Also I've seen others suggest these options when setting an IP manually fails to work. Besides I find (in my opinion) it much easier to manage IP address in one place, on my router, rather than multiple computers, VMs, and(or) jails

@tprelog
Copy link

tprelog commented Jan 29, 2019

After further testing the original error exist in scapy 2.4.1 and 2.4.2.

The last working version was scapy 2.4.0 as alternative to using the wget workaround mentioned above downgrading to scapy 2.4.0 inside the jail will also work.

root@amazon-dash:~ #

pip install scapy==2.4.0
service amazon-dash start

EDIT: I have updated the plugin script to (hopefully) handle this auto-magically.

@tprelog
Copy link

tprelog commented Jan 29, 2019

@Nekmo I think you can close this now.

@Nekmo
Copy link
Owner

Nekmo commented Feb 3, 2019

Thanks for the notice! it may be a bug in Scapy. I'll wait for a patched version.

@Nekmo Nekmo self-assigned this Feb 3, 2019
Nekmo added a commit that referenced this issue Feb 6, 2019
@Nekmo Nekmo closed this as completed Mar 14, 2019
@Nekmo Nekmo added this to the v1.3.3 milestone Mar 14, 2019
@Nekmo Nekmo modified the milestones: v1.3.3, v1.4.0 Mar 22, 2019
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

3 participants