Example #1
0
    public int Disconnect(string containerIdA, string containerIdB)
    {
        var tuple = _determinableTuple(containerIdA, containerIdB);

        if (!_networks.ContainsKey(tuple))
        {
            return((int)Errors.NotConnected);
        }

        var netname = _networks[tuple];

        VagrantController.DockerNetworkDisconnect(_containersIds[containerIdA], netname);
        VagrantController.DockerNetworkDisconnect(_containersIds[containerIdB], netname);
        VagrantController.DockerNetworkRemove(netname);
        return((int)Errors.OK);
    }
Example #2
0
    public int StopSnoopOn(string containerIdA, string containerIdB, string containerSnooping)
    {
        var tuple = _determinableTuple(containerIdA, containerIdB);

        if (!_networks.ContainsKey(tuple))
        {
            return((int)Errors.NotConnected);
        }

        var netName = _networks[tuple];

        VagrantController.DockerNetworkDisconnect(_containersIds[containerSnooping], netName);
        var ipa        = VagrantController.GetContainerIP(_containersIds[containerIdA], netName);
        var ipb        = VagrantController.GetContainerIP(_containersIds[containerIdB], netName);
        var ipAttacker = VagrantController.GetContainerIP(_containersIds[containerSnooping], netName);

        VagrantController.IptablesRemoveEavesdropping(ipa, ipb, ipAttacker);
        return((int)Errors.OK);
    }