Ejemplo n.º 1
0
    def newconn(self, queue, geometry, sessionname = '',vnc_id='turbovnc_vnc'):
        
        #Create a random vncpassword and encrypt it
        rcm_cipher = rcm_utils.rcm_cipher()
        vncpassword = rcm_cipher.vncpassword
        vncpassword_crypted=rcm_cipher.encrypt()
        
        #new_encoded_param='geometry='+ geometry + ' ' + 'queue='+ queue + ' ' +  'sessionname=' + '\'' + sessionname + '\'' + ' ' \
        # + 'subnet=' + self.subnet + ' ' + 'vncpassword='******' ' + 'vncpassword_crypted=' + '\'' + vncpassword_crypted + '\''
        #o=self.prex('new' + ' ' + new_encoded_param )

        o=self.protocol.new(geometry=geometry, queue=queue, sessionname='\'' + sessionname + '\'', subnet=self.subnet, vncpassword=vncpassword,
        vncpassword_crypted=vncpassword_crypted, vnc_id=vnc_id)
        
        session=rcm.rcm_session(o)
        return session 
Ejemplo n.º 2
0
    def newconn(self, queue, geometry, sessionname = '',vnc_id='turbovnc_vnc'):
        
        #Create a random vncpassword and encrypt it
        rcm_cipher = rcm_utils.rcm_cipher()
        vncpassword = rcm_cipher.vncpassword
        vncpassword_crypted=rcm_cipher.encrypt()
        
        #new_encoded_param='geometry='+ geometry + ' ' + 'queue='+ queue + ' ' +  'sessionname=' + '\'' + sessionname + '\'' + ' ' \
        # + 'subnet=' + self.subnet + ' ' + 'vncpassword='******' ' + 'vncpassword_crypted=' + '\'' + vncpassword_crypted + '\''
        #o=self.prex('new' + ' ' + new_encoded_param )

        o=self.protocol.new(geometry=geometry, queue=queue, sessionname='\'' + sessionname + '\'', subnet=self.subnet, vncpassword=vncpassword,
        vncpassword_crypted=vncpassword_crypted, vnc_id=vnc_id)
        
        session=rcm.rcm_session(o)
        return session 
Ejemplo n.º 3
0
    def vncsession(self, session=None, otp='', gui_cmd=None, configFile=None):
        """

        :rtype : object
        """
        tunnel_command = ''
        vnc_command = ''
        vncpassword_decrypted = ''

        if session:

            portnumber = 5900 + int(session.hash['display'])
            local_portnumber=rcm_utils.get_unused_portnumber()
            node = session.hash['node']
            nodelogin = session.hash['nodelogin']
            tunnel = session.hash['tunnel']
            vncpassword = session.hash.get('vncpassword','')

            #Decrypt password
            rcm_cipher = rcm_utils.rcm_cipher()
            vncpassword_decrypted=rcm_cipher.decrypt(vncpassword)

            if(self.debug):
                module_logger.debug( "portnumber --> "+ str(portnumber) +" node --> " + str(node) + " nodelogin --> " + str(nodelogin)+ " tunnel --> "+str(tunnel))


            if sys.platform.startswith('darwin') :
                vnc_command = self.vncexe + " -quality 80 -subsampling 2X" + " -password " + vncpassword_decrypted
                vnc_command += " -loglevel "+str(rcm_utils.vnc_loglevel)
            elif(sys.platform == 'win32'):
            #    vnc_command = self.vncexe + " -medqual " + "-password " + vncpassword_decrypted
                #vnc_command = "echo "+ vncpassword_decrypted+ " | " + self.vncexe + " -medqual " + "-autopass -nounixlogin"
                vnc_command = "echo "+ vncpassword_decrypted+ " | " + self.vncexe + "-autopass -nounixlogin"
                vnc_command += " -logfile "+os.path.join(rcm_utils.log_folder(),'vncviewer_'+nodelogin+'_'+session.hash.get('sessionid','')+'.log')
                vnc_command += " -loglevel "+str(rcm_utils.vnc_loglevel)
            else:
                #vnc_command = self.vncexe + " -medqual "
                vnc_command = self.vncexe + " -quality 80 " + " -password " + vncpassword_decrypted
                #vnc_command += " -logfile "+os.path.join(rcm_utils.log_folder(),'vncviewer_'+nodelogin+'_'+session.hash.get('sessionid','')+'.log')



            if(sys.platform == 'win32' or sys.platform.startswith('darwin')):
                if (tunnel == 'y'):
                    tunnel_command = self.ssh_command  + " -L 127.0.0.1:" +str(local_portnumber) + ":" + node + ":" + str(portnumber) + " " + self.login_options + "@" + nodelogin 
                    if sys.platform.startswith('darwin'): 
                        tunnel_command +=  " echo 'rcm_tunnel'; sleep 20"
                    else: 
                        tunnel_command +=  " echo 'rcm_tunnel'; sleep 10"
                    vnc_command += " 127.0.0.1:" + str(local_portnumber)
                else:
                    #tunnel_command = self.ssh_command  + " -L 127.0.0.1:" +str(portnumber) + ":" + node + ":" + str(portnumber) + " " + self.login_options + "@" + nodelogin + " echo 'rcm_tunnel'; sleep 10"
                    vnc_command += " " + nodelogin + ":" + str(portnumber)
            else:
                if (tunnel == 'y'):
                    vnc_command += " -via '"  + self.login_options + "@" + nodelogin + "' " + node +":" + str(session.hash['display'])
                else:
                    vnc_command += ' ' + nodelogin + ":" + session.hash['display']
        else:

            vnc_command = self.vncexe + " -config "

                
        
        if(self.debug): module_logger.info( "tunnel->"+tunnel_command.replace(self.passwd,"****")+"< vnc->"+vnc_command+"< conffile->"+str(configFile)+"<")

        st=rcm_utils.SessionThread ( tunnel_command, vnc_command, self.passwd, vncpassword_decrypted,  otp, gui_cmd, configFile, self.debug)

        if(self.debug): module_logger.debug( "!!!!!session  thread--->"+str(st)+"<- num thread:"+str(len(self.session_thread)))
        self.session_thread.append(st)
        st.start()
Ejemplo n.º 4
0
    def vncsession(self, session=None, otp='', gui_cmd=None, configFile=None):
        """

        :rtype : object
        """
        tunnel_command = ''
        vnc_command = ''
        vncpassword_decrypted = ''

        if session:

            portnumber = 5900 + int(session.hash['display'])
            local_portnumber=rcm_utils.get_unused_portnumber()
            node = session.hash['node']
            nodelogin = session.hash['nodelogin']
            tunnel = session.hash['tunnel']
            vncpassword = session.hash.get('vncpassword','')

            #Decrypt password
            rcm_cipher = rcm_utils.rcm_cipher()
            vncpassword_decrypted=rcm_cipher.decrypt(vncpassword)

            if(self.debug):
                module_logger.debug( "portnumber --> "+ str(portnumber) +" node --> " + str(node) + " nodelogin --> " + str(nodelogin)+ " tunnel --> "+str(tunnel))


            if sys.platform.startswith('darwin') :
                vnc_command = self.vncexe + " -quality 80 -subsampling 2X" + " -password " + vncpassword_decrypted
                vnc_command += " -loglevel "+str(rcm_utils.vnc_loglevel)
            elif(sys.platform == 'win32'):
            #    vnc_command = self.vncexe + " -medqual " + "-password " + vncpassword_decrypted
                vnc_command = "echo "+ vncpassword_decrypted+ " | " + self.vncexe + " -medqual " + "-autopass -nounixlogin"
                vnc_command += " -logfile "+os.path.join(rcm_utils.log_folder(),'vncviewer_'+nodelogin+'_'+session.hash.get('sessionid','')+'.log')
                vnc_command += " -loglevel "+str(rcm_utils.vnc_loglevel)
            else:
                vnc_command = self.vncexe + " -medqual "
                #vnc_command += " -logfile "+os.path.join(rcm_utils.log_folder(),'vncviewer_'+nodelogin+'_'+session.hash.get('sessionid','')+'.log')



            if(sys.platform == 'win32' or sys.platform.startswith('darwin')):
                if (tunnel == 'y'):
                    tunnel_command = self.ssh_command  + " -L 127.0.0.1:" +str(local_portnumber) + ":" + node + ":" + str(portnumber) + " " + self.login_options + "@" + nodelogin 
                    if sys.platform.startswith('darwin'): 
                        tunnel_command +=  " echo 'rcm_tunnel'; sleep 20"
                    else: 
                        tunnel_command +=  " echo 'rcm_tunnel'; sleep 10"
                    vnc_command += " 127.0.0.1:" + str(local_portnumber)
                else:
                    #tunnel_command = self.ssh_command  + " -L 127.0.0.1:" +str(portnumber) + ":" + node + ":" + str(portnumber) + " " + self.login_options + "@" + nodelogin + " echo 'rcm_tunnel'; sleep 10"
                    vnc_command += " " + nodelogin + ":" + str(portnumber)
            else:
                if (tunnel == 'y'):
                    vnc_command += " -via '"  + self.login_options + "@" + nodelogin + "' " + node +":" + str(session.hash['display'])
                else:
                    vnc_command += ' ' + nodelogin + ":" + session.hash['display']
        else:

            vnc_command = self.vncexe + " -config "

                
        
        if(self.debug): module_logger.info( "tunnel->"+tunnel_command.replace(self.passwd,"****")+"< vnc->"+vnc_command+"< conffile->"+str(configFile)+"<")

        st=rcm_utils.SessionThread ( tunnel_command, vnc_command, self.passwd, vncpassword_decrypted,  otp, gui_cmd, configFile, self.debug)

        if(self.debug): module_logger.debug( "!!!!!session  thread--->"+str(st)+"<- num thread:"+str(len(self.session_thread)))
        self.session_thread.append(st)
        st.start()