Blame tests/08-unlbl_default.tests
|
Packit |
51d0f7 |
#!/bin/bash
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
#
|
|
Packit |
51d0f7 |
# NetLabel Tools test script
|
|
Packit |
51d0f7 |
#
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
#
|
|
Packit |
51d0f7 |
# This program is free software: you can redistribute it and/or modify
|
|
Packit |
51d0f7 |
# it under the terms of version 2 of the GNU General Public License as
|
|
Packit |
51d0f7 |
# published by the Free Software Foundation.
|
|
Packit |
51d0f7 |
#
|
|
Packit |
51d0f7 |
# This program is distributed in the hope that it will be useful,
|
|
Packit |
51d0f7 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
51d0f7 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit |
51d0f7 |
# GNU General Public License for more details.
|
|
Packit |
51d0f7 |
#
|
|
Packit |
51d0f7 |
# You should have received a copy of the GNU General Public License
|
|
Packit |
51d0f7 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
Packit |
51d0f7 |
#
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
# add the fallback definition
|
|
Packit |
51d0f7 |
$GLBL_NETLABELCTL unlbl add default address:1.2.3.4 \
|
|
Packit |
51d0f7 |
label:system_u:object_r:unlabeled_t:s0
|
|
Packit |
51d0f7 |
[[ $? -ne 0 ]] && exit 1
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
# verify the fallback definition
|
|
Packit |
51d0f7 |
found=0
|
|
Packit |
51d0f7 |
for i in $($GLBL_NETLABELCTL unlbl list); do
|
|
Packit |
51d0f7 |
if [[ $i =~ ^interface:DEFAULT ]]; then
|
|
Packit |
51d0f7 |
[[ $i =~ address:1.2.3.4/32,label:\"system_u:object_r:unlabeled_t:s0\" ]] && \
|
|
Packit |
51d0f7 |
found=1
|
|
Packit |
51d0f7 |
fi
|
|
Packit |
51d0f7 |
done
|
|
Packit |
51d0f7 |
[[ $found -ne 1 ]] && exit 1
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
# remove the fallback definition
|
|
Packit |
51d0f7 |
$GLBL_NETLABELCTL unlbl del default address:1.2.3.4
|
|
Packit |
51d0f7 |
[[ $? -ne 0 ]] && exit 1
|
|
Packit |
51d0f7 |
|
|
Packit |
51d0f7 |
exit 0
|