Added config for xinetd + mockup VM server

The mockup VM script returns either error (if random is odd) or 
success (if random is even).

The protocol is the following:
C: Action {Start, Stop, Monit} login pass uid
S: ( Error[^|]+ | ok ) | ip(:port)? | hostname
This commit is contained in:
François Serman 2013-04-12 22:03:28 +00:00
parent 943d091944
commit 90c6cf1d29
3 changed files with 32 additions and 0 deletions

2
.gitattributes vendored
View File

@ -494,6 +494,7 @@ etc/alternc/templates/postfix/sasl/smtpd.conf -text
etc/alternc/templates/proftpd/modules.conf -text etc/alternc/templates/proftpd/modules.conf -text
etc/alternc/templates/proftpd/proftpd.conf -text etc/alternc/templates/proftpd/proftpd.conf -text
etc/alternc/templates/proftpd/welcome.msg -text etc/alternc/templates/proftpd/welcome.msg -text
etc/xinetd.d/alternc_lxc -text
install/alternc.install -text install/alternc.install -text
install/body_checks -text install/body_checks -text
install/domaines.template -text install/domaines.template -text
@ -582,6 +583,7 @@ src/alternc-check -text
src/alternc-dboptimize -text src/alternc-dboptimize -text
src/alternc-passwd -text src/alternc-passwd -text
src/alternc_add_policy_dovecot -text src/alternc_add_policy_dovecot -text
src/alternc_lxc_remote -text
src/alternc_reload -text src/alternc_reload -text
src/compress_logs.sh -text src/compress_logs.sh -text
src/courier-dovecot-migrate.pl -text src/courier-dovecot-migrate.pl -text

16
etc/xinetd.d/alternc_lxc Normal file
View File

@ -0,0 +1,16 @@
service alternc_lxc
{
type = UNLISTED
port = 6504
socket_type = stream
protocol = tcp
wait = no
user = root
server = /var/lib/alternc-lxc/alternc_lxc_remote
only_from = 127.0.0.1
disable = no
}

14
src/alternc_lxc_remote Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env perl
my $line = <>;
my $nb = int(rand(42));
if ($nb % 2 == 0) {
print "Error message here::\n";
} else {
print "Ok|127.0.0.1:4242|localhost:4242\n";
my ($action,$login,$pass,$uid) = split /|/, $line;
printf("Hi %s (%d) do you want to %s? -> btw your pass is %s\n", $login, $uid, $action, $pass);
}