Skip to content

Commit b7f00e6

Browse files
committed
Merge branch 'release/v11' of https://github.com/utmstack/UTMStack into release/v11
2 parents e8faeef + 468c4b5 commit b7f00e6

7 files changed

Lines changed: 29 additions & 15 deletions

File tree

backend/src/main/java/com/park/utmstack/domain/tfa/TfaSetupState.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package com.park.utmstack.domain.tfa;
22

3-
import lombok.Getter;
4-
import lombok.ToString;
3+
import lombok.Data;
54

6-
@Getter
7-
@ToString
5+
@Data
86
public class TfaSetupState {
9-
private final String secret;
10-
private final long expiresAt;
11-
private final long setupStartedAt;
7+
private String secret;
8+
private String lastUsedCode;
9+
private long expiresAt;
10+
private long setupStartedAt;
1211

1312
public TfaSetupState(String secret, long expiresAt) {
1413
this.secret = secret;

backend/src/main/java/com/park/utmstack/service/tfa/TfaService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ private TfaMethodService getMethodService(TfaMethod method) {
2323
return methodServices.stream()
2424
.filter(service -> service.getMethod().equals(method))
2525
.findFirst()
26-
.orElseThrow(() -> new IllegalArgumentException("Método TFA no soportado: " + method));
26+
.orElseThrow(() -> new IllegalArgumentException("TFA method not supported: " + method));
2727
}
2828

2929
public TfaInitResponse initiateSetup(User user, TfaMethod method) {

backend/src/main/java/com/park/utmstack/service/tfa/TotpTfaService.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,13 @@ public TfaVerifyResponse verifyCode(User user, String code) {
6363
.orElseThrow(() -> new IllegalStateException("No TFA setup found for user: " + user.getLogin()));
6464

6565
boolean expired = tfaSetupState.isExpired();
66-
boolean valid = !expired && authenticator.authorize(tfaSetupState.getSecret(), Integer.parseInt(code));
66+
boolean valid = !expired && authenticator.authorize(tfaSetupState.getSecret(), Integer.parseInt(code)) && !code.equals(tfaSetupState.getLastUsedCode());
67+
68+
if(expired){
69+
tfaSetupState.setLastUsedCode(code);
70+
tfaSetupState.setExpiresAt(System.currentTimeMillis() + Constants.EXPIRES_IN_SECONDS * 1000);
71+
cache.storeState(user.getLogin(), TfaMethod.TOTP, tfaSetupState);
72+
}
6773

6874
return new TfaVerifyResponse(
6975
valid,

filters/filebeat/system_linux_module.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ pipeline:
3131
from:
3232
- log.host.hostname
3333
to: origin.host
34+
- rename:
35+
from:
36+
- log.host.name
37+
to: origin.user
38+
- rename:
39+
from:
40+
- log.host.id
41+
to: log.hostId
3442
- rename:
3543
from:
3644
- log.event.dataset

filters/sophos/sophos_xg_firewall.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,4 +738,4 @@ pipeline:
738738
- log.logcomponent
739739
- log.logsubtype
740740
- log.name
741-
- log.logtype
741+
- log.logtype

filters/windows/windows-events.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2968,4 +2968,4 @@ pipeline:
29682968
- log.metadata
29692969
- log.event
29702970
- log.ecs
2971-
- log.log
2971+
- log.log

plugins/alerts/main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ package main
33
import (
44
"context"
55
"fmt"
6+
"net"
7+
"os"
8+
"strings"
9+
"time"
10+
611
"github.com/threatwinds/go-sdk/catcher"
712
"github.com/threatwinds/go-sdk/opensearch"
813
"github.com/threatwinds/go-sdk/plugins"
914
"github.com/threatwinds/go-sdk/utils"
1015
"github.com/tidwall/gjson"
11-
"net"
12-
"os"
13-
"strings"
14-
"time"
1516

1617
"google.golang.org/grpc"
1718
"google.golang.org/protobuf/types/known/emptypb"

0 commit comments

Comments
 (0)