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

Need a way to set privilege level #23

Closed
mrichar1 opened this issue Sep 26, 2014 · 4 comments
Closed

Need a way to set privilege level #23

mrichar1 opened this issue Sep 26, 2014 · 4 comments

Comments

@mrichar1
Copy link

Both ipmitool and freeipmi assume a default privilege level for the connection (administrator and operator respectively). This will result in an error if the user isn't at this level.

Both toolsets have a flag to pass in a specific priv (-L and -l) - can rubyipmi be extended to support setting the privilege level in the connection object?

Thanks!

@logicminds
Copy link
Owner

I thought the privilege (operator, administrator) was assigned to the user at user creation time? It seems weird that the CLI/Rubyipmi would be able to override the role that is assigned to the user.

To answer your question about extending support. Yes it would be really simple to add the priv option to the connection object. Basically would need to do the following in the initialize method of the connection object.

If you want to code this yourself and issue a pull request it should be fairly simple to do. Otherwise I can probably take care of this next week.

class Connection
def initialize
...
@options['L'] = opts[:priv] if opts.keys?(:priv)
# should probably check to make sure the priv type matches one of these
#-L <privlvl>
#              Force session privilege level.  Can be CALLBACK, USER, OPERATOR, ADMINISTRATOR. #Default is ADMINISTRATOR.
end

then call

conn = Rubyipmi.connect("username", "password", "hostname", {:priv => 'OPERATOR'})

@logicminds
Copy link
Owner

@mrichar1 just pushed branch 0.8.0 with this support. https://github.com/logicminds/rubyipmi/tree/0.8.0

I haven't merged to master yet until I can get my integration tests to pass. Feel free to test using this branch.

The privilege is optional as I am seeing weird issues sometimes when using it. Just provide this option to test out.

conn = Rubyipmi.connect("username", "password", "hostname", 'any', {:privilege => 'OPERATOR'})
# PRIV_TYPES = ['CALLBACK', 'USER', 'OPERATOR', 'ADMINISTRATOR']

@mrichar1
Copy link
Author

mrichar1 commented Oct 2, 2014

Hi,

I've done some testing and it seems to work as expected, both with ipmitool and freeipmi.

Many thanks!

@logicminds
Copy link
Owner

this has now been merge to master. Will release to ruby gems shortly.

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

2 participants