From de6554b067189a0c9bb00df0516968ec8c282c48 Mon Sep 17 00:00:00 2001 From: Marta Carbone Date: Mon, 23 Jun 2008 11:34:51 +0000 Subject: [PATCH] Changed dummynet box configuration files. --- PLC/Methods/GetDummyBoxMedium.py | 10 +++++----- PLC/Methods/GetDummyBoxUsers.py | 10 +++++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/PLC/Methods/GetDummyBoxMedium.py b/PLC/Methods/GetDummyBoxMedium.py index 5a816775..058342a4 100644 --- a/PLC/Methods/GetDummyBoxMedium.py +++ b/PLC/Methods/GetDummyBoxMedium.py @@ -19,6 +19,7 @@ from PLC.DummyBoxes import DummyBox, DummyBoxes # main class for a DummyBox from PLC.Methods.GetBootMedium import compute_key # key generation function WORK_DIR = "/tmp/DummynetBoxMedium" +BASE_IMAGE = "/usr/share/dummynet/picobsd.bin" class GetDummyBoxMedium(Method): """ @@ -68,10 +69,10 @@ class GetDummyBoxMedium(Method): file += 'IP_GATEWAY="%s"\n' % dummybox['gateway'] file += 'IP_DNS1="%s"\n' % dummybox['dns1'] file += 'IP_DNS2="%s"\n' % dummybox['dns2'] - file += 'DUMMYBOX_ID=%s\n' % dummybox['dummybox_id'] - file += 'DUMMYBOX_KEY=%s\n' % new_key + file += 'DUMMYBOX_ID="%s"\n' % dummybox['dummybox_id'] + file += 'DUMMYBOX_KEY="%s"\n' % new_key - file += 'CS_IP=%s\n' % self.api.config.PLC_API_HOST + file += 'CS_IP="%s"\n' % self.api.config.PLC_API_HOST # write the configuration file # WORK_DIR must be writable @@ -85,7 +86,6 @@ class GetDummyBoxMedium(Method): def call(self, auth, dummybox_id): # set file names - BASE_IMAGE = WORK_DIR + '/picobsd.bin' IMAGE_NAME = str(WORK_DIR) + "/dummybox_" + str(dummybox_id) + ".bin" configfile = WORK_DIR + '/dummybox.conf' lockfile = WORK_DIR + '/lockfile' @@ -140,5 +140,5 @@ class GetDummyBoxMedium(Method): dummybox.sync() # return the file - #return IMAGE_NAME + return IMAGE_NAME return base64.b64encode(file(IMAGE_NAME).read()) diff --git a/PLC/Methods/GetDummyBoxUsers.py b/PLC/Methods/GetDummyBoxUsers.py index 732cbf88..d867b780 100644 --- a/PLC/Methods/GetDummyBoxUsers.py +++ b/PLC/Methods/GetDummyBoxUsers.py @@ -57,7 +57,7 @@ class GetDummyBoxUsers(Method): # to format the output files # port-forwarding should be denied in the main sshd configuration file ssh_command = "/home/user/dbox.cmd " - ssh_configuration = ",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty " + ssh_configuration = ",no-port-forwarding,no-agent-forwarding,no-X11-forwarding " # Get dummyboxes information dummyboxes = DummyBoxes(self.api, dummybox_id, ['site_id']) @@ -149,7 +149,11 @@ class GetDummyBoxUsers(Method): authorized_keys_file += "# and $SSH_ORIGINAL_COMMAND is the command line inserted by the node\n" for i in authorized_keys_dict: - authorized_keys_file += "command=" + "\"" + ssh_command + str(authorized_keys_dict[i]); - authorized_keys_file += " $SSH_ORIGINAL_COMMAND" + "\"" + ssh_configuration + str(i) + "\n" + # index of the key + key_index = str(authorized_keys_dict[i]) + + # create the dummynet box command + authorized_keys_file += "command=\"" + ssh_command + key_index; + authorized_keys_file += " $SSH_ORIGINAL_COMMAND\"" + ssh_configuration + str(i) + "\n" return user_map+NEWFILE_MARK+"\n"+authorized_keys_file -- 2.47.0