mirror of
https://github.com/dkmstr/openuds.git
synced 2025-03-20 06:50:23 +03:00
* Advancing on proxy
* Preparing UDS to allow "proxied" requests to services (to simplify access to remote "hidden" networks)
This commit is contained in:
parent
ad5b8dcded
commit
1a2619c170
@ -37,10 +37,12 @@ from django.utils.translation import ugettext_noop as _
|
||||
from uds.core.util import OsDetector
|
||||
from uds.core import Module
|
||||
from uds.core.transports import protocols
|
||||
from uds.core.util import connection
|
||||
|
||||
import six
|
||||
import logging
|
||||
|
||||
__updated__ = '2016-10-14'
|
||||
__updated__ = '2017-01-19'
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@ -106,6 +108,12 @@ class Transport(Module):
|
||||
'''
|
||||
pass
|
||||
|
||||
def testServer(self, userService, ip, port):
|
||||
# TODO: Add Proxy support here
|
||||
# GET URL = proxy.../testService?ip=xxxxx&port=yyy&timeout=zzzz
|
||||
return connection.testServer(ip, six.text_type(port))
|
||||
|
||||
|
||||
def isAvailableFor(self, userService, ip):
|
||||
'''
|
||||
Checks if the transport is available for the requested destination ip
|
||||
|
@ -42,7 +42,6 @@ from uds.core.transports.BaseTransport import Transport
|
||||
from uds.core.transports.BaseTransport import TUNNELED_GROUP
|
||||
|
||||
from uds.core.transports import protocols
|
||||
from uds.core.util import connection
|
||||
from uds.core.util import OsDetector
|
||||
from uds.models import TicketStore
|
||||
|
||||
@ -110,7 +109,7 @@ class HTML5RDPTransport(Transport):
|
||||
ready = self.cache.get(ip)
|
||||
if ready is None:
|
||||
# Check again for readyness
|
||||
if connection.testServer(ip, '3389') is True:
|
||||
if self.testServer(userService, ip, '3389') is True:
|
||||
self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT)
|
||||
return True
|
||||
else:
|
||||
|
@ -39,7 +39,6 @@ from uds.core.ui.UserInterface import gui
|
||||
from uds.core.transports.BaseTransport import Transport
|
||||
from uds.core.transports import protocols
|
||||
from uds.core.util import OsDetector
|
||||
from uds.core.util import connection
|
||||
from .NXFile import NXFile
|
||||
|
||||
import logging
|
||||
@ -153,7 +152,7 @@ class NXTransport(Transport):
|
||||
ready = self.cache.get(ip)
|
||||
if ready is None:
|
||||
# Check again for readyness
|
||||
if connection.testServer(ip, self._listenPort) is True:
|
||||
if self.testServer(userService, ip, self._listenPort) is True:
|
||||
self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT)
|
||||
return True
|
||||
else:
|
||||
|
@ -40,7 +40,6 @@ from uds.core.transports.BaseTransport import Transport
|
||||
from uds.core.transports.BaseTransport import TUNNELED_GROUP
|
||||
from uds.core.transports import protocols
|
||||
from uds.models import TicketStore
|
||||
from uds.core.util import connection
|
||||
from uds.core.util import OsDetector
|
||||
from uds.core.util.tools import DictAsObj
|
||||
from .NXFile import NXFile
|
||||
@ -171,7 +170,7 @@ class TSNXTransport(Transport):
|
||||
ready = self.cache.get(ip)
|
||||
if ready is None:
|
||||
# Check again for readyness
|
||||
if connection.testServer(ip, self._listenPort) is True:
|
||||
if self.testServer(userService, ip, self._listenPort) is True:
|
||||
self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT)
|
||||
return True
|
||||
else:
|
||||
|
@ -33,16 +33,14 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from django.utils.translation import ugettext_noop as _
|
||||
from uds.core.managers.UserPrefsManager import CommonPrefs
|
||||
from uds.core.ui.UserInterface import gui
|
||||
from uds.core.transports.BaseTransport import Transport
|
||||
from uds.core.transports import protocols
|
||||
from uds.core.util import connection
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
__updated__ = '2016-07-28'
|
||||
__updated__ = '2017-01-19'
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -82,7 +80,7 @@ class BaseRDPTransport(Transport):
|
||||
ready = self.cache.get(ip)
|
||||
if ready is None:
|
||||
# Check again for ready
|
||||
if connection.testServer(ip, '3389') is True:
|
||||
if self.testServer(userService, ip, '3389') is True:
|
||||
self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT)
|
||||
return True
|
||||
else:
|
||||
|
@ -47,7 +47,7 @@ import six
|
||||
import os
|
||||
import logging
|
||||
|
||||
__updated__ = '2016-11-07'
|
||||
__updated__ = '2017-01-19'
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -164,7 +164,7 @@ class BaseX2GOTransport(Transport):
|
||||
ready = self.cache.get(ip)
|
||||
if ready is None:
|
||||
# Check again for ready
|
||||
if connection.testServer(ip, '22') is True:
|
||||
if self.testServer(userService, ip, '22') is True:
|
||||
self.cache.put(ip, 'Y', READY_CACHE_TIMEOUT)
|
||||
return True
|
||||
else:
|
||||
|
3
udsProxy/.gitignore
vendored
3
udsProxy/.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
bin
|
||||
pkg
|
||||
vars
|
||||
src/gopkg.in
|
||||
src/*
|
||||
!src/uds
|
||||
|
@ -12,10 +12,15 @@ import (
|
||||
ini "gopkg.in/ini.v1"
|
||||
)
|
||||
|
||||
const configFilename = "/etc/UDSProxy.cfg"
|
||||
const configFilename = "/etc/udsproxy.cfg"
|
||||
|
||||
var config struct {
|
||||
Broker string `ini:"broker"` // Broker address
|
||||
Server string // Server Type, "http" or "https"
|
||||
Port string // Server port
|
||||
Broker string // Broker address
|
||||
UseSSL bool // If use https for connecting with broker: Warning, certificate must be valid on Broker
|
||||
SSLCertificateFile string // Certificate file
|
||||
SSLCertificateKeyFile string // Certificate key
|
||||
}
|
||||
|
||||
// Test service
|
||||
@ -72,13 +77,24 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
// Default config values
|
||||
config.Port = "9090"
|
||||
|
||||
// Read config
|
||||
cfg.MapTo(&config)
|
||||
|
||||
fmt.Println("Broker address: ", config.Broker)
|
||||
fmt.Println("Broker address: ", config.Broker, ", Server type & port: ", config.Server, config.Port)
|
||||
http.HandleFunc("/actor", actor) // set router
|
||||
http.HandleFunc("/testService", testService)
|
||||
err = http.ListenAndServe(":9090", nil) // set listen port
|
||||
if config.Server == "https" {
|
||||
err = http.ListenAndServeTLS(":"+config.Port, config.SSLCertificateFile, config.SSLCertificateKeyFile, nil) // set listen port
|
||||
} else {
|
||||
err = http.ListenAndServe(":"+config.Port, nil) // set listen port
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
log.Fatal("ListenAndServe: ", err)
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user