Skip to content

Commit

Permalink
Fixing compile/lint issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
getvictor committed Sep 25, 2024
1 parent 97931c3 commit e6ecd8f
Show file tree
Hide file tree
Showing 19 changed files with 11 additions and 1,696 deletions.
4 changes: 3 additions & 1 deletion server/mdm/scep/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ SCEPSERVER=\

my: scepclient-$(OSARCH) scepserver-$(OSARCH)

win: scepclient-$(OSARCH).exe scepserver-$(OSARCH).exe

docker: scepclient-linux-amd64 scepserver-linux-amd64

$(SCEPCLIENT):
Expand Down Expand Up @@ -48,4 +50,4 @@ test:
test-race:
go test -cover -race ./...

.PHONY: my docker $(SCEPCLIENT) $(SCEPSERVER) release clean test test-race
.PHONY: my mywin docker $(SCEPCLIENT) $(SCEPSERVER) release clean test test-race
54 changes: 1 addition & 53 deletions server/mdm/scep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Binary releases are available on the [releases page](https://github.com/micromdm
To compile the SCEP client and server you will need [a Go compiler](https://golang.org/dl/) as well as standard tools like git, make, etc.

1. Clone the repository and get into the source directory: `git clone https://github.com/micromdm/scep.git && cd scep`
2. Compile the client and server binaries: `make`
2. Compile the client and server binaries: `make` (for Windows: `make win`)

The binaries will be compiled in the current directory and named after the architecture. I.e. `scepclient-linux-amd64` and `scepserver-linux-amd64`.

Expand Down Expand Up @@ -178,58 +178,6 @@ docker run -it --rm -v /path/to/ca/folder:/depot micromdm/scep:latest ca -init
docker run -it --rm -v /path/to/ca/folder:/depot -p 8080:8080 micromdm/scep:latest
```
## SCEP library
The core `scep` library can be used for both client and server operations.
```
go get github.com/micromdm/scep/scep
```
For detailed usage, see the [Go Reference](https://pkg.go.dev/github.com/micromdm/scep/v2/scep).
Example (server):
```go
// read a request body containing SCEP message
body, err := ioutil.ReadAll(r.Body)
if err != nil {
// handle err
}
// parse the SCEP message
msg, err := scep.ParsePKIMessage(body)
if err != nil {
// handle err
}
// do something with msg
fmt.Println(msg.MessageType)
// extract encrypted pkiEnvelope
err := msg.DecryptPKIEnvelope(CAcert, CAkey)
if err != nil {
// handle err
}
// use the CSR from decrypted PKCS request and sign
// MyCSRSigner returns an *x509.Certificate here
crt, err := MyCSRSigner(msg.CSRReqMessage.CSR)
if err != nil {
// handle err
}
// create a CertRep message from the original
certRep, err := msg.Success(CAcert, CAkey, crt)
if err != nil {
// handle err
}
// send response back
// w is a http.ResponseWriter
w.Write(certRep.Raw)
```
## Server library
You can import the scep endpoint into another Go project. For an example take a look at [scepserver.go](cmd/scepserver/scepserver.go).
Expand Down
57 changes: 0 additions & 57 deletions server/mdm/scep/scep/certs_selector.go

This file was deleted.

156 changes: 0 additions & 156 deletions server/mdm/scep/scep/certs_selector_test.go

This file was deleted.

Loading

0 comments on commit e6ecd8f

Please sign in to comment.