order.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. package api
  2. import (
  3. "context"
  4. "crypto/rand"
  5. "crypto/x509"
  6. "encoding/base64"
  7. "encoding/json"
  8. "fmt"
  9. "net"
  10. "net/http"
  11. "strings"
  12. "time"
  13. "github.com/go-chi/chi/v5"
  14. "go.step.sm/crypto/randutil"
  15. "go.step.sm/crypto/x509util"
  16. "github.com/smallstep/certificates/acme"
  17. "github.com/smallstep/certificates/acme/wire"
  18. "github.com/smallstep/certificates/api/render"
  19. "github.com/smallstep/certificates/authority/policy"
  20. "github.com/smallstep/certificates/authority/provisioner"
  21. )
  22. // maxRemoteAttestationHint is the maximum length of the value of a
  23. // remote-attestation identifier.
  24. const maxRemoteAttestationHint = 128
  25. // NewOrderRequest represents the body for a NewOrder request.
  26. type NewOrderRequest struct {
  27. Identifiers []acme.Identifier `json:"identifiers"`
  28. NotBefore time.Time `json:"notBefore,omitzero"`
  29. NotAfter time.Time `json:"notAfter,omitzero"`
  30. }
  31. // Validate validates a new-order request body.
  32. func (n *NewOrderRequest) Validate() error {
  33. if len(n.Identifiers) == 0 {
  34. return acme.NewError(acme.ErrorMalformedType, "identifiers list cannot be empty")
  35. }
  36. var remoteAttestations int
  37. for _, id := range n.Identifiers {
  38. switch id.Type {
  39. case acme.IP:
  40. if net.ParseIP(id.Value) == nil {
  41. return acme.NewError(acme.ErrorMalformedType, "invalid IP address: %s", id.Value)
  42. }
  43. case acme.DNS:
  44. value, _ := trimIfWildcard(id.Value)
  45. if _, err := x509util.SanitizeName(value); err != nil {
  46. return acme.NewError(acme.ErrorMalformedType, "invalid DNS name: %s", id.Value)
  47. }
  48. case acme.PermanentIdentifier:
  49. if id.Value == "" {
  50. return acme.NewError(acme.ErrorMalformedType, "permanent identifier cannot be empty")
  51. }
  52. case acme.WireUser, acme.WireDevice:
  53. // validation of Wire identifiers is performed in `validateWireIdentifiers`, but
  54. // marked here as known and supported types.
  55. continue
  56. case acme.RemoteAttestation:
  57. // The value is a hint, which may be empty.
  58. if len(id.Value) > maxRemoteAttestationHint {
  59. return acme.NewError(acme.ErrorMalformedType, "remote-attestation identifier value cannot be longer than %d bytes", maxRemoteAttestationHint)
  60. }
  61. // One attestation per order, so that finalize, the webhooks
  62. // and the templates each see a single one.
  63. remoteAttestations++
  64. if remoteAttestations > 1 {
  65. return acme.NewError(acme.ErrorMalformedType, "an order cannot have more than one remote-attestation identifier")
  66. }
  67. default:
  68. return acme.NewError(acme.ErrorMalformedType, "identifier type unsupported: %s", id.Type)
  69. }
  70. }
  71. if err := n.validateWireIdentifiers(); err != nil {
  72. return acme.WrapError(acme.ErrorMalformedType, err, "failed validating Wire identifiers")
  73. }
  74. // TODO(hs): add some validations for DNS domains?
  75. // TODO(hs): combine the errors from this with allow/deny policy, like example error in https://datatracker.ietf.org/doc/html/rfc8555#section-6.7.1
  76. return nil
  77. }
  78. func (n *NewOrderRequest) validateWireIdentifiers() error {
  79. if !n.hasWireIdentifiers() {
  80. return nil
  81. }
  82. userIdentifiers := identifiersOfType(acme.WireUser, n.Identifiers)
  83. deviceIdentifiers := identifiersOfType(acme.WireDevice, n.Identifiers)
  84. if len(userIdentifiers) != 1 {
  85. return fmt.Errorf("expected exactly one Wire UserID identifier; got %d", len(userIdentifiers))
  86. }
  87. if len(deviceIdentifiers) != 1 {
  88. return fmt.Errorf("expected exactly one Wire DeviceID identifier, got %d", len(deviceIdentifiers))
  89. }
  90. wireUserID, err := wire.ParseUserID(userIdentifiers[0].Value)
  91. if err != nil {
  92. return fmt.Errorf("failed parsing Wire UserID: %w", err)
  93. }
  94. wireDeviceID, err := wire.ParseDeviceID(deviceIdentifiers[0].Value)
  95. if err != nil {
  96. return fmt.Errorf("failed parsing Wire DeviceID: %w", err)
  97. }
  98. if _, err := wire.ParseClientID(wireDeviceID.ClientID); err != nil {
  99. return fmt.Errorf("invalid Wire client ID %q: %w", wireDeviceID.ClientID, err)
  100. }
  101. switch {
  102. case wireUserID.Domain != wireDeviceID.Domain:
  103. return fmt.Errorf("UserID domain %q does not match DeviceID domain %q", wireUserID.Domain, wireDeviceID.Domain)
  104. case wireUserID.Name != wireDeviceID.Name:
  105. return fmt.Errorf("UserID name %q does not match DeviceID name %q", wireUserID.Name, wireDeviceID.Name)
  106. case wireUserID.Handle != wireDeviceID.Handle:
  107. return fmt.Errorf("UserID handle %q does not match DeviceID handle %q", wireUserID.Handle, wireDeviceID.Handle)
  108. }
  109. return nil
  110. }
  111. // hasWireIdentifiers returns whether the [NewOrderRequest] contains
  112. // Wire identifiers.
  113. func (n *NewOrderRequest) hasWireIdentifiers() bool {
  114. for _, i := range n.Identifiers {
  115. if i.Type == acme.WireUser || i.Type == acme.WireDevice {
  116. return true
  117. }
  118. }
  119. return false
  120. }
  121. // identifiersOfType returns the Identifiers that are of type typ.
  122. func identifiersOfType(typ acme.IdentifierType, ids []acme.Identifier) (result []acme.Identifier) {
  123. for _, id := range ids {
  124. if id.Type == typ {
  125. result = append(result, id)
  126. }
  127. }
  128. return
  129. }
  130. // FinalizeRequest captures the body for a Finalize order request.
  131. type FinalizeRequest struct {
  132. CSR string `json:"csr"`
  133. csr *x509.CertificateRequest
  134. }
  135. // Validate validates a finalize request body.
  136. func (f *FinalizeRequest) Validate() error {
  137. var err error
  138. // RFC 8555 isn't 100% conclusive about using raw base64-url encoding for the
  139. // CSR specifically, instead of "normal" base64-url encoding (incl. padding).
  140. // By trimming the padding from CSRs submitted by ACME clients that use
  141. // base64-url encoding instead of raw base64-url encoding, these are also
  142. // supported. This was reported in https://github.com/smallstep/certificates/issues/939
  143. // to be the case for a Synology DSM NAS system.
  144. csrBytes, err := base64.RawURLEncoding.DecodeString(strings.TrimRight(f.CSR, "="))
  145. if err != nil {
  146. return acme.WrapError(acme.ErrorMalformedType, err, "error base64url decoding csr")
  147. }
  148. f.csr, err = x509.ParseCertificateRequest(csrBytes)
  149. if err != nil {
  150. return acme.WrapError(acme.ErrorMalformedType, err, "unable to parse csr")
  151. }
  152. if err = f.csr.CheckSignature(); err != nil {
  153. return acme.WrapError(acme.ErrorMalformedType, err, "csr failed signature check")
  154. }
  155. return nil
  156. }
  157. var defaultOrderExpiry = time.Hour * 24
  158. var defaultOrderBackdate = time.Minute
  159. // NewOrder ACME api for creating a new order.
  160. func NewOrder(w http.ResponseWriter, r *http.Request) {
  161. ctx := r.Context()
  162. ca := mustAuthority(ctx)
  163. db := acme.MustDatabaseFromContext(ctx)
  164. linker := acme.MustLinkerFromContext(ctx)
  165. acc, err := accountFromContext(ctx)
  166. if err != nil {
  167. render.Error(w, r, err)
  168. return
  169. }
  170. prov, err := provisionerFromContext(ctx)
  171. if err != nil {
  172. render.Error(w, r, err)
  173. return
  174. }
  175. payload, err := payloadFromContext(ctx)
  176. if err != nil {
  177. render.Error(w, r, err)
  178. return
  179. }
  180. var nor NewOrderRequest
  181. if err := json.Unmarshal(payload.value, &nor); err != nil {
  182. render.Error(w, r, acme.WrapError(acme.ErrorMalformedType, err,
  183. "failed to unmarshal new-order request payload"))
  184. return
  185. }
  186. if err := nor.Validate(); err != nil {
  187. render.Error(w, r, err)
  188. return
  189. }
  190. // TODO(hs): gather all errors, so that we can build one response with ACME subproblems
  191. // include the nor.Validate() error here too, like in the example in the ACME RFC?
  192. acmeProv, err := acmeProvisionerFromContext(ctx)
  193. if err != nil {
  194. render.Error(w, r, err)
  195. return
  196. }
  197. if err := addRemoteAttestationIdentifier(ctx, acmeProv, &nor); err != nil {
  198. render.Error(w, r, err)
  199. return
  200. }
  201. // Under a provisioner that requires EAB, an account orders only while the
  202. // key it was created with exists: removing the key revokes the account.
  203. var eak *acme.ExternalAccountKey
  204. if acmeProv.RequireEAB {
  205. if eak, err = db.GetExternalAccountKeyByAccountID(ctx, prov.GetID(), acc.ID); err != nil {
  206. render.Error(w, r, acme.WrapErrorISE(err, "error retrieving external account binding key"))
  207. return
  208. }
  209. if eak == nil {
  210. render.Error(w, r, acme.NewError(acme.ErrorUnauthorizedType,
  211. "account %s has no external account binding key", acc.ID))
  212. return
  213. }
  214. }
  215. acmePolicy, err := newACMEPolicyEngine(eak)
  216. if err != nil {
  217. render.Error(w, r, acme.WrapErrorISE(err, "error creating ACME policy engine"))
  218. return
  219. }
  220. for _, identifier := range nor.Identifiers {
  221. // A remote-attestation identifier names nothing in the certificate,
  222. // so the name policies do not apply to it.
  223. if identifier.Type == acme.RemoteAttestation {
  224. continue
  225. }
  226. // evaluate the ACME account level policy
  227. if err = isIdentifierAllowed(acmePolicy, identifier); err != nil {
  228. render.Error(w, r, acme.WrapError(acme.ErrorRejectedIdentifierType, err, "not authorized"))
  229. return
  230. }
  231. // evaluate the provisioner level policy
  232. orderIdentifier := provisioner.ACMEIdentifier{Type: provisioner.ACMEIdentifierType(identifier.Type), Value: identifier.Value}
  233. if err = prov.AuthorizeOrderIdentifier(ctx, orderIdentifier); err != nil {
  234. render.Error(w, r, acme.WrapError(acme.ErrorRejectedIdentifierType, err, "not authorized"))
  235. return
  236. }
  237. // evaluate the authority level policy
  238. if err = ca.AreSANsAllowed(ctx, []string{identifier.Value}); err != nil {
  239. render.Error(w, r, acme.WrapError(acme.ErrorRejectedIdentifierType, err, "not authorized"))
  240. return
  241. }
  242. }
  243. now := clock.Now()
  244. // New order.
  245. o := &acme.Order{
  246. AccountID: acc.ID,
  247. ProvisionerID: prov.GetID(),
  248. Status: acme.StatusPending,
  249. Identifiers: nor.Identifiers,
  250. ExpiresAt: now.Add(defaultOrderExpiry),
  251. AuthorizationIDs: make([]string, len(nor.Identifiers)),
  252. NotBefore: nor.NotBefore,
  253. NotAfter: nor.NotAfter,
  254. }
  255. for i, identifier := range o.Identifiers {
  256. az := &acme.Authorization{
  257. AccountID: acc.ID,
  258. Identifier: identifier,
  259. ExpiresAt: o.ExpiresAt,
  260. Status: acme.StatusPending,
  261. }
  262. if err := newAuthorization(ctx, az); err != nil {
  263. render.Error(w, r, err)
  264. return
  265. }
  266. o.AuthorizationIDs[i] = az.ID
  267. }
  268. if o.NotBefore.IsZero() {
  269. o.NotBefore = now
  270. }
  271. if o.NotAfter.IsZero() {
  272. o.NotAfter = o.NotBefore.Add(prov.DefaultTLSCertDuration())
  273. }
  274. // if request NotBefore was empty, then backdate the order.NotBefore (now)
  275. // to avoid timing issues.
  276. if nor.NotBefore.IsZero() {
  277. backdate := defaultOrderBackdate
  278. if bd := ca.GetBackdate(); bd != nil {
  279. backdate = *bd
  280. }
  281. o.NotBefore = o.NotBefore.Add(-backdate)
  282. }
  283. if err := db.CreateOrder(ctx, o); err != nil {
  284. render.Error(w, r, acme.WrapErrorISE(err, "error creating order"))
  285. return
  286. }
  287. linker.LinkOrder(ctx, o)
  288. w.Header().Set("Location", linker.GetLink(ctx, acme.OrderLinkType, o.ID))
  289. render.JSONStatus(w, r, o, http.StatusCreated)
  290. }
  291. // addRemoteAttestationIdentifier refuses a remote-attestation identifier if the
  292. // provisioner does not enable remote-attest-01, and adds one with an empty hint
  293. // if the provisioner requires remote attestation and the order has none, as
  294. // draft-ietf-acme-rats-03 section 3.2 allows.
  295. func addRemoteAttestationIdentifier(ctx context.Context, prov *provisioner.ACME, nor *NewOrderRequest) error {
  296. enabled := prov.IsChallengeEnabled(ctx, provisioner.REMOTE_ATTEST_01)
  297. for _, id := range nor.Identifiers {
  298. if id.Type == acme.RemoteAttestation {
  299. if !enabled {
  300. return acme.NewError(acme.ErrorUnsupportedIdentifierType, "remote-attestation identifiers are not supported by this provisioner")
  301. }
  302. return nil
  303. }
  304. }
  305. if enabled && prov.GetRemoteAttestation().IsRequired() {
  306. nor.Identifiers = append(nor.Identifiers, acme.Identifier{Type: acme.RemoteAttestation})
  307. }
  308. return nil
  309. }
  310. func isIdentifierAllowed(acmePolicy policy.X509Policy, identifier acme.Identifier) error {
  311. if acmePolicy == nil {
  312. return nil
  313. }
  314. return acmePolicy.AreSANsAllowed([]string{identifier.Value})
  315. }
  316. func newACMEPolicyEngine(eak *acme.ExternalAccountKey) (policy.X509Policy, error) {
  317. if eak == nil {
  318. //nolint:nilnil,nolintlint // expected values
  319. return nil, nil
  320. }
  321. return policy.NewX509PolicyEngine(eak.Policy)
  322. }
  323. func trimIfWildcard(value string) (string, bool) {
  324. if after, ok := strings.CutPrefix(value, "*."); ok {
  325. return after, true
  326. }
  327. return value, false
  328. }
  329. func newAuthorization(ctx context.Context, az *acme.Authorization) error {
  330. value, isWildcard := trimIfWildcard(az.Identifier.Value)
  331. az.Wildcard = isWildcard
  332. az.Identifier = acme.Identifier{
  333. Value: value,
  334. Type: az.Identifier.Type,
  335. }
  336. chTypes := challengeTypes(az)
  337. var err error
  338. az.Token, err = randutil.Alphanumeric(32)
  339. if err != nil {
  340. return acme.WrapErrorISE(err, "error generating random alphanumeric ID")
  341. }
  342. db := acme.MustDatabaseFromContext(ctx)
  343. prov := acme.MustProvisionerFromContext(ctx)
  344. az.Challenges = make([]*acme.Challenge, 0, len(chTypes))
  345. for _, typ := range chTypes {
  346. if !prov.IsChallengeEnabled(ctx, provisioner.ACMEChallenge(typ)) {
  347. continue
  348. }
  349. var target string
  350. switch az.Identifier.Type {
  351. case acme.WireUser:
  352. wireOptions, err := prov.GetOptions().GetWireOptions()
  353. if err != nil {
  354. return acme.WrapErrorISE(err, "failed getting Wire options")
  355. }
  356. target, err = wireOptions.GetOIDCOptions().EvaluateTarget("") // TODO(hs): determine if required by Wire
  357. if err != nil {
  358. return acme.WrapError(acme.ErrorMalformedType, err, "invalid Go template registered for 'target'")
  359. }
  360. case acme.WireDevice:
  361. wireID, err := wire.ParseDeviceID(az.Identifier.Value)
  362. if err != nil {
  363. return acme.WrapError(acme.ErrorMalformedType, err, "failed parsing WireDevice")
  364. }
  365. clientID, err := wire.ParseClientID(wireID.ClientID)
  366. if err != nil {
  367. return acme.WrapError(acme.ErrorMalformedType, err, "failed parsing ClientID")
  368. }
  369. wireOptions, err := prov.GetOptions().GetWireOptions()
  370. if err != nil {
  371. return acme.WrapErrorISE(err, "failed getting Wire options")
  372. }
  373. target, err = wireOptions.GetDPOPOptions().EvaluateTarget(clientID.DeviceID)
  374. if err != nil {
  375. return acme.WrapError(acme.ErrorMalformedType, err, "invalid Go template registered for 'target'")
  376. }
  377. }
  378. ch := &acme.Challenge{
  379. AccountID: az.AccountID,
  380. Value: az.Identifier.Value,
  381. Type: typ,
  382. Token: az.Token,
  383. Status: acme.StatusPending,
  384. Target: target,
  385. }
  386. if typ == acme.REMOTEATTEST01 {
  387. ch.FreshnessNonce = newFreshnessNonce()
  388. ch.AttestClaimsHint = prov.GetRemoteAttestation().GetClaimsHint()
  389. }
  390. if err := db.CreateChallenge(ctx, ch); err != nil {
  391. return acme.WrapErrorISE(err, "error creating challenge")
  392. }
  393. az.Challenges = append(az.Challenges, ch)
  394. }
  395. if err = db.CreateAuthorization(ctx, az); err != nil {
  396. return acme.WrapErrorISE(err, "error creating authorization")
  397. }
  398. return nil
  399. }
  400. // newFreshnessNonce returns the freshness nonce of a remote-attest-01
  401. // challenge: 32 random bytes, base64url encoded without padding.
  402. func newFreshnessNonce() string {
  403. b := make([]byte, 32)
  404. _, _ = rand.Read(b) // never fails
  405. return base64.RawURLEncoding.EncodeToString(b)
  406. }
  407. // GetOrder ACME api for retrieving an order.
  408. func GetOrder(w http.ResponseWriter, r *http.Request) {
  409. ctx := r.Context()
  410. db := acme.MustDatabaseFromContext(ctx)
  411. linker := acme.MustLinkerFromContext(ctx)
  412. acc, err := accountFromContext(ctx)
  413. if err != nil {
  414. render.Error(w, r, err)
  415. return
  416. }
  417. prov, err := provisionerFromContext(ctx)
  418. if err != nil {
  419. render.Error(w, r, err)
  420. return
  421. }
  422. o, err := db.GetOrder(ctx, chi.URLParam(r, "ordID"))
  423. if err != nil {
  424. render.Error(w, r, acme.WrapErrorISE(err, "error retrieving order"))
  425. return
  426. }
  427. if acc.ID != o.AccountID {
  428. render.Error(w, r, acme.NewError(acme.ErrorUnauthorizedType,
  429. "account '%s' does not own order '%s'", acc.ID, o.ID))
  430. return
  431. }
  432. if prov.GetID() != o.ProvisionerID {
  433. render.Error(w, r, acme.NewError(acme.ErrorUnauthorizedType,
  434. "provisioner '%s' does not own order '%s'", prov.GetID(), o.ID))
  435. return
  436. }
  437. if err = o.UpdateStatus(ctx, db); err != nil {
  438. render.Error(w, r, acme.WrapErrorISE(err, "error updating order status"))
  439. return
  440. }
  441. linker.LinkOrder(ctx, o)
  442. w.Header().Set("Location", linker.GetLink(ctx, acme.OrderLinkType, o.ID))
  443. render.JSON(w, r, o)
  444. }
  445. // FinalizeOrder attempts to finalize an order and create a certificate.
  446. func FinalizeOrder(w http.ResponseWriter, r *http.Request) {
  447. ctx := r.Context()
  448. db := acme.MustDatabaseFromContext(ctx)
  449. linker := acme.MustLinkerFromContext(ctx)
  450. acc, err := accountFromContext(ctx)
  451. if err != nil {
  452. render.Error(w, r, err)
  453. return
  454. }
  455. prov, err := provisionerFromContext(ctx)
  456. if err != nil {
  457. render.Error(w, r, err)
  458. return
  459. }
  460. payload, err := payloadFromContext(ctx)
  461. if err != nil {
  462. render.Error(w, r, err)
  463. return
  464. }
  465. var fr FinalizeRequest
  466. if err := json.Unmarshal(payload.value, &fr); err != nil {
  467. render.Error(w, r, acme.WrapError(acme.ErrorMalformedType, err,
  468. "failed to unmarshal finalize-order request payload"))
  469. return
  470. }
  471. if err := fr.Validate(); err != nil {
  472. render.Error(w, r, err)
  473. return
  474. }
  475. o, err := db.GetOrder(ctx, chi.URLParam(r, "ordID"))
  476. if err != nil {
  477. render.Error(w, r, acme.WrapErrorISE(err, "error retrieving order"))
  478. return
  479. }
  480. if acc.ID != o.AccountID {
  481. render.Error(w, r, acme.NewError(acme.ErrorUnauthorizedType,
  482. "account '%s' does not own order '%s'", acc.ID, o.ID))
  483. return
  484. }
  485. if prov.GetID() != o.ProvisionerID {
  486. render.Error(w, r, acme.NewError(acme.ErrorUnauthorizedType,
  487. "provisioner '%s' does not own order '%s'", prov.GetID(), o.ID))
  488. return
  489. }
  490. ca := mustAuthority(ctx)
  491. if err = o.Finalize(ctx, db, fr.csr, ca, prov); err != nil {
  492. render.Error(w, r, acme.WrapErrorISE(err, "error finalizing order"))
  493. return
  494. }
  495. linker.LinkOrder(ctx, o)
  496. w.Header().Set("Location", linker.GetLink(ctx, acme.OrderLinkType, o.ID))
  497. render.JSON(w, r, o)
  498. }
  499. // challengeTypes determines the types of challenges that should be used
  500. // for the ACME authorization request.
  501. func challengeTypes(az *acme.Authorization) []acme.ChallengeType {
  502. var chTypes []acme.ChallengeType
  503. switch az.Identifier.Type {
  504. case acme.IP:
  505. chTypes = []acme.ChallengeType{acme.HTTP01, acme.TLSALPN01}
  506. case acme.DNS:
  507. chTypes = []acme.ChallengeType{acme.DNS01}
  508. // HTTP and TLS challenges can only be used for identifiers without wildcards.
  509. if !az.Wildcard {
  510. chTypes = append(chTypes, []acme.ChallengeType{acme.HTTP01, acme.TLSALPN01}...)
  511. }
  512. case acme.PermanentIdentifier:
  513. chTypes = []acme.ChallengeType{acme.DEVICEATTEST01}
  514. case acme.WireUser:
  515. chTypes = []acme.ChallengeType{acme.WIREOIDC01}
  516. case acme.WireDevice:
  517. chTypes = []acme.ChallengeType{acme.WIREDPOP01}
  518. case acme.RemoteAttestation:
  519. chTypes = []acme.ChallengeType{acme.REMOTEATTEST01}
  520. default:
  521. chTypes = []acme.ChallengeType{}
  522. }
  523. return chTypes
  524. }