wifi icon indicating copy to clipboard operation
wifi copied to clipboard

Add sudo argument to Cell.all

Open yohanboniface opened this issue 9 years ago • 5 comments

A user must have root access to list interfaces, but we don't want to run python as root, which would be a big security issue. So this PR allows to only give sudo access to iwlist to the user running python.

I haven't see any unittests on Cell.all so I haven't added any. If I missed something, please point me to it :)

cc @ametaireau

yohanboniface avatar May 07 '15 15:05 yohanboniface

Hi @yohanboniface,

I think this is good.

Don't you need the sudo arg on other calls?

-rocky 2015年5月7日 上午9:44于 "Yohan Boniface" [email protected]写道:

A user must have root access to list interfaces, but we don't want to run python as root, which would be a big security issue. So this PR allows to only give sudo access to iwlist to the user running python.

I haven't see any unittests on Cell.all so I haven't added any. If I missed something, please point me to it :)

cc @ametaireau https://github.com/ametaireau

You can view, comment on, or merge this pull request online at:

https://github.com/rockymeza/wifi/pull/66 Commit Summary

  • Add sudo argument to Cell.all

File Changes

  • M wifi/scan.py https://github.com/rockymeza/wifi/pull/66/files#diff-0 (7)

Patch Links:

  • https://github.com/rockymeza/wifi/pull/66.patch
  • https://github.com/rockymeza/wifi/pull/66.diff

— Reply to this email directly or view it on GitHub https://github.com/rockymeza/wifi/pull/66.

rockymeza avatar May 07 '15 23:05 rockymeza

Good question? :)

Answer is not yet, but certainly in the near future ;)

@splite07, I guess we'll also need sudo to activate a given cell?

yohanboniface avatar May 08 '15 09:05 yohanboniface

Yes you are right! We will need to have sudo args on save() call, activate() call and probably delete() call

fheslouin avatar May 12 '15 09:05 fheslouin

OK, I'll update my PR this way. :) @rockymeza adding sudo kwarg to all those method sounds ok for you?

yohanboniface avatar May 12 '15 12:05 yohanboniface

@yohanboniface, I think it's ok. I don't know what else we would do. I would love to have some unit tests that mock subprocess just to make sure that this is working. (I know it didn't have any before, sorry!)

rockymeza avatar May 12 '15 15:05 rockymeza