| ... | ... |
@@ -1415,6 +1415,35 @@ function get_pip_command() {
|
| 1415 | 1415 |
fi |
| 1416 | 1416 |
} |
| 1417 | 1417 |
|
| 1418 |
+# Path permissions sanity check |
|
| 1419 |
+# check_path_perm_sanity path |
|
| 1420 |
+function check_path_perm_sanity() {
|
|
| 1421 |
+ # Ensure no element of the path has 0700 permissions, which is very |
|
| 1422 |
+ # likely to cause issues for daemons. Inspired by default 0700 |
|
| 1423 |
+ # homedir permissions on RHEL and common practice of making DEST in |
|
| 1424 |
+ # the stack user's homedir. |
|
| 1425 |
+ |
|
| 1426 |
+ local real_path=$(readlink -f $1) |
|
| 1427 |
+ local rebuilt_path="" |
|
| 1428 |
+ for i in $(echo ${real_path} | tr "/" " "); do
|
|
| 1429 |
+ rebuilt_path=$rebuilt_path"/"$i |
|
| 1430 |
+ |
|
| 1431 |
+ if [[ $(stat -c '%a' ${rebuilt_path}) = 700 ]]; then
|
|
| 1432 |
+ echo "*** DEST path element" |
|
| 1433 |
+ echo "*** ${rebuilt_path}"
|
|
| 1434 |
+ echo "*** appears to have 0700 permissions." |
|
| 1435 |
+ echo "*** This is very likely to cause fatal issues for devstack daemons." |
|
| 1436 |
+ |
|
| 1437 |
+ if [[ -n "$SKIP_PATH_SANITY" ]]; then |
|
| 1438 |
+ return |
|
| 1439 |
+ else |
|
| 1440 |
+ echo "*** Set SKIP_PATH_SANITY to skip this check" |
|
| 1441 |
+ die $LINENO "Invalid path permissions" |
|
| 1442 |
+ fi |
|
| 1443 |
+ fi |
|
| 1444 |
+ done |
|
| 1445 |
+} |
|
| 1446 |
+ |
|
| 1418 | 1447 |
# Restore xtrace |
| 1419 | 1448 |
$XTRACE |
| 1420 | 1449 |
|
| ... | ... |
@@ -208,6 +208,9 @@ fi |
| 208 | 208 |
sudo mkdir -p $DEST |
| 209 | 209 |
sudo chown -R $STACK_USER $DEST |
| 210 | 210 |
|
| 211 |
+# a basic test for $DEST path permissions (fatal on error unless skipped) |
|
| 212 |
+check_path_perm_sanity ${DEST}
|
|
| 213 |
+ |
|
| 211 | 214 |
# Set ``OFFLINE`` to ``True`` to configure ``stack.sh`` to run cleanly without |
| 212 | 215 |
# Internet access. ``stack.sh`` must have been previously run with Internet |
| 213 | 216 |
# access to install prerequisites and fetch repositories. |