HSAdmin Backend Domains, E-Mail, Datenbanken
Peter Hormanns
2014-05-13 c922044f5d38e9c60e0f24c9d3b175132d64c0f4
Remove Pac IP-Configuration from network-interfaces
2 files modified
37 ■■■■■ changed files
hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java 31 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv4.vm 6 ●●●●● patch | view | raw | blame | history
hsarback/src/de/hsadmin/mods/pac/PacProcessorFactory.java
@@ -41,7 +41,7 @@
                createSudouersProc(hive),
                createProftpdConfProc(hive),
                createMakePacDirectoryStructure(unixUser),
                createIfUp(pacName),
                createIfUp(pac),
                createHttpdVirtualProc(hive),
                createAccountingRulesProc());
        } else {
@@ -69,7 +69,7 @@
            Hive hive = pac.getHive();
            WaitingTasksProcessor waiting = new WaitingTasksProcessor(createDelUserProc(pac.getName()));
            waiting.appendProcessor(pac.getHiveName(), new CompoundProcessor(
                createIfDown(pac.getName()),
                createIfDown(pac),
                createEtcHostsProc(hive),
                createNetworkInterfacesProc(hive),
                createSudouersProc(hive),
@@ -113,10 +113,11 @@
        return new VelocityProcessor("/de/hsadmin/mods/pac/hosts.vm", hive, "/etc/hosts", true);
    }
    private Processor createNetworkInterfacesProc(Hive hive) throws ProcessorException {
        VelocityProcessor interfacesProc = new VelocityProcessor("/de/hsadmin/mods/pac/interfaces.vm", hive, "/etc/network/interfaces", true);
        VelocityProcessor pacIPv4Proc = new VelocityProcessor("/de/hsadmin/mods/pac/pac-addr-ipv4.vm", hive, "/etc/network/pac-addr-ipv4", true);
        return new CompoundProcessor(interfacesProc, pacIPv4Proc);
    private Processor createNetworkInterfacesProc(final Hive hive) throws ProcessorException {
//        VelocityProcessor interfacesProc = new VelocityProcessor("/de/hsadmin/mods/pac/interfaces.vm", hive, "/etc/network/interfaces", true);
        final VelocityProcessor pacIPv4Proc = new VelocityProcessor("/de/hsadmin/mods/pac/pac-addr-ipv4.vm", hive, "/etc/network/pac-addr-ipv4", true);
        return pacIPv4Proc;
//        return new CompoundProcessor(interfacesProc, pacIPv4Proc);
    }
    private Processor createIPTablesProc() {
@@ -183,12 +184,22 @@
                );
    }
    private Processor createIfUp(String pacName) {
        return new ShellProcessor("ifup eth0:" + pacName);
    private Processor createIfUp(final Pac pac) {
//        return new ShellProcessor("ifup eth0:" + pacName);
        return new ShellProcessor("ip addr add "
                + pac.getCurINetAddr().getInetAddr()
                + "/32 dev eth0 label eth0:"
                + pac.getName()
            );
    }
    private Processor createIfDown(String pacName) {
        return new ShellProcessor("ifdown eth0:" + pacName);
    private Processor createIfDown(final Pac pac) {
//        return new ShellProcessor("ifdown eth0:" + pacName);
        return new ShellProcessor("ip addr del "
                + pac.getCurINetAddr().getInetAddr()
                + "/32 dev eth0 label eth0:"
                + pac.getName()
            );
    }
    private UnixUser getPacAdminUser(Pac pac) throws ProcessorException {
hsarback/src/de/hsadmin/mods/pac/pac-addr-ipv4.vm
@@ -2,11 +2,9 @@
# This file is managed by HSAdmin.
# Do not edit manually. Changes will be overwritten.
#
#
#foreach( $pac in ${hive.pacs} )
#if( !${pac.managedServer} )
eth0:${pac.name}:${pac.curINetAddr.inetAddr}/32
#end
#end
#end