tinkerbell / pbnj

Service for interacting with BMCs
Apache License 2.0
109 stars 37 forks source link

oob/bmc: redfish user account management #120

Closed joelrebel closed 2 years ago

joelrebel commented 2 years ago

Description

This implements the bmclib 'next' client interface methods to manage user accounts using Redfish.

Related https://github.com/bmc-toolbox/bmclib/pull/260

Why is this needed

Enables user account management on Dell BMCs through redfish

How Has This Been Tested?

Tested CreateUser, UpdateUser, DeleteUser on Dell BMCs using evans.

# evans

github.com.tinkerbell.pbnj.api.v1.BMC@127.0.0.1:50051> call CreateUser
✔ directAuthn
authn::directAuthn::host::host (TYPE_STRING) => 192.168.1.1
authn::directAuthn::username (TYPE_STRING) => root
authn::directAuthn::password (TYPE_STRING) => calvin
vendor::name (TYPE_STRING) => 
user_creds::username (TYPE_STRING) => foobar
user_creds::password (TYPE_STRING) => hunter2
✔ USER_ROLE_ADMIN
{
  "taskId": "c8af7l9licst11vmjft0"
}

# ❯ go run main.go server                                                                                                                                                        
[
  {
    "level": "info",
    "service": "github.com/tinkerbell/pbnj",
    "v": 0,
    "logger": "github.com/tinkerbell/pbnj",
    "caller": "github.com/tinkerbell/pbnj/grpc/server.go:125",
    "time": 1645538971718,
    "message": "starting PBnJ gRPC server"
  },
  {
    "level": "info",
    "service": "github.com/tinkerbell/pbnj",
    "grpc.method": "CreateUser",
    "grpc.service": "github.com.tinkerbell.pbnj.api.v1.BMC",
    "requestID": "QbECEILx",
    "bmcIP": "192.168.1.1",
    "taskID": "c8aetiplicsr0j7crp0g",
    "v": 0,
    "logger": "github.com/tinkerbell/pbnj",
    "username": "root",
    "vendor": "",
    "userCreds.Username": "foobar",
    "userCreds.UserRole": "USER_ROLE_ADMIN",
    "caller": "github.com/tinkerbell/pbnj/grpc/rpc/bmc.go:69",
    "time": 1645539019043,
    "message": "start CreateUser request"
  },
  {
    "level": "info",
    "service": "github.com/tinkerbell/pbnj",
    "grpc.method": "CreateUser",
    "grpc.service": "github.com.tinkerbell.pbnj.api.v1.BMC",
    "requestID": "QbECEILx",
    "bmcIP": "192.168.1.1",
    "taskID": "c8aetiplicsr0j7crp0g",
    "description": "creating user",
    "v": 0,
    "logger": "github.com/tinkerbell/pbnj",
    "complete": true,
    "caller": "github.com/tinkerbell/pbnj/grpc/taskrunner/taskrunner.go:135",
    "time": 1645539043550,
    "message": "task complete"
  }
]

How are existing users impacted? What migration steps/scripts do we need?

Checklist:

I have:

codecov[bot] commented 2 years ago

Codecov Report

Merging #120 (6cd347f) into main (9a09ef8) will increase coverage by 0.45%. The diff coverage is n/a.

:exclamation: Current head 6cd347f differs from pull request most recent head c5e858b. Consider uploading reports for the commit c5e858b to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #120      +/-   ##
==========================================
+ Coverage   86.20%   86.66%   +0.45%     
==========================================
  Files           8        8              
  Lines         435      435              
==========================================
+ Hits          375      377       +2     
+ Misses         47       45       -2     
  Partials       13       13              
Impacted Files Coverage Δ
grpc/taskrunner/taskrunner.go 65.26% <0.00%> (+2.10%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9a09ef8...c5e858b. Read the comment docs.

jacobweinstock commented 2 years ago

Hey @joelrebel. This looks good, thank you. Would you be open to using the latest commit in bmclib? We get a few things that would be nice, like an ipmitool power off fix.

joelrebel commented 2 years ago

@jacobweinstock yep, I've bumped bmclib to current HEAD.