예제 #1
0
 def post_client_request ( self, request, ip, mac, client_type) :
     res = post_request.serv_post_client_request (request, self.data_path,\
                        ip, mac, client_type, self.certbase, self.cert_path)
     return res
예제 #2
0
        pwdObj = pwd.getpwnam(user_name)
    except KeyError, e:
        print e
        return None
    for files in [client_req_file, key+'_pub']:
        if os.path.exists(files):
            os.chown(files,pwdObj.pw_uid,pwdObj.pw_gid)
            os.chmod(files, 0644)
    if os.path.exists(key):
        os.chown(key,pwdObj.pw_uid,pwdObj.pw_gid)
        os.chmod(key, 0600)

    ip, mac, client_type = get_ip_mac_type()
    data = open(client_req_file).read()

    req_id = post_request.serv_post_client_request (data, data_path, ip, mac, \
                                           client_type, certbase, cert_path)

    fc = open(os.path.join(client_cert_path, 'req_id'), 'w')
    fc.write(req_id)
    fc.close()
    return req_id

def sign_certificate(req_id, cert_path, data_path):
    cert_cmd.sing_req_by_server(req_id, cert_path, data_path, auto = True)

def get_certificate(cert_path,data_path,certbase,client_cert_path,user_name):
    req_id_file = os.path.join(client_cert_path, 'req_id')
    if not os.path.exists(req_id_file):
        print _("request not sent or file %s deleted") %req_id_file
        return 1
    fc = open(req_id_file, 'r')