[entropy*] drop socket service related code, R.I.P.

This commit is contained in:
Fabio Erculiani
2011-04-15 07:35:51 +02:00
parent 10ee59f257
commit aa62400790
11 changed files with 20 additions and 412 deletions
-1
View File
@@ -41,7 +41,6 @@ entropy-install:
install -m 644 conf/brokenlibsmask.conf $(DESTDIR)/etc/entropy/
install -m 644 conf/repositories.conf.example $(DESTDIR)/etc/entropy/
install -m 644 conf/socket* $(DESTDIR)/etc/entropy/
install -m 644 conf/entropy.conf $(DESTDIR)/etc/entropy/
cp conf/packages $(DESTDIR)/etc/entropy/ -Ra
install -m 644 misc/05entropy.envd $(DESTDIR)/etc/env.d/05entropy
-2
View File
@@ -152,8 +152,6 @@ def _add_repository(entropy_client, repo_strings):
toc.append((purple(_("Repository id:")), teal(repoid)))
toc.append((darkgreen(_("Description:")), teal(repodata['description'])))
toc.append((purple(_("Repository format:")), darkgreen(repodata['dbcformat'])))
toc.append((brown(_("Service port:")), teal(str(repodata['service_port']))))
toc.append((brown(_("Service port (SSL):")), teal(str(repodata['ssl_service_port']))))
for pkg_url in repodata['plain_packages']:
toc.append((purple(_("Packages URL:")), pkg_url))
db_url = repodata['plain_database']
-80
View File
@@ -1,80 +0,0 @@
# Project Entropy 1.0 Socket Services configuration file
# Socket Interface allows client applications to
# execute policy-validated tasks on the system
# running the service.
### :BEGIN: SERVER CONFIGURATION
#
# Listening address:
# listen = <valid IP address or hostname>
#
# example (default):
# listen = localhost
# use * to allow the interface to listen on any interface/address
#
# listen = localhost
#
# Listening port (non-SSL server instances):
# listen-port = <valid port, from 1-65535>
#
# example (default):
# listen-port = 999
#
# listen-port = 999
#
# Listening timeout:
# listen-timeout = <valid timeout, in seconds>
#
# example (default):
# listen-timeout = 30
#
# listen-timeout = 30
#
# Listening threads:
# listen-threads = <number of listening threads>
#
# example (default):
# listen-threads = 5
#
# listen-threads = 5
#
# Sessions TTL:
# session-ttl = <number of seconds>
#
# example (default):
# session-ttl = 120
#
# session-ttl = 120
#
# Maximum number of simulaneous connections:
# max-connections = <number of connections>
#
# example (default):
# max-connections = 5
#
# max-connections = 5
#
# SSL port (when using SSL):
# ssl-port = <valid port, from 1-65535>
#
# example (default):
# ssl-port = 998
#
# ssl-port = 998
#
# Disabled commands (space separated):
# disabled-commands = <existing_command_1 existing_command_2 existing_command_3>
#
# example:
# disabled-commands = existing_command_1 existing_command_2
#
# disabled-commands =
#
# Blacklisted IPs (space separated):
# ip-blacklist = <ip1 ip2 ip3>
#
# example:
# ip-blacklist = 123.123.123.123 111.111.111.111
#
# ip-blacklist =
-23
View File
@@ -1,23 +0,0 @@
-----BEGIN CERTIFICATE-----
MIID4zCCA0ygAwIBAgIJAJ/rPCvLbQ5vMA0GCSqGSIb3DQEBBQUAMIGoMQswCQYD
VQQGEwJJVDEOMAwGA1UECBMFSXRhbHkxEjAQBgNVBAcTCUhlbGxvdG93bjEWMBQG
A1UEChMNU2FiYXlvbiBMaW51eDEQMA4GA1UECxMHRW50cm9weTEkMCIGA1UEAxMb
U2FiYXlvbiBMaW51eCBFbnRyb3B5IFN0YWNrMSUwIwYJKoZIhvcNAQkBFhZseG5h
eUBzYWJheW9ubGludXgub3JnMB4XDTA4MDMzMTExMDIzM1oXDTA5MDMzMTExMDIz
M1owgagxCzAJBgNVBAYTAklUMQ4wDAYDVQQIEwVJdGFseTESMBAGA1UEBxMJSGVs
bG90b3duMRYwFAYDVQQKEw1TYWJheW9uIExpbnV4MRAwDgYDVQQLEwdFbnRyb3B5
MSQwIgYDVQQDExtTYWJheW9uIExpbnV4IEVudHJvcHkgU3RhY2sxJTAjBgkqhkiG
9w0BCQEWFmx4bmF5QHNhYmF5b25saW51eC5vcmcwgZ8wDQYJKoZIhvcNAQEBBQAD
gY0AMIGJAoGBANGK7Ft4wVFad4u/tbdj+qJavJo66O77M2YUEDCusLkcjOfGEvqT
IzEYiYiVETqZgxcIMH7FcSZdJVjf6vreok4JwCjAVZgDC1XCEkU31usvJJVj33a8
1tbWvAecscMjAFHSuQl6zguytPJUlnnT8o7Fvb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CfXGzherk7QmdGFTYfteDuz70b9ObRUgnQR
BUuOk8eLAkEA5konLGZUGuNp7XdbfEIDQ61HnoHABw8crEPG7OHINesxYcGsS/TF
S1eG/m55foOIPLRVCGp65r2BdVd7agSSqQJAXWY6UXOYxUDBUkZE4V9ar667f+uk
bwurN2c1bJSPzbD/KIsrkRtHUvE6R78Mr7U0CzP4PPT0T6Z3L5P19ddffQJBAIPx
ZoJk2rlRJMbexPbrp40mAcvKUWh5+xaj+pyMPDbQW0nEOmCGjGe/bWPnjgqzd+I3
/CRHRcVgPIUrq1Ux64kCQQCBfHSn10/YMVHaecEMZeCcSiO9YWEgintn27qR4kod
/bLQsxnBHmeg8CvDkpvrdcPCSTWUCV7irhmdiNBUJEE9
-----END RSA PRIVATE KEY-----
@@ -532,24 +532,17 @@ class RepositoryMixin:
if not disable and not enable: # so it's a add
service_uri = repodata.get('service_uri', '')
if service_uri:
service_uri = ',%s' % (service_uri,)
repository_lines = []
mirror_count = 0
for mirror in repodata['plain_packages']:
if mirror_count == 0:
mirror_count += 1
rline = "repository = %s|%s|%s|%s%s#%s#%s,%s" % (
rline = "repository = %s|%s|%s|%s#%s" % (
repodata['repoid'],
repodata['description'],
mirror,
repodata['plain_database'],
service_uri,
repodata['dbcformat'],
repodata['service_port'],
repodata['ssl_service_port'],
)
else:
rline = "repository = %s||%s|" % (
-41
View File
@@ -253,8 +253,6 @@ def const_default_settings(rootdir):
'serverconf': default_etp_confdir+"/server.conf",
# client.conf file (generic entropy client side settings)
'clientconf': default_etp_confdir+"/client.conf",
# socket.conf file
'socketconf': default_etp_confdir+"/socket.conf",
# used by entropy.spm to build pkgs relative URL metadata ("download",
# returned by EntropyRepository.retrieveDownloadURL())
'packagesrelativepath_basedir': "packages",
@@ -619,45 +617,6 @@ def const_default_settings(rootdir):
'genericdbid': "__generic__",
'systemreleasefile': "/etc/sabayon-release",
# these are constants, for real settings
# look ad SystemSettings class
'socket_service': { # here are the constants
'hostname': "localhost",
'port': 1026,
'ssl_port': 1027, # above + 1
'timeout': 200,
'forked_requests_timeout': 300,
'max_command_length': 768000, # bytes
'threads': 5,
'session_ttl': 15,
'default_uid': 0,
'max_connections': 5,
'max_connections_per_host': 15,
'max_connections_per_host_barrier': 8,
'disabled_cmds': set(),
'ip_blacklist': set(),
'ssl_key': default_etp_confdir+"/socket_server.key",
'ssl_cert': default_etp_confdir+"/socket_server.crt",
'ssl_ca_cert': default_etp_confdir+"/socket_server.CA.crt",
'ssl_ca_pkey': default_etp_confdir+"/socket_server.CA.key",
'answers': {
# command run
'ok': const_convert_to_rawstring(chr(0)+"OK"+chr(0)),
# execution error
'er': const_convert_to_rawstring(chr(0)+"ER"+chr(1)),
# not allowed
'no': const_convert_to_rawstring(chr(0)+"NO"+chr(2)),
# close connection
'cl': const_convert_to_rawstring(chr(0)+"CL"+chr(3)),
# max connections reached
'mcr': const_convert_to_rawstring(chr(0)+"MCR"+chr(4)),
# end of size
'eos': const_convert_to_rawstring(chr(0)),
# no operation
'noop': const_convert_to_rawstring(chr(0)+"NOOP"+chr(0)),
},
},
'install_sources': {
'unknown': 0,
'user': 1,
+18 -142
View File
@@ -187,7 +187,6 @@ class SystemSettings(Singleton, EntropyPluginStore):
'broken_syms': etpConst['confdir']+"/brokensyms.conf",
'broken_libs_mask': etpConst['confdir']+"/brokenlibsmask.conf",
'hw_hash': etpConst['confdir']+"/.hw.hash",
'socket_service': etpConst['socketconf'],
'system': etpConst['entropyconf'],
'repositories': etpConst['repositoriesconf'],
'system_package_sets': {},
@@ -196,7 +195,7 @@ class SystemSettings(Singleton, EntropyPluginStore):
'keywords', 'unmask', 'mask', 'satisfied', 'license_mask',
'license_accept', 'system_mask', 'system_package_sets',
'system_dirs', 'system_dirs_mask', 'extra_ldpaths',
'socket_service', 'system', 'system_rev_symlinks', 'hw_hash',
'system', 'system_rev_symlinks', 'hw_hash',
'broken_syms', 'broken_libs_mask'
])
self.__setting_files_pre_run.extend(['repositories'])
@@ -818,100 +817,6 @@ class SystemSettings(Singleton, EntropyPluginStore):
data[line[0]] = frozenset(line[1:])
return data
def _socket_service_parser(self):
"""
Parses socket service configuration file.
This file contains information about Entropy remote service ports
and SSL.
@return: parsed metadata
@rtype: dict
"""
data = etpConst['socket_service'].copy()
sock_conf = self.__setting_files['socket_service']
if not (os.path.isfile(sock_conf) and \
os.access(sock_conf, os.R_OK)):
return data
socket_f = open(sock_conf, "r")
socketconf = [x.strip() for x in socket_f.readlines() if \
x.strip() and not x.strip().startswith("#")]
socket_f.close()
def _listen(setting):
data['hostname'] = setting
def _listen_port(setting):
try:
data['port'] = int(setting)
except ValueError:
return
def _listen_timeout(setting):
try:
data['timeout'] = int(setting)
except ValueError:
return
def _listen_threads(setting):
try:
data['threads'] = int(setting)
except ValueError:
return
def _session_ttl(setting):
try:
data['session_ttl'] = int(setting)
except ValueError:
return
def _max_connections(setting):
try:
data['max_connections'] = int(setting)
except ValueError:
return
def _ssl_port(setting):
try:
data['ssl_port'] = int(setting)
except ValueError:
return
def _disabled_commands(setting):
for disabled_cmd in setting.split():
data['disabled_cmds'].add(disabled_cmd)
def _ip_blacklist(setting):
for ip_blacklist in setting.split():
data['ip_blacklist'].add(ip_blacklist)
settings_map = {
'listen': _listen,
'listen-port': _listen_port,
'listen-timeout': _listen_timeout,
'listen-threads': _listen_threads,
'session-ttl': _session_ttl,
'max-connections': _max_connections,
'ssl-port': _ssl_port,
'disabled-commands': _disabled_commands,
'ip-blacklist': _ip_blacklist,
}
for line in socketconf:
key, value = entropy.tools.extract_setting(line)
if key is None:
continue
func = settings_map.get(key)
if func is None:
continue
func(value)
return data
def _system_parser(self):
"""
@@ -1048,57 +953,31 @@ class SystemSettings(Singleton, EntropyPluginStore):
repopackages = repo_split[2].strip()
repodatabase = repo_split[3].strip()
eapi3_uri = None
eapi3_port = etpConst['socket_service']['port']
eapi3_ssl_port = etpConst['socket_service']['ssl_port']
eapi3_formatcolon = repodatabase.rfind("#")
# Support for custom EAPI3 ports
if eapi3_formatcolon != -1:
try:
ports = repodatabase[eapi3_formatcolon+1:].split(",")
if ports:
eapi3_port = int(ports[0])
if len(ports) > 1:
eapi3_ssl_port = int(ports[1])
except (ValueError, IndexError,):
eapi3_port = etpConst['socket_service']['port']
eapi3_ssl_port = etpConst['socket_service']['ssl_port']
repodatabase = repodatabase[:eapi3_formatcolon]
# Support for custom database file compression
dbformat = etpConst['etpdatabasefileformat']
dbformatcolon = repodatabase.rfind("#")
if dbformatcolon != -1:
if dbformat in etpConst['etpdatabasesupportedcformats']:
try:
dbformat = repodatabase[dbformatcolon+1:]
except (IndexError, ValueError, TypeError,):
pass
dbformat = None
for testno in range(2):
dbformatcolon = repodatabase.rfind("#")
if dbformatcolon == -1:
break
try:
dbformat = repodatabase[dbformatcolon+1:]
except (IndexError, ValueError, TypeError,):
pass
repodatabase = repodatabase[:dbformatcolon]
# Support for custom EAPI3 service URI
eapi3_uricolon = repodatabase.rfind(",")
if eapi3_uricolon != -1:
if dbformat not in etpConst['etpdatabasesupportedcformats']:
# fallback to default
dbformat = etpConst['etpdatabasefileformat']
found_eapi3_uri = repodatabase[eapi3_uricolon+1:]
if found_eapi3_uri:
eapi3_uri = found_eapi3_uri
repodatabase = repodatabase[:eapi3_uricolon]
# strip off, if exists, the deprecated service_uri part (EAPI3 shit)
uricol = repodatabase.rfind(",")
if uricol != -1:
repodatabase = repodatabase[:uricol]
mydata = {}
mydata['repoid'] = reponame
mydata['service_port'] = eapi3_port
mydata['ssl_service_port'] = eapi3_ssl_port
if not repodatabase.endswith("file://") and (eapi3_uri is None):
try:
# try to cope with the fact that no specific EAPI3 URI has been
# provided
eapi3_uri = repodatabase.split("/")[2]
except IndexError:
eapi3_uri = None
mydata['service_uri'] = eapi3_uri
mydata['description'] = repodesc
mydata['packages'] = []
mydata['plain_packages'] = []
@@ -1249,9 +1128,6 @@ class SystemSettings(Singleton, EntropyPluginStore):
obj['database'] = repodata['database']
obj['dbrevision'] = repodata['dbrevision']
obj['dbcformat'] = repodata['dbcformat']
obj['service_uri'] = repodata['service_uri']
obj['service_port'] = repodata['service_port']
obj['ssl_service_port'] = repodata['ssl_service_port']
else:
my_repodata[reponame] = repodata.copy()
@@ -423,33 +423,12 @@ class ServerSystemSettingsPlugin(SystemSettingsPlugin):
repodesc = repo_split[1].strip()
repouris = repo_split[2].strip()
service_url = None
eapi3_port = etpConst['socket_service']['port']
eapi3_ssl_port = etpConst['socket_service']['ssl_port']
if len(repo_split) > 3:
service_url = repo_split[3].strip()
eapi3_formatcolon = service_url.rfind("#")
if eapi3_formatcolon != -1:
try:
ports = service_url[eapi3_formatcolon+1:].split(",")
eapi3_port = int(ports[0])
if len(ports) > 1:
eapi3_ssl_port = int(ports[1])
service_url = service_url[:eapi3_formatcolon]
except (ValueError, IndexError,):
eapi3_port = etpConst['socket_service']['port']
eapi3_ssl_port = etpConst['socket_service']['ssl_port']
mydata = {}
mydata['repoid'] = repoid
mydata['description'] = repodesc
mydata['pkg_mirrors'] = []
mydata['repo_mirrors'] = []
mydata['community'] = False
mydata['service_url'] = service_url
mydata['service_port'] = eapi3_port
mydata['ssl_service_port'] = eapi3_ssl_port
uris = repouris.split()
for uri in uris:
do_pkg = False
@@ -4048,8 +4027,6 @@ class Server(Client):
dbc = self._open_temp_repository(repoid, temp_file = ":memory:")
self._memory_db_srv_instances[repoid] = dbc
eapi3_port = int(etpConst['socket_service']['port'])
eapi3_ssl_port = int(etpConst['socket_service']['ssl_port'])
# add to settings
repodata = {
'repoid': repoid,
@@ -4057,9 +4034,6 @@ class Server(Client):
'pkg_mirrors': pkg_mirrors,
'repo_mirrors': repo_mirrors,
'community': community_repo,
'service_port': eapi3_port,
'ssl_service_port': eapi3_ssl_port,
'service_url': service_url,
'handler': '', # not supported
'__temporary__': True,
}
-19
View File
@@ -148,8 +148,6 @@ class AddRepositoryWindow(MenuSkel):
self.addrepo_ui.repoidEntry.set_text(repodata['repoid'])
self.addrepo_ui.repoDescEntry.set_text(repodata['description'])
self.addrepo_ui.repodbPort.set_text(str(repodata['service_port']))
self.addrepo_ui.repodbPortSSL.set_text(str(repodata['ssl_service_port']))
self.repoMirrorsView.store.clear()
for x in repodata['plain_packages']:
self.repoMirrorsView.add(x)
@@ -170,8 +168,6 @@ class AddRepositoryWindow(MenuSkel):
repodata['plain_packages'] = self.repoMirrorsView.get_all()
repodata['dbcformat'] = self.addrepo_ui.repodbcformatEntry.get_active_text()
repodata['plain_database'] = self.addrepo_ui.repodbEntry.get_text()
repodata['service_port'] = self.addrepo_ui.repodbPort.get_text()
repodata['ssl_service_port'] = self.addrepo_ui.repodbPortSSL.get_text()
return repodata
def _validate_repo_submit(self, repodata, edit = False):
@@ -195,21 +191,6 @@ class AddRepositoryWindow(MenuSkel):
errors.append(_("Repository URL must be a valid URL"))
if not repodata['service_port']:
repodata['service_port'] = int(etpConst['socket_service']['port'])
else:
try:
repodata['service_port'] = int(repodata['service_port'])
except (ValueError,):
errors.append(_("Repository Services Port not valid"))
if not repodata['ssl_service_port']:
repodata['ssl_service_port'] = int(etpConst['socket_service']['ssl_port'])
else:
try:
repodata['ssl_service_port'] = int(repodata['ssl_service_port'])
except (ValueError,):
errors.append(_("Secure Services Port not valid"))
return errors
def on_mirrorDown_clicked( self, widget ):
+1 -55
View File
@@ -6044,64 +6044,10 @@ Relaxed</property>
<child>
<widget class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_rows">4</property>
<property name="n_columns">4</property>
<property name="column_spacing">10</property>
<property name="row_spacing">3</property>
<child>
<widget class="GtkEntry" id="repodbPortSSL">
<property name="visible">True</property>
<property name="can_focus">True</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label30">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Secure Services Port</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Services Port</property>
</widget>
<packing>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="repodbPort">
<property name="visible">True</property>
<property name="can_focus">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="repodbcformatEntry">
<property name="visible">True</property>