mirror of
				https://github.com/KevinMidboe/delugeClient.git
				synced 2025-10-29 12:00:13 +00:00 
			
		
		
		
	Set password in config file to authenticate with password instead of priv key.
This commit is contained in:
		| @@ -1,10 +1,11 @@ | |||||||
| [Deluge] | [Deluge] | ||||||
| HOST = YOUR_DELUGE_HOST | HOST = YOUR_DELUGE_HOST_IP | ||||||
| PORT = YOUR_DELUGE_PORT | PORT = YOUR_DELUGE_PORT | ||||||
| USER = YOUR_DELUGE_USER | USER = YOUR_DELUGE_USER | ||||||
| PASSWORD = YOUR_DELUGE_PASSWORD | PASSWORD = YOUR_DELUGE_PASSWORD | ||||||
|  |  | ||||||
| [ssh] | [ssh] | ||||||
| HOST = YOUR_DELUGE_SERVER_IP | HOST = YOUR_SSH_HOST_IP | ||||||
| USER = YOUR_SSH_USER | USER = YOUR_SSH_USER | ||||||
| PKEY = YOUR_SSH_PRIVATE_KEY_DIRECTORY | PKEY = YOUR_SSH_PRIVATE_KEY_DIR | ||||||
|  | PASSWORD = YOUR_SSH_PASSWORD | ||||||
|   | |||||||
| @@ -96,6 +96,7 @@ class Deluge(object): | |||||||
|  |  | ||||||
|       self.ssh_host = config['ssh']['HOST'] |       self.ssh_host = config['ssh']['HOST'] | ||||||
|       self.ssh_user = config['ssh']['USER'] |       self.ssh_user = config['ssh']['USER'] | ||||||
|  |       self.ssh_password = config['ssh']['PASSWORD'] | ||||||
|       self.ssh_pkey = config['ssh']['PKEY'] |       self.ssh_pkey = config['ssh']['PKEY'] | ||||||
|     |     | ||||||
|       self._connect() |       self._connect() | ||||||
| @@ -110,8 +111,12 @@ class Deluge(object): | |||||||
|    def _connect(self): |    def _connect(self): | ||||||
|       logger.info('Checking if script on same server as deluge RPC') |       logger.info('Checking if script on same server as deluge RPC') | ||||||
|       if (socket.gethostbyname(socket.gethostname()) != self.host): |       if (socket.gethostbyname(socket.gethostname()) != self.host): | ||||||
|          self.tunnel = SSHTunnelForwarder(self.ssh_host, ssh_username=self.ssh_user, ssh_pkey=self.ssh_pkey,  |          if (self.ssh_password): | ||||||
|             local_bind_address=('localhost', self.port), remote_bind_address=('localhost', self.port)) |             self.tunnel = SSHTunnelForwarder(self.ssh_host, ssh_username=self.ssh_user, ssh_password=self.ssh_password, | ||||||
|  |                local_bind_address=('localhost', self.port), remote_bind_address=('localhost', self.port)) | ||||||
|  |          else: | ||||||
|  |             self.tunnel = SSHTunnelForwarder(self.ssh_host, ssh_username=self.ssh_user, ssh_pkey=self.ssh_pkey,  | ||||||
|  |                local_bind_address=('localhost', self.port), remote_bind_address=('localhost', self.port)) | ||||||
|          self.tunnel.start() |          self.tunnel.start() | ||||||
|  |  | ||||||
|       self.client = DelugeRPCClient(self.host, self.port, self.user, self.password) |       self.client = DelugeRPCClient(self.host, self.port, self.user, self.password) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user