mirror of
https://github.com/r-smith/deceptifeed.git
synced 2025-10-23 08:22:21 +00:00
feat: add proxy protocol configuration setting
This change adds a configuration option to enable Proxy Protocol (not yet implemented). Planned for TCP and SSH honeypot types. Use `<useProxyProtocol>true</useProxyProtocol>` in the XML config.
This commit is contained in:
@@ -104,6 +104,7 @@ type Server struct {
|
|||||||
Headers []string `xml:"headers>header"`
|
Headers []string `xml:"headers>header"`
|
||||||
Prompts []Prompt `xml:"prompts>prompt"`
|
Prompts []Prompt `xml:"prompts>prompt"`
|
||||||
SendToThreatFeed bool `xml:"sendToThreatFeed"`
|
SendToThreatFeed bool `xml:"sendToThreatFeed"`
|
||||||
|
UseProxyProtocol bool `xml:"useProxyProtocol"`
|
||||||
Rules Rules `xml:"rules"`
|
Rules Rules `xml:"rules"`
|
||||||
SourceIPHeader string `xml:"sourceIpHeader"`
|
SourceIPHeader string `xml:"sourceIpHeader"`
|
||||||
LogPath string `xml:"logPath"`
|
LogPath string `xml:"logPath"`
|
||||||
@@ -257,9 +258,15 @@ func (c *Config) InitializeLoggers() error {
|
|||||||
io.MultiWriter(file, c.Monitor),
|
io.MultiWriter(file, c.Monitor),
|
||||||
&slog.HandlerOptions{
|
&slog.HandlerOptions{
|
||||||
ReplaceAttr: func(groups []string, a slog.Attr) slog.Attr {
|
ReplaceAttr: func(groups []string, a slog.Attr) slog.Attr {
|
||||||
// Remove 'message' and 'log level' fields from output.
|
switch a.Key {
|
||||||
if a.Key == slog.MessageKey || a.Key == slog.LevelKey {
|
case slog.MessageKey, slog.LevelKey:
|
||||||
|
// Remove default 'message' and 'log level' fields.
|
||||||
return slog.Attr{}
|
return slog.Attr{}
|
||||||
|
case "source_ip_error":
|
||||||
|
// Remove 'source_ip_error' field if it's empty.
|
||||||
|
if len(a.Value.String()) == 0 {
|
||||||
|
return slog.Attr{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return a
|
return a
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user