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

[Error] module 'configparser' has no attribute 'SafeConfigParser'. Did you mean: 'RawConfigParser' #60

Closed
mute019 opened this issue Dec 4, 2023 · 6 comments · Fixed by #61

Comments

@mute019
Copy link
Contributor

mute019 commented Dec 4, 2023

I replaced the SafeConfigParser() with RawConfigParser() in the config.py and Zeekctl started working. Right now, I am wondering about the issues I might face for changing it in the future. I would love to see a feedback from your side about it. Thank You!

@awelzel
Copy link
Contributor

awelzel commented Dec 4, 2023

Thank you. Not sure how this hasn't come up, seems SafeConfigParser has been deprecated since Python 3.2.

I think just using ConfigParser should be more appropriate. How would you feel about opening a PR?

In [3]: configparser.SafeConfigParser()
<ipython-input-3-980feb9aa499>:1: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in Python 3.12. Use ConfigParser directly instead.
  configparser.SafeConfigParser()
Out[3]: <configparser.SafeConfigParser at 0x7fed340b3580>

@awelzel awelzel transferred this issue from zeek/zeek Dec 4, 2023
@awelzel
Copy link
Contributor

awelzel commented Dec 4, 2023

Might be good to understand why zeekctl didn't show the deprecation warning or why no test caught that.

@mute019
Copy link
Contributor Author

mute019 commented Dec 4, 2023

Okay, I will open a pull request tomorrow.

@ckreibich
Copy link
Member

It's pretty funny — the deprecation warning comes from warnings.warn(..., DeprecationWarning), which only shows when happening in __main__ or when PYTHONDEVMODE=1:

$ zeekctl
Hint: Run the zeekctl "deploy" command to get started.

Welcome to ZeekControl 2.5.0-24

Type "help" for help.

[ZeekControl] >
$ PYTHONDEVMODE=1 zeekctl
/home/christian/inst/opt/zeek/lib64/zeek/python/zeekctl/ZeekControl/config.py:389: DeprecationWarning: The SafeConfigParser class has been renamed to ConfigParser in Python 3.2. This alias will be removed in Python 3.12. Use ConfigParser directly instead.
  config = configparser.SafeConfigParser()
Hint: Run the zeekctl "deploy" command to get started.

Welcome to ZeekControl 2.5.0-24

Type "help" for help.

[ZeekControl] >

They didn't yell loud enough for us to notice...

@mute019
Copy link
Contributor Author

mute019 commented Dec 5, 2023

Okay, another issue, I guess. In the documentation, it is not explicit mentioned in the documentation of the zeekctl whether we should run zeekctl using sudo command.

Without sudo I am able to access the zeekctl but I am still facing an issue with permissions.

`zeekctl
Error: failed to write file: [Errno 13] Permission denied: '/usr/local/zeek/spool/.zeekctl-config.sh.tmp'

Welcome to ZeekControl 2.5.0-39

Type "help" for help.

[ZeekControl] > deploy
Error: failed to read lock file: [Errno 2] No such file or directory: '/usr/local/zeek/spool/lock'
Error: Unable to get lock
[ZeekControl] > exit
`

Hence, the conclusion:

With RawConfigParser only root can access zeekctl.
With ConfigParser both root and normal user are able access zeekctl but the normal user is facing issues with permissions.

@mute019
Copy link
Contributor Author

mute019 commented Dec 5, 2023

Okay, another issue, I guess. In the documentation, it is not explicit mentioned in the documentation of the zeekctl whether we should run zeekctl using sudo command.

Without sudo I am able to access the zeekctl but I am still facing an issue with permissions.

`zeekctl Error: failed to write file: [Errno 13] Permission denied: '/usr/local/zeek/spool/.zeekctl-config.sh.tmp'

Welcome to ZeekControl 2.5.0-39

Type "help" for help.

[ZeekControl] > deploy Error: failed to read lock file: [Errno 2] No such file or directory: '/usr/local/zeek/spool/lock' Error: Unable to get lock [ZeekControl] > exit `

Hence, the conclusion:

With RawConfigParser only root can access zeekctl. With ConfigParser both root and normal user are able access zeekctl but the normal user is facing issues with permissions.

Sorry, I overlooked the FAQ section in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants