Skip to content

Commit f36cac3

Browse files
committed
add nap paths by default, update agent config during upgrade
1 parent c12f42e commit f36cac3

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

internal/config/defaults.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ func DefaultAllowedDirectories() []string {
106106
"/usr/share/nginx/modules",
107107
"/var/run/nginx",
108108
"/var/log/nginx",
109+
"/opt/app_protect",
110+
"/etc/app_protect",
109111
}
110112
}
111113

internal/watcher/instance/nginx-app-protect-instance-watcher.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var (
2626
attackSignatureVersionFilePath = "/opt/app_protect/var/update_files/signatures/version"
2727
threatCampaignVersionFilePath = "/opt/app_protect/var/update_files/threat_campaigns/version"
2828
enforcerEngineVersionFilePath = "/opt/app_protect/bd_config/enforcer.version"
29+
napConfigPath = "/etc/app_protect"
2930

3031
versionFiles = []string{
3132
versionFilePath,
@@ -232,11 +233,6 @@ func (w *NginxAppProtectInstanceWatcher) createInstance(ctx context.Context) {
232233
InstanceChildren: make([]*mpi.InstanceChild, 0),
233234
},
234235
}
235-
236-
slog.InfoContext(ctx, "Discovered a new NGINX App Protect instance")
237-
w.agentConfig.AllowedDirectories = append(w.agentConfig.AllowedDirectories, napDirPath)
238-
slog.InfoContext(ctx, "Added NAP directory to allowed directories", "directories", w.agentConfig.AllowedDirectories)
239-
240236
w.instancesChannel <- InstanceUpdatesMessage{
241237
CorrelationID: logger.CorrelationIDAttr(ctx),
242238
InstanceUpdates: InstanceUpdates{

scripts/packages/upgrade-agent-config.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ for config_dir in $config_dirs; do
5252
done
5353

5454
allowed_directories="${allowed_directories}\n - /var/log/nginx"
55-
55+
allowed_directories="${allowed_directories}\n - /opt/app_protect"
56+
allowed_directories="${allowed_directories}\n - /etc/app_protect"
57+
5658
v3_config_contents="
5759
#
5860
# /etc/nginx-agent/nginx-agent.conf

0 commit comments

Comments
 (0)