Commit 89701227 authored by Killian Lufau's avatar Killian Lufau

modify user-agent to identity system of a node

The main goal of this is the check if we should keep supporting
older distributions.
parent 8401ce4e
......@@ -19,7 +19,7 @@ Authenticated communication:
- the one of the last handshake (hello)
"""
import base64, hmac, hashlib, httplib, inspect, json, logging
import mailbox, os, random, select, smtplib, socket, sqlite3
import mailbox, os, platform, random, select, smtplib, socket, sqlite3
import string, struct, sys, threading, time, weakref, zlib
from collections import defaultdict, deque
from datetime import datetime
......@@ -259,6 +259,17 @@ class RegistryServer(object):
raise Exception("Wrong HMAC")
key = hashlib.sha1(key).digest()
session[:] = hashlib.sha1(key).digest(),
else:
x_forwarded_for = request.headers.get("X-Forwarded-For")
ipv6=None
if method == "hello":
ipv6=utils.ipFromBin(
x509.networkFromCa(self.cert.ca)
+ kw["client_prefix"])
logging.info("<%s>: %s, (%s, %s)",
method, ipv6 or "No IPV6",
x_forwarded_for or request.headers.get("host"),
request.headers.get("user-agent"))
try:
result = m(**kw)
except HTTPError, e:
......@@ -640,7 +651,7 @@ class RegistryServer(object):
class RegistryClient(object):
_hmac = None
user_agent = "re6stnet/" + version.version
user_agent = platform.platform() + ",re6stnet/" + version.version
def __init__(self, url, cert=None, auto_close=True):
self.cert = cert
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment