summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2007-10-24 09:09:29 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2007-10-24 09:09:29 -0700
commitae08adfabeed8fec9093e759a40f156d589defa9 (patch)
tree346ae29a6645f5b547b567b4a9956a6338462f89 /etc
parentf3a563927fd763646b104e9af0a8a78f48920a95 (diff)
downloadvyatta-cfg-ae08adfabeed8fec9093e759a40f156d589defa9.tar.gz
vyatta-cfg-ae08adfabeed8fec9093e759a40f156d589defa9.zip
make sure config directories have correct permissions.
Diffstat (limited to 'etc')
-rw-r--r--etc/bash_completion.d/vyatta-cfg22
-rwxr-xr-xetc/init.d/vyatta-ofr10
2 files changed, 25 insertions, 7 deletions
diff --git a/etc/bash_completion.d/vyatta-cfg b/etc/bash_completion.d/vyatta-cfg
index f740c54..f76437e 100644
--- a/etc/bash_completion.d/vyatta-cfg
+++ b/etc/bash_completion.d/vyatta-cfg
@@ -26,6 +26,8 @@ if [ "$_OFR_CONFIGURE" != "ok" ]; then
return 0
fi
+umask 0002
+
if [ -r /etc/default/vyatta ]; then
source /etc/default/vyatta
fi
@@ -143,8 +145,9 @@ edit ()
really_exit()
{
- umount $VYATTA_TEMP_CONFIG_DIR
- rm -rf $VYATTA_TEMP_CONFIG_DIR $VYATTA_CHANGES_ONLY_DIR $VYATTA_CONFIG_TMP
+ sudo umount $VYATTA_TEMP_CONFIG_DIR
+ sudo rm -rf $VYATTA_TEMP_CONFIG_DIR $VYATTA_CHANGES_ONLY_DIR \
+ $VYATTA_CONFIG_TMP
unset _OFR_CONFIGURE
builtin exit 0
}
@@ -764,11 +767,18 @@ vyatta_config_complete ()
fi
}
-mkdir -p $VYATTA_ACTIVE_CONFIGURATION_DIR
-mkdir -p $VYATTA_CHANGES_ONLY_DIR
-mkdir -p $VYATTA_CONFIG_TMP
+DEF_GROUP=quaggavty
+make_vyatta_config_dir ()
+{
+ sudo mkdir -m 0775 -p $1
+ sudo chgrp ${DEF_GROUP} $1
+}
+
+make_vyatta_config_dir $VYATTA_ACTIVE_CONFIGURATION_DIR
+make_vyatta_config_dir $VYATTA_CHANGES_ONLY_DIR
+make_vyatta_config_dir $VYATTA_CONFIG_TMP
if [ ! -d $VYATTA_TEMP_CONFIG_DIR ]; then
- mkdir -p $VYATTA_TEMP_CONFIG_DIR
+ make_vyatta_config_dir $VYATTA_TEMP_CONFIG_DIR
sudo mount -t unionfs -o dirs=${VYATTA_CHANGES_ONLY_DIR}=rw:/opt/vyatta/config/active=ro unionfs ${VYATTA_TEMP_CONFIG_DIR}
fi
diff --git a/etc/init.d/vyatta-ofr b/etc/init.d/vyatta-ofr
index f0d9695..0c71b20 100755
--- a/etc/init.d/vyatta-ofr
+++ b/etc/init.d/vyatta-ofr
@@ -150,13 +150,21 @@ load_bootfile ()
{
if [ -x $vyatta_sbindir/vyatta-config-loader.pl ]; then
log_progress_msg configure
- $vyatta_sbindir/vyatta-config-loader.pl $BOOTFILE
+ sg ${GROUP} -c "$vyatta_sbindir/vyatta-config-loader.pl $BOOTFILE"
fi
}
+setup_config_dir ()
+{
+ [ -d ${vyatta_configdir} ] || mkdir -p ${vyatta_configdir}
+ chgrp ${GROUP} ${vyatta_configdir}
+ chmod 0775 ${vyatta_configdir}
+}
+
start ()
{
log_daemon_msg "Starting Vyatta Router"
+ setup_config_dir
if ! get_config; then
try_floppy
fi