mirror of
https://github.com/Kicksecure/security-misc.git
synced 2024-12-26 19:09:27 -05:00
send error messages to stderr
This commit is contained in:
parent
d8c9fac2e5
commit
8f14e808a9
@ -17,7 +17,7 @@ add_statoverride_entry() {
|
||||
fi
|
||||
|
||||
if test -u "${file_name}" || test -g "${file_name}"; then
|
||||
echo "suid - file_name: '${file_name}' | existing_mode: '${existing_mode}'"
|
||||
echo "suid - file_name: '${file_name}' | existing_mode: '${existing_mode}'" >&2
|
||||
|
||||
if dpkg-statoverride --list | grep -q "${file_name}"; then
|
||||
if ! dpkg-statoverride --list | grep -q "${owner} ${group} ${existing_mode:1} ${file_name}"; then
|
||||
@ -37,7 +37,7 @@ add_statoverride_entry() {
|
||||
set_file_perms() {
|
||||
while read -r line; do
|
||||
if [[ "$line" =~ ^#.*$ ]]; then
|
||||
echo "ERROR: cannot parse line with invalid character: ${line}"
|
||||
echo "ERROR: cannot parse line with invalid character: ${line}" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -46,12 +46,12 @@ set_file_perms() {
|
||||
fi
|
||||
|
||||
if ! read -r file mode owner group capability <<< "${line}" ; then
|
||||
echo "ERROR: cannot parse line: ${line}"
|
||||
echo "ERROR: cannot parse line: ${line}" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
if ! [ -e "${file}" ]; then
|
||||
echo "ERROR: File '${file}' does not exist!"
|
||||
echo "ERROR: File '${file}' does not exist!" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -59,17 +59,17 @@ set_file_perms() {
|
||||
if [ "${mode}" = "nosuid" ]; then
|
||||
nosuid="true"
|
||||
elif ! seq -w 000 4777 | grep -qw "${mode}"; then
|
||||
echo "ERROR: Mode '${mode}' is invalid!"
|
||||
echo "ERROR: Mode '${mode}' is invalid!" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
if ! getent passwd | grep -q "^${owner}:" && ! [ "${mode}" = "nosuid" ]; then
|
||||
echo "ERROR: User '${owner}' does not exist!"
|
||||
echo "ERROR: User '${owner}' does not exist!" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
if ! getent group | grep -q "^${group}:" && ! [ "${mode}" = "nosuid" ]; then
|
||||
echo "ERROR: Group '${group}' does not exist!"
|
||||
echo "ERROR: Group '${group}' does not exist!" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
@ -90,7 +90,7 @@ set_file_perms() {
|
||||
setcap -r "${file}"
|
||||
else
|
||||
if ! capsh --print | grep "Bounding set" | grep -q "${capability}"; then
|
||||
echo "ERROR: Capability '${capability}' does not exist!"
|
||||
echo "ERROR: Capability '${capability}' does not exist!" >&2
|
||||
continue
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user