From 90c6cf1d29637df3df690d1efada83b18f52a0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Serman?= Date: Fri, 12 Apr 2013 22:03:28 +0000 Subject: [PATCH] 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 --- .gitattributes | 2 ++ etc/xinetd.d/alternc_lxc | 16 ++++++++++++++++ src/alternc_lxc_remote | 14 ++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 etc/xinetd.d/alternc_lxc create mode 100755 src/alternc_lxc_remote diff --git a/.gitattributes b/.gitattributes index 7880b6a5..679127d7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -494,6 +494,7 @@ etc/alternc/templates/postfix/sasl/smtpd.conf -text etc/alternc/templates/proftpd/modules.conf -text etc/alternc/templates/proftpd/proftpd.conf -text etc/alternc/templates/proftpd/welcome.msg -text +etc/xinetd.d/alternc_lxc -text install/alternc.install -text install/body_checks -text install/domaines.template -text @@ -582,6 +583,7 @@ src/alternc-check -text src/alternc-dboptimize -text src/alternc-passwd -text src/alternc_add_policy_dovecot -text +src/alternc_lxc_remote -text src/alternc_reload -text src/compress_logs.sh -text src/courier-dovecot-migrate.pl -text diff --git a/etc/xinetd.d/alternc_lxc b/etc/xinetd.d/alternc_lxc new file mode 100644 index 00000000..3b52493d --- /dev/null +++ b/etc/xinetd.d/alternc_lxc @@ -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 +} + + diff --git a/src/alternc_lxc_remote b/src/alternc_lxc_remote new file mode 100755 index 00000000..9250ddbb --- /dev/null +++ b/src/alternc_lxc_remote @@ -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); +} +