mise en place alternc-lxc

Mise en place du paquet alternc-lxc sur une installation d'AlternC existante afin de permettre un accès par SSH aux utilisateurs du panel, cloisonné dans leur répertoire.

aptitude install alternc-lxc debootstrap bridge-utils

monter le fs cgroup pour pouvoir utiliser LXC

cgroup	/sys/fs/cgroup	cgroup	defaults	0	0

restrictions xinetd

(quand mis en place sur le meme serveur que le panel AlternC, mettre 127.0.0.1)

création de l'image de base pour les LXC créés

( telnet localhost 6504 le dit, au pire )

configuration réseau

auto dummy0
iface dummy0 inet static

auto brvm
iface brvm inet static
        address 172.x.y.1
        netmask 255.255.255.0
        bridge_ports dummy0
        bridge_stp off
        bridge_maxwait 5
=> ''ifup brvm'' pour activer l'interface

sous-domaine

ports d'accès SSH

# SSH pour les LXC
DNAT            net     vm:172.x.y.21:22       tcp     2221
DNAT            net     vm:172.x.y.22:22       tcp     2222

configuration alternc-lxc

{ 
    "_comment":"This is a json-formatted array for AlternC-lxc.  'vm': List of the VM that can be launched in this server for each VM, the key is the vm NAME, and the values set the VM hostname, and network with their IP, mac, and physical link     'servers': List all the AlternC's servers allowed to ask for a VM Each server has its servername as a key And the parameters are its secretkey and nfs or local mount for AlternC's HTML folder.   To check it before production, use json_xs -t null config.json ",

    "vm": {
        "vm1":{ 
            "hostname": "vm1.host.domaine.tld -p 2221",
            "network":{
                "eth0":{
                    "link":"brvm",
                    "ipv4":"172.x.y.21\/24",
                    "ipv4.gateway":"172.x.y.1",
                    "mac":"AA:CC:42:00:01:21"
                }
            }
        },
        "vm2":{ 
            "hostname": "vm2.host.domaine.tld -p 2222",
            "network":{
                "eth0":{
                    "link":"brvm",
                    "ipv4":"172.x.y.22\/24",
                    "ipv4.gateway":"172.x.y.1",
                    "mac":"AA:CC:42:00:01:22"
                }
            }
        }
    },

    "servers": {
        "host.domaine.tld":{
            "_comment_key":"Modifier la clef!!",
            "key":"xyzt1234",
            "_comment_htmlmount":"Ajuster la commande permettant d'acceder aux donnees web AlternC",
            "htmlmount":" -o bind /var/www/alternc",
            "mysql_host": "172.x.y.1"
        }
    }
}

Tant que l'adresse IP n'est pas renseignée, le menu n'apparait pas.

INSERT INTO variable(name,value,comment) VALUES ('lxc_ip','127.0.0.1','LXC server for running consoles');
INSERT INTO variable(name,value,comment) VALUES ('lxc_key','1234','Key for auth to LXC server');
INSERT INTO variable(name,value,comment) VALUES ('lxc_port','6504','Port to access LXC server');
INSERT INTO variable(name,value,comment) VALUES ('lxc_maxtime','4','How many hours do we allow to have a server before shutting it down');

quelques commandes utiles