1
0
mirror of https://github.com/dkmstr/openuds.git synced 2024-12-22 13:34:04 +03:00

towards 1.7.5

This commit is contained in:
Adolfo Gómez García 2015-04-26 03:26:22 +02:00
parent a996562a5e
commit f411eec5f4
16 changed files with 160 additions and 295 deletions

View File

@ -6,12 +6,12 @@ RELEASE=1
top=`pwd`
cat udsactor-template.spec |
sed -e s/"version 1.7.0"/"version ${VERSION}"/g |
sed -e s/"version 0.0.0"/"version ${VERSION}"/g |
sed -e s/"release 1"/"release ${RELEASE}"/g > udsactor-$VERSION.spec
# Now fix dependencies for opensuse
cat udsactor-template.spec |
sed -e s/"version 1.7.0"/"version ${VERSION}"/g |
sed -e s/"version 0.0.0"/"version ${VERSION}"/g |
sed -e s/"name udsactor"/"name udsactor-opensuse"/g |
sed -e s/"PyQt4"/"python-qt4"/g |
sed -e s/"libXScrnSaver"/"libXss1"/g > udsactor-opensuse-$VERSION.spec

View File

@ -1,69 +0,0 @@
%define _topdir %(echo $PWD)/rpm
%define name udsactor
%define version 1.7.0
%define release 1
%define buildroot %{_topdir}/%{name}-%{version}-%{release}-root
BuildRoot: %{buildroot}
Name: %{name}
Version: %{version}
Release: %{release}
Summary: Actor for Universal Desktop Services (UDS) Broker
License: BSD3
Group: Admin
Requires: python-six python-requests PyQt4 libXScrnSaver
Vendor: Virtual Cable S.L.U.
URL: http://www.udsenterprise.com
Provides: udsactor
%define _rpmdir ../
%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
%install
curdir=`pwd`
cd ../..
make DESTDIR=$RPM_BUILD_ROOT DISTRO=rh install-udsactor
cd $curdir
%clean
rm -rf $RPM_BUILD_ROOT
curdir=`pwd`
cd ../..
make DESTDIR=$RPM_BUILD_ROOT DISTRO=rh clean
cd $curdir
%post
systemctl enable udsactor.service > /dev/null 2>&1
%preun
systemctl disable udsactor.service > /dev/null 2>&1
systemctl stop udsactor.service > /dev/null 2>&1
%postun
# $1 == 0 on uninstall, == 1 on upgrade for preun and postun (just a reminder for me... :) )
if [ $1 -eq 0 ]; then
rm -rf /etc/udsactor
rm /var/log/udsactor.log
fi
# And, posibly, the .pyc leaved behind on /usr/share/UDSActor
rm -rf /usr/share/UDSActor > /dev/null 2>&1
%description
This package provides the required components to allow this machine to work on an environment managed by UDS Broker.
%files
%defattr(-,root,root)
/etc/udsactor
/etc/xdg/autostart/UDSActorTool.desktop
/etc/init.d/udsactor
/usr/bin/UDSActorTool-startup
/usr/bin/udsactor
/usr/bin/UDSActorTool
/usr/sbin/UDSActorConfig
/usr/sbin/UDSActorConfig-pkexec
/usr/share/UDSActor/*
/usr/share/applications/UDS_Actor_Configuration.desktop
/usr/share/autostart/UDSActorTool.desktop
/usr/share/polkit-1/actions/org.openuds.pkexec.UDSActorConfig.policy

View File

@ -1,6 +1,6 @@
%define _topdir %(echo $PWD)/rpm
%define name udsactor
%define version 1.7.0
%define version 0.0.0
%define release 1
%define buildroot %{_topdir}/%{name}-%{version}-%{release}-root

View File

@ -1,61 +0,0 @@
%define _topdir %(echo $PWD)/rpm
%define name udsactor-xrdp
%define version 1.7.0
%define release 1
%define buildroot %{_topdir}/%{name}-%{version}-%{release}-root
BuildRoot: %{buildroot}
Name: %{name}
Version: %{version}
Release: %{release}
Summary: Glue between UDS Actor and XRDP
License: BSD3
Group: Admin
Requires: xrdp udsactor pam
Vendor: Virtual Cable S.L.U.
URL: http://www.udsenterprise.com
Provides: udsactor-xrdp
%define _rpmdir ../
%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
%install
curdir=`pwd`
cd ../..
make DESTDIR=$RPM_BUILD_ROOT DISTRO=rh install-udsactor-xrdp
cd $curdir
%clean
rm -rf $RPM_BUILD_ROOT
curdir=`pwd`
cd ../..
make DESTDIR=$RPM_BUILD_ROOT DISTRO=rh clean
cd $curdir
%post
SESMANFILE=/etc/pam.d/xrdp-sesman
TMPFILE=$(mktemp /tmp/sesman.XXXXX)
grep -v uds $SESMANFILE > $TMPFILE
echo >> $TMPFILE
echo "# Added by udsactor-xrdp" >> $TMPFILE
echo "session optional pam_exec.so /usr/bin/uds-sesman" >> $TMPFILE
cp $TMPFILE $SESMANFILE
rm $TMPFILE > /dev/null 2>&1
%preun
%postun
SESMANFILE=/etc/pam.d/xrdp-sesman
TMPFILE=$(mktemp /tmp/sesman.XXXXX)
grep -v uds $SESMANFILE > $TMPFILE
cp $TMPFILE $SESMANFILE
rm $TMPFILE > /dev/null 2>&1
%description
This package provides the required components to allow this machine to work on an environment managed by UDS Broker.
%files
%defattr(-,root,root)
/usr/bin/*

View File

@ -46,6 +46,7 @@ from udsactor import operations
from about_dialog_ui import Ui_UDSAboutDialog
from message_dialog_ui import Ui_UDSMessageDialog
from udsactor.scriptThread import ScriptExecutorThread
from udsactor import VERSION
trayIcon = None
@ -61,6 +62,7 @@ class UDSAboutDialog(QtGui.QDialog):
QtGui.QDialog.__init__(self, parent)
self.ui = Ui_UDSAboutDialog()
self.ui.setupUi(self)
self.ui.VersionLabel.setText("Version " + VERSION)
def closeDialog(self):
self.hide()

View File

@ -31,17 +31,19 @@
'''
from __future__ import unicode_literals
__title__ = 'udsactor'
__version__ = '1.7.0'
__build__ = 0x010700
__author__ = 'Adolfo Gómez'
__license__ = "BSD 3-clause"
__copyright__ = "Copyright 2014 VirtualCable S.L.U."
# On centos, old six release does not includes byte2int, nor six.PY2
import six
VERSION = '1.7.5'
__title__ = 'udsactor'
__version__ = VERSION
__build__ = 0x010750
__author__ = 'Adolfo Gómez'
__license__ = "BSD 3-clause"
__copyright__ = "Copyright 2014-205 VirtualCable S.L.U."
if not hasattr(six, 'byte2int'):
if six.PY3:
import operator

View File

@ -42,7 +42,7 @@ from uds.models import User
from uds.web import errors
from uds.web.views.service import getService
from uds.core.managers import cryptoManager
from uds.core.util.Config import GlobalConfig
import six
@ -89,7 +89,7 @@ class Client(Handler):
'''
logger.debug("Client args for GET: {0}".format(self._args))
if len(self._args) == 0:
if len(self._args) == 0: # Gets version
url = self._request.build_absolute_uri(reverse('ClientDownload'))
return Client.result({
'availableVersion': CLIENT_VERSION,
@ -97,14 +97,23 @@ class Client(Handler):
'downloadUrl': url
})
if len(self._args) == 1:
if len(self._args) == 1: # Simple test
return Client.result(_('Correct'))
try:
ticket, scrambler = self._args
ticket, scrambler = self._args # If more than 2 args, got an error
hostname = self._params['hostname'] # Or if hostname is not included...
srcIp = self._request.ip
# Ip is optional,
if GlobalConfig.HONOR_CLIENT_IP_NOTIFY.getBool() is True:
srcIp = self._params.get('ip', srcIp)
except Exception:
raise RequestError('Invalid request')
logger.debug('Got Ticket: {}, scrambled: {}, Hostname: {}, Ip: {}'.format(ticket, scrambler, hostname, srcIp))
try:
data = TicketStore.get(ticket)
except Exception:
@ -120,6 +129,8 @@ class Client(Handler):
ip, userService, userServiceInstance, transport, transportInstance = res
password = cryptoManager().xor(data['password'], scrambler).decode('utf-8')
userService.setConnectionSource(srcIp, hostname) # Store where we are accessing from so we can notify Service
transportScript = transportInstance.getUDSTransportScript(userService, transport, ip, self._request.os, self._request.user, password, self._request)
logger.debug('Script:\n{}'.format(transportScript))

View File

@ -37,8 +37,7 @@ from uds.REST import RequestError
from uds.models import Authenticator
from uds.models import DeployedService
from uds.models import Transport
from uds.core.util.Ticket import Ticket
from uds.models import TicketStore
import datetime
import six
@ -132,12 +131,11 @@ class Tickets(Handler):
time = 60 if time < 1 else time
realname = self._params.get('realname', self._params['username'])
servicePool = self._params.get('servicePool', None)
transport = None
transport = self._params.get('transport', None)
if servicePool is not None:
servicePool = DeployedService.objects.get(uuid=servicePool.lower())
transport = self._params.get('transport', None)
if transport is not None:
transport = Transport.objects.get(uuid=transport.lower())
try:
@ -163,16 +161,16 @@ class Tickets(Handler):
except Exception as e:
return Tickets.result(error=six.text_type(e))
data = {}
data['username'] = username
data['password'] = password
data['realname'] = realname
data['groups'] = groups
data['auth'] = auth.uuid
data['servicePool'] = servicePool
data['transport'] = transport
data = {
'username': username,
'password': password,
'realname': realname,
'groups': groups,
'auth': auth.uuid,
'servicePool': servicePool,
'transport': transport,
}
ticket = Ticket()
ticket.save(data, time)
ticket = TicketStore.create(data)
return Tickets.result(ticket.key)
return Tickets.result(ticket)

View File

@ -55,7 +55,7 @@ import logging
logger = logging.getLogger(__name__)
class TestReport(Report):
class UsersReport(Report):
title = 'Test report'
author = 'UDS Enterprise'
@ -79,6 +79,7 @@ class TestReport(Report):
elements = [
SystemField(expression='%(report_title)s', top=0.1 * cm, left=0, width=BAND_WIDTH,
style={'fontName': 'Helvetica-Bold', 'fontSize': 14, 'alignment': TA_CENTER}),
Label(text="User ID", top=0.8 * cm, left=0.5 * cm),
Label(text="Real Name", top=0.8 * cm, left=3 * cm),
Label(text="Last access", top=0.8 * cm, left=7 * cm),
@ -102,9 +103,11 @@ class TestReport(Report):
def users(request, idAuth):
resp = HttpResponse(content_type='application/pdf')
users = Authenticator.objects.get(uuid=idAuth).users.order_by('name')
auth = Authenticator.objects.get(uuid=idAuth)
users = auth.users.order_by('name')
report = TestReport(queryset=users)
report = UsersReport(queryset=users)
report.title = _('Users List for {}').format(auth.name)
report.generate_by(PDFGenerator, filename=resp)
return resp
# return HttpResponse(pdf, content_type='application/pdf')

View File

@ -1,13 +0,0 @@
{% extends "uds/html5/templates/base.html" %}
{% load i18n static %}
{% block body %}
<div class="panel panel-default text-center">
<div id="transport">
{{ transport }}
</div>
</div>
<div class="text-center">
<a href="{% url 'uds.web.views.index' %}" class="btn btn-info"><i class="fa fa-home"></i> {% trans "Back to services list" %}</a>
</div>
{% endblock %}

View File

@ -0,0 +1,35 @@
{% extends "uds/html5/templates/base.html" %}
{% load i18n html5 static %}
{% block title %}{% trans 'Service launcher' %}{% endblock %}
{% block body %}
<div class="jumbotron center service" data-href="{{ link }}">
<h1> {% trans 'Service launcher' %}</h1>
<br />
<p>{% trans 'The service you have requested is being launched.' %}</p>
<br />
<h5>{% trans 'If the service does not launchs automatically, probably you dont have the UDS plugin installed' %}</h5>
<h5>{% trans 'You can obtain it from here:' %}<a href="{% url 'ClientDownload' %}">{% trans 'UDS Plugin download page' %}</a></h5>
</div>
{% endblock %}
{% block js %}
<script>
function launchURL(el) {
var $el = $(el);
url = $el.attr('data-href');
url = url != null ? url : $el.attr('href');
if ( url.substring(0, 7) == 'udsa://' ) {
uds.launch($el);
} else {
window.location = url;
}
}
$(function() {
launchURL($('.service')[0]);
});
</script>
{% endblock %}

View File

@ -30,22 +30,21 @@
@author: Adolfo Gómez, dkmaster at dkmon dot com
'''
from django.conf.urls import patterns, include, url
from uds.core.util.modfinder import loadModulesUrls
from uds import REST
js_info_dict = {
'domain': 'djangojs',
'packages': ('uds',),
}
from django.conf.urls import patterns, include, url
from uds.core.util.modfinder import loadModulesUrls
from uds import REST
urlpatterns = patterns(
'uds',
url(r'^$', 'web.views.index', name='Index'),
(r'^login/$', 'web.views.login'),
(r'^login/(?P<tag>.+)$', 'web.views.login'),
(r'^logout$', 'web.views.logout'),
(r'^service/(?P<idService>.+)/(?P<idTransport>.+)$', 'web.views.service'),
# Icons
(r'^transicon/(?P<idTrans>.+)$', 'web.views.transportIcon'),
# Images
@ -55,9 +54,7 @@ urlpatterns = patterns(
# Transport component url
url(r'^transcomp/(?P<idTransport>.+)/(?P<componentId>.+)$', 'web.views.transcomp', name='TransportComponent'),
# Transport own link processor
url(r'^trans/(?P<idService>.+)/(?P<idTransport>.+)$', 'web.views.trans', name='TransportOwnLink'),
# Service notification url
(r'^sernotify/(?P<idUserService>.+)/(?P<notification>.+)$', 'web.views.sernotify'),
url(r'^trans/(?P<idService>.+)/(?P<idTransport>.+)$', 'web.views.transportOwnLink', name='TransportOwnLink'),
# Authenticators custom html
(r'^customAuth/(?P<idAuth>.*)$', 'web.views.customAuth'),
# Preferences

View File

@ -30,18 +30,18 @@
'''
from __future__ import unicode_literals
__updated__ = '2015-03-27'
import logging
logger = logging.getLogger(__name__)
from .login import login, logout, customAuth
from .index import index, about
from .prefs import prefs
from .service import service, trans, transcomp, sernotify, transportIcon, serviceImage, clientEnabler
from .service import transportOwnLink, transcomp, transportIcon, serviceImage, clientEnabler
from .auth import authCallback, authInfo, ticketAuth
from .download import download
from .client_download import client_downloads, plugin_detection
from .js import jsCatalog
from ..errors import error
__updated__ = '2015-04-26'
logger = logging.getLogger(__name__)

View File

@ -30,30 +30,35 @@
'''
from __future__ import unicode_literals
__updated__ = '2015-03-27'
__updated__ = '2015-04-26'
from django.utils.translation import ugettext as _
from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect
from django.views.decorators.csrf import csrf_exempt
from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse
from django.views.decorators.cache import never_cache
from django.shortcuts import render_to_response
from django.template import RequestContext
from uds.core.auths.auth import webLogin, webLogout, authenticateViaCallback, authLogLogin, getUDSCookie
from uds.models import Authenticator, DeployedService, Transport
from uds.core.util import html
from uds.core.util import OsDetector
from uds.core.util.Ticket import Ticket
from uds.core.util.State import State
from uds.core.ui import theme
from uds.models import TicketStore
from uds.core.auths.Exceptions import InvalidUserException
from uds.core.services.Exceptions import InvalidServiceException, ServiceInMaintenanceMode
import uds.web.errors as errors
from uds.web.views.service import getService
import logging
logger = logging.getLogger(__name__)
from .service import service
@csrf_exempt
def authCallback(request, authName):
@ -136,27 +141,22 @@ def ticketAuth(request, ticketId):
'''
Used to authenticate an user via a ticket
'''
ticket = Ticket(ticketId)
logger.debug('Ticket: {}'.format(ticket))
data = TicketStore.get(ticketId)
try:
try:
# Extract ticket.data from ticket.data storage, and remove it if success
username = ticket.data['username']
groups = ticket.data['groups']
auth = ticket.data['auth']
realname = ticket.data['realname']
servicePool = ticket.data['servicePool']
password = ticket.data['password']
transport = ticket.data['transport']
except:
username = data['username']
groups = data['groups']
auth = data['auth']
realname = data['realname']
servicePool = data['servicePool']
password = data['password']
transport = data['transport']
except Exception:
logger.error('Ticket stored is not valid')
raise InvalidUserException()
# Remove ticket
ticket.delete()
auth = Authenticator.objects.get(uuid=auth)
# If user does not exists in DB, create it right now
# Add user to groups, if they exists...
@ -165,7 +165,7 @@ def ticketAuth(request, ticketId):
try:
grps.append(auth.groups.get(uuid=g))
except Exception:
logger.debug('Group list has changed since ticket assignement')
logger.debug('Group list has changed since ticket assignment')
if len(grps) == 0:
logger.error('Ticket has no valid groups')
@ -186,15 +186,25 @@ def ticketAuth(request, ticketId):
# Check if servicePool is part of the ticket
if servicePool is not None:
servicePool = DeployedService.objects.get(uuid=servicePool)
# Check if service pool can't be accessed by groups
servicePool.validateUser(usr)
if servicePool.isInMaintenance():
raise ServiceInMaintenanceMode()
# If service pool is in there, also is transport
res = getService(request, servicePool, transport)
if res is None:
return render_to_response(theme.template('service_not_ready.html'), context_instance=RequestContext(request))
transport = Transport.objects.get(uuid=transport)
ip, userService, userServiceInstance, transport, transportInstance = res
response = service(request, 'F' + servicePool.uuid, transport.uuid) # 'A' Indicates 'assigned service'
if transportInstance.ownLink is True:
link = reverse('TransportOwnLink', args=('F' + userServiceInstance.uuid, transportInstance.uuid))
else:
link = html.udsAccessLink(request, 'F' + userService.uuid, transport.uuid)
return render_to_response(
theme.template('simpleLauncher.html'),
{
'link': link
},
context_instance=RequestContext(request)
)
else:
response = HttpResponsePermanentRedirect(reverse('uds.web.views.index'))

View File

@ -34,20 +34,17 @@ __updated__ = '2015-04-24'
from django.shortcuts import render_to_response
from django.shortcuts import render
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.template import RequestContext
from uds.core.auths.auth import webLoginRequired, webPassword
from uds.core.auths.auth import webLoginRequired
from uds.models import DeployedService, Transport, UserService, Network, TicketStore
from uds.models import DeployedService, Transport, UserService, Network
from uds.core.util.Config import GlobalConfig
from uds.core.util import OsDetector
from uds.core.util import html
from uds.core.ui import theme
from uds.core.managers.UserServiceManager import UserServiceManager
from uds.core.managers import cryptoManager
import logging
@ -173,7 +170,7 @@ def index(request):
services = sorted(services, key=lambda s: s['name'].upper())
autorun = False
if len(services) == 1 and GlobalConfig.AUTORUN_SERVICE.get(True) == '1' and len(services[0]['transports']) > 0:
if len(services) == 1 and GlobalConfig.AUTORUN_SERVICE.getBool(True) and len(services[0]['transports']) > 0:
if request.session.get('autorunDone', '0') == '0':
request.session['autorunDone'] = '1'
autorun = True

View File

@ -30,8 +30,6 @@
'''
from __future__ import unicode_literals
__updated__ = '2015-04-16'
from django.utils.translation import ugettext as _
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render_to_response
@ -59,7 +57,7 @@ import logging
logger = logging.getLogger(__name__)
__updated__ = '2015-02-22'
__updated__ = '2015-04-26'
def getService(request, idService, idTransport, doTest=True):
@ -68,24 +66,24 @@ def getService(request, idService, idTransport, doTest=True):
logger.debug('Kind of service: {0}, idService: {1}'.format(kind, idService))
if kind == 'A': # This is an assigned service
logger.debug('Getting A service {}'.format(idService))
ads = UserService.objects.get(uuid=idService)
ads.deployed_service.validateUser(request.user)
userService = UserService.objects.get(uuid=idService)
userService.deployed_service.validateUser(request.user)
else:
ds = DeployedService.objects.get(uuid=idService)
# We first do a sanity check for this, if the user has access to this service
# If it fails, will raise an exception
ds.validateUser(request.user)
# Now we have to locate an instance of the service, so we can assign it to user.
ads = UserServiceManager.manager().getAssignationForUser(ds, request.user)
userService = UserServiceManager.manager().getAssignationForUser(ds, request.user)
if ads.isInMaintenance() is True:
if userService.isInMaintenance() is True:
raise ServiceInMaintenanceMode()
logger.debug('Found service: {0}'.format(ads))
logger.debug('Found service: {0}'.format(userService))
trans = Transport.objects.get(uuid=idTransport)
# Ensures that the transport is allowed for this service
if trans not in ads.deployed_service.transports.all():
if trans not in userService.deployed_service.transports.all():
raise InvalidServiceException()
# If transport is not available for the request IP...
@ -93,57 +91,41 @@ def getService(request, idService, idTransport, doTest=True):
raise InvalidServiceException()
if doTest is False:
return (None, ads, None, trans, None)
return (None, userService, None, trans, None)
# Test if the service is ready
if ads.isReady():
log.doLog(ads, log.INFO, "User {0} from {1} has initiated access".format(request.user.name, request.ip), log.WEB)
if userService.isReady():
log.doLog(userService, log.INFO, "User {0} from {1} has initiated access".format(request.user.name, request.ip), log.WEB)
# If ready, show transport for this service, if also ready ofc
iads = ads.getInstance()
iads = userService.getInstance()
ip = iads.getIp()
events.addEvent(ads.deployed_service, events.ET_ACCESS, username=request.user.name, srcip=request.ip, dstip=ip, uniqueid=ads.unique_id)
events.addEvent(userService.deployed_service, events.ET_ACCESS, username=request.user.name, srcip=request.ip, dstip=ip, uniqueid=userService.unique_id)
if ip is not None:
itrans = trans.getInstance()
if itrans.isAvailableFor(ip):
ads.setConnectionSource(request.ip, 'unknown')
log.doLog(ads, log.INFO, "User service ready", log.WEB)
UserServiceManager.manager().notifyPreconnect(ads, itrans.processedUser(ads, request.user), itrans.protocol)
return (ip, ads, iads, trans, itrans)
userService.setConnectionSource(request.ip, 'unknown')
log.doLog(userService, log.INFO, "User service ready", log.WEB)
UserServiceManager.manager().notifyPreconnect(userService, itrans.processedUser(userService, request.user), itrans.protocol)
return (ip, userService, iads, trans, itrans)
else:
log.doLog(ads, log.WARN, "User service is not accessible (ip {0})".format(ip), log.TRANSPORT)
logger.debug('Transport is not ready for user service {0}'.format(ads))
log.doLog(userService, log.WARN, "User service is not accessible (ip {0})".format(ip), log.TRANSPORT)
logger.debug('Transport is not ready for user service {0}'.format(userService))
else:
logger.debug('Ip not available from user service {0}'.format(ads))
logger.debug('Ip not available from user service {0}'.format(userService))
else:
log.doLog(ads, log.WARN, "User {0} from {1} tried to access, but machine was not ready".format(request.user.name, request.ip), log.WEB)
log.doLog(userService, log.WARN, "User {0} from {1} tried to access, but machine was not ready".format(request.user.name, request.ip), log.WEB)
return None
@webLoginRequired(admin=False)
def service(request, idService, idTransport):
def transportOwnLink(request, idService, idTransport):
try:
res = getService(request, idService, idTransport)
if res is not None:
ip, ads, iads, trans, itrans = res
transportHtml = itrans.renderAsHtml(ads, trans, ip, request)
return render_to_response(theme.template('show_transport.html'), {'transport': transportHtml, 'nolang': True}, context_instance=RequestContext(request))
except Exception, e:
logger.exception("Exception")
return errors.exceptionView(request, e)
# Not ready, show message and return to this page in a while
return render_to_response(theme.template('service_not_ready.html'), context_instance=RequestContext(request))
@webLoginRequired(admin=False)
def trans(request, idService, idTransport):
try:
res = getService(request, idService, idTransport)
if res is not None:
ip, ads, iads, trans, itrans = res
return itrans.getLink(ads, trans, ip, request.os, request.user, webPassword(request), request)
ip, userService, iads, trans, itrans = res
# This returns a response object in fact
return itrans.getLink(userService, trans, ip, request.os, request.user, webPassword(request), request)
except Exception, e:
logger.exception("Exception")
return errors.exceptionView(request, e)
@ -165,35 +147,6 @@ def transcomp(request, idTransport, componentId):
return errors.exceptionView(request, e)
@webLoginRequired(admin=False)
def sernotify(request, idUserService, notification):
try:
if notification == 'hostname':
hostname = request.GET.get('hostname', None)[:64] # Cuts host name to 64 chars
ip = request.ip
if GlobalConfig.HONOR_CLIENT_IP_NOTIFY.getBool(True) is True:
ip = request.GET.get('ip', ip)
if ip is not None and hostname is not None:
us = UserService.objects.get(uuid=idUserService)
us.setConnectionSource(ip, hostname)
else:
return HttpResponse('Invalid request!', 'text/plain')
elif notification == "log":
message = request.GET.get('message', None)
level = request.GET.get('level', None)
if message is not None and level is not None:
us = UserService.objects.get(uuid=idUserService)
log.doLog(us, level, message, log.TRANSPORT)
else:
return HttpResponse('Invalid request!', 'text/plain')
except Exception as e:
logger.exception("Exception")
return errors.errorView(request, e)
return HttpResponse('ok', content_type='text/plain')
def transportIcon(request, idTrans):
try:
icon = Transport.objects.get(uuid=idTrans).getInstance().icon(False)
@ -232,10 +185,10 @@ def clientEnabler(request, idService, idTransport):
scrambler = cryptoManager().randomString(32)
password = cryptoManager().xor(webPassword(request), scrambler)
_x, ads, _x, trans, _x = res
_x, userService, _x, trans, _x = res
data = {
'service': 'A' + ads.uuid,
'service': 'A' + userService.uuid,
'transport': trans.uuid,
'user': request.user.uuid,
'password': password