mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
removes expiration verification for the setup flow to prevent clock skew from failing registration
This commit is contained in:
committed by
Aiden McClelland
parent
271dd3e12d
commit
5fbf34a84e
@@ -7,7 +7,6 @@ import Startlude hiding ( ask )
|
|||||||
import Control.Carrier.Lift ( runM )
|
import Control.Carrier.Lift ( runM )
|
||||||
import Data.Conduit
|
import Data.Conduit
|
||||||
import qualified Data.Conduit.Binary as CB
|
import qualified Data.Conduit.Binary as CB
|
||||||
import Data.Time.ISO8601
|
|
||||||
import Yesod.Core hiding ( expiresAt )
|
import Yesod.Core hiding ( expiresAt )
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
@@ -32,7 +31,6 @@ getHostsR = handleS9ErrT $ do
|
|||||||
hostParams <- extractHostsQueryParams
|
hostParams <- extractHostsQueryParams
|
||||||
|
|
||||||
verifyHmac productKey hostParams
|
verifyHmac productKey hostParams
|
||||||
verifyTimestampNotExpired $ hostsParamsExpiration hostParams
|
|
||||||
|
|
||||||
mClaimedAt <- checkExistingPasswordRegistration rootAccountName
|
mClaimedAt <- checkExistingPasswordRegistration rootAccountName
|
||||||
case mClaimedAt of
|
case mClaimedAt of
|
||||||
@@ -50,15 +48,6 @@ verifyHmac productKey params = do
|
|||||||
HostsParams { hostsParamsHmac, hostsParamsExpiration, hostsParamsSalt } = params
|
HostsParams { hostsParamsHmac, hostsParamsExpiration, hostsParamsSalt } = params
|
||||||
unauthorizedHmac = ClientCryptographyE "Unauthorized hmac"
|
unauthorizedHmac = ClientCryptographyE "Unauthorized hmac"
|
||||||
|
|
||||||
verifyTimestampNotExpired :: MonadIO m => Text -> S9ErrT m ()
|
|
||||||
verifyTimestampNotExpired expirationTimestamp = do
|
|
||||||
now <- liftIO getCurrentTime
|
|
||||||
case parseISO8601 . toS $ expirationTimestamp of
|
|
||||||
Nothing -> throwE $ TTLExpirationE "invalid timestamp"
|
|
||||||
Just expiration -> when (expiration < now) (throwE $ TTLExpirationE "expired")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
getCertificateR :: Handler TypedContent
|
getCertificateR :: Handler TypedContent
|
||||||
getCertificateR = do
|
getCertificateR = do
|
||||||
base <- getsYesod $ appFilesystemBase . appSettings
|
base <- getsYesod $ appFilesystemBase . appSettings
|
||||||
|
|||||||
Reference in New Issue
Block a user