Changes between Version 3 and Version 4 of SWEET32


Ignore:
Timestamp:
08/24/16 22:05:44 (8 years ago)
Author:
Steffan Karger
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SWEET32

    v3 v4  
    3838config to renegatiate after every 64 megabytes.
    3939
    40 Note that if you're using two-factor authentication, or username-password
    41 authentication, this might require used to re-enter their 2FA token or
    42 usernamne and password.  To avoid this, do not use --auth-nocache, and enable
    43 <insert-correct-name> on the server side to ask for 2FA once per session only.
     40Note that if you're using two-factor authentication, or username-password authentication, this might require users to re-enter their 2FA token or usernamne and password.  To avoid this, do not use {{{--auth-nocache}}}, and use the {{{auth-token}}} option (see below) in the client-connect and auth-user-pass-verify scripts on the server side to ask for 2FA once per session only.
    4441
    45 <some text on the single-2FA-per-session option>
     42The (undocumented) {{{auth-token}}} option can be pushed by a client-connect script (running on the server) to instruct the connecting client to return this token as the password during the next authentication.  The auth-user-pass-verify script (running on the server) should accept this token during the next authentication sessions, until the token expires.
     43
     44The following client-connect and auth-user-pass-verify scripts illustrate how these options can be used.  Note that these scripts are examples for auth-token usage only, and should be adapted to your own needs before using them.  These scripts should not be used as-is!
     45
     46client-connect:
     47{{{
     48#!/usr/bin/env python
     49
     50import base64
     51import hmac
     52import os
     53import sys
     54import time
     55
     56username = os.environ['username']
     57
     58# Create an authentication 'cookie' that binds to the current user and time
     59ts = time.time()
     60to_auth = str(ts) + ":" + username
     61
     62h = hmac.new('mysecret')
     63h.update(to_auth)
     64digest = base64.b64encode(h.digest())
     65
     66auth_token = "push \"auth-token " + str(ts) + ":" + digest + "\""
     67
     68print "Sending auth-token:", auth_token
     69
     70open(sys.argv[1], 'w').write(auth_token)
     71}}}
     72
     73auth-user-pass-verify:
     74{{{
     75#!/usr/bin/env python
     76
     77import base64
     78import hmac
     79import os
     80import time
     81
     82username = os.environ['username']
     83password = os.environ['password']
     84
     85# Try password auth first
     86if (password == "mysecretpassword"):
     87    print "password OK"
     88    exit(0)
     89
     90# Otherwise verify auth-token
     91token = password.split(":")
     92
     93to_auth = token[0] + ":" + os.environ['username']
     94
     95h = hmac.new('mysecret')
     96h.update(to_auth)
     97digest = h.digest()
     98
     99# Exit with error if authentication fails
     100if digest != base64.b64decode(token[1]):
     101    print "Auth-token incorrect"
     102    exit(1)
     103
     104# Exit with error if auth-token expired
     105if time.time() - float(token[0]) > 60:
     106    print "Auth-token expired"
     107    exit(1)
     108
     109# All went well!
     110exit(0)
     111}}}
    46112
    47113== 3. Enable cipher negotiation (experimental!)