You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vcl.apache.org by fa...@apache.org on 2009/07/21 19:43:05 UTC

svn commit: r796405 - /incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm

Author: fapeeler
Date: Tue Jul 21 17:43:05 2009
New Revision: 796405

URL: http://svn.apache.org/viewvc?rev=796405&view=rev
Log:
VCL-187

added code to grant_access routine which enables the external ssh port

Modified:
    incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm

Modified: incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm
URL: http://svn.apache.org/viewvc/incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm?rev=796405&r1=796404&r2=796405&view=diff
==============================================================================
--- incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm (original)
+++ incubator/vcl/trunk/managementnode/lib/VCL/Module/OS/Linux/Ubuntu.pm Tue Jul 21 17:43:05 2009
@@ -318,6 +318,40 @@
 		return 0;
 	}
 
+	my $user = $self->data->get_user_login_id();
+	my $computer_node_name = $self->data->get_computer_node_name();
+	my $identity = $self->data->get_image_identity;
+
+	notify($ERRORS{'OK'}, 0, "In grant_access routine $user,$computer_node_name");
+	my @sshcmd;
+	my $clear_extsshd = "perl -pi -e \'s/^AllowUsers .*\n//' /etc/ssh/external_sshd_config";
+	if(run_ssh_command($computer_node_name, $identity, $clear_extsshd, "root")) {
+		notify($ERRORS{'DEBUG'}, 0, "cleared AllowUsers directive from external_sshd_config");
+	}
+	else {
+		notify($ERRORS{'CRITICAL'}, 0, "failed to add AllowUsers $user to external_sshd_config");
+	}
+
+	my $cmd = "echo \"AllowUsers $user\" >> /etc/ssh/external_sshd_config";
+	if (run_ssh_command($computer_node_name, $identity, $cmd, "root")) {
+		notify($ERRORS{'DEBUG'}, 0, "added AllowUsers $user to external_sshd_config");
+	}
+	else {
+		notify($ERRORS{'CRITICAL'}, 0, "failed to add AllowUsers $user to external_sshd_config");
+		return 0;
+	}
+	undef @sshcmd;
+	@sshcmd = run_ssh_command($computer_node_name, $identity, "/etc/init.d/ext_sshd restart", "root");
+
+	foreach my $l (@{$sshcmd[1]}) {
+		if ($l =~ /Stopping ext_sshd:/i) {
+			#notify($ERRORS{'OK'},0,"stopping sshd on $computer_node_name ");
+		}
+		if ($l =~ /Starting ext_sshd:[  OK  ]/i) {
+			notify($ERRORS{'OK'}, 0, "ext_sshd on $computer_node_name started");
+		}
+	}    #foreach
+	notify($ERRORS{'OK'}, 0, "started ext_sshd on $computer_node_name");
 	return 1;
 }