Introduce "slapos node register" script.

Squashed commit of the following:

commit a9aa690c5b74de55fed2499cbe6a2a205fbc2550
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Fri Aug 17 10:18:14 2012 +0200

    Introduce use of logger

commit a36d37f766062eb5faed1e179d64a6c6a2bc2e50
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 16 19:05:09 2012 +0200

    update copyright from 2010 to 2012

commit 167c2a83d45a5e1ca88dab806a5612e981aaf6a9
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 16 19:02:56 2012 +0200

    Add dry run control in saving old configuration

commit 80eecf880c214c96d780547e95c447d794a87c0e
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 16 19:00:35 2012 +0200

    Clean code

commit 359cf29263e72f2070659d7fdc1ba227dff85426
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 16 18:51:43 2012 +0200

    Moved comments to docs

commit 84077e2a926b7d8fdf2495001df9378a301b5bbd
Merge: 42f2b2d 8d7ba61
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 16 18:46:52 2012 +0200

    Merge remote-tracking branch 'origin/register' into register

commit 42f2b2dae626dfa7ef54f2df97e21d089e5890d7
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 16 18:46:31 2012 +0200

    Moved register.py to register/

commit 8d7ba617c3d0697683eff48aee8401067d23c413
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 16 10:48:48 2012 +0200

    Display error if wrong usage

commit 927d395f2f3e1f01085c38ea681f16034182e2bd
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Tue Aug 14 14:57:33 2012 +0200

    Added created_tap = false in slapos.cfg

commit 49669afd0514f01b4720f94137c1f76cc47b4904
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Tue Aug 14 12:05:07 2012 +0200

    If a slapos.old file is find, backup will be made in slapos.old.i
    Where i is the lower integer available starting at 1

commit 430406f39753af3f2de26e5a631350c5fb997a3a
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Tue Aug 14 11:04:11 2012 +0200

    Can pass login and password in command line argument

commit 50b19497981d274f327fbe44c619a221539697aa
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 9 11:49:29 2012 +0200

    Solved bug in writting interface in slapos.cfg

commit 27fe79c859a65095493303da7f81ace0c3643641
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 9 10:51:10 2012 +0200

    Added option to modify master webservice url for computer registration

commit 9ed75848324789bb01404592780ba7cd2ab65f3c
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 9 10:17:28 2012 +0200

    Removed useless recursive include in MANIFEST.in

commit 6b2d90c0b8149872b56dc9b565cb4800c3183594
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 9 10:08:31 2012 +0200

    removed useless parameters in Option function call

commit 34083f2351570a1413bffb18db05bd17a6a8a18c
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 9 10:06:07 2012 +0200

    removed useless '/'.join in os.path.join

commit 8408a213e655cc9030493d8a4695a4e4c0380c30
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Thu Aug 9 09:53:07 2012 +0200

    Withdraw unused module from code

commit 2805cf2a9927e0b09a60984f7255423602e37e31
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Wed Aug 8 16:17:31 2012 +0200

    Fixed forgotten code

commit 35e0b0ba9c6a7a9782a895b7ff74ab1294d1cad2
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Wed Aug 8 15:53:50 2012 +0200

    Added slapos entry point, just giving acces to register script now

commit d2456a5a5f9135176498ac40088850627e21f88c
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Wed Aug 8 11:46:34 2012 +0200

    Register function is now made to run in command line
    ipv6 interface option added

commit 71bc5c9edae00502cf09abaac4a4d70be96d4a9a
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Tue Aug 7 17:40:56 2012 +0200

    Added creation partition_pki repertory

commit e80fede661858f98d0508bf61c4489b2e174882e
Author: Cédric Le Ninivin <cedric.leninivin@tiolive.com>
Date:   Tue Aug 7 17:01:23 2012 +0200

    Introducing independant register function that saves configuration in /etc/opt/slapos/slapos.cfg
parent a630757b
......@@ -58,6 +58,7 @@ setup(name=name,
'slapgrid-supervisord = slapos.grid.svcbackend:supervisord',
'slapproxy = slapos.proxy:main',
'bang = slapos.bang:main',
'slapos = slapos.slapos:main',
]
},
test_suite="slapos.tests",
......
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2012 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import base64
from getpass import getpass
import logging
from optparse import OptionParser, Option
import os
import pkg_resources
import shutil
import sys
import urllib2
class SlapError(Exception):
"""
Slap error
"""
def __init__(self, message):
self.msg = message
class UsageError(SlapError):
pass
class ExecError(SlapError):
pass
class Parser(OptionParser):
"""
Parse all arguments.
"""
def __init__(self, usage=None, version=None):
"""
Initialize all options possibles.
"""
OptionParser.__init__(self, usage=usage, version=version,
option_list=[
Option("--interface-name",
help="Interface name to access internet",
default='eth0',
type=str),
Option("--master-url",
help="URL of vifib master",
default='https://slap.vifib.com',
type=str),
Option("--master-url-web",
help="URL of vifib master webservice to register certificates",
default='https://www.vifib.net',
type=str),
Option("--partition-number",
help="Number of partition on computer",
default='10',
type=int),
Option("--ipv4-local-network",
help="Base of ipv4 local network",
default='10.0.0.0/16',
type=str),
Option("--ipv6-interface",
help="Interface name to get ipv6",
default='',
type=str),
Option("--login",
help="User login on Vifib master webservice",
default=None,
type=str),
Option("--password",
help="User password on Vifib master webservice",
default=None,
type=str),
Option("-n", "--dry-run",
help="Simulate the execution steps",
default=False,
action="store_true"),
])
def check_args(self):
"""
Check arguments
"""
(options, args) = self.parse_args()
if len(args) != 1:
self.error("Incorrect number of arguments")
node_name = args[0]
if options.password != None and options.login == None :
self.error("Please enter your login with your password")
if options.ipv6_interface != '' :
options.ipv6_interface = ('ipv6_interface = ' + options.ipv6_interface)
return options, node_name
def get_login():
"""Get user id and encode it for basic identification"""
login = raw_input("Vifib Login: ")
password = getpass()
identification = base64.encodestring('%s:%s' % (login, password))[:-1]
return identification
def check_login(identification,master_url_web):
"""Check if logged correctly on vifib"""
request = urllib2.Request(master_url_web)
# Prepare header for basic authentification
authheader = "Basic %s" % identification
request.add_header("Authorization", authheader)
home_page_url = urllib2.urlopen(request).read()
if 'Logout' in home_page_url:
return 1
else : return 0
def get_certificates(identification,node_name,master_url_web):
"""Download certificates on vifib master"""
register_server_url = '/'.join([master_url_web, ("add-a-server/WebSection_registerNewComputer?dialog_id=WebSection_viewServerInformationDialog&dialog_method=WebSection_registerNewComputer&title={}&object_path=/erp5/web_site_module/hosting/add-a-server&update_method=&cancel_url=https%3A//www.vifib.net/add-a-server/WebSection_viewServerInformationDialog&Base_callDialogMethod=&field_your_title=Essai1&dialog_category=None&form_id=view".format(node_name))])
request = urllib2.Request(register_server_url)
# Prepare header for basic authentification
authheader = "Basic %s" % identification
request.add_header("Authorization", authheader)
url = urllib2.urlopen(request)
page = url.read()
return page
def parse_certificates(source):
"""Parse html gotten from vifib to make certificate and key files"""
c_start = source.find("Certificate:")
c_end = source.find("</textarea>",c_start)
k_start = source.find("-----BEGIN PRIVATE KEY-----")
k_end = source.find("</textarea>",k_start)
return [source[c_start:c_end],source[k_start:k_end]]
def get_computer_name(certificate):
"""Parse certificate to get computer name and return it"""
k=certificate.find("COMP-")
i=certificate.find("/email",k)
return certificate[k:i]
def save_former_config(config):
"""Save former configuration if found"""
# Check for config file in /etc/opt/slapos/
if os.path.exists('/etc/opt/slapos/slapos.cfg'):
former_slapos_configuration='/etc/opt/slapos'
else : former_slapos_configuration = 0
if former_slapos_configuration:
saved_slapos_configuration = former_slapos_configuration + '.old'
while True:
if os.path.exists(saved_slapos_configuration):
print "Slapos configuration detected in %s" % saved_slapos_configuration
if saved_slapos_configuration[len(saved_slapos_configuration)-1]!= 'd' :
saved_slapos_configuration = saved_slapos_configuration[:len(saved_slapos_configuration)-1] \
+ str( int(saved_slapos_configuration[len(saved_slapos_configuration)-1])+1 )
else :
saved_slapos_configuration += ".1"
else: break
config.logger.info( "Former slapos configuration detected in %s moving to %s" % (former_slapos_configuration,saved_slapos_configuration))
shutil.move(former_slapos_configuration,saved_slapos_configuration)
def slapconfig(config):
"""Base Function to configure slapos in /etc/opt/slapos"""
dry_run = config.dry_run
try:
# Create slapos configuration directory if needed
slap_configuration_directory = os.path.normpath(config.slapos_configuration)
slap_configuration_file = os.path.join(slap_configuration_directory, 'slapos.cfg')
if not os.path.exists(slap_configuration_directory):
config.logger.info ("Creating directory: %s" % slap_configuration_directory)
if not dry_run:
os.mkdir(slap_configuration_directory, 0711)
user_certificate_repository_path = os.path.join(slap_configuration_directory,'ssl')
if not os.path.exists(user_certificate_repository_path):
config.logger.info ("Creating directory: %s" % user_certificate_repository_path)
if not dry_run:
os.mkdir(user_certificate_repository_path, 0711)
key_file = os.path.join(user_certificate_repository_path, 'key')
cert_file = os.path.join(user_certificate_repository_path, 'certificate')
for (src, dst) in [(config.key, key_file), (config.certificate,
cert_file)]:
config.logger.info ("Copying to %r, and setting minimum privileges" % dst)
if not dry_run:
destination = open(dst,'w')
destination.write(''.join(src))
destination.close()
os.chmod(dst, 0600)
os.chown(dst, 0, 0)
certificate_repository_path = os.path.join(slap_configuration_directory,'ssl','partition_pki')
if not os.path.exists(certificate_repository_path):
config.logger.info ("Creating directory: %s" % certificate_repository_path)
if not dry_run:
os.mkdir(certificate_repository_path, 0711)
# Put slapgrid configuration file
config.logger.info ("Creating slap configuration: %s" % slap_configuration_file)
if not dry_run:
open(slap_configuration_file, 'w').write(
pkg_resources.resource_stream(__name__,
'register/templates/slapos.cfg.in').read() % dict(
computer_id=config.computer_id, master_url=config.master_url,
key_file=key_file, cert_file=cert_file,
certificate_repository_path=certificate_repository_path,
partition_amount=config.partition_number,
interface=config.interface_name,
ipv4_network=config.ipv4_local_network,
ipv6_interface=config.ipv6_interface
))
config.logger.info ("SlapOS configuration: DONE")
finally:
return 0
# Class containing all parameters needed for configuration
class Config:
def setConfig(self, option_dict, node_name):
"""
Set options given by parameters.
"""
# Set options parameters
for option, value in option_dict.__dict__.items():
setattr(self, option, value)
self.node_name = node_name
# Define logger for register
self.logger = logging.getLogger('Register')
self.logger.setLevel(logging.DEBUG)
# create console handler and set level to debug
self.ch = logging.StreamHandler()
self.ch.setLevel(logging.INFO)
# create formatter
self.formatter = logging.Formatter('%(levelname)s - %(message)s')
# add formatter to ch
self.ch.setFormatter(self.formatter)
# add ch to logger
self.logger.addHandler(self.ch)
def COMPConfig(self, slapos_configuration,
computer_id,
certificate,
key):
self.slapos_configuration= slapos_configuration
self.computer_id=computer_id
self.certificate=certificate
self.key=key
def displayUserConfig(self):
self.logger.debug ("Computer Name : %s" % self.node_name)
self.logger.debug ("Master URL: %s" % self.master_url)
self.logger.debug ("Number of partition: %s" % self.partition_number)
self.logger.debug ("Interface Name: %s" % self.interface_name)
self.logger.debug ("Ipv4 sub network: %s" % self.ipv4_local_network)
self.logger.debug ("Ipv6 Interface: %s" %self.ipv6_interface)
def register(config):
"""Register new computer on VIFIB and generate slapos.cfg"""
# Get User identification and check them
if config.login == None :
while True :
print ("Please enter your Vifib login")
user_id = get_login()
if check_login(user_id,config.master_url_web): break
config.logger.warning ("Wrong login/password")
elif config.password == None :
if not check_login(base64.encodestring('%s:%s' % (config.login,getpass()))[:-1],config.master_url_web):
config.logger.error ("Wrong login/password")
return 1
else:
if not check_login(base64.encodestring('%s:%s' % (config.login,config.password))[:-1],config.master_url_web):
config.logger.error ("Wrong login/password")
return 1
# Get source code of page having certificate and key
certificate_key = get_certificates(user_id,config.node_name,config.master_url_web)
# Parse certificate and key and get computer id
certificate_key = parse_certificates(certificate_key)
certificate = certificate_key[0]
key = certificate_key[1]
COMP = get_computer_name(certificate)
# Getting configuration parameters
slapos_configuration='/etc/opt/slapos/'
config.COMPConfig(slapos_configuration=slapos_configuration,
computer_id=COMP,
certificate = certificate,
key = key
)
# Save former configuration
if not config.dry_run:
save_former_config(config)
# Prepare Slapos Configuration
slapconfig(config)
return 0
def main():
"Run default configuration."
usage = "usage: slapos node %s NODE_NAME [options] " % sys.argv[0]
try:
# Parse arguments
config = Config()
config.setConfig(*Parser(usage=usage).check_args())
return_code = register(config)
except UsageError, err:
print >>sys.stderr, err.msg
print >>sys.stderr, "For help use --help"
return_code = 16
except ExecError, err:
print >>sys.stderr, err.msg
return_code = 16
except SystemExit, err:
# Catch exception raise by optparse
return_code = err
sys.exit(return_code)
[slapos]
software_root = /opt/slapgrid
instance_root = /srv/slapgrid
master_url = %(master_url)s
computer_id = %(computer_id)s
key_file = %(key_file)s
cert_file = %(cert_file)s
certificate_repository_path = %(certificate_repository_path)s
[slapformat]
interface_name = %(interface)s
computer_xml = /opt/slapos/slapos.xml
log_file = /opt/slapos/slapformat.log
create_tap = false
partition_amount = %(partition_amount)s
partition_base_name = slappart
user_base_name = slapuser
tap_base_name = slaptap
# You can choose any other local network which does not conflict with your
# current machine configuration
ipv4_local_network = %(ipv4_network)s
%(ipv6_interface)s
[networkcache]
# Define options for binary cache, used to download already compiled software.
download-binary-cache-url = http://www.shacache.org/shacache
download-cache-url = https://www.shacache.org/shacache
download-binary-dir-url = http://www.shacache.org/shadir
# List of signatures of uploaders we trust:
# Romain Courteaud
# Sebastien Robin
# Kazuhiko Shiozaki
# Cedric de Saint Martin
# Yingjie Xu
# Gabriel Monnerat
# Łukasz Nowak
signature-certificate-list =
-----BEGIN CERTIFICATE-----
MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE
CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5
MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl
ZmF1bHQgUHJvdmluY2UxDzANBgNVBAoTBk5leGVkaTCBnzANBgkqhkiG9w0BAQEF
AAOBjQAwgYkCgYEApYZv6OstoqNzxG1KI6iE5U4Ts2Xx9lgLeUGAMyfJLyMmRLhw
boKOyJ9Xke4dncoBAyNPokUR6iWOcnPHtMvNOsBFZ2f7VA28em3+E1JRYdeNUEtX
Z0s3HjcouaNAnPfjFTXHYj4um1wOw2cURSPuU5dpzKBbV+/QCb5DLheynisCAwEA
ATANBgkqhkiG9w0BAQsFAAOBgQBCZLbTVdrw3RZlVVMFezSHrhBYKAukTwZrNmJX
mHqi2tN8tNo6FX+wmxUUAf3e8R2Ymbdbn2bfbPpcKQ2fG7PuKGvhwMG3BlF9paEC
q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g
QUUGLQ==
-----END CERTIFICATE-----
-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CLsUiUeci
Vd0Ozh79JSRpkrdI8R/NRQ2XPHAo+29TT70=
-----END CERTIFICATE-----
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2012 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly advised to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import sys
from register.register import main as node_register
def main():
if len(sys.argv) < 3:
print "Usage: slapos node register NODE_NAME [options]"
print "%s: error: Incorrect number of arguments" % sys.argv[0]
return 0
"Run default configuration."
if sys.argv[1] == "node" and sys.argv[2] == "register":
sys.argv=sys.argv[2:]
node_register()
else :
print "Usage: slapos node register NODE_NAME [options]"
print "%s: error: Incorrect arguments" % sys.argv[0]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment