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