2018-08-29 03:47:52 +03:00
|
|
|
/- asn1
|
2018-08-30 01:07:21 +03:00
|
|
|
/+ base64, der, primitive-rsa, *pkcs, *jose
|
2018-04-27 23:31:18 +03:00
|
|
|
=, eyre
|
2018-08-29 03:58:23 +03:00
|
|
|
=* rsa primitive-rsa
|
2018-04-19 09:27:55 +03:00
|
|
|
::
|
2018-05-25 10:28:26 +03:00
|
|
|
|%
|
|
|
|
:: +en-base64url: url-safe base64 encoding, without padding
|
2018-04-30 19:17:53 +03:00
|
|
|
::
|
2018-05-25 10:28:26 +03:00
|
|
|
++ en-base64url
|
|
|
|
~(en base64 | &)
|
|
|
|
:: +de-base64url: url-safe base64 decoding, without padding
|
2018-04-30 19:17:53 +03:00
|
|
|
::
|
|
|
|
++ de-base64url
|
|
|
|
~(de base64 | &)
|
2018-06-26 08:10:19 +03:00
|
|
|
:: |octn: encode/decode unsigned atoms as big-endian octet stream
|
|
|
|
::
|
|
|
|
++ octn
|
|
|
|
|%
|
|
|
|
++ en |=(a=@u `octs`[(met 3 a) (swp 3 a)])
|
|
|
|
++ de |=(a=octs `@u`(rev 3 p.a q.a))
|
|
|
|
--
|
2018-11-02 08:10:37 +03:00
|
|
|
:: |body: acme api response body types
|
|
|
|
::
|
|
|
|
++ body
|
|
|
|
|%
|
|
|
|
+$ acct [id=@t wen=@t sas=@t]
|
|
|
|
::
|
|
|
|
+$ order
|
|
|
|
$: exp=@t
|
|
|
|
sas=@t
|
|
|
|
aut=(list purl)
|
|
|
|
fin=(unit purl)
|
|
|
|
cer=(unit purl)
|
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ auth
|
|
|
|
$: dom=turf
|
|
|
|
sas=@t
|
|
|
|
exp=@t
|
|
|
|
cal=challenge
|
|
|
|
==
|
|
|
|
::
|
|
|
|
+$ challenge [typ=@t sas=@t url=purl tok=@t err=(unit error)]
|
|
|
|
::
|
|
|
|
+$ error [type=@t detail=@t]
|
|
|
|
--
|
2018-05-25 10:28:26 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: |grab: acme api response json reparsers
|
2018-05-18 01:10:24 +03:00
|
|
|
::
|
2018-05-15 07:26:59 +03:00
|
|
|
++ grab
|
2018-04-19 09:27:55 +03:00
|
|
|
=, dejs:format
|
2018-05-15 07:26:59 +03:00
|
|
|
|%
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +json-purl: parse url
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-05-15 07:26:59 +03:00
|
|
|
++ json-purl (su auri:de-purl:html)
|
2018-11-02 08:10:37 +03:00
|
|
|
:: +json-date: parse iso-8601
|
|
|
|
::
|
|
|
|
:: XX actually parse
|
|
|
|
::
|
|
|
|
++ json-date so
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +directory: parse ACME service directory
|
2018-05-15 07:26:59 +03:00
|
|
|
::
|
|
|
|
++ directory
|
|
|
|
%- ot
|
2018-11-02 08:10:37 +03:00
|
|
|
:~ 'newAccount'^json-purl
|
|
|
|
'newNonce'^json-purl
|
|
|
|
'newOrder'^json-purl
|
|
|
|
'revokeCert'^json-purl
|
|
|
|
'keyChange'^json-purl
|
2018-05-15 07:26:59 +03:00
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +acct: parse ACME service account
|
2018-05-15 07:26:59 +03:00
|
|
|
::
|
|
|
|
++ acct
|
2018-11-02 08:10:37 +03:00
|
|
|
^- $-(json acct:body)
|
|
|
|
:: ignoring key, contact, initialIp
|
|
|
|
::
|
|
|
|
(ot 'id'^no 'createdAt'^json-date 'status'^so ~)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +order: parse certificate order
|
2018-05-15 07:26:59 +03:00
|
|
|
::
|
|
|
|
++ order
|
2018-11-02 08:10:37 +03:00
|
|
|
^- $-(json order:body)
|
|
|
|
%- ou
|
|
|
|
:~ 'expires'^(un json-date)
|
|
|
|
'status'^(un so)
|
|
|
|
'authorizations'^(uf ~ (ar json-purl))
|
|
|
|
'finalize'^(uf ~ (mu json-purl))
|
|
|
|
'certificate'^(uf ~ (mu json-purl))
|
2018-05-15 07:26:59 +03:00
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +auth: parse authorization
|
|
|
|
::
|
2018-05-15 07:26:59 +03:00
|
|
|
++ auth
|
|
|
|
=> |%
|
2018-11-02 08:10:37 +03:00
|
|
|
:: +iden: extract +turf from service identifier
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-05-15 07:26:59 +03:00
|
|
|
++ iden
|
|
|
|
|= [typ=@t hot=host]
|
2018-11-02 08:10:37 +03:00
|
|
|
^- turf
|
2018-05-15 07:26:59 +03:00
|
|
|
?>(&(?=(%dns typ) ?=([%& *] hot)) p.hot)
|
2018-11-02 08:10:37 +03:00
|
|
|
:: +http-trial: extract %http-01 challenge
|
2018-05-15 07:26:59 +03:00
|
|
|
::
|
|
|
|
++ trial
|
2018-11-02 08:10:37 +03:00
|
|
|
|= a=(list challenge:body)
|
|
|
|
^- challenge:body
|
|
|
|
=/ b (skim a |=([typ=@t *] ?=(%http-01 typ)))
|
2018-05-15 07:26:59 +03:00
|
|
|
?>(?=(^ b) i.b)
|
|
|
|
--
|
2018-11-02 08:10:37 +03:00
|
|
|
^- $-(json auth:body)
|
2018-05-15 07:26:59 +03:00
|
|
|
%- ot
|
2018-11-02 08:10:37 +03:00
|
|
|
:~ 'identifier'^(cu iden (ot type+so value+(su thos:de-purl:html) ~))
|
|
|
|
'status'^so
|
|
|
|
'expires'^json-date
|
|
|
|
'challenges'^(cu trial (ar challenge))
|
2018-05-15 23:52:54 +03:00
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +challenge: parse domain validation challenge
|
2018-05-15 23:52:54 +03:00
|
|
|
::
|
|
|
|
++ challenge
|
2018-11-02 08:10:37 +03:00
|
|
|
^- $-(json challenge:body)
|
|
|
|
%- ou
|
|
|
|
:~ 'type'^(un so)
|
|
|
|
'status'^(un so)
|
|
|
|
'url'^(un json-purl)
|
|
|
|
'token'^(un so)
|
|
|
|
'error'^(uf ~ (mu error))
|
2018-05-15 07:26:59 +03:00
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +error: parse ACME service error response
|
2018-05-15 07:26:59 +03:00
|
|
|
::
|
|
|
|
++ error
|
2018-11-02 08:10:37 +03:00
|
|
|
^- $-(json error:body)
|
|
|
|
(ot type+so detail+so ~)
|
2018-05-15 07:26:59 +03:00
|
|
|
--
|
2018-04-19 09:27:55 +03:00
|
|
|
--
|
|
|
|
::
|
|
|
|
:::: acme state
|
|
|
|
::
|
|
|
|
|%
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +move: output effect
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
+= move [bone card]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +card: output effect payload
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
+= card
|
|
|
|
$% [%hiss wire [~ ~] %httr %hiss hiss:eyre]
|
2018-06-29 03:03:16 +03:00
|
|
|
[%wait wire @da]
|
2018-06-23 06:43:41 +03:00
|
|
|
[%well wire path (unit mime)]
|
2018-06-28 22:56:20 +03:00
|
|
|
[%rule wire %cert (unit [wain wain])]
|
2018-06-23 06:43:41 +03:00
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +nonce-next: next effect to emit upon receiving nonce
|
2018-06-27 00:53:29 +03:00
|
|
|
::
|
|
|
|
+= nonce-next
|
|
|
|
$? %register
|
|
|
|
%new-order
|
|
|
|
%finalize-order
|
|
|
|
%finalize-trial
|
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +acct: an ACME service account
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
+= acct
|
2018-11-01 09:54:30 +03:00
|
|
|
$: :: key: account keypair
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
key=key:rsa
|
2018-11-01 09:54:30 +03:00
|
|
|
:: reg: account registration
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX wen=@da once parser is fixed
|
|
|
|
::
|
|
|
|
reg=(unit [wen=@t kid=@t])
|
2018-06-23 06:43:41 +03:00
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +config: finalized configuration
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
+= config
|
2018-11-01 09:54:30 +03:00
|
|
|
$: :: dom: domains
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
dom=(set turf)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: key: certificate keypair
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
key=key:rsa
|
2018-11-01 09:54:30 +03:00
|
|
|
:: cer: signed certificate
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
cer=wain
|
2018-11-01 09:54:30 +03:00
|
|
|
:: exp: expiration date
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
exp=@da
|
2018-11-01 09:54:30 +03:00
|
|
|
:: dor: source ACME service order URL
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
dor=purl
|
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +trial: domain validation challenge
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
+= trial
|
2018-11-01 09:54:30 +03:00
|
|
|
$% :: %http only for now
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
$: %http
|
2018-11-01 09:54:30 +03:00
|
|
|
:: ego: ACME service challenge url
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
ego=purl
|
2018-11-01 09:54:30 +03:00
|
|
|
:: tok: challenge token
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
tok=@t
|
2018-11-01 09:54:30 +03:00
|
|
|
:: sas: challenge status
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
sas=?(%recv %pend %auth)
|
|
|
|
== ==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +auth: domain authorization
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
+= auth
|
2018-11-01 09:54:30 +03:00
|
|
|
$: :: ego: ACME service authorization url
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
ego=purl
|
2018-11-01 09:54:30 +03:00
|
|
|
:: dom: domain under authorization
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
dom=turf
|
2018-11-01 09:54:30 +03:00
|
|
|
:: cal: domain validation challenge
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
cal=trial
|
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +order-auth: domain authorization state for order processing
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
+= order-auth
|
2018-11-01 09:54:30 +03:00
|
|
|
$: :: pending: remote authorization urls
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
pending=(list purl)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: active: authorization in progress
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
active=(unit [idx=@ auth])
|
2018-11-01 09:54:30 +03:00
|
|
|
:: done: finalized authorizations (XX or failed?)
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
done=(list auth)
|
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +order: ACME certificate order
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
+= order
|
2018-11-01 09:54:30 +03:00
|
|
|
$: :: dom: domains
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
dom=(set turf)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: sas: order state
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
sas=$@(%wake [%rest wen=@da])
|
2018-11-01 09:54:30 +03:00
|
|
|
:: exp: expiration date
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX @da once ISO-8601 parser
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
exp=@t
|
2018-11-01 09:54:30 +03:00
|
|
|
:: ego: ACME service order url
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
ego=purl
|
2018-11-01 09:54:30 +03:00
|
|
|
:: fin: ACME service order finalization url
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
fin=purl
|
2018-11-01 09:54:30 +03:00
|
|
|
:: key: certificate keypair
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
key=key:rsa
|
2018-11-01 09:54:30 +03:00
|
|
|
:: csr: DER-encoded PKCS10 certificate signing request
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
csr=@ux
|
2018-11-01 09:54:30 +03:00
|
|
|
:: aut: authorizations required by this order
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
aut=order-auth
|
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +history: archive of past ACME service interactions
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
+= history
|
2018-11-01 09:54:30 +03:00
|
|
|
$: :: act: list of revoked account keypairs
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
act=(list acct)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: fig: list of expired configurations
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
fig=(list config)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: fal: list of failed order attempts
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
fal=(list order)
|
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +directory: ACME v2 service directory
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
+= directory
|
2018-11-01 09:54:30 +03:00
|
|
|
$: :: reg: registration url (newAccount)
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
reg=purl
|
2018-11-01 09:54:30 +03:00
|
|
|
:: non: nonce creation url (newNonce)
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
non=purl
|
2018-11-01 09:54:30 +03:00
|
|
|
:: der: order creation url (newOrder)
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
der=purl
|
2018-11-01 09:54:30 +03:00
|
|
|
:: rev: certificate revocation url (revokeCert)
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
rev=purl
|
2018-11-01 09:54:30 +03:00
|
|
|
:: rek: account key revocation url (keyChange)
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
rek=purl
|
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +acme: complete app state
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
+= acme
|
2018-11-01 09:54:30 +03:00
|
|
|
$: :: bas: ACME service root url
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
bas=purl
|
2018-11-01 09:54:30 +03:00
|
|
|
:: dir: ACME service directory
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
dir=directory
|
2018-11-01 09:54:30 +03:00
|
|
|
:: act: ACME service account
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
act=acct
|
2018-11-01 09:54:30 +03:00
|
|
|
:: liv: active, live configuration
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
liv=(unit config)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: hit: ACME account history
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
hit=history
|
2018-11-01 09:54:30 +03:00
|
|
|
:: nonces: list of unused nonces
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
nonces=(list @t)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: rod: active, in-progress order
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
rod=(unit order)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: pen: pending domains for next order
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
pen=(unit (set turf))
|
2018-11-01 09:54:30 +03:00
|
|
|
:: cey: certificate key XX move?
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
cey=key:rsa
|
|
|
|
==
|
|
|
|
--
|
2018-04-19 09:27:55 +03:00
|
|
|
::
|
|
|
|
:::: acme app
|
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: mov: list of outgoing moves for the current transaction
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-04-19 09:27:55 +03:00
|
|
|
=| mov=(list move)
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-05-15 07:26:59 +03:00
|
|
|
|_ [bow=bowl:gall acme]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +this: self
|
2018-04-19 09:27:55 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX Should be a +* core alias, see urbit/arvo#712
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ this .
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +emit: emit a move
|
2018-04-19 09:27:55 +03:00
|
|
|
::
|
|
|
|
++ emit
|
|
|
|
|= car=card
|
2018-04-24 08:49:21 +03:00
|
|
|
~& [%emit car]
|
2018-04-19 09:27:55 +03:00
|
|
|
this(mov [[ost.bow car] mov])
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +abet: finalize transaction
|
2018-05-15 23:52:54 +03:00
|
|
|
::
|
2018-04-19 09:27:55 +03:00
|
|
|
++ abet
|
2018-06-23 06:43:41 +03:00
|
|
|
^- (quip move _this)
|
2018-04-19 09:27:55 +03:00
|
|
|
[(flop mov) this(mov ~)]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +request: generic http request
|
2018-04-19 09:27:55 +03:00
|
|
|
::
|
2018-05-17 19:36:29 +03:00
|
|
|
++ request
|
2018-06-23 06:43:41 +03:00
|
|
|
|= [wir=wire req=hiss]
|
2018-05-15 23:52:54 +03:00
|
|
|
^- card
|
2018-06-23 06:43:41 +03:00
|
|
|
[%hiss wir [~ ~] %httr %hiss req]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +signed-request: JWS JSON POST
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ signed-request
|
|
|
|
|= [url=purl non=@t bod=json]
|
|
|
|
^- hiss
|
|
|
|
:^ url %post
|
|
|
|
(my content-type+['application/jose+json' ~] ~)
|
2018-05-15 07:26:59 +03:00
|
|
|
:- ~
|
2018-06-23 06:43:41 +03:00
|
|
|
^- octs
|
|
|
|
=; pro=json
|
|
|
|
(as-octt:mimes:html (en-json:html (sign:jws key.act pro bod)))
|
2018-04-19 09:27:55 +03:00
|
|
|
:- %o %- my :~
|
2018-06-23 06:43:41 +03:00
|
|
|
nonce+s+non
|
|
|
|
url+s+(crip (en-purl:html url))
|
|
|
|
?^ reg.act
|
|
|
|
kid+s+kid.u.reg.act
|
|
|
|
jwk+(pass:en:jwk key.act)
|
2018-04-19 09:27:55 +03:00
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +bad-nonce: check if an http response is a badNonce error
|
2018-04-19 09:27:55 +03:00
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
++ bad-nonce
|
|
|
|
|= rep=httr
|
|
|
|
^- ?
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX always 400?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
?. =(400 p.rep) |
|
|
|
|
?~ r.rep |
|
|
|
|
=/ jon=(unit json) (de-json:html q.u.r.rep)
|
|
|
|
?~ jon |
|
2018-11-02 08:10:37 +03:00
|
|
|
=('urn:ietf:params:acme:error:badNonce' type:(error:grab u.jon))
|
2018-11-01 09:54:30 +03:00
|
|
|
:: |effect: send moves to advance
|
2018-05-18 09:05:12 +03:00
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
++ effect
|
|
|
|
|%
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +directory: get ACME service directory
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ directory
|
|
|
|
^+ this
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX now?
|
|
|
|
::
|
|
|
|
(emit (request /acme/directory/(scot %p our.bow) bas %get ~ ~))
|
|
|
|
:: +nonce: get a new nonce for the next request
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ nonce
|
2018-06-27 00:53:29 +03:00
|
|
|
|= nex=@tas
|
|
|
|
~| [%bad-nonce-next nex]
|
|
|
|
?> ?=(nonce-next nex)
|
2018-06-23 06:43:41 +03:00
|
|
|
^+ this
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX now?
|
|
|
|
::
|
2018-06-27 00:53:29 +03:00
|
|
|
(emit (request /acme/nonce/next/[nex] non.dir %get ~ ~))
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +register: create ACME service account
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: Note: accepts services ToS.
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ register
|
|
|
|
^+ this
|
|
|
|
?~ nonces
|
2018-06-27 00:53:29 +03:00
|
|
|
(nonce %register)
|
2018-06-23 06:43:41 +03:00
|
|
|
%- emit(nonces t.nonces, reg.act ~)
|
|
|
|
%+ request
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX now?
|
|
|
|
::
|
|
|
|
/acme/register/(scot %p our.bow)
|
2018-06-23 06:43:41 +03:00
|
|
|
%^ signed-request reg.dir i.nonces
|
|
|
|
[%o (my [['termsOfServiceAgreed' b+&] ~])]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX rekey
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +new-order: create a new certificate order
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ new-order
|
|
|
|
^+ this
|
|
|
|
~| %new-order-effect-fail
|
|
|
|
?. ?=(^ reg.act) ~|(%no-account !!)
|
|
|
|
?. ?=([~ ^] pen) ~|(%no-domains !!)
|
|
|
|
?~ nonces
|
2018-06-27 00:53:29 +03:00
|
|
|
(nonce %new-order)
|
2018-06-23 06:43:41 +03:00
|
|
|
%- emit(nonces t.nonces)
|
|
|
|
%+ request
|
|
|
|
/acme/new-order/(scot %da now.bow)
|
|
|
|
%^ signed-request der.dir i.nonces
|
|
|
|
:- %o %- my :~
|
|
|
|
:- %identifiers
|
|
|
|
:- %a
|
|
|
|
%+ turn
|
|
|
|
~(tap in `(set turf)`u.pen)
|
|
|
|
|=(a=turf [%o (my type+s+'dns' value+s+(join '.' a) ~)])
|
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +finalize-order: finalize completed order
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ finalize-order
|
|
|
|
^+ this
|
|
|
|
~| %finalize-order-effect-fail
|
|
|
|
?. ?=(^ reg.act) ~|(%no-account !!)
|
|
|
|
?. ?=(^ rod) ~|(%no-active-order !!)
|
|
|
|
?. ?=(~ pending.aut.u.rod) ~|(%pending-authz !!)
|
|
|
|
?. ?=(~ active.aut.u.rod) ~|(%active-authz !!)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX revisit wrt rate limits
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
?> ?=(%wake sas.u.rod)
|
|
|
|
?~ nonces
|
2018-06-27 00:53:29 +03:00
|
|
|
(nonce %finalize-order)
|
2018-06-23 06:43:41 +03:00
|
|
|
%- emit(nonces t.nonces)
|
|
|
|
%+ request
|
|
|
|
/acme/finalize-order/(scot %da now.bow)
|
|
|
|
%^ signed-request fin.u.rod i.nonces
|
2018-06-26 08:10:19 +03:00
|
|
|
[%o (my csr+s+(en-base64url (met 3 csr.u.rod) `@`csr.u.rod) ~)]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +check-order: check completed order for certificate availability
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ check-order
|
|
|
|
^+ this
|
|
|
|
~| %check-order-effect-fail
|
|
|
|
?. ?=(^ reg.act) ~|(%no-account !!)
|
|
|
|
?. ?=(^ rod) ~|(%no-active-order !!)
|
|
|
|
?. ?=(~ pending.aut.u.rod) ~|(%pending-authz !!)
|
|
|
|
?. ?=(~ active.aut.u.rod) ~|(%active-authz !!)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX revisit wrt rate limits
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
?> ?=(%wake sas.u.rod)
|
|
|
|
(emit (request /acme/check-order/(scot %da now.bow) ego.u.rod %get ~ ~))
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +certificate: download PEM-encoded certificate
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ certificate
|
|
|
|
|= url=purl
|
|
|
|
^+ this
|
|
|
|
~| %certificate-effect-fail
|
|
|
|
?. ?=(^ reg.act) ~|(%no-account !!)
|
|
|
|
?. ?=(^ rod) ~|(%no-active-order !!)
|
|
|
|
=/ hed (my accept+['applicate/x-pem-file' ~] ~)
|
|
|
|
(emit (request /acme/certificate/(scot %da now.bow) url %get hed ~))
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +install: tell %eyre about our certificate
|
2018-06-28 22:56:20 +03:00
|
|
|
::
|
|
|
|
++ install
|
|
|
|
^+ this
|
|
|
|
~| %install-effect-fail
|
|
|
|
?> ?=(^ liv)
|
2018-07-16 19:28:23 +03:00
|
|
|
=/ key=wain (ring:en:pem:pkcs8 key.u.liv)
|
2018-06-28 22:56:20 +03:00
|
|
|
(emit %rule /install %cert `[key `wain`cer.u.liv])
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +get-authz: get next ACME service domain authorization object
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ get-authz
|
|
|
|
^+ this
|
|
|
|
~| %get-authz-effect-fail
|
|
|
|
?. ?=(^ reg.act) ~|(%no-account !!)
|
|
|
|
?. ?=(^ rod) ~|(%no-active-order !!)
|
|
|
|
?. ?=(^ pending.aut.u.rod) ~|(%no-pending-authz !!)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX revisit wrt rate limits
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
?> ?=(%wake sas.u.rod)
|
|
|
|
%- emit
|
|
|
|
(request /acme/get-authz/(scot %da now.bow) i.pending.aut.u.rod %get ~ ~)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX check/finalize-authz ??
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +save-trial: save ACME domain validation challenge to /.well-known/
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ save-trial
|
|
|
|
^+ this
|
|
|
|
~| %save-trial-effect-fail
|
|
|
|
?. ?=(^ reg.act) ~|(%no-account !!)
|
|
|
|
?. ?=(^ rod) ~|(%no-active-order !!)
|
|
|
|
?. ?=(^ active.aut.u.rod) ~|(%no-active-authz !!)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX revisit wrt rate limits
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
?> ?=(%wake sas.u.rod)
|
|
|
|
=* aut u.active.aut.u.rod
|
|
|
|
%- emit
|
|
|
|
:^ %well
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX idx in wire?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
/acme/save-trial/(scot %da now.bow)
|
|
|
|
/acme-challenge/[tok.cal.aut]
|
|
|
|
:+ ~
|
|
|
|
/text/plain
|
|
|
|
%- as-octs:mimes:html
|
|
|
|
(rap 3 [tok.cal.aut '.' (pass:thumb:jwk key.act) ~])
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +test-trial: confirm that ACME domain validation challenge is available
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ test-trial
|
|
|
|
^+ this
|
|
|
|
~| %test-trial-effect-fail
|
|
|
|
?. ?=(^ reg.act) ~|(%no-account !!)
|
|
|
|
?. ?=(^ rod) ~|(%no-active-order !!)
|
|
|
|
?. ?=(^ active.aut.u.rod) ~|(%no-active-authz !!)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX revisit wrt rate limits
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
?> ?=(%wake sas.u.rod)
|
|
|
|
=* aut u.active.aut.u.rod
|
|
|
|
=/ pat=path /'.well-known'/acme-challenge/[tok.cal.aut]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: note: requires port 80, just as the ACME service will
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
=/ url=purl [[sec=| por=~ hos=[%& dom.aut]] [ext=~ pat] hed=~]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: =/ url=purl [[sec=| por=`8.081 hos=[%& /localhost]] [ext=~ pat] hed=~]
|
|
|
|
:: XX idx in wire?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
(emit (request /acme/test-trial/(scot %da now.bow) url %get ~ ~))
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +finalize-trial: notify ACME service that challenge is ready
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ finalize-trial
|
|
|
|
^+ this
|
2018-07-17 02:15:15 +03:00
|
|
|
~| %finalize-trial-effect-fail
|
2018-06-23 06:43:41 +03:00
|
|
|
?. ?=(^ reg.act) ~|(%no-account !!)
|
|
|
|
?. ?=(^ rod) ~|(%no-active-order !!)
|
|
|
|
?. ?=(^ active.aut.u.rod) ~|(%no-active-authz !!)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX revisit wrt rate limits
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
?> ?=(%wake sas.u.rod)
|
|
|
|
=* aut u.active.aut.u.rod
|
|
|
|
?~ nonces
|
2018-06-27 00:53:29 +03:00
|
|
|
(nonce %finalize-trial)
|
2018-06-23 06:43:41 +03:00
|
|
|
%- emit(nonces t.nonces)
|
|
|
|
%+ request
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX idx in wire?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
/acme/finalize-trial/(scot %da now.bow)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: empty object included for signature
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
(signed-request ego.cal.aut i.nonces [%o ~])
|
|
|
|
:: XX delete-trial?
|
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +retry: retry effect after timeout
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-06-29 03:03:16 +03:00
|
|
|
++ retry
|
|
|
|
|= [wir=wire wen=@da]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX validate wire and date
|
|
|
|
::
|
2018-06-29 03:03:16 +03:00
|
|
|
(emit %wait [%acme wir] wen)
|
2018-06-23 06:43:41 +03:00
|
|
|
--
|
2018-11-01 09:54:30 +03:00
|
|
|
:: |event: accept event, emit next effect(s)
|
2018-05-15 23:52:54 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX should these next effects be triggered at call sites instead?
|
2018-05-15 07:26:59 +03:00
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
++ event
|
|
|
|
|%
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +directory: accept ACME service directory, trigger registration
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ directory
|
2018-06-23 07:11:22 +03:00
|
|
|
|= [wir=wire rep=httr]
|
2018-06-23 06:43:41 +03:00
|
|
|
^+ this
|
|
|
|
?. =(200 p.rep)
|
|
|
|
~& [%directory-fail rep]
|
2018-10-31 21:24:19 +03:00
|
|
|
?: =(504 p.rep)
|
|
|
|
:: retry timeouts
|
|
|
|
:: XX count retries? backoff?
|
|
|
|
::
|
|
|
|
~& %retrying
|
|
|
|
(retry:effect /directory (add now.bow ~s10))
|
|
|
|
:: XX never happened yet, wat do?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
this
|
|
|
|
=. dir (directory:grab (need (de-json:html q:(need r.rep))))
|
|
|
|
?~(reg.act register:effect this)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +nonce: accept new nonce and trigger next effect
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: Nonce has already been saved in +sigh-httr. The next effect
|
|
|
|
:: is specified in the wire.
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ nonce
|
|
|
|
|= [wir=wire rep=httr]
|
|
|
|
^+ this
|
2018-06-27 00:53:29 +03:00
|
|
|
~| [%unrecognized-nonce-wire wir]
|
|
|
|
?> &(?=(^ wir) ?=([%next ^] t.wir))
|
2018-06-23 06:43:41 +03:00
|
|
|
=* nex i.t.t.wir
|
2018-06-27 00:53:29 +03:00
|
|
|
~| [%unknown-nonce-next nex]
|
|
|
|
?> ?=(nonce-next nex)
|
|
|
|
?. =(204 p.rep)
|
2018-10-31 21:24:19 +03:00
|
|
|
~& [%nonce-fail wir rep]
|
|
|
|
:: cttp i/o timeout, always retry
|
|
|
|
:: XX set timer? count retries? backoff?
|
2018-06-27 00:53:29 +03:00
|
|
|
::
|
2018-10-31 21:24:19 +03:00
|
|
|
?: =(504 p.rep)
|
|
|
|
(nonce:effect nex)
|
|
|
|
:: XX never happened yet, retry nonce anyway?
|
|
|
|
::
|
|
|
|
this
|
2018-06-27 00:53:29 +03:00
|
|
|
?- nex
|
2018-06-23 06:43:41 +03:00
|
|
|
%register register:effect
|
|
|
|
%new-order new-order:effect
|
|
|
|
%finalize-order finalize-order:effect
|
|
|
|
%finalize-trial finalize-trial:effect
|
2018-05-15 07:26:59 +03:00
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +register: accept ACME service registration
|
2018-05-15 07:26:59 +03:00
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
++ register
|
|
|
|
|= [wir=wire rep=httr]
|
|
|
|
^+ this
|
|
|
|
?. =(201 p.rep)
|
2018-10-31 21:24:19 +03:00
|
|
|
:: XX possible 204?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
?: (bad-nonce rep)
|
2018-06-27 00:53:29 +03:00
|
|
|
(nonce:effect %register)
|
2018-06-23 06:43:41 +03:00
|
|
|
~& [%register-fail wir rep]
|
2018-10-31 21:24:19 +03:00
|
|
|
?: =(504 p.rep)
|
|
|
|
:: retry timeouts
|
|
|
|
:: XX count retries? backoff?
|
|
|
|
::
|
|
|
|
~& %retrying
|
|
|
|
(retry:effect /register (add now.bow ~s10))
|
|
|
|
:: XX retry service failures?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
this
|
2018-05-15 07:26:59 +03:00
|
|
|
=/ loc=@t
|
|
|
|
q:(head (skim q.rep |=((pair @t @t) ?=(%location p))))
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX @da once parser is fixed
|
|
|
|
::
|
|
|
|
=/ wen=@t
|
2018-05-18 18:34:55 +03:00
|
|
|
?~ r.rep
|
|
|
|
(scot %da now.bow)
|
2018-11-02 08:10:37 +03:00
|
|
|
=/ bod=acct:body
|
2018-05-18 18:34:55 +03:00
|
|
|
(acct:grab (need (de-json:html q.u.r.rep)))
|
|
|
|
?> ?=(%valid sas.bod)
|
|
|
|
wen.bod
|
2018-06-29 05:52:35 +03:00
|
|
|
=. reg.act `[wen loc]
|
|
|
|
?~(pen this new-order:effect)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX rekey
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
:: +new-order: order created, begin processing authorizations
|
2018-05-15 07:26:59 +03:00
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
++ new-order
|
|
|
|
|= [wir=wire rep=httr]
|
|
|
|
^+ this
|
|
|
|
?. =(201 p.rep)
|
2018-10-31 21:24:19 +03:00
|
|
|
:: XX possible 204?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
?: (bad-nonce rep)
|
2018-06-27 00:53:29 +03:00
|
|
|
(nonce:effect %new-order)
|
2018-06-23 06:43:41 +03:00
|
|
|
~& [%new-order-fail wir rep]
|
2018-10-31 21:24:19 +03:00
|
|
|
?: =(504 p.rep)
|
|
|
|
:: retry timeouts
|
|
|
|
:: XX count retries? backoff?
|
|
|
|
::
|
|
|
|
~& %retrying
|
|
|
|
(retry:effect /new-order (add now.bow ~s10))
|
|
|
|
:: XX retry service failures?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
this
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX delete order if not?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
?> ?=(^ pen)
|
2018-05-15 23:52:54 +03:00
|
|
|
=/ loc=@t
|
|
|
|
q:(head (skim q.rep |=((pair @t @t) ?=(%location p))))
|
2018-06-23 06:43:41 +03:00
|
|
|
=/ ego=purl (need (de-purl:html loc))
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX parse identifiers, confirm equal to pending domains
|
|
|
|
:: XX check status
|
|
|
|
::
|
2018-11-02 08:10:37 +03:00
|
|
|
=/ bod=order:body
|
2018-05-15 07:26:59 +03:00
|
|
|
(order:grab (need (de-json:html q:(need r.rep))))
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX maybe generate key here?
|
|
|
|
::
|
2018-06-26 08:10:19 +03:00
|
|
|
=/ csr=@ux +:(en:der:pkcs10 cey ~(tap in u.pen))
|
2018-06-23 06:43:41 +03:00
|
|
|
=/ dor=order
|
2018-11-02 08:10:37 +03:00
|
|
|
[dom=u.pen sas=%wake exp.bod ego (need fin.bod) cey csr [aut.bod ~ ~]]
|
2018-06-23 06:43:41 +03:00
|
|
|
get-authz:effect(rod `dor, pen ~)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +finalize-order: order finalized, poll for certificate
|
2018-05-18 09:05:12 +03:00
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
++ finalize-order
|
|
|
|
|= [wir=wire rep=httr]
|
|
|
|
^+ this
|
2018-11-02 05:18:05 +03:00
|
|
|
?: (bad-nonce rep)
|
|
|
|
(nonce:effect %finalize-order)
|
|
|
|
?: =(504 p.rep)
|
|
|
|
:: retry timeouts
|
|
|
|
:: XX count retries? backoff?
|
2018-10-31 21:24:19 +03:00
|
|
|
::
|
2018-11-02 05:18:05 +03:00
|
|
|
~& [%finalize-order-fail wir rep]
|
|
|
|
~& %retrying
|
|
|
|
(retry:effect /finalize-order (add now.bow ~s10))
|
|
|
|
:: check-order regardless of status code
|
2018-11-01 09:54:30 +03:00
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
check-order:effect
|
2018-11-02 05:18:05 +03:00
|
|
|
:: +check-order: check order status, dispatch appropriately
|
2018-05-15 23:52:54 +03:00
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
++ check-order
|
|
|
|
|= [wir=wire rep=httr]
|
|
|
|
^+ this
|
|
|
|
?. =(200 p.rep)
|
|
|
|
~& [%check-order-fail wir rep]
|
2018-10-31 21:24:19 +03:00
|
|
|
?: =(504 p.rep)
|
|
|
|
:: retry timeouts
|
|
|
|
:: XX count retries? backoff?
|
|
|
|
::
|
|
|
|
~& %retrying
|
|
|
|
(retry:effect /check-order (add now.bow ~s10))
|
|
|
|
:: XX retry service failures?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
this
|
|
|
|
?> ?=(^ rod)
|
2018-11-02 08:10:37 +03:00
|
|
|
=/ bod=order:body
|
|
|
|
(order:grab (need (de-json:html q:(need r.rep))))
|
2018-05-15 23:52:54 +03:00
|
|
|
?+ sas.bod
|
2018-06-23 06:43:41 +03:00
|
|
|
~& [%check-order-status-unknown sas.bod]
|
|
|
|
this
|
2018-10-31 01:20:10 +03:00
|
|
|
:: order failed (at any stage)
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
%invalid
|
|
|
|
~& [%check-order-fail %invalid wir rep]
|
2018-11-02 08:37:02 +03:00
|
|
|
:: XX check authz, get the failure reason
|
2018-11-02 05:18:05 +03:00
|
|
|
:: XX possible to retry any reasons?
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX send notification somehow?
|
|
|
|
::
|
2018-11-02 05:18:05 +03:00
|
|
|
?> ?=(^ rod)
|
2018-11-02 08:37:02 +03:00
|
|
|
:: save failed order for future autopsy
|
|
|
|
::
|
|
|
|
=. fal.hit [u.rod fal.hit]
|
|
|
|
:: copy order domain(s), clear order, try again soon
|
|
|
|
::
|
|
|
|
:: XX backoff, count retries, how long, etc.
|
|
|
|
::
|
|
|
|
(retry:effect(rod ~, pen `dom.u.rod) /new-order (add now.bow ~m10))
|
2018-10-31 01:20:10 +03:00
|
|
|
:: initial order state
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
%pending
|
|
|
|
check-order:effect
|
2018-10-31 01:20:10 +03:00
|
|
|
:: validations completed
|
|
|
|
::
|
|
|
|
%ready
|
|
|
|
finalize-order:effect
|
|
|
|
:: finalization requested
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
%processing
|
|
|
|
check-order:effect
|
2018-10-31 01:20:10 +03:00
|
|
|
:: certificate issued
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
%valid
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX update order state
|
|
|
|
:: XX =< delete-trial
|
|
|
|
::
|
2018-11-02 08:10:37 +03:00
|
|
|
~| impossible-order+[wir rep bod]
|
|
|
|
(certificate:effect (need cer.bod))
|
2018-05-15 23:52:54 +03:00
|
|
|
==
|
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +certificate: accept PEM-encoded certificate
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ certificate
|
|
|
|
|= [wir=wire rep=httr]
|
|
|
|
^+ this
|
|
|
|
?. =(200 p.rep)
|
|
|
|
~& [%certificate-fail wir rep]
|
2018-10-31 21:24:19 +03:00
|
|
|
?: =(504 p.rep)
|
|
|
|
:: retry timeouts
|
|
|
|
:: XX count retries? backoff?
|
|
|
|
::
|
|
|
|
~& %retrying
|
|
|
|
:: will re-attempt certificate download per order status
|
|
|
|
::
|
|
|
|
(retry:effect /check-order (add now.bow ~s10))
|
|
|
|
:: XX retry service failures?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
this
|
|
|
|
?> ?=(^ rod)
|
|
|
|
=/ cer=wain (to-wain:format q:(need r.rep))
|
|
|
|
=/ fig=config
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX expiration date
|
|
|
|
::
|
2018-06-28 22:56:20 +03:00
|
|
|
[dom.u.rod key.u.rod cer (add now.bow ~d90) ego.u.rod]
|
2018-06-23 06:43:41 +03:00
|
|
|
=? fig.hit ?=(^ liv) [u.liv fig.hit]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX set renewal timer
|
|
|
|
::
|
2018-06-28 22:56:20 +03:00
|
|
|
install:effect(liv `fig, rod ~)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +get-authz: accept ACME service authorization object
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ get-authz
|
|
|
|
|= [wir=wire rep=httr]
|
|
|
|
^+ this
|
|
|
|
?. =(200 p.rep)
|
|
|
|
~& [%get-authz-fail wir rep]
|
2018-10-31 21:24:19 +03:00
|
|
|
?: =(504 p.rep)
|
|
|
|
:: retry timeouts
|
|
|
|
:: XX count retries? backoff?
|
|
|
|
::
|
|
|
|
~& %retrying
|
|
|
|
(retry:effect /get-authz (add now.bow ~s10))
|
|
|
|
:: XX retry service failures?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
this
|
|
|
|
?> ?=(^ rod)
|
|
|
|
?> ?=(^ pending.aut.u.rod)
|
2018-11-02 08:10:37 +03:00
|
|
|
=/ bod=auth:body
|
2018-06-23 06:43:41 +03:00
|
|
|
(auth:grab (need (de-json:html q:(need r.rep))))
|
|
|
|
=/ cal=trial
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX parse token to verify url-safe base64?
|
|
|
|
::
|
2018-11-02 08:10:37 +03:00
|
|
|
[%http url.cal.bod tok.cal.bod %recv]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX check that URLs are the same
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
=/ tau=auth [i.pending.aut.u.rod dom.bod cal]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX get idx from wire instead?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
=/ idx=@ud +((lent done.aut.u.rod))
|
|
|
|
=/ rod-aut=order-auth
|
|
|
|
%= aut.u.rod
|
|
|
|
pending t.pending.aut.u.rod
|
|
|
|
active `[idx tau]
|
|
|
|
==
|
|
|
|
=< test-trial:effect
|
|
|
|
save-trial:effect(aut.u.rod rod-aut)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX check/finalize-authz ??
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +test-trial: accept response from challenge test
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: Note that +save-trail:effect has no corresponding event.
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ test-trial
|
|
|
|
|= [wir=wire rep=httr]
|
|
|
|
^+ this
|
|
|
|
?. =(200 p.rep)
|
|
|
|
~& [%test-trial-fail wir rep]
|
2018-11-01 05:54:29 +03:00
|
|
|
:: XX this condition will need to change if vere/cttp timeouts change
|
|
|
|
::
|
|
|
|
?: &(=(504 p.rep) ?=(~ r.rep))
|
|
|
|
:: retry timeouts
|
|
|
|
:: XX count retries, backoff
|
|
|
|
::
|
|
|
|
(retry:effect /test-trial (add now.bow ~s10))
|
|
|
|
this
|
2018-06-23 06:43:41 +03:00
|
|
|
?> ?=(^ rod)
|
|
|
|
?> ?=(^ active.aut.u.rod)
|
2018-11-01 05:44:48 +03:00
|
|
|
=* aut u.active.aut.u.rod
|
|
|
|
=/ bod
|
|
|
|
%- as-octs:mimes:html
|
|
|
|
(rap 3 [tok.cal.aut '.' (pass:thumb:jwk key.act) ~])
|
|
|
|
?. ?& ?=(^ r.rep)
|
|
|
|
=(bod u.r.rep)
|
|
|
|
==
|
|
|
|
:: XX save-trail again?
|
|
|
|
:: XX probably a DNS misconfiguration
|
|
|
|
::
|
|
|
|
~& [%test-trial-mismatch expected=bod got=[wir rep]]
|
|
|
|
this
|
2018-06-23 06:43:41 +03:00
|
|
|
finalize-trial:effect
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +finalize-trial:
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ finalize-trial
|
|
|
|
|= [wir=wire rep=httr]
|
|
|
|
^+ this
|
|
|
|
?. =(200 p.rep)
|
2018-10-31 21:24:19 +03:00
|
|
|
:: XX possible 204? assume pending?
|
|
|
|
:: XX handle "challenge is not pending"
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
?: (bad-nonce rep)
|
2018-06-27 00:53:29 +03:00
|
|
|
(nonce:effect %finalize-trial)
|
2018-06-23 06:43:41 +03:00
|
|
|
~& [%finalize-trial-fail wir rep]
|
2018-10-31 21:24:19 +03:00
|
|
|
?: =(504 p.rep)
|
|
|
|
:: retry timeouts
|
|
|
|
:: XX count retries? backoff?
|
|
|
|
::
|
|
|
|
~& %retrying
|
|
|
|
(retry:effect /finalize-trial (add now.bow ~s10))
|
|
|
|
:: cancel order?
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
this
|
|
|
|
?> ?=(^ rod)
|
|
|
|
?> ?=(^ active.aut.u.rod)
|
|
|
|
=* aut u.active.aut.u.rod
|
2018-11-02 08:10:37 +03:00
|
|
|
=/ bod=challenge:body
|
2018-06-23 06:43:41 +03:00
|
|
|
(challenge:grab (need (de-json:html q:(need r.rep))))
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX check for other possible values in 200 response
|
|
|
|
:: note: may have already been validated
|
|
|
|
::
|
2018-06-24 05:31:20 +03:00
|
|
|
?> ?=(?(%pending %valid) sas.bod)
|
2018-06-23 06:43:41 +03:00
|
|
|
=/ rod-aut=order-auth
|
|
|
|
aut.u.rod(active ~, done [+.aut(sas.cal %pend) done.aut.u.rod])
|
|
|
|
?~ pending.aut.u.rod
|
2018-10-31 01:20:10 +03:00
|
|
|
check-order:effect(aut.u.rod rod-aut)
|
2018-06-23 06:43:41 +03:00
|
|
|
get-authz:effect(aut.u.rod rod-aut)
|
|
|
|
:: XX delete-trial?
|
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +retry: retry effect after timeout
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ retry
|
2018-06-29 03:03:16 +03:00
|
|
|
|= wir=wire
|
|
|
|
^+ this
|
2018-10-31 21:24:19 +03:00
|
|
|
?> ?=(^ wir)
|
|
|
|
?+ i.wir
|
2018-06-29 03:03:16 +03:00
|
|
|
~&(unknown-retry+wir this)
|
2018-10-31 21:24:19 +03:00
|
|
|
%directory directory:effect
|
|
|
|
%register register:effect
|
|
|
|
%new-order new-order:effect
|
|
|
|
%finalize-order finalize-order:effect
|
|
|
|
%check-order check-order:effect
|
|
|
|
%get-authz get-authz:effect
|
|
|
|
%test-trial test-trial:effect
|
|
|
|
%finalize-trial finalize-trial:effect
|
2018-06-29 03:03:16 +03:00
|
|
|
==
|
2018-06-23 06:43:41 +03:00
|
|
|
--
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +sigh-tang: handle http request failure
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ sigh-tang
|
|
|
|
|= [wir=wire saw=tang]
|
|
|
|
^- (quip move _this)
|
|
|
|
~& [%sigh-tang wir]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX take evasive action
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
[((slog saw) ~) this]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +sigh-recoverable-error: handle http rate-limit response
|
2018-07-19 21:05:12 +03:00
|
|
|
::
|
|
|
|
++ sigh-recoverable-error
|
|
|
|
|= [wir=wire %429 %rate-limit lim=(unit @da)]
|
|
|
|
^- (quip move _this)
|
|
|
|
~& [%sigh-recoverable wir lim]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX retry
|
|
|
|
::
|
2018-07-19 21:05:12 +03:00
|
|
|
[~ this]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +sigh-httr: accept http response
|
2018-06-23 06:43:41 +03:00
|
|
|
::
|
|
|
|
++ sigh-httr
|
|
|
|
|= [wir=wire rep=httr]
|
|
|
|
^- (quip move _this)
|
|
|
|
~& [wir rep]
|
|
|
|
?> ?=([%acme ^] wir)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: add nonce to pool, if present
|
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
=/ nonhed (skim q.rep |=((pair @t @t) ?=(%replay-nonce p)))
|
|
|
|
=? nonces ?=(^ nonhed) [q.i.nonhed nonces]
|
|
|
|
=< abet
|
|
|
|
~| [%sigh-fail wir rep]
|
2018-06-23 07:11:22 +03:00
|
|
|
%. [t.wir rep]
|
2018-06-23 06:43:41 +03:00
|
|
|
?+ i.t.wir
|
|
|
|
~&([%unknown-wire i.t.wir] !!)
|
2018-06-23 07:11:22 +03:00
|
|
|
%directory directory:event
|
|
|
|
%nonce nonce:event
|
|
|
|
%register register:event
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX rekey
|
|
|
|
::
|
2018-06-23 07:11:22 +03:00
|
|
|
%new-order new-order:event
|
|
|
|
%finalize-order finalize-order:event
|
|
|
|
%check-order check-order:event
|
|
|
|
%certificate certificate:event
|
|
|
|
%get-authz get-authz:event
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX check/finalize-authz ??
|
|
|
|
::
|
2018-06-23 07:11:22 +03:00
|
|
|
%test-trial test-trial:event
|
|
|
|
%finalize-trial finalize-trial:event
|
2018-06-23 06:43:41 +03:00
|
|
|
:: XX delete-trial?
|
2018-11-01 09:54:30 +03:00
|
|
|
::
|
2018-04-19 09:27:55 +03:00
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +wake: timer wakeup event
|
2018-06-29 03:03:16 +03:00
|
|
|
::
|
|
|
|
++ wake
|
|
|
|
|= [wir=wire ~]
|
|
|
|
^- (quip move _this)
|
|
|
|
~& [%wake wir]
|
|
|
|
?> ?=([%acme *] wir)
|
|
|
|
abet:(retry:event t.wir)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +poke-acme-order: create new order for a set of domains
|
2018-06-28 22:56:20 +03:00
|
|
|
::
|
|
|
|
++ poke-acme-order
|
2018-06-29 05:52:35 +03:00
|
|
|
|= a=(set turf)
|
|
|
|
~& [%poke-acme a]
|
|
|
|
abet:(add-order a)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +poke-noun: for debugging
|
2018-04-19 09:27:55 +03:00
|
|
|
::
|
2018-05-17 06:08:15 +03:00
|
|
|
++ poke-noun
|
|
|
|
|= a=*
|
|
|
|
^- (quip move _this)
|
2018-06-23 06:43:41 +03:00
|
|
|
=< abet
|
|
|
|
?+ a
|
|
|
|
~&(+<+.this this)
|
2018-06-24 06:56:27 +03:00
|
|
|
%dbug ~& [%private (ring:en:pem:pkcs1 key.act)]
|
|
|
|
~& [%public (pass:en:pem:pkcs1 key.act)]
|
|
|
|
this
|
2018-06-23 06:43:41 +03:00
|
|
|
%init init
|
|
|
|
%reg register:effect
|
|
|
|
%order new-order:effect
|
|
|
|
%auth get-authz:effect
|
|
|
|
%trial test-trial:effect
|
|
|
|
%final finalize-order:effect
|
|
|
|
%poll check-order:effect
|
2018-06-29 05:52:35 +03:00
|
|
|
%our (add-order (sy /org/urbit/(crip +:(scow %p our.bow)) ~))
|
2018-06-28 22:56:20 +03:00
|
|
|
%rule install:effect
|
2018-07-10 23:29:35 +03:00
|
|
|
%fake fake
|
|
|
|
%none none
|
2018-05-17 06:08:15 +03:00
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +none: uninstall cert for testing
|
|
|
|
::
|
|
|
|
:: XX remove
|
|
|
|
::
|
2018-07-10 23:29:35 +03:00
|
|
|
++ none
|
|
|
|
^+ this
|
|
|
|
(emit %rule /uninstall %cert ~)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +fake: install fake cert for testing
|
|
|
|
::
|
|
|
|
:: XX remove
|
|
|
|
::
|
2018-07-10 23:29:35 +03:00
|
|
|
++ fake
|
|
|
|
^+ this
|
|
|
|
=/ key=wain
|
|
|
|
:~ '-----BEGIN RSA PRIVATE KEY-----'
|
|
|
|
'MIIEpAIBAAKCAQEAisQPzzmGWNZSNNAwY59XrqK/bU0NKNZS2ETOiJeSpzPAHYl+'
|
|
|
|
'c39V96/QUR0tra2zQI4QD6kpMYX/7R5nwuvsA4o7ypfYupNrlzLPThCKEHpZomDD'
|
|
|
|
'0Bb3T8u7YGrMjEX5cOmZIU2T/iy4GK/wWuBIy2TEp/0J+RoSCIr8Df/A7GIM8bwn'
|
|
|
|
'v23Vq0kE2xBqqaT5LjvuQoXfiLJ42F33DDno9lVikKEyt55D/08rH41KpXvn3tWZ'
|
|
|
|
'46tZK6Ds7Zr1hEV1LbDx1CXDzQ6gKObBe54DWDV3h7TJhr0BSW68dFJhro7Y60Ns'
|
|
|
|
'zTcFqY1RC9F0ePtsnKGFzMOe/U+fPvsGe2oWvwIDAQABAoIBACCf19ewfpWETe98'
|
|
|
|
'wuOpIsQ8HyVjaCShvvh5tNUITcJhuFk5ajFdTqjc/O0VHxgmLm6O99e2vaiXCISH'
|
|
|
|
'EX4SWXq7lTMcYCf9YN47Y+HGoa8eFNTIS0ExJRPtojAY695O1UZmpUnfI1wux1mG'
|
|
|
|
'g8vZz0OCfXnBVAbsyjCX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Nz8l3PmPLCyQXWGohnJ8iBm+5nk7O2ynaPVW0U2W+pt2w'
|
|
|
|
'SVuvdDM5zGv2f9ltNWUiYZHJ1mmO97jSY/6YfdOUH66iRtQtDkHBRdkNBsMbD+Em'
|
|
|
|
'2TgBldtHNSJBfB3pm9FblgOcJ0FSWcUDWJ7vO0+NTXlgrRofRT6pVywzxVo6dND0'
|
|
|
|
'WzYlTWeUVsO40xJqhgUQRER9YLOLxJ0O6C8i0xFxAMKOtSdodMB3RIwt7RFQ0uyt'
|
|
|
|
'n5Z5MqkYhlMI3J1tPRTp1nEt9fyGspBOO05gi148Qasp+3N+svqKomoQglNoAxU='
|
|
|
|
'-----END CERTIFICATE-----'
|
|
|
|
==
|
2018-07-16 19:28:23 +03:00
|
|
|
=/ k=key:rsa (need (ring:de:pem:pkcs1 key))
|
|
|
|
=/ k8=wain (ring:en:pem:pkcs8 k)
|
|
|
|
(emit %rule /install %cert `[k8 cert])
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +poke-path: for debugging
|
2018-05-17 06:08:15 +03:00
|
|
|
::
|
|
|
|
++ poke-path
|
2018-06-29 05:52:35 +03:00
|
|
|
|=(a=path abet:(add-order (sy a ~)))
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +prep: initialize and adapt state
|
2018-05-17 06:08:15 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: ++ prep _[~ this]
|
2018-05-15 07:26:59 +03:00
|
|
|
++ prep
|
|
|
|
|= old=(unit acme)
|
2018-06-23 06:43:41 +03:00
|
|
|
^- (quip move _this)
|
2018-06-29 07:01:45 +03:00
|
|
|
?~ old
|
2018-06-23 06:43:41 +03:00
|
|
|
[~ this]
|
2018-06-29 07:01:45 +03:00
|
|
|
[~ this(+<+ u.old)]
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +rekey: create new 2.048 bit RSA key
|
|
|
|
::
|
|
|
|
:: XX do something about this iteration
|
2018-05-15 07:26:59 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
++ rekey
|
2018-05-18 19:36:39 +03:00
|
|
|
|= eny=@
|
2018-05-15 23:52:54 +03:00
|
|
|
=| i=@
|
|
|
|
|- ^- key:rsa
|
2018-05-18 19:36:39 +03:00
|
|
|
=/ k (new-key:rsa 2.048 eny)
|
2018-05-16 22:38:50 +03:00
|
|
|
=/ m (met 0 n.pub.k)
|
2018-11-01 09:54:30 +03:00
|
|
|
:: ?: =(0 (mod m 8)) k
|
2018-06-23 06:43:41 +03:00
|
|
|
?: =(2.048 m) k
|
2018-05-15 23:52:54 +03:00
|
|
|
~& [%key iter=i width=m]
|
2018-05-18 19:36:39 +03:00
|
|
|
$(i +(i), eny +(eny))
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +init: initialize :acme state
|
2018-05-15 23:52:54 +03:00
|
|
|
::
|
2018-05-15 07:26:59 +03:00
|
|
|
++ init
|
|
|
|
=/ url
|
2018-05-17 06:08:15 +03:00
|
|
|
'https://acme-staging-v02.api.letsencrypt.org/directory'
|
2018-06-29 03:03:16 +03:00
|
|
|
=< (retry:effect /directory +(now.bow))
|
2018-06-23 06:43:41 +03:00
|
|
|
%= this
|
2018-05-18 19:36:39 +03:00
|
|
|
bas (need (de-purl:html url))
|
2018-05-18 19:58:55 +03:00
|
|
|
act [(rekey eny.bow) ~]
|
|
|
|
cey (rekey (mix eny.bow (shaz now.bow)))
|
2018-05-18 19:36:39 +03:00
|
|
|
==
|
2018-11-01 09:54:30 +03:00
|
|
|
:: +add-order: add new certificate order
|
2018-05-17 06:08:15 +03:00
|
|
|
::
|
|
|
|
++ add-order
|
2018-06-29 05:52:35 +03:00
|
|
|
|= dom=(set turf)
|
2018-05-17 06:08:15 +03:00
|
|
|
^+ this
|
2018-06-29 07:01:45 +03:00
|
|
|
?: ?=(?(%earl %pawn) (clan:title our.bow))
|
|
|
|
this
|
2018-11-01 09:54:30 +03:00
|
|
|
:: set pending order
|
2018-06-29 07:01:45 +03:00
|
|
|
::
|
|
|
|
=. pen `dom
|
2018-11-01 09:54:30 +03:00
|
|
|
:: archive active order if exists
|
2018-06-29 07:01:45 +03:00
|
|
|
::
|
2018-11-01 09:54:30 +03:00
|
|
|
:: XX we may have pending moves out for this order
|
|
|
|
:: put dates in wires, check against order creation date?
|
|
|
|
:: or re-use order-id?
|
2018-06-29 07:01:45 +03:00
|
|
|
::
|
2018-06-23 06:43:41 +03:00
|
|
|
=? fal.hit ?=(^ rod) [u.rod fal.hit]
|
2018-06-29 07:01:45 +03:00
|
|
|
=. rod ~
|
2018-11-01 09:54:30 +03:00
|
|
|
:: if registered, create order
|
2018-06-29 07:01:45 +03:00
|
|
|
::
|
|
|
|
?^ reg.act
|
|
|
|
new-order:effect
|
2018-11-01 09:54:30 +03:00
|
|
|
:: if initialized, defer
|
2018-06-29 07:01:45 +03:00
|
|
|
::
|
|
|
|
?.(=(act *acct) this init)
|
2018-04-19 09:27:55 +03:00
|
|
|
--
|
|
|
|
|