Skip to content

Commit

Permalink
Packages scripts refactor (#316)
Browse files Browse the repository at this point in the history
* Packages scripts refactor

* Packages scripts refactor

* Packages scripts refactor

---------

Co-authored-by: Chris Adams <[email protected]>
  • Loading branch information
oCHRISo and Chris Adams authored May 22, 2023
1 parent 8ea5b58 commit cf4cc7f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 20 deletions.
8 changes: 4 additions & 4 deletions nginx-agent.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#
# Configuration file for NGINX Agent.
#
# This file is to track agent configuration values that are meant to be statically set. There
# are additional agent configuration values that are set via the API and agent install script
# This file is to track NGINX Agent configuration values that are meant to be statically set. There
# are additional NGINX Agent configuration values that are set via the API and NGINX Agent install script
# which can be found in /var/lib/nginx-agent/agent-dynamic.conf.

log:
Expand All @@ -20,7 +20,7 @@ nginx:

dataplane:
status:
# poll interval for data plane status - the frequency the agent will query the dataplane for changes
# poll interval for data plane status - the frequency the NGINX Agent will query the dataplane for changes
poll_interval: 30s
# report interval for data plane status - the maximum duration to wait before syncing dataplane information if no updates have being observed
report_interval: 24h
Expand All @@ -37,5 +37,5 @@ metrics:
config_dirs: "/etc/nginx:/usr/local/etc/nginx:/usr/share/nginx/modules:/etc/nms"

api:
# default port for Agent API, this is for the server configuration of the REST API
# default port for NGINX Agent API, this is for the server configuration of the REST API
port: 8081
2 changes: 1 addition & 1 deletion scripts/packages/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: nginx-agent
version: "${VERSION}"
origin: www/nginx-agent
comment: "Monitors NGINX"
desc: "Unified agent for various NGINX control plane services."
desc: "NGINX Agent for various NGINX control plane services."
maintainer: "NGINX Inc. <[email protected]>"
www: https://nginx.com
prefix: /
9 changes: 4 additions & 5 deletions scripts/packages/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ add_default_config_file() {
#
# Configuration file for NGINX Agent.
#
# This file is to track agent configuration values that are meant to be statically set. There
# are additional agent configuration values that are set via the API and agent install script
# This file is to track NGINX Agent configuration values that are meant to be statically set. There
# are additional NGINX Agent configuration values that are set via the API and NGINX Agent install script
# which can be found in /var/lib/nginx-agent/agent-dynamic.conf.
# specify the server grpc port to connect to
Expand Down Expand Up @@ -224,7 +224,7 @@ nginx:
dataplane:
status:
# poll interval for data plane status - the frequency the agent will query the dataplane for changes
# poll interval for data plane status - the frequency the NGINX Agent will query the dataplane for changes
poll_interval: 30s
# report interval for data plane status - the maximum duration to wait before syncing dataplane information if no updates have being observed
report_interval: 24h
Expand All @@ -241,7 +241,7 @@ metrics:
config_dirs: "/etc/nginx:/usr/local/etc/nginx:/usr/share/nginx/modules:/etc/nms"
api:
# default port for Agent API, this is for the server configuration of the REST API
# default port for NGINX Agent API, this is for the server configuration of the REST API
port: 8081
EOF
printf "PostInstall: Updating file permissions for nginx-agent.conf to 0640\n"
Expand Down Expand Up @@ -303,4 +303,3 @@ summary() {
upgrade_config_file
summary
}

14 changes: 6 additions & 8 deletions scripts/packages/preinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ AGENT_DYNAMIC_CONFIG_COMMENT="#
#
# Dynamic configuration file for NGINX Agent.
#
# The purpose of this file is to track agent configuration
# values that can be dynamically changed via the API and the agent install script.
# The purpose of this file is to track NGINX Agent configuration
# values that can be dynamically changed via the API and the NGINX Agent install script.
# You may edit this file, but API calls that modify the tags on this system will
# overwrite the tag values in this file.
#
# The agent configuration values that API calls can modify are as follows:
# The NGINX Agent configuration values that API calls can modify are as follows:
# - tags
#
# The agent configuration value(s) that the agent install script can modify are as follows:
# The NGINX Agent configuration value(s) that the NGINX Agent install script can modify are as follows:
# - instance_group
"
Expand All @@ -67,8 +67,6 @@ err_exit() {

title() {
printf "\n --- NGINX Agent Package Installer --- \n\n"
printf " --- Will install the NGINX Agent in 5 seconds ---\n"
sleep 5
}

ensure_sudo() {
Expand Down Expand Up @@ -109,7 +107,7 @@ update_config_file() {
printf "Updating %s ...\n" "${AGENT_DYNAMIC_CONFIG_FILE}"

if [ ! -f "$AGENT_CONFIG_FILE" ]; then
printf "Agent config file %s does not exist. Could not be updated\n" "$AGENT_CONFIG_FILE"
printf "NGINX Agent config file %s does not exist. Could not be updated\n" "$AGENT_CONFIG_FILE"
exit 0
fi

Expand Down Expand Up @@ -160,4 +158,4 @@ update_config_file() {
ensure_sudo
load_config_values
update_config_file
}
}
4 changes: 2 additions & 2 deletions scripts/selinux/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ sudo ./nginx_agent.sh --update

## Debugging
* To check for policy violation look at the file `/var/log/audit/audit.log`
* To check if agent is confined by selinux: `ps -efZ | grep nginx-agent`
* To check if NGINX Agent is confined by selinux: `ps -efZ | grep nginx-agent`
* For debugging nginx selinux issues refer to this nginx blog: https://www.nginx.com/blog/using-nginx-plus-with-selinux

## References
* https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/using_selinux/writing-a-custom-selinux-policy_using-selinux
* https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/using_selinux/writing-a-custom-selinux-policy_using-selinux

0 comments on commit cf4cc7f

Please sign in to comment.