From bc56cc2ff737150aace78f261a350226ce11a0d2 Mon Sep 17 00:00:00 2001 From: coco3x Date: Wed, 11 Dec 2024 23:01:11 +0900 Subject: [PATCH 01/13] =?UTF-8?q?feat:=20ContinuousProcess=EB=A5=BC=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=ED=95=98=EB=8A=94=20log=20writer=EB=93=A4(md?= =?UTF-8?q?ns,=20montior)=EC=97=90=20=ED=94=84=EB=A1=9C=EC=84=B8=EC=8A=A4?= =?UTF-8?q?=20=EB=B3=B5=EA=B5=AC=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../managed/mdns/MdnsLogWriter.java | 31 ++++++++++++------- .../log_writer/monitor/MonitorLogWriter.java | 24 ++++++++++---- 2 files changed, 38 insertions(+), 17 deletions(-) diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java index ef03b43d..9509b190 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java @@ -7,6 +7,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; @@ -17,7 +18,7 @@ @Component public class MdnsLogWriter { private final Map processes; - private final Map wasDead; + private final Map dead; private final MdnsLogParser parser; private final ManagedLogDAO dao; private final String sudoPassword; @@ -27,13 +28,8 @@ public MdnsLogWriter(ManagedLogDAO dao, MdnsLogParser parser, NetworkConfig conf this.parser = parser; this.sudoPassword = sudoPassword; this.processes = new HashMap<>(); - this.wasDead = new HashMap<>(); - config.getMdnsList() - .forEach(managedInfo -> { - this.processes.put(managedInfo, new MdnsLogProcess(managedInfo, sudoPassword)); - log.info("[managed - mdns({})] started", managedInfo.ssid()); - this.wasDead.put(managedInfo, false); - }); + this.dead = new HashMap<>(); + config.getMdnsList().forEach(this::startProcess); } @Scheduled(initialDelay = 10000, fixedDelay = 10000) @@ -43,9 +39,13 @@ private void writeLogs() { ManagedInfo managedInfo = entry.getKey(); MdnsLogProcess process = entry.getValue(); boolean alive = process.isAlive(); - if (!alive && wasDead.get(managedInfo).equals(Boolean.FALSE)) { - wasDead.put(managedInfo, true); - log.error("[managed - mdns({})] dead :\n{}\n{}", managedInfo.ssid(), "에러 스트림 내용:", process.readErrorLines()); + //프로세스가 죽었다는 것을 인지했을때만 아래 로직을 실행 + if (!alive && dead.get(managedInfo).equals(Boolean.FALSE)) { + dead.put(managedInfo, true); + log.error("[managed - mdns({})] 프로세스가 종료됨 :\n{}\n{}", managedInfo.ssid(), "프로세스의 에러 스트림 내용:", process.readErrorLines()); + log.error("[managed - mdns({})] 프로세스를 재실행합니다.", managedInfo.ssid()); + //프로세스 실행은 논블로킹 + new Thread(()->startProcess(managedInfo)).start(); } return alive;}) .flatMap(entry -> { @@ -71,4 +71,13 @@ private void writeLogs() { dao.upsertAll(totalLogs); } + private void startProcess(ManagedInfo info){ + Optional.ofNullable(this.processes.get(info)).ifPresent(MdnsLogProcess::terminate); + MdnsLogProcess process = new MdnsLogProcess(info, sudoPassword); + this.processes.put(info, process); + log.info("[managed - mdns({})] 프로세스 실행 완료", info.ssid()); + this.dead.put(info, false); + } + + } diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogWriter.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogWriter.java index 314d64fe..9ec8417a 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogWriter.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogWriter.java @@ -1,7 +1,10 @@ package com.whoz_in.log_writer.monitor; import com.whoz_in.log_writer.config.NetworkConfig; +import com.whoz_in.log_writer.managed.ManagedInfo; +import com.whoz_in.log_writer.managed.mdns.MdnsLogProcess; import java.util.HashSet; +import java.util.Optional; import java.util.Set; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -12,7 +15,7 @@ @Component public class MonitorLogWriter { private MonitorLogProcess process; //교체될 수 있으므로 final X - private Boolean wasDead = false; + private Boolean dead = false; private final MonitorLogParser parser; private final MonitorLogDAO repo; private final String sudoPassword; @@ -23,15 +26,16 @@ public MonitorLogWriter(MonitorLogParser parser, MonitorLogDAO repo, NetworkConf this.repo = repo; this.monitorInfo = config.getMonitorInfo(); this.sudoPassword = sudoPassword; - this.process = new MonitorLogProcess(monitorInfo, sudoPassword); - log.info("[monitor] started"); + startProcess(); } @Scheduled(initialDelay = 10000, fixedDelay = 10000) private void saveLogs(){ if (!process.isAlive()) { - if (wasDead.equals(Boolean.FALSE)) { - log.error("[monitor] dead :\n{}\n{}", "에러 스트림 내용:", process.readErrorLines()); - wasDead = true; + if (dead.equals(Boolean.FALSE)) { + dead = true; + log.error("[monitor] 프로세스가 종료됨 :\n{}\n{}", "프로세스의 에러 스트림 내용:", process.readErrorLines()); + log.error("[monitor] 프로세스를 재실행합니다."); + startProcess(); } return; } @@ -48,4 +52,12 @@ private void saveLogs(){ repo.upsertAll(macs); } + private void startProcess(){ + Optional.ofNullable(this.process).ifPresent(MonitorLogProcess::terminate); + MonitorLogProcess p = new MonitorLogProcess(monitorInfo, sudoPassword); + this.process = p; + log.info("[monitor] 프로세스 실행 완료"); + this.dead = false; + } + } \ No newline at end of file From 2c7bc072d85c1daf0e9674e2899484769c1aa372 Mon Sep 17 00:00:00 2001 From: coco3x Date: Thu, 12 Dec 2024 21:57:11 +0900 Subject: [PATCH 02/13] =?UTF-8?q?feat:=20=EC=8B=9C=EC=8A=A4=ED=85=9C?= =?UTF-8?q?=EC=9D=98=20=EB=84=A4=ED=8A=B8=EC=9B=8C=ED=81=AC=20=EC=9D=B8?= =?UTF-8?q?=ED=84=B0=ED=8E=98=EC=9D=B4=EC=8A=A4=EB=A5=BC=20=EC=96=BB?= =?UTF-8?q?=EB=8A=94=20=EA=B5=AC=ED=98=84=EC=B2=B4=EB=A5=BC=20prod,=20loca?= =?UTF-8?q?l=EB=A1=9C=20=EB=82=98=EB=88=84=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IwconfigNetworkInterfaces.java} | 18 ++++++++------ .../common/StubNetworkInterfaces.java | 24 +++++++++++++++++++ .../common/SystemNetworkInterfaces.java | 11 +++++++++ 3 files changed, 46 insertions(+), 7 deletions(-) rename modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/{system_validator/SystemNetworkInterfaces.java => common/IwconfigNetworkInterfaces.java} (89%) create mode 100644 modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/StubNetworkInterfaces.java create mode 100644 modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/SystemNetworkInterfaces.java diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemNetworkInterfaces.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/IwconfigNetworkInterfaces.java similarity index 89% rename from modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemNetworkInterfaces.java rename to modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/IwconfigNetworkInterfaces.java index f9ec0de5..10f0fd62 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemNetworkInterfaces.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/IwconfigNetworkInterfaces.java @@ -1,14 +1,17 @@ -package com.whoz_in.log_writer.system_validator; +package com.whoz_in.log_writer.common; -import com.whoz_in.log_writer.common.NetworkInterface; import com.whoz_in.log_writer.common.process.TransientProcess; import java.util.ArrayList; import java.util.List; +import org.springframework.context.annotation.Profile; import org.springframework.stereotype.Component; //iwconfig의 출력을 파싱하여 네트워크 인터페이스들을 반환함 +//prod 환경에선 iwconfig가 설치되어있을 것을 SystemValidator를 통해 보장한다. +@Profile("prod") @Component -public class SystemNetworkInterfaces { +public final class IwconfigNetworkInterfaces implements SystemNetworkInterfaces { + //최신 정보를 가져온다. public List getLatest() { List interfaces = new ArrayList<>(); @@ -22,7 +25,8 @@ public List getLatest() { for (String line : iwconfigOutput) { line = line.trim(); // 인터페이스 이름 감지 (인터페이스 정보 나오기 시작) - if (!line.startsWith(" ") && (line.contains("IEEE 802.11") || line.contains("unassociated"))) { + if (!line.startsWith(" ") && (line.contains("IEEE 802.11") || line.contains( + "unassociated"))) { if (currentName != null) { // 첫 인터페이스가 아니면 모아둔 이전 인터페이스의 정보 저장 interfaces.add(new NetworkInterface(currentName, currentEssid, currentMode)); @@ -30,7 +34,8 @@ public List getLatest() { // 새 인터페이스 정보 모으기 & 초기화 currentName = line.split("\\s+")[0]; if (line.contains("ESSID:")) - currentEssid = line.split("ESSID:")[1].split("\\s+")[0].replace("\"", "").trim(); + currentEssid = line.split("ESSID:")[1].split("\\s+")[0].replace("\"", "") + .trim(); else currentEssid = ""; currentMode = null; // 초기화 @@ -47,7 +52,7 @@ public List getLatest() { } return interfaces; } - +} /* //샘플 iwconfig @@ -84,4 +89,3 @@ public List getLatest() { " Tx excessive retries:0 Invalid misc:0 Missed beacon:0" ); */ -} diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/StubNetworkInterfaces.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/StubNetworkInterfaces.java new file mode 100644 index 00000000..0f1690df --- /dev/null +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/StubNetworkInterfaces.java @@ -0,0 +1,24 @@ +package com.whoz_in.log_writer.common; + +import com.whoz_in.log_writer.config.NetworkConfig; +import java.util.List; +import lombok.RequiredArgsConstructor; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; + + +/* +기본적으로 맥에서 iwconfig를 못쓴다. +그래서 local에선 설정한 네트워크 인터페이스를 출력하는 이 가짜 객체를 만든 것이다. + */ +@Profile("local") +@Component +@RequiredArgsConstructor +public final class StubNetworkInterfaces implements SystemNetworkInterfaces{ + private final NetworkConfig networkConfig; + + @Override + public List getLatest() { + return networkConfig.getNetworkInterfaces(); + } +} diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/SystemNetworkInterfaces.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/SystemNetworkInterfaces.java new file mode 100644 index 00000000..10b8badf --- /dev/null +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/SystemNetworkInterfaces.java @@ -0,0 +1,11 @@ +package com.whoz_in.log_writer.common; + +import java.util.List; + +//실시간으로 시스템에 존재하는 네트워크 인터페이스들을 얻을 수 있는 기능을 제공해야 한다. +public interface SystemNetworkInterfaces { + List getLatest(); + default boolean exists(NetworkInterface ni){ + return getLatest().contains(ni); + } +} From 7479f6dbd36ba9417722a034c659a34943208da8 Mon Sep 17 00:00:00 2001 From: coco3x Date: Fri, 13 Dec 2024 20:06:57 +0900 Subject: [PATCH 03/13] =?UTF-8?q?update:=20=ED=94=84=EB=A1=9C=EC=84=B8?= =?UTF-8?q?=EC=8A=A4=20=EC=A0=95=EB=B3=B4=EC=97=90=20=EB=84=A4=ED=8A=B8?= =?UTF-8?q?=EC=9B=8C=ED=81=AC=20=EC=9D=B8=ED=84=B0=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../log_writer/config/NetworkConfig.java | 22 ++++++++++--------- .../log_writer/managed/ManagedInfo.java | 4 +++- .../log_writer/managed/arp/ArpLogWriter.java | 6 ++--- .../managed/mdns/MdnsLogWriter.java | 10 ++++----- .../log_writer/monitor/MonitorInfo.java | 9 ++++++-- .../system_validator/SystemValidator.java | 16 +++++++------- .../SystemValidatorConfig.java | 13 ++++++----- 7 files changed, 45 insertions(+), 35 deletions(-) diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/config/NetworkConfig.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/config/NetworkConfig.java index b6ddef16..ff8e5a60 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/config/NetworkConfig.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/config/NetworkConfig.java @@ -47,7 +47,12 @@ public NetworkConfig(@Value("${spring.profiles.active:default}") String profile, //monitor Map monitorMap = (Map) map.get("monitor"); this.monitorInfo = new MonitorInfo( - generateCommand(monitorMap.get("command"), monitorMap.get("interface"))); + this.networkInterfaces.stream() + .filter(ni->ni.getName().equals(monitorMap.get("interface"))) + .findAny() + .orElseThrow(()->new IllegalStateException(monitorMap.get("interface")+"은 설정된 network_interfaces에 존재하지 않습니다.")), + generateCommand(monitorMap.get("command"), monitorMap.get("interface")) + ); // managed Map managedMap = (Map) map.get("managed"); // mdns @@ -55,12 +60,11 @@ public NetworkConfig(@Value("${spring.profiles.active:default}") String profile, String mdnsCommand = (String) mdnsMap.get("command"); this.mdnsList = ((List) mdnsMap.get("interfaces")).stream() .map(interfaceName -> { - NetworkInterface mdnsNI = networkInterfaces.stream().filter( - ni -> ni.getName().equals(interfaceName) - ).findAny().orElseThrow(()->new IllegalStateException(interfaceName+"은 설정된 network_interfaces에 존재하지 않습니다.")); - return new ManagedInfo(interfaceName, - mdnsNI.getEssid(), - generateCommand(mdnsCommand, interfaceName)); + NetworkInterface mdnsNI = networkInterfaces.stream() + .filter(ni -> ni.getName().equals(interfaceName)) + .findAny() + .orElseThrow(()->new IllegalStateException(interfaceName+"은 설정된 network_interfaces에 존재하지 않습니다.")); + return new ManagedInfo(mdnsNI, generateCommand(mdnsCommand, interfaceName)); }) .toList(); // arp @@ -71,9 +75,7 @@ public NetworkConfig(@Value("${spring.profiles.active:default}") String profile, NetworkInterface arpNI = networkInterfaces.stream().filter( ni -> ni.getName().equals(interfaceName) ).findAny().orElseThrow(()->new IllegalStateException(interfaceName+"은 설정된 network_interfaces에 존재하지 않습니다.")); - return new ManagedInfo(interfaceName, - arpNI.getEssid(), - generateCommand(arpCommand, interfaceName)); + return new ManagedInfo(arpNI, generateCommand(arpCommand, interfaceName)); }) .toList(); } diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/ManagedInfo.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/ManagedInfo.java index 56ccc953..5c527961 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/ManagedInfo.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/ManagedInfo.java @@ -1,4 +1,6 @@ package com.whoz_in.log_writer.managed; +import com.whoz_in.log_writer.common.NetworkInterface; + //Managed 프로세스를 생성하고 처리하는 과정에서 필요한 정보를 담는다. -public record ManagedInfo(String interfaceName, String ssid, String command) {} +public record ManagedInfo(NetworkInterface ni, String command) {} diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java index 86d1c9aa..ebfa4664 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java @@ -44,7 +44,7 @@ private void scan() { .filter(parser::validate) .map(line->{ ManagedLog log = parser.parse(line); - log.setSsid(arpInfo.ssid()); + log.setSsid(arpInfo.ni().getEssid()); return log; }) .collect(Collectors.toSet()); //Set으로 중복 제거 @@ -56,10 +56,10 @@ private void scan() { */ if (procLogs.isEmpty()) { //SystemValidator가 시스템의 네트워크 인터페이스가 올바른지 검증하기 때문에 여기서는 warn으로 로깅 - log.warn("[managed - arp({})] 실행 실패 : ERROR", arpInfo.ssid()); + log.warn("[managed - arp({})] 실행 실패 : ERROR", arpInfo.ni().getEssid()); return Stream.empty(); } - log.info("[managed - arp({})] log to save : {}", arpInfo.ssid(), procLogs.size()); + log.info("[managed - arp({})] log to save : {}", arpInfo.ni().getEssid(), procLogs.size()); return procLogs.stream(); }) .toList(); diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java index 9509b190..034ea114 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java @@ -42,8 +42,8 @@ private void writeLogs() { //프로세스가 죽었다는 것을 인지했을때만 아래 로직을 실행 if (!alive && dead.get(managedInfo).equals(Boolean.FALSE)) { dead.put(managedInfo, true); - log.error("[managed - mdns({})] 프로세스가 종료됨 :\n{}\n{}", managedInfo.ssid(), "프로세스의 에러 스트림 내용:", process.readErrorLines()); - log.error("[managed - mdns({})] 프로세스를 재실행합니다.", managedInfo.ssid()); + log.error("[managed - mdns({})] 프로세스가 종료됨 :\n{}\n{}", managedInfo.ni().getEssid(), "프로세스의 에러 스트림 내용:", process.readErrorLines()); + log.error("[managed - mdns({})] 프로세스를 재실행합니다.", managedInfo.ni().getEssid()); //프로세스 실행은 논블로킹 new Thread(()->startProcess(managedInfo)).start(); } @@ -56,13 +56,13 @@ private void writeLogs() { for(;;) { line = process.readLine(); if (line == null) { - log.info("[managed - mdns({})] log to save : {}", managedInfo.ssid(), logs.size()); + log.info("[managed - mdns({})] log to save : {}", managedInfo.ni().getEssid(), logs.size()); return logs.values().stream(); } parser.parse(line).ifPresent( mdnsLog -> { logs.put(mdnsLog, mdnsLog); - mdnsLog.setSsid(managedInfo.ssid());} + mdnsLog.setSsid(managedInfo.ni().getEssid());} ); } }) @@ -75,7 +75,7 @@ private void startProcess(ManagedInfo info){ Optional.ofNullable(this.processes.get(info)).ifPresent(MdnsLogProcess::terminate); MdnsLogProcess process = new MdnsLogProcess(info, sudoPassword); this.processes.put(info, process); - log.info("[managed - mdns({})] 프로세스 실행 완료", info.ssid()); + log.info("[managed - mdns({})] 프로세스 실행 완료", info.ni().getEssid()); this.dead.put(info, false); } diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorInfo.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorInfo.java index 9b3b6fdb..6ffe6d2d 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorInfo.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorInfo.java @@ -1,4 +1,9 @@ package com.whoz_in.log_writer.monitor; -//Monitor 프로세스를 생성하고 처리하는 과정에서 필요한 정보를 담는다. -public record MonitorInfo(String command) {} \ No newline at end of file +import com.whoz_in.log_writer.common.NetworkInterface; + +//Monitor 프로세스 생성자에서 요구하는 객체로, 프로세스를 생성하고 처리하기 위해 필요한 정보를 담는다. +public record MonitorInfo( + NetworkInterface ni, + String command +) {} \ No newline at end of file diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidator.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidator.java index 5bfe2364..085a2ed6 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidator.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidator.java @@ -2,14 +2,14 @@ import com.whoz_in.log_writer.common.NetworkInterface; -import com.whoz_in.log_writer.common.validation.ValidationException; +import com.whoz_in.log_writer.common.IwconfigNetworkInterfaces; +import com.whoz_in.log_writer.common.SystemNetworkInterfaces; import com.whoz_in.log_writer.common.validation.ValidationResult; -import com.whoz_in.log_writer.common.validation.Validator; import com.whoz_in.log_writer.config.NetworkConfig; -import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; +import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.Scheduled; //시스템의 전체적인 검증을 진행하는 클래스 @@ -17,17 +17,17 @@ @Slf4j public final class SystemValidator { private final NetworkConfig config; - private final SystemNetworkInterfaces systemNetworkInterfaces; + private final SystemNetworkInterfaces systemNIs; private final NetworkInterfaceValidator networkInterfaceValidator; //서버 시작 시 검증 (실패 시 예외가 발생하여 서버 시작이 실패하게 됨) public SystemValidator( NetworkConfig config, - SystemNetworkInterfaces systemNetworkInterfaces, + SystemNetworkInterfaces systemNIs, CommandInstalledValidator commandInstalledValidator, NetworkInterfaceValidator networkInterfaceValidator) { this.config = config; - this.systemNetworkInterfaces = systemNetworkInterfaces; + this.systemNIs = systemNIs; this.networkInterfaceValidator = networkInterfaceValidator; log.info("시스템 검증을 수행합니다"); @@ -37,7 +37,7 @@ public SystemValidator( commands.forEach(commandInstalledValidator::validate); //네트워크 인터페이스 정보 - List system = systemNetworkInterfaces.getLatest(); + List system = systemNIs.getLatest(); List setting = config.getNetworkInterfaces(); //네트워크 인터페이스 출력 @@ -62,7 +62,7 @@ private void checkRegularly() { log.info("시스템 검증 시작.."); //네트워크 인터페이스 상태 검증 ValidationResult result = networkInterfaceValidator.getValidationResult( - systemNetworkInterfaces.getLatest(), config.getNetworkInterfaces()); + systemNIs.getLatest(), config.getNetworkInterfaces()); //더 많은 검증하면 result에 추가하기.. if (result.hasErrors()) { diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidatorConfig.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidatorConfig.java index ea514962..8660b747 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidatorConfig.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidatorConfig.java @@ -1,30 +1,31 @@ package com.whoz_in.log_writer.system_validator; -import com.whoz_in.log_writer.common.validation.BiValidator; -import com.whoz_in.log_writer.common.validation.ValidationResult; +import com.whoz_in.log_writer.common.SystemNetworkInterfaces; import com.whoz_in.log_writer.config.NetworkConfig; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; + +//TODO: Conditional로 뺄지 아니면 @Slf4j @Configuration public class SystemValidatorConfig { private final String profile; private final NetworkConfig config; - private final SystemNetworkInterfaces systemNetworkInterfaces; + private final SystemNetworkInterfaces systemNIs; private final CommandInstalledValidator commandInstalledValidator; private final NetworkInterfaceValidator networkInterfaceValidator; public SystemValidatorConfig(@Value("${spring.profiles.active}") String profile, NetworkConfig config, - SystemNetworkInterfaces systemNetworkInterfaces, + SystemNetworkInterfaces systemNIs, CommandInstalledValidator commandInstalledValidator, NetworkInterfaceValidator networkInterfaceValidator) { this.profile = profile; this.config = config; - this.systemNetworkInterfaces = systemNetworkInterfaces; + this.systemNIs = systemNIs; this.commandInstalledValidator = commandInstalledValidator; this.networkInterfaceValidator = networkInterfaceValidator; } @@ -39,6 +40,6 @@ public SystemValidator systemValidator(){ log.info("리눅스가 아니거나 스프링 프로필이 prod가 아니므로 시스템 검증을 수행하지 않습니다."); return null; } - return new SystemValidator(config, systemNetworkInterfaces, commandInstalledValidator, networkInterfaceValidator); + return new SystemValidator(config, systemNIs, commandInstalledValidator, networkInterfaceValidator); } } From edf6f5eb6d388e667980cb3d274aa1f176e365c6 Mon Sep 17 00:00:00 2001 From: coco3x Date: Fri, 13 Dec 2024 21:04:22 +0900 Subject: [PATCH 04/13] =?UTF-8?q?update:=20=EB=AA=A8=EB=8B=88=ED=84=B0=20?= =?UTF-8?q?=EB=84=A4=ED=8A=B8=EC=9B=8C=ED=81=AC=20=EC=9D=B8=ED=84=B0?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=8A=A4=EA=B0=80=20=EC=8B=9C=EC=8A=A4?= =?UTF-8?q?=ED=85=9C=EC=97=90=20=EC=9E=88=EB=8A=94=EC=A7=80=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=ED=95=98=EA=B3=A0=20=EC=8B=A4=ED=96=89=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../log_writer/monitor/MonitorLogWriter.java | 48 ++++++++++++------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogWriter.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogWriter.java index 9ec8417a..cb3f14f3 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogWriter.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogWriter.java @@ -1,8 +1,7 @@ package com.whoz_in.log_writer.monitor; +import com.whoz_in.log_writer.common.SystemNetworkInterfaces; import com.whoz_in.log_writer.config.NetworkConfig; -import com.whoz_in.log_writer.managed.ManagedInfo; -import com.whoz_in.log_writer.managed.mdns.MdnsLogProcess; import java.util.HashSet; import java.util.Optional; import java.util.Set; @@ -15,30 +14,28 @@ @Component public class MonitorLogWriter { private MonitorLogProcess process; //교체될 수 있으므로 final X - private Boolean dead = false; + private boolean isProcDead; private final MonitorLogParser parser; private final MonitorLogDAO repo; private final String sudoPassword; private final MonitorInfo monitorInfo; + private final SystemNetworkInterfaces systemNIs; - public MonitorLogWriter(MonitorLogParser parser, MonitorLogDAO repo, NetworkConfig config, @Value("${sudo_password}") String sudoPassword) { + public MonitorLogWriter(MonitorLogParser parser, MonitorLogDAO repo, NetworkConfig config, + @Value("${sudo_password}") String sudoPassword, + SystemNetworkInterfaces systemNIs) { this.parser = parser; this.repo = repo; this.monitorInfo = config.getMonitorInfo(); this.sudoPassword = sudoPassword; + this.systemNIs = systemNIs; startProcess(); } + @Scheduled(initialDelay = 10000, fixedDelay = 10000) private void saveLogs(){ - if (!process.isAlive()) { - if (dead.equals(Boolean.FALSE)) { - dead = true; - log.error("[monitor] 프로세스가 종료됨 :\n{}\n{}", "프로세스의 에러 스트림 내용:", process.readErrorLines()); - log.error("[monitor] 프로세스를 재실행합니다."); - startProcess(); - } - return; - } + //프로세스 죽었으면 기록 안함 + if (!process.isAlive()) return; Set macs = new HashSet<>(); String line; for(;;) { @@ -52,12 +49,31 @@ private void saveLogs(){ repo.upsertAll(macs); } + @Scheduled(initialDelay = 10000, fixedDelay = 10000) + private void checkProcess(){ + if (process.isAlive()) return; + + if (!isProcDead) { + isProcDead = true; + log.error("[monitor] 프로세스가 종료됨 :\n{}\n{}", "프로세스의 에러 스트림 내용:", process.readErrorLines()); + } + startProcess(); + } + + //이전 프로세스를 제거하고 새로운 프로세스를 실행시켜 교체하는 역할 private void startProcess(){ + log.info("[monitor] 프로세스를 실행합니다."); + + //TODO: validator + if (!systemNIs.exists(monitorInfo.ni())){ + log.error("[monitor] 실행 실패 : 설정된 모니터 네트워크 인터페이스가 시스템에 존재하지 않습니다."); + return; + } Optional.ofNullable(this.process).ifPresent(MonitorLogProcess::terminate); - MonitorLogProcess p = new MonitorLogProcess(monitorInfo, sudoPassword); - this.process = p; + this.process = new MonitorLogProcess(monitorInfo, sudoPassword); + this.isProcDead = false; + log.info("[monitor] 프로세스 실행 완료"); - this.dead = false; } } \ No newline at end of file From 4ba9d025c9ffaa68eb2070b0df7c471cc3c4f0e5 Mon Sep 17 00:00:00 2001 From: coco3x Date: Fri, 13 Dec 2024 21:31:34 +0900 Subject: [PATCH 05/13] =?UTF-8?q?update:=20mdns=20writer=20-=20=ED=94=84?= =?UTF-8?q?=EB=A1=9C=EC=84=B8=EC=8A=A4=20=EC=8B=9C=EC=9E=91=20=EC=8B=9C=20?= =?UTF-8?q?=EB=84=A4=ED=8A=B8=EC=9B=8C=ED=81=AC=20=EC=9D=B8=ED=84=B0?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=8A=A4=20=EA=B2=80=EC=A6=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../managed/mdns/MdnsLogWriter.java | 50 +++++++++++++------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java index 034ea114..2ee9ac2b 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java @@ -1,5 +1,6 @@ package com.whoz_in.log_writer.managed.mdns; +import com.whoz_in.log_writer.common.SystemNetworkInterfaces; import com.whoz_in.log_writer.config.NetworkConfig; import com.whoz_in.log_writer.managed.ManagedInfo; import com.whoz_in.log_writer.managed.ManagedLog; @@ -22,32 +23,25 @@ public class MdnsLogWriter { private final MdnsLogParser parser; private final ManagedLogDAO dao; private final String sudoPassword; + private final SystemNetworkInterfaces systemNIs; - public MdnsLogWriter(ManagedLogDAO dao, MdnsLogParser parser, NetworkConfig config, @Value("${sudo_password}") String sudoPassword) { + public MdnsLogWriter(ManagedLogDAO dao, MdnsLogParser parser, NetworkConfig config, + @Value("${sudo_password}") String sudoPassword, + SystemNetworkInterfaces systemNIs + ) { this.dao = dao; this.parser = parser; this.sudoPassword = sudoPassword; this.processes = new HashMap<>(); this.dead = new HashMap<>(); + this.systemNIs = systemNIs; config.getMdnsList().forEach(this::startProcess); } @Scheduled(initialDelay = 10000, fixedDelay = 10000) - private void writeLogs() { + private void saveLogs() { List totalLogs = this.processes.entrySet().parallelStream() - .filter(entry-> { - ManagedInfo managedInfo = entry.getKey(); - MdnsLogProcess process = entry.getValue(); - boolean alive = process.isAlive(); - //프로세스가 죽었다는 것을 인지했을때만 아래 로직을 실행 - if (!alive && dead.get(managedInfo).equals(Boolean.FALSE)) { - dead.put(managedInfo, true); - log.error("[managed - mdns({})] 프로세스가 종료됨 :\n{}\n{}", managedInfo.ni().getEssid(), "프로세스의 에러 스트림 내용:", process.readErrorLines()); - log.error("[managed - mdns({})] 프로세스를 재실행합니다.", managedInfo.ni().getEssid()); - //프로세스 실행은 논블로킹 - new Thread(()->startProcess(managedInfo)).start(); - } - return alive;}) + .filter(entry-> entry.getValue().isAlive()) .flatMap(entry -> { ManagedInfo managedInfo = entry.getKey(); MdnsLogProcess process = entry.getValue(); @@ -71,12 +65,36 @@ private void writeLogs() { dao.upsertAll(totalLogs); } + @Scheduled(initialDelay = 10000, fixedDelay = 10000) + private void checkProcesses(){ + this.processes.entrySet().parallelStream() + .filter(entry-> !entry.getValue().isAlive()) + .forEach(entry ->{ + ManagedInfo managedInfo = entry.getKey(); + MdnsLogProcess process = entry.getValue(); + //프로세스가 죽었다는 것을 인지했을때만 아래 로직을 실행 + if (dead.get(managedInfo).equals(Boolean.FALSE)) { + dead.put(managedInfo, true); + log.error("[managed - mdns({})] 프로세스가 종료됨 :\n{}\n{}", managedInfo.ni().getEssid(), "프로세스의 에러 스트림 내용:", process.readErrorLines()); + } + startProcess(managedInfo); + }); + } + private void startProcess(ManagedInfo info){ + String ssid = info.ni().getEssid(); + log.info("[managed - mdns({})] 프로세스를 실행합니다.", ssid); + + if (!systemNIs.exists(info.ni())){ + log.error("[managed - mdns({})] 설정된 mdns 네트워크 인터페이스가 시스템에 존재하지 않습니다.", ssid); + return; + } Optional.ofNullable(this.processes.get(info)).ifPresent(MdnsLogProcess::terminate); MdnsLogProcess process = new MdnsLogProcess(info, sudoPassword); this.processes.put(info, process); - log.info("[managed - mdns({})] 프로세스 실행 완료", info.ni().getEssid()); this.dead.put(info, false); + + log.info("[managed - mdns({})] 프로세스 실행 완료", ssid); } From 1e42f54fad8f51f8a0e07f6668f04e75f9e9a3a4 Mon Sep 17 00:00:00 2001 From: coco3x Date: Fri, 13 Dec 2024 21:36:41 +0900 Subject: [PATCH 06/13] =?UTF-8?q?update:=20=EC=9A=B4=EC=98=81=EC=B2=B4?= =?UTF-8?q?=EC=A0=9C=EB=A5=BC=20=ED=99=95=EC=9D=B8=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EA=B3=A0=20prod=EB=A9=B4=20=EA=B2=80=EC=A6=9D?= =?UTF-8?q?=EC=9D=84=20=EC=8B=9C=EB=8F=84=20=ED=95=9C=EB=8B=A4.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CommandInstalledValidator.java | 1 + .../system_validator/SystemValidator.java | 3 ++ .../SystemValidatorConfig.java | 45 ------------------- 3 files changed, 4 insertions(+), 45 deletions(-) delete mode 100644 modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidatorConfig.java diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/CommandInstalledValidator.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/CommandInstalledValidator.java index d7ab5004..1ccef9cb 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/CommandInstalledValidator.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/CommandInstalledValidator.java @@ -7,6 +7,7 @@ import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; +//which로 커맨드가 설치되어있는지 확인함 @Component @RequiredArgsConstructor public class CommandInstalledValidator implements Validator { diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidator.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidator.java index 085a2ed6..b67745d5 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidator.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidator.java @@ -11,10 +11,13 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; //시스템의 전체적인 검증을 진행하는 클래스 //SystemValidatorConfig에 의해 빈으로 등록됩니다 @Slf4j +@Profile("prod") +@Component public final class SystemValidator { private final NetworkConfig config; private final SystemNetworkInterfaces systemNIs; diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidatorConfig.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidatorConfig.java deleted file mode 100644 index 8660b747..00000000 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidatorConfig.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.whoz_in.log_writer.system_validator; - -import com.whoz_in.log_writer.common.SystemNetworkInterfaces; -import com.whoz_in.log_writer.config.NetworkConfig; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - - -//TODO: Conditional로 뺄지 아니면 -@Slf4j -@Configuration -public class SystemValidatorConfig { - private final String profile; - private final NetworkConfig config; - private final SystemNetworkInterfaces systemNIs; - private final CommandInstalledValidator commandInstalledValidator; - private final NetworkInterfaceValidator networkInterfaceValidator; - - public SystemValidatorConfig(@Value("${spring.profiles.active}") String profile, - NetworkConfig config, - SystemNetworkInterfaces systemNIs, - CommandInstalledValidator commandInstalledValidator, - NetworkInterfaceValidator networkInterfaceValidator) { - this.profile = profile; - this.config = config; - this.systemNIs = systemNIs; - this.commandInstalledValidator = commandInstalledValidator; - this.networkInterfaceValidator = networkInterfaceValidator; - } - - @Bean - public SystemValidator systemValidator(){ - String osName = System.getProperty("os.name").toLowerCase(); - log.info("운영체제 - {}", osName); - log.info("스프링 프로필 - {}", profile); - - if (!profile.equals("prod") || !osName.contains("nux")){ - log.info("리눅스가 아니거나 스프링 프로필이 prod가 아니므로 시스템 검증을 수행하지 않습니다."); - return null; - } - return new SystemValidator(config, systemNIs, commandInstalledValidator, networkInterfaceValidator); - } -} From 61288194bb615287e3ec455095276150ddf7c6cd Mon Sep 17 00:00:00 2001 From: coco3x Date: Fri, 13 Dec 2024 21:44:27 +0900 Subject: [PATCH 07/13] =?UTF-8?q?update:=20channel=20hopper=20prod?= =?UTF-8?q?=EC=9D=BC=20=EC=8B=9C=20=EB=93=B1=EB=A1=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../log_writer/monitor/ChannelHopper.java | 11 ++++++-- .../monitor/ChannelHopperConfig.java | 28 ------------------- 2 files changed, 8 insertions(+), 31 deletions(-) delete mode 100644 modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/ChannelHopperConfig.java diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/ChannelHopper.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/ChannelHopper.java index cd05dec0..b2a2e222 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/ChannelHopper.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/ChannelHopper.java @@ -2,24 +2,29 @@ import com.whoz_in.log_writer.common.NetworkInterface; import com.whoz_in.log_writer.common.process.TransientProcess; +import com.whoz_in.log_writer.config.NetworkConfig; import java.util.HashSet; import java.util.Set; import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Profile; import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; //모니터 모드인 네트워크 인터페이스의 채널을 주기적으로 바꿔주는 역할 //변경될 채널은 주변 모든 와이파이들을 대상으로 함. @Slf4j -public class ChannelHopper { +@Profile("prod") +@Component +public final class ChannelHopper { private final NetworkInterface monitor; private final String sudoPassword; private final Set channelsToHop = new HashSet<>(); - public ChannelHopper(NetworkInterface monitor, @Value("${sudo_password}") String sudoPassword) { + public ChannelHopper(NetworkConfig config, @Value("${sudo_password}") String sudoPassword) { this.sudoPassword = sudoPassword; - this.monitor = monitor; + this.monitor = config.getMonitorInfo().ni(); } @Scheduled(initialDelay = 5000, fixedDelay = 1000) diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/ChannelHopperConfig.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/ChannelHopperConfig.java deleted file mode 100644 index 1fb14d8e..00000000 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/ChannelHopperConfig.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.whoz_in.log_writer.monitor; - -import com.whoz_in.log_writer.config.NetworkConfig; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class ChannelHopperConfig { - private final NetworkConfig config; - private final String sudoPassword; - - public ChannelHopperConfig(@Autowired NetworkConfig config, @Value("${sudo_password}") String sudoPassword) { - this.config = config; - this.sudoPassword = sudoPassword; - } - - //모니터 모드인 네트워크 인터페이스가 있을경우 채널을 이동하는 ChannelHopper를 빈으로 등록 - @Bean - public ChannelHopper channelHopper(){ - return config.getNetworkInterfaces().stream() - .filter(ni -> ni.getMode().equals("monitor")) - .findAny() - .map(networkInterface -> new ChannelHopper(networkInterface, sudoPassword)) - .orElse(null); - } -} From df5617a0893777cd4936eda7ce9a3c8655a00efd Mon Sep 17 00:00:00 2001 From: coco3x Date: Sat, 14 Dec 2024 01:39:57 +0900 Subject: [PATCH 08/13] =?UTF-8?q?fix:=20sudo=EA=B0=80=20=EC=95=84=EB=8B=8C?= =?UTF-8?q?=20=EC=BB=A4=EB=A7=A8=EB=93=9C=EA=B0=80=20=EB=84=88=EB=AC=B4=20?= =?UTF-8?q?=EB=B9=A8=EB=A6=AC=20=EB=81=9D=EB=82=98=EC=84=9C=20sudo=20passw?= =?UTF-8?q?ord=EB=A5=BC=20=EC=9E=85=EB=A0=A5=ED=95=A0=20=EB=95=8C=20broken?= =?UTF-8?q?=20pipe=EA=B0=80=20=EB=9C=A8=EB=8A=94=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/process/TransientProcess.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/process/TransientProcess.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/process/TransientProcess.java index eb6ff281..f27c4880 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/process/TransientProcess.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/process/TransientProcess.java @@ -20,22 +20,31 @@ public class TransientProcess { public TransientProcess() {} + // sudo 없이 실행할 커맨드 + // command 예시: "ifconfig" public TransientProcess(String command){ - this(command, null); - } - public TransientProcess(String command, @Nullable String sudoPassword) { try { this.process = new ProcessBuilder(command.split(" ")) .redirectErrorStream(true) .start(); - this.br = new BufferedReader(new InputStreamReader(process.getInputStream())); - this.ebr = new BufferedReader(new InputStreamReader(process.getErrorStream())); - if (sudoPassword==null) return; - Writer writer = new OutputStreamWriter(this.process.getOutputStream()); + } catch (IOException e) { + throw new RuntimeException(command+" - 실행 실패"); + } + this.br = new BufferedReader(new InputStreamReader(process.getInputStream())); + this.ebr = new BufferedReader(new InputStreamReader(process.getErrorStream())); + } + + // sudo로 실행할 커맨드 + // sudoCommand 예시: "sudo iwconfig" + // sudo 없이 실행한 커맨드일 경우 writer에 flush하기도 전에 끝날 수 있으므로 나눠진 것 + public TransientProcess(String sudoCommand, String sudoPassword) { + this(sudoCommand); + Writer writer = new OutputStreamWriter(this.process.getOutputStream()); + try { writer.write(sudoPassword + System.lineSeparator()); writer.flush(); } catch (IOException e) { - throw new RuntimeException("TransientProcess 실행 실패 -", e); + throw new RuntimeException(sudoCommand + " - sudo 명령어 입력 중 오류 발생"); } } From d7c885132e4fa56c1d72a96ab9ca064565df2ff8 Mon Sep 17 00:00:00 2001 From: coco3x Date: Sat, 14 Dec 2024 01:40:42 +0900 Subject: [PATCH 09/13] =?UTF-8?q?refactor:=20arp=20=EB=A1=9C=EA=B9=85=20?= =?UTF-8?q?=EB=A9=94=EC=84=9C=EB=93=9C=20=EB=A6=AC=ED=8C=A9=ED=86=A0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../log_writer/managed/arp/ArpLogProcess.java | 5 ++ .../log_writer/managed/arp/ArpLogWriter.java | 50 +++++++++---------- 2 files changed, 28 insertions(+), 27 deletions(-) diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogProcess.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogProcess.java index 9437879f..ba62d949 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogProcess.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogProcess.java @@ -2,10 +2,15 @@ import com.whoz_in.log_writer.common.process.TransientProcess; import com.whoz_in.log_writer.managed.ManagedInfo; +import java.io.IOException; +import lombok.Getter; +@Getter public class ArpLogProcess extends TransientProcess { + private final ManagedInfo info; public ArpLogProcess(ManagedInfo info, String password) { super(info.command(), password); + this.info = info; } } diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java index ebfa4664..352e4c6d 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java @@ -5,7 +5,10 @@ import com.whoz_in.log_writer.managed.ManagedInfo; import com.whoz_in.log_writer.managed.ManagedLog; import com.whoz_in.log_writer.managed.ManagedLogDAO; +import java.io.IOException; +import java.util.Collection; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -34,36 +37,29 @@ public ArpLogWriter(ManagedLogDAO dao, this.sudoPassword = sudoPassword; } + //주기적으로 arp 명령어를 실행하여 로그를 저장함 @Scheduled(initialDelay = 10000, fixedDelay = 5000) private void scan() { - List logs= arpList.stream() - .flatMap(arpInfo-> { - ArpLogProcess proc = new ArpLogProcess(arpInfo, sudoPassword); //프로세스 실행 - List lines = proc.resultList(); //프로세스의 모든 출력 가져오기 - Set procLogs = lines.stream() //출력 라인들을 ManagedLog 변환하며 ssid도 넣어줌 - .filter(parser::validate) - .map(line->{ - ManagedLog log = parser.parse(line); - log.setSsid(arpInfo.ni().getEssid()); - return log; - }) - .collect(Collectors.toSet()); //Set으로 중복 제거 - - /* - Arp-scan은 단발성인데 - Process의 isAlive()는 실행 중일 때도 false일 수 있고, 종료 중일 때도 true일 수 있으므로 오류의 판단이 힘들다. - 따라서 Arp-scan의 경우 무조건 1개 이상의 결과가 나오므로 0개라면 실행 실패라고 판단한다. - */ - if (procLogs.isEmpty()) { - //SystemValidator가 시스템의 네트워크 인터페이스가 올바른지 검증하기 때문에 여기서는 warn으로 로깅 - log.warn("[managed - arp({})] 실행 실패 : ERROR", arpInfo.ni().getEssid()); - return Stream.empty(); - } - log.info("[managed - arp({})] log to save : {}", arpInfo.ni().getEssid(), procLogs.size()); - return procLogs.stream(); - }) + List logs = arpList.stream() //실행할 arp들을 스트림화 + .map(info -> new ArpLogProcess(info, sudoPassword)) //arp 실행 + .map(this::getLogsFromProcess) //arp 출력을 로그 Set으로 변환 + .flatMap(Collection::stream) //Set끼리 합침 .toList(); - dao.upsertAll(logs); } + + //프로세스의 출력들을 로그로 변환한다. + private Set getLogsFromProcess(ArpLogProcess process){ + Set logs = process.resultList().stream() + .filter(parser::validate) + .map(line -> { + ManagedLog log = parser.parse(line); + //ssid도 넣어줌 + log.setSsid(process.getInfo().ni().getEssid()); + return log; + }) + .collect(Collectors.toSet());//Set으로 중복 제거 + log.info("[managed - arp({})] log to save : {}", process.getInfo().ni().getEssid(), logs.size()); + return logs; + } } From 3401999b65e6f50b1f09dad262dfa715913b6bb0 Mon Sep 17 00:00:00 2001 From: coco3x Date: Sat, 14 Dec 2024 02:05:04 +0900 Subject: [PATCH 10/13] =?UTF-8?q?refactor:=20monitor=20log=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=20=EB=A1=9C=EC=A7=81=20=EB=A6=AC=ED=8C=A9=ED=86=A0?= =?UTF-8?q?=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/process/ContinuousProcess.java | 15 +++++++++++++++ .../log_writer/monitor/MonitorLogWriter.java | 19 +++++++++---------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/process/ContinuousProcess.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/process/ContinuousProcess.java index e7a371d4..69506832 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/process/ContinuousProcess.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/process/ContinuousProcess.java @@ -7,6 +7,8 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.Writer; +import java.util.ArrayList; +import java.util.List; //실행 후 종료되지 않는 프로세스 //꾸준히 출력을 읽을 수 있어야 한다. @@ -50,6 +52,19 @@ public String readLine(){ } } + public List readLines() { + List lines = new ArrayList<>(); + try { + String line; + while((line=this.br.readLine()) != null) { + lines.add(line); + } + return lines; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + /** * @return 프로세스의 에러 출력에서 한 줄을 읽어들인다. * 읽을 줄이 없을경우 null을 출력한다. diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogWriter.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogWriter.java index cb3f14f3..1c7cb440 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogWriter.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/monitor/MonitorLogWriter.java @@ -16,16 +16,16 @@ public class MonitorLogWriter { private MonitorLogProcess process; //교체될 수 있으므로 final X private boolean isProcDead; private final MonitorLogParser parser; - private final MonitorLogDAO repo; + private final MonitorLogDAO dao; private final String sudoPassword; private final MonitorInfo monitorInfo; private final SystemNetworkInterfaces systemNIs; - public MonitorLogWriter(MonitorLogParser parser, MonitorLogDAO repo, NetworkConfig config, + public MonitorLogWriter(MonitorLogParser parser, MonitorLogDAO dao, NetworkConfig config, @Value("${sudo_password}") String sudoPassword, SystemNetworkInterfaces systemNIs) { this.parser = parser; - this.repo = repo; + this.dao = dao; this.monitorInfo = config.getMonitorInfo(); this.sudoPassword = sudoPassword; this.systemNIs = systemNIs; @@ -36,19 +36,18 @@ public MonitorLogWriter(MonitorLogParser parser, MonitorLogDAO repo, NetworkConf private void saveLogs(){ //프로세스 죽었으면 기록 안함 if (!process.isAlive()) return; + Set macs = new HashSet<>(); - String line; - for(;;) { - line = process.readLine(); - if (line == null) break; - macs.addAll(parser.parse(line)); - } + process.readLines().stream() + .map(parser::parse) + .forEach(macs::addAll); macs.remove(""); log.info("[monitor] mac to save: " + macs.size()); - repo.upsertAll(macs); + dao.upsertAll(macs); } + //프로세스 죽었으면 에러 내용을 기록하고 프로세스 재실행 @Scheduled(initialDelay = 10000, fixedDelay = 10000) private void checkProcess(){ if (process.isAlive()) return; From 3fa219e6fb3f64e662a4ca471721d05587280e1d Mon Sep 17 00:00:00 2001 From: coco3x Date: Sat, 14 Dec 2024 03:22:35 +0900 Subject: [PATCH 11/13] =?UTF-8?q?refactor:=20mdns=20writer=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../managed/mdns/MdnsLogProcess.java | 5 ++- .../managed/mdns/MdnsLogWriter.java | 43 ++++++++++--------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogProcess.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogProcess.java index 74dfbd62..bc8c2f0f 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogProcess.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogProcess.java @@ -2,10 +2,13 @@ import com.whoz_in.log_writer.common.process.ContinuousProcess; import com.whoz_in.log_writer.managed.ManagedInfo; +import lombok.Getter; +@Getter public class MdnsLogProcess extends ContinuousProcess { - + private final ManagedInfo info; public MdnsLogProcess(ManagedInfo info, String sudoPassword) { super(info.command(), sudoPassword); + this.info = info; } } diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java index 2ee9ac2b..810af72a 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/mdns/MdnsLogWriter.java @@ -5,10 +5,13 @@ import com.whoz_in.log_writer.managed.ManagedInfo; import com.whoz_in.log_writer.managed.ManagedLog; import com.whoz_in.log_writer.managed.ManagedLogDAO; +import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.Set; +import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; @@ -38,33 +41,31 @@ public MdnsLogWriter(ManagedLogDAO dao, MdnsLogParser parser, NetworkConfig conf config.getMdnsList().forEach(this::startProcess); } + //주기적으로 로그를 저장함 @Scheduled(initialDelay = 10000, fixedDelay = 10000) private void saveLogs() { - List totalLogs = this.processes.entrySet().parallelStream() - .filter(entry-> entry.getValue().isAlive()) - .flatMap(entry -> { - ManagedInfo managedInfo = entry.getKey(); - MdnsLogProcess process = entry.getValue(); - Map logs = new HashMap<>(); - String line; - for(;;) { - line = process.readLine(); - if (line == null) { - log.info("[managed - mdns({})] log to save : {}", managedInfo.ni().getEssid(), logs.size()); - return logs.values().stream(); - } - parser.parse(line).ifPresent( - mdnsLog -> { - logs.put(mdnsLog, mdnsLog); - mdnsLog.setSsid(managedInfo.ni().getEssid());} - ); - } - }) + List totalLogs = this.processes.values().parallelStream() + .filter(MdnsLogProcess::isAlive) + .map(this::getLogsFromProcess) + .flatMap(Collection::stream) .toList(); - dao.upsertAll(totalLogs); } + //프로세스에 쌓인 출력들을 로그로 변환 + private Set getLogsFromProcess(MdnsLogProcess process){ + Set logs = process.readLines().stream() + .map(parser::parse) + .filter(Optional::isPresent) + .map(Optional::get) + .collect(Collectors.toSet()); + String ssid = process.getInfo().ni().getEssid(); + logs.forEach(log->log.setSsid(ssid)); + log.info("[managed - mdns({})] log to save : {}", ssid, logs.size()); //이거 여기 있는건 좀 그러긴 함 + return logs; + } + + //주기적으로 프로세스가 죽었는지 확인하고 재실행함 @Scheduled(initialDelay = 10000, fixedDelay = 10000) private void checkProcesses(){ this.processes.entrySet().parallelStream() From e11fb7768b21a142d4daba30a1c3852dea265512 Mon Sep 17 00:00:00 2001 From: coco3x Date: Sat, 14 Dec 2024 03:24:38 +0900 Subject: [PATCH 12/13] =?UTF-8?q?refactor:=20arp=20log=20writer=20?= =?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../whoz_in/log_writer/managed/arp/ArpLogWriter.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java index 352e4c6d..68caebbf 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java @@ -52,14 +52,12 @@ private void scan() { private Set getLogsFromProcess(ArpLogProcess process){ Set logs = process.resultList().stream() .filter(parser::validate) - .map(line -> { - ManagedLog log = parser.parse(line); - //ssid도 넣어줌 - log.setSsid(process.getInfo().ni().getEssid()); - return log; - }) + .map(parser::parse) .collect(Collectors.toSet());//Set으로 중복 제거 - log.info("[managed - arp({})] log to save : {}", process.getInfo().ni().getEssid(), logs.size()); + + String ssid = process.getInfo().ni().getEssid(); + logs.forEach(log->log.setSsid(ssid)); + log.info("[managed - arp({})] log to save : {}", ssid, logs.size()); return logs; } } From 0d8b87c67480ea6c046a81d3bbd80b6d9fcb63d3 Mon Sep 17 00:00:00 2001 From: coco3x Date: Sat, 14 Dec 2024 03:26:08 +0900 Subject: [PATCH 13/13] =?UTF-8?q?style:=20=EC=93=B8=EB=AA=A8=20=EC=97=86?= =?UTF-8?q?=EB=8A=94=20=EC=9E=84=ED=8F=AC=ED=8A=B8=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../whoz_in/log_writer/common/process/TransientProcess.java | 1 - .../com/whoz_in/log_writer/managed/arp/ArpLogProcess.java | 1 - .../com/whoz_in/log_writer/managed/arp/ArpLogWriter.java | 5 +---- .../system_validator/CommandInstalledValidator.java | 2 +- .../whoz_in/log_writer/system_validator/SystemValidator.java | 1 - 5 files changed, 2 insertions(+), 8 deletions(-) diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/process/TransientProcess.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/process/TransientProcess.java index f27c4880..ba21c6a7 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/process/TransientProcess.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/common/process/TransientProcess.java @@ -1,6 +1,5 @@ package com.whoz_in.log_writer.common.process; -import jakarta.annotation.Nullable; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogProcess.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogProcess.java index ba62d949..45811d37 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogProcess.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogProcess.java @@ -2,7 +2,6 @@ import com.whoz_in.log_writer.common.process.TransientProcess; import com.whoz_in.log_writer.managed.ManagedInfo; -import java.io.IOException; import lombok.Getter; @Getter diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java index 68caebbf..f1a5070a 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/managed/arp/ArpLogWriter.java @@ -5,19 +5,16 @@ import com.whoz_in.log_writer.managed.ManagedInfo; import com.whoz_in.log_writer.managed.ManagedLog; import com.whoz_in.log_writer.managed.ManagedLogDAO; -import java.io.IOException; import java.util.Collection; import java.util.List; -import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import java.util.stream.Stream; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; -//TODO: 에러 로그 어떻게 관리할지 생각. 일단 TransientProcess라서 구현 안함 + @Slf4j @Component public class ArpLogWriter { diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/CommandInstalledValidator.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/CommandInstalledValidator.java index 1ccef9cb..b84f3966 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/CommandInstalledValidator.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/CommandInstalledValidator.java @@ -1,8 +1,8 @@ package com.whoz_in.log_writer.system_validator; +import com.whoz_in.log_writer.common.process.TransientProcess; import com.whoz_in.log_writer.common.validation.ValidationResult; import com.whoz_in.log_writer.common.validation.Validator; -import com.whoz_in.log_writer.common.process.TransientProcess; import java.util.List; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; diff --git a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidator.java b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidator.java index b67745d5..c78e4d84 100644 --- a/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidator.java +++ b/modules/infrastructure/log-writer/src/main/java/com/whoz_in/log_writer/system_validator/SystemValidator.java @@ -2,7 +2,6 @@ import com.whoz_in.log_writer.common.NetworkInterface; -import com.whoz_in.log_writer.common.IwconfigNetworkInterfaces; import com.whoz_in.log_writer.common.SystemNetworkInterfaces; import com.whoz_in.log_writer.common.validation.ValidationResult; import com.whoz_in.log_writer.config.NetworkConfig;