Skip to content

Added SetRecoveryLock support#757

Merged
jessepeterson merged 30 commits intomicromdm:mainfrom
tomaswallentinus:patch-2
Jun 16, 2021
Merged

Added SetRecoveryLock support#757
jessepeterson merged 30 commits intomicromdm:mainfrom
tomaswallentinus:patch-2

Conversation

@tomaswallentinus
Copy link
Contributor

It says SetFirmwarePassword on the files, but its meant to be SetRecoveryLock and VerifyRecoveryLock.

I was thinking about test files, but in what file should I put the tests?

Added the M1-equivalent to SetFirmwarePassword. I haven't seen the docs yet but would be suprised if its not the same as for SetFirmwarePassword
Added the M1-equivalent to SetFirmwarePassword. I haven't seen the docs yet but would be suprised if its not the same as for SetFirmwarePassword
Added the M1-equivalent to SetFirmwarePassword. I haven't seen the docs yet but would be suprised if its not the same as for SetFirmwarePassword
Added the M1-equivalent to SetFirmwarePassword. I haven't seen the docs yet but would be suprised if its not the same as for SetFirmwarePassword
Added the M1-equivalent to SetFirmwarePassword. I haven't seen the docs yet but would be suprised if its not the same as for SetFirmwarePassword
Added the M1-equivalent to SetFirmwarePassword. I haven't seen the docs yet but would be suprised if its not the same as for SetFirmwarePassword
Added support for RequestRequiresNetworkTether
Added the M1-equivalent to SetFirmwarePassword. I haven't seen the docs yet but would be suprised if its not the same as for SetFirmwarePassword
Added support for RequestRequiresNetworkTether
Added the M1-equivalent to SetFirmwarePassword. I haven't seen the docs yet but would be suprised if its not the same as for SetFirmwarePassword
Added support for RequestRequiresNetworkTether
Added the M1-equivalent to SetFirmwarePassword. I haven't seen the docs yet but would be suprised if its not the same as for SetFirmwarePassword
Added the SetFirmwarePassword. Only for Intel-macs
Added the M1-equivalent to VerifyFirmwarePassword. I haven't seen the docs yet but would be suprised if its not the same as for VerifyFirmwarePassword
Added missing command for VerifyFirmwarePassword (only for Intel macs)
Added test case for SetRecoveryLock
@meta-github
Copy link
Contributor

verify_firmware_password script is using VerifyRecoveryLock. A typo?

@jessepeterson
Copy link
Member

When you're happy with this I would love to see some testing along the lines of how #743 was done (:heart: @korylprince).

@tomaswallentinus
Copy link
Contributor Author

tomaswallentinus commented Jun 10, 2021 via email

@tomaswallentinus
Copy link
Contributor Author

If I run gofmt -s -l . now I only get info about platform/blueprint/blueprint.go but that file is not even in the commit.

@tomaswallentinus
Copy link
Contributor Author

Everything works as expected =)

Request Current Local Password CurrentPassword NewPassword Result
SetRecoveryLock empty 1234 test Acknowledged, No password change
SetRecoveryLock empty empty 1234 Password changed
SetRecoveryLock 1234 1234 empty Password removed
         
Request Current Local Password Password   Result
VerifyRecoveryLock empty empty   PasswordVerified=true
VerifyRecoveryLock 1234 empty   Error, Existing recovery lock password not provided
VerifyRecoveryLock 1234 1111   PasswordVerified=false
VerifyRecoveryLock 1234 1234   PasswordVerified=true

@jessepeterson jessepeterson self-assigned this Jun 11, 2021
@jessepeterson
Copy link
Member

When I checkout your branch I get:

$ gofmt -s -l .
mdm/mdm/internal/mdmproto/mdm.pb.go

Looks like that file still needs some formatting. :)

@tomaswallentinus
Copy link
Contributor Author

It doesn't work for me. I have updated protobuf, i have removed mdm.pb.go and generated it again, but it's still gets the same format error. Why don't my gofmt see whats wrong with mdm.pb.go and why is mdm.pb.go generated with incorrect format when the other files are correct?

@tomaswallentinus
Copy link
Contributor Author

This one is ready for production if anyone wants to review :)

@jessepeterson
Copy link
Member

@tomaswallentinus I'm curious how you generated the mdm.pb.go file. When I checkout your branch and just run go generate it seems to make very drastic changes (what I think is a "revert" of the changes you made). If you look at the diff it even reverts the protobuf version somehow: proto.ProtoPackageIsVersion2 from proto.ProtoPackageIsVersion3. Which tooling did you install to make it do that?

Copy link
Member

@jessepeterson jessepeterson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This generally looks good. I want to get to the bottom of the mdm.pb.go file changes, though. See my other comment. Once that's resolved then I think this is good to go!

@tomaswallentinus
Copy link
Contributor Author

I have seen that as well. Is it because I use Ubuntu 20.04 instead of macOS maybe?

@jessepeterson
Copy link
Member

I don't think its platform dependent. How did you install the protoc tools? I have:

$ which protoc
/usr/local/bin/protoc
$ protoc --version
libprotoc 3.2.0
$ go install github.com/gogo/protobuf/[email protected]

@tomaswallentinus
Copy link
Contributor Author

I accualy just used: go get github.com/gogo/protobuf/protoc-gen-gofast
But I used your version install now and it generates the same file.

$which protoc
/usr/bin/protoc
$protoc --version
libprotoc 3.17.3
$go version
go version go1.16.5 linux/amd64
$cd mdm/mdm/internal/mdmproto
$rm mdm.pb.go
$go generate

And that gives me the "proto.ProtoPackageIsVersion2" line.

@tomaswallentinus
Copy link
Contributor Author

Not even updating protoc-gen-go to: https://github.com/protocolbuffers/protobuf-go/releases v 1.26 gives me a later version number.

@jessepeterson
Copy link
Member

Could it be a pathing issue (could you have an older protoc-gen-gofast)? My understanding is that go shells out to protoc which then shells out to protoc-gen-gfast. Could protoc be finding a different protoc-gen-gofast maybe? I can't duplicate this.

@tomaswallentinus
Copy link
Contributor Author

Looks like it. If I run
sudo find . -name "protoc-gen-gofast
I have:

./home/*/go/pkg/mod/github.com/gogo/[email protected]/protoc-gen-gofast
./home/*/go/bin/protoc-gen-gofast
./root/go/pkg/mod/github.com/gogo/[email protected]/protoc-gen-gofast
./root/go/bin/protoc-gen-gofast
./usr/share/gocode/src/github.com/gogo/protobuf/protoc-gen-gofast
./usr/bin/protoc-gen-gofast

I will try moving them.

@tomaswallentinus
Copy link
Contributor Author

O-holy-night🎷 that did it.
I needed to do:
rm /usr/bin/protoc-gen-gofast sudo mv /home/*/go/bin/protoc-gen-gofast /usr/bin/protoc-gen-gofast
Now the versionnumber in the file is 3.

Copy link
Member

@jessepeterson jessepeterson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Glad that worked. The diff for the .pb.go file is more like what I expected now, too.

@jessepeterson jessepeterson merged commit 1dfa0a8 into micromdm:main Jun 16, 2021
@tomaswallentinus tomaswallentinus deleted the patch-2 branch June 16, 2021 21:11
@ivanhata ivanhata mentioned this pull request Sep 14, 2021
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

Successfully merging this pull request may close these issues.

3 participants