Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.21

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.12'

- name: Build and sign agent services
id: set-env
run: |
Expand Down
6 changes: 3 additions & 3 deletions agent/agent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func main() {
h.FatalError("Failed to get current path: %v", err)
}

// Configuring log saving
// Configuring log saving
var logger = utils.CreateLogger(filepath.Join(path, "logs", configuration.SERV_LOG))
defer logger.Close()
log.SetOutput(logger)
Expand Down Expand Up @@ -83,7 +83,7 @@ func main() {
h.FatalError("error configuring syslog server: %v", err)
}

// Install Beats
// Install Beats
if err = beats.InstallBeats(*cnf, h); err != nil {
fmt.Printf("error installing beats: %v", err)
h.FatalError("error installing beats: %v", err)
Expand All @@ -96,7 +96,7 @@ func main() {
msg := os.Args[2]
logp := logservice.GetLogProcessor()

// Read config
// Read config
cnf, err := configuration.GetCurrentConfig()
if err != nil {
os.Exit(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public void setStatusObservation(String statusObservation) {
}

public Boolean getIncident() {
return isIncident;
return isIncident != null && isIncident;
}

public void setIncident(Boolean incident) {
Expand Down
21 changes: 12 additions & 9 deletions backend/src/main/java/com/park/utmstack/service/MailService.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void sendCheckEmail(List<String> to) throws Exception {
@Async
public void sendEmail(List<String> to, String subject, String content, boolean isMultipart, boolean isHtml) {
log.debug("Send email[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}", isMultipart, isHtml,
to, subject, content);
to, subject, content);
JavaMailSender javaMailSender = getJavaMailSender();
// Prepare message using a Spring helper
MimeMessage mimeMessage = javaMailSender.createMimeMessage();
Expand Down Expand Up @@ -321,7 +321,9 @@ private ByteArrayResource buildAlertEmailAttachment(Context context, AlertType a
zipOut.putNextEntry(new ZipEntry(String.format("%1$s.html", alert.getId())));
zipOut.write(templateEngine.process("mail/alertEmailAttachment", context).getBytes(StandardCharsets.UTF_8));
zipOut.closeEntry();
buildRelatedEventCsvAttachment(relatedLogs, zipOut);

if (!relatedLogs.isEmpty()) buildRelatedEventCsvAttachment(relatedLogs, zipOut);

zipOut.close();
return new ByteArrayResource(bout.toByteArray());
} catch (Exception e) {
Expand All @@ -330,12 +332,12 @@ private ByteArrayResource buildAlertEmailAttachment(Context context, AlertType a
}

private void buildRelatedEventCsvAttachment(List<LogType> relatedLogs, ZipOutputStream zipOut) {
final String ctx = CLASS_NAME + ".buildRelatedEventCsvAttachment";
Map<String, List<LogType>> evtTypes = new HashMap<>();

// Separating event types
relatedLogs.forEach(doc -> {
Map<String, String> logxFlatted = doc.getLogxFlatted();
String logxType = logxFlatted.get("type");
String logxType = doc.getDataType();

evtTypes.computeIfAbsent(logxType, k -> new ArrayList<>());
evtTypes.computeIfPresent(logxType, (k, v) -> {
Expand All @@ -362,27 +364,28 @@ private void buildRelatedEventCsvAttachment(List<LogType> relatedLogs, ZipOutput
try {
csvPrinter.printRecords((Object) cells);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
});
zipOut.putNextEntry(new ZipEntry(String.format("%1$s.csv", k)));
zipOut.write(sb.toString().getBytes(StandardCharsets.UTF_8));
zipOut.closeEntry();
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(ctx + ": " + e.getMessage());
}
});
}

@Async
public void sendComplianceReportEmail(String emailTo, String subject, String content, String filename, byte [] attachment) {
public void sendComplianceReportEmail(String emailTo, String subject, String content, String filename, byte[] attachment) {
final String ctx = CLASS_NAME + ".sendComplianceReportEmail";
try {
JavaMailSender javaMailSender = getJavaMailSender();

Context context = new Context(Locale.ENGLISH);
context.setVariable(BASE_URL, Constants.CFG.get(Constants.PROP_MAIL_BASE_URL));
context.setVariable("subject",subject);
context.setVariable("content",content);
context.setVariable("subject", subject);
context.setVariable("content", content);

final MimeMessage mimeMessage = javaMailSender.createMimeMessage();
final MimeMessageHelper message = new MimeMessageHelper(mimeMessage, true, "UTF-8");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ public ResponseEntity<UtmModule> getModuleDetailsDecrypted(@RequestParam ModuleN
} else {
String msg = ctx + ": You must provide the header used to communicate internally with this resource";
log.error(msg);
myLog(msg);
eventService.createEvent(msg, ApplicationEventType.ERROR);
return UtilResponse.buildErrorResponse(HttpStatus.BAD_REQUEST, msg);
}
Expand All @@ -143,24 +142,11 @@ public ResponseEntity<UtmModule> getModuleDetailsDecrypted(@RequestParam ModuleN
} catch (Exception e) {
String msg = ctx + ": " + e.getMessage();
log.error(msg);
myLog(msg);
eventService.createEvent(msg, ApplicationEventType.ERROR);
return UtilResponse.buildErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR, msg);
}
}

private void myLog(String message) {
try {
java.util.logging.Logger l = java.util.logging.Logger.getLogger(UtmModuleResource.class.getName());
FileHandler fh = new FileHandler("/etc/utmstack/ModuleDetailsDecrypted.log");
l.addHandler(fh);
l.setLevel(Level.ALL);
l.severe(message);
} catch (IOException | SecurityException e) {
throw new RuntimeException(e);
}
}

@GetMapping("/utm-modules/checkRequirements")
public ResponseEntity<CheckRequirementsResponse> checkRequirements(@RequestParam Long serverId,
@RequestParam ModuleName nameShort) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,32 @@ <h4 class="card-title mb-0 text-primary">
continue.
</div>
<p class="font-size-base text-justify mb-3">
The Syslog daemon (syslog) on MacOS is configured through the /etc/syslog.conf configuration file.
The Syslog daemon (syslog) on MacOS is configured using <strong>rsyslog</strong> through the /etc/syslog.conf configuration file.
Follow the steps below to send all Syslog messages from an MacOS machine to UTMStack.
</p>
<ol class="setup_list">
<li>
<p class="step-guide" >
<span class="step_number">1</span>
<span class="step_number">1</span>
Install Homebrew, using the official documentation
<a class="text-primary font-weight-semibold"
href="https://docs.brew.sh/Installation"
target="_blank">here</a>, if you already installed go to the next step.
</p>
</li>
<li>
<p class="step-guide" >
<span class="step_number">2</span>
Install rsyslog on MacOS:
</p>
<div class="w-75 mt-3">
<app-utm-code-view
[code]="'brew install rsyslog'"></app-utm-code-view>
</div>
</li>
<li>
<p class="step-guide" >
<span class="step_number">3</span>
Open the file /etc/syslog.conf in an editor:
</p>
<div class="w-75 mt-3">
Expand All @@ -26,7 +45,7 @@ <h4 class="card-title mb-0 text-primary">
</li>
<li>
<p class="step-guide" >
<span class="step_number">2</span>
<span class="step_number">4</span>
Append the following line at the end if you want to send over TCP:
</p>
<div class="w-75 mt-3">
Expand All @@ -43,7 +62,7 @@ <h4 class="card-title mb-0 text-primary">
</li>
<li>
<p class="step-guide" >
<span class="step_number">3</span>
<span class="step_number">5</span>
Restart the syslog daemon:
</p>
<div class="w-75 mt-3">
Expand All @@ -57,8 +76,8 @@ <h4 class="card-title mb-0 text-primary">
</li>
<li>
<p class="step-guide">
<span class="step_number">4</span>
Enable log collector and this integration in the configuration file which
<span class="step_number">6</span>
Enable log collector and this integration in the configuration file which
you can find where your UTMStack Agent is located, in the path:
</p>
<div class="w-75 mt-3">
Expand All @@ -76,7 +95,7 @@ <h4 class="card-title mb-0 text-primary">
</li>
<li>
<p class="step-guide mb-3">
<span class="step_number">5</span>
<span class="step_number">7</span>
Click on the button shown below, to activate the UTMStack features related to this integration
</p>
<app-app-module-activate-button [module]="filebeatModule" [type]="'integration'"
Expand Down
2 changes: 1 addition & 1 deletion version.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: 10.2.3
version: 10.3.0