AnsweredAssumed Answered

Create Unix Record with root delegation - qualysapi python

Question asked by Abelardo Frías on Nov 28, 2018

qualysapi root delegation

 

I need to creat a unix record with root delegation, but i dont know how to do de request with de "data" and  a XML

 

def create_cred_vm_unix(user_vm, pass_vm, ip_vm):
   data = {'action':'create','title':'UnixRecord','username':user_vm,'password':pass_vm,'ips':str(ip_vm)}
   call = '/api/2.0/fo/auth/unix/'
   parameters = (
                           E.UNIX_AUTH_PARAMS
                              (
                              E.ROOT_TOOLS
                                 (
                                    E.ROOT_TOOL
                                        (
                                          E.STANDARD_TYPE({"type":"sudo"}),
                                          E.PASSWORD_INFO
                                             (
                                                   {"type":"basic"},
                                                   E.PASSWORD("<![CDATA["+pass_vm.encode('utf-8')+"]]>")
                                             )
                                          )
                                       )
                                    )
                                 )
    
   response = qgc.request(call, data, parameters)

Outcomes