Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Packages scripts refactor #316

Merged
merged 3 commits into from
May 22, 2023
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
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