Changeset 1388 for trunk/packages


Ignore:
Timestamp:
Oct 28, 2008, 8:00:19 PM (16 years ago)
Author:
broder
Message:

Generate the VNC token key at invirt-vnc-server install-time instead
of hard-coding

Location:
trunk/packages/invirt-vnc-server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/invirt-vnc-server/debian/changelog

    r1386 r1388  
    22
    33  * sipb-xen-vnc-server -> invirt-vnc-server
     4  * Generate the VNC token key at install-time instead of hard-coding
    45
    5  -- Evan Broder <broder@mit.edu>  Tue, 28 Oct 2008 15:18:42 -0400
     6 -- Evan Broder <broder@mit.edu>  Tue, 28 Oct 2008 19:44:04 -0400
    67
    78sipb-xen-vnc-server (1.2) unstable; urgency=low
  • trunk/packages/invirt-vnc-server/debian/invirt-vnc-server.postinst

    • Property svn:executable set to *
    r1386 r1388  
    2424            echo "Please be sure to copy vncproxy.crt and vncproxykey.pem into /usr/share/invirt-vnc-server/"
    2525        fi
     26        mkdir -p /etc/invirt/secrets
     27        if ! [ -e /etc/invirt/secrets/vnc-key ]; then
     28            openssl rand -base64 33 >/etc/invirt/secrets/vnc-key
     29        fi
    2630    ;;
    2731
  • trunk/packages/invirt-vnc-server/python/vnc/extauth.py

    r1386 r1388  
    1919import socket
    2020import time
    21 import get_port
    22 
    23 TOKEN_KEY = "0M6W0U1IXexThi5idy8mnkqPKEq1LtEnlK/pZSn0cDrN"
     21
     22def getTokenKey():
     23    token_key = file('/etc/invirt/secrets/vnc-key').read().strip()
     24    while True:
     25        yield token_key
     26getTokenKey = getTokenKey().next
    2427
    2528def getPort(name, auth_data):
     29    import get_port
    2630    if (auth_data["machine"] == name):
    2731        port = get_port.findPort(name)
     
    6367
    6468    def validateToken(self, token):
    65         global TOKEN_KEY
    6669        self.auth_error = "Invalid token"
    6770        try:
    6871            token = base64.urlsafe_b64decode(token)
    6972            token = cPickle.loads(token)
    70             m = hmac.new(TOKEN_KEY, digestmod=sha)
     73            m = hmac.new(getTokenKey(), digestmod=sha)
    7174            m.update(token['data'])
    7275            if (m.digest() == token['digest']):
Note: See TracChangeset for help on using the changeset viewer.