update checkpoint to openappsec

This commit is contained in:
davidga 2022-11-13 15:56:42 +02:00
parent 10bf82bcc0
commit c20a5bfeb7

View File

@ -278,7 +278,7 @@ usage()
printf "%s %s : Load configuration\n" "$load_config_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#load_config_option})))")" printf "%s %s : Load configuration\n" "$load_config_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#load_config_option})))")"
printf "%s %s : Set proxy\n" "$proxy_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#proxy_option})))")" printf "%s %s : Set proxy\n" "$proxy_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#proxy_option})))")"
printf "%s %s : Display configuration\n" "$display_config_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#display_config_option})))")" printf "%s %s : Display configuration\n" "$display_config_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#display_config_option})))")"
printf "%s %s : Create Check Point agent info\n" "$cp_agent_info_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#cp_agent_info_option})))")" printf "%s %s : Create Openappsec agent info\n" "$cp_agent_info_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#cp_agent_info_option})))")"
printf "%s %s : Display current policy\n" "$display_policy_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#display_policy_option})))")" printf "%s %s : Display current policy\n" "$display_policy_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#display_policy_option})))")"
printf "%s %s : Load gradual policy\n" "$set_gradual_policy_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#set_gradual_policy_option})))")" printf "%s %s : Load gradual policy\n" "$set_gradual_policy_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#set_gradual_policy_option})))")"
printf "%s %s : Remove gradual policy\n" "$delete_gradual_policy_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#delete_gradual_policy_option})))")" printf "%s %s : Remove gradual policy\n" "$delete_gradual_policy_option" "$(printf "%s" "$line_padding" | cut -c 1-"$(max_num 1 $((${#line_padding} - ${#delete_gradual_policy_option})))")"
@ -463,15 +463,15 @@ read_agent_run_status() # Initials - rars
rars_output=$(tail -n 1 /tmp/agent-status.txt) rars_output=$(tail -n 1 /tmp/agent-status.txt)
if [ "$1" = "start" ]; then if [ "$1" = "start" ]; then
if [ "$rars_output" = "running" ]; then if [ "$rars_output" = "running" ]; then
echo "Check Point Nano Agent watchdog started successfully" echo "Openappsec Nano Agent watchdog started successfully"
else else
echo "Check Point Nano Agent is already running" echo "Openappsec Nano Agent is already running"
fi fi
else # "$1" = "stop" else # "$1" = "stop"
if [ "$rars_output" = "down" ]; then if [ "$rars_output" = "down" ]; then
echo "Check Point Nano Agent stopped successfully" echo "Openappsec Nano Agent stopped successfully"
else else
echo "Check Point Nano Agent is not running" echo "Openappsec Nano Agent is not running"
fi fi
fi fi
} }
@ -527,7 +527,7 @@ run_stop_agent()
uninstall_agent() # Initials - ua uninstall_agent() # Initials - ua
{ {
printf "Are you sure you want to uninstall Check Point Nano Agent? (Y/N): " && read -r ua_confirm printf "Are you sure you want to uninstall Openappsec Nano Agent? (Y/N): " && read -r ua_confirm
case $ua_confirm in case $ua_confirm in
[Yy] | [Yy][Ee][Ss]) ;; [Yy] | [Yy][Ee][Ss]) ;;
*) exit 1 ;; *) exit 1 ;;
@ -540,9 +540,9 @@ uninstall_agent() # Initials - ua
fi fi
${ua_uninstall_script} ${ua_uninstall_script}
if test "$?" = "0"; then if test "$?" = "0"; then
echo "Check Point Nano Agent successfully uninstalled" echo "Openappsec Nano Agent successfully uninstalled"
else else
echo "Failed to uninstall Check Point Nano Agent" echo "Failed to uninstall Openappsec Nano Agent"
exit 1 exit 1
fi fi
} }
@ -824,7 +824,7 @@ print_single_service_status() # Initials - psss
return return
fi fi
echo "---- Check Point $(format_nano_service_name "$psss_service_name") Nano Service ----" echo "---- Openappsec $(format_nano_service_name "$psss_service_name") Nano Service ----"
psss_is_userspace_process_running=$(is_userspace_running "$psss_service_name") psss_is_userspace_process_running=$(is_userspace_running "$psss_service_name")
@ -900,7 +900,7 @@ run_status() # Initials - rs
rs_agent_version="Version $rs_agent_version" rs_agent_version="Version $rs_agent_version"
fi fi
echo "---- Check Point Nano Agent ----" echo "---- Openappsec Nano Agent ----"
echo "$rs_agent_version" echo "$rs_agent_version"
if [ "$(is_userspace_running "watchdog")" = true ] || [ "$(is_userspace_running "agent")" = true ]; then if [ "$(is_userspace_running "watchdog")" = true ] || [ "$(is_userspace_running "agent")" = true ]; then
format_colored_status_line "Status: Running" format_colored_status_line "Status: Running"
@ -1434,16 +1434,16 @@ set_mode()
if [ "$mode" = "online_mode" ]; then if [ "$mode" = "online_mode" ]; then
time_sleep=2 time_sleep=2
time_out=60 time_out=60
echo "Registering Check Point Nano Agent to Fog.." echo "Registering Openappsec Nano Agent to Fog.."
until $USR_SBIN_PATH/${CP_NANO_CTL} -s 2> /dev/null | grep -q "Registration status: Succeeded"; do until $USR_SBIN_PATH/${CP_NANO_CTL} -s 2> /dev/null | grep -q "Registration status: Succeeded"; do
time_out=$(( time_out - time_sleep )) time_out=$(( time_out - time_sleep ))
if [ $time_out -le 0 ]; then if [ $time_out -le 0 ]; then
echo "Check Point Nano Agent registration failed. Failed to register to Fog: $fog_address" echo "Openappsec Nano Agent registration failed. Failed to register to Fog: $fog_address"
exit 1 exit 1
fi fi
sleep ${time_sleep} sleep ${time_sleep}
done done
echo "Check Point Nano Agent is registered to $fog_address" echo "Openappsec Nano Agent is registered to $fog_address"
echo "Orchestration mode changed successfully" echo "Orchestration mode changed successfully"
else else
echo "Orchestration mode was changed successfully" echo "Orchestration mode was changed successfully"