Ignore:
Timestamp:
Jan 19, 2017, 1:41:02 PM (3 years ago)
Author:
mabarracus
Message:

Fix config files permission

Location:
lliurex-analytics-server/trunk/fuentes/debian
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lliurex-analytics-server/trunk/fuentes/debian/control

    r1132 r3369  
    99Depends: ${shlibs:Depends}, ${misc:Depends},
    1010        debconf (>= 0.5) | debconf-2.0, po-debconf,
    11         ucf, python3, python-daemon, apache2, libapache2-mod-php7.0, php7.0-mysql, mysql-server, python-requests, dialog
     11        ucf, python3, python-daemon, apache2, libapache2-mod-php7.0, php7.0-mysql, mysql-server, python-requests, dialog, perl
    1212Recommends:
    1313Suggests:
  • lliurex-analytics-server/trunk/fuentes/debian/postinst

    r3367 r3369  
    121121            echo "user=$user" >> /etc/lliurex-analytics-server/config_db
    122122            echo "pass=$pass" >> /etc/lliurex-analytics-server/config_db
     123            chmod 750 /etc/lliurex-analytics-server/config_db
    123124        fi
    124125        $mysqluser < /usr/lib/analytics-server/analytics.sql
     
    131132            echo "user=$user" >> /etc/lliurex-analytics-server/config_db
    132133            echo "pass=$pass" >> /etc/lliurex-analytics-server/config_db
    133 
     134            chmod 640 /etc/lliurex-analytics-server/config_db
    134135        fi
    135136    fi
     
    137138    RES1=$(grep -o '@phpuser@' /usr/lib/analytics-server/analytics/config.php)
    138139    RES2=$(grep -o '@phppass@' /usr/lib/analytics-server/analytics/config.php)
    139    
    140     if [ -n "${RES1}" -a -n "${RES2}" ]; then
     140
     141    if [ -f "/usr/lib/analytics-server/analytics/config.php" -a -n "${RES1}" -a -n "${RES2}" ]; then
    141142        sed -i.old -e "s/@phpuser@/$user/g" -e  "s/@phppass@/$pass/g" /usr/lib/analytics-server/analytics/config.php
    142143        rm /usr/lib/analytics-server/analytics/config.php.old
     144        chmod 640 /usr/lib/analytics-server/analytics/config.php
     145        apachectl_cmd=$(which apachectl)
     146        apache_group=$(${apachectl_cmd} -t -D DUMP_RUN_CFG 2>/dev/null|perl -ne '/group:[ ]+name=\"(.*)\"/i && print $1')
     147        if [ -z "${apache_group}" ]; then
     148            echo "Warning: apache group not detected, falling back to www-data"
     149            apache_group="www-data"
     150        fi
     151        chgrp ${apache_group} /usr/lib/analytics-server/analytics/config.php
    143152    else
    144153        echo "BUG !! WARNING: replace tags @phpuser@ & @phppass@ not found in /usr/lib/analytics-server/analytics/config.php"
  • lliurex-analytics-server/trunk/fuentes/debian/postrm

    r3366 r3369  
    6262        echo "flush privileges;"| ${mysql_cmd} 2>/dev/null
    6363        echo "Database analytics & user ${USER} removed from mysql"
     64        if [ -f "/etc/lliurex-analytics-server/config_db" ]; then
     65            rm -f /etc/lliurex-analytics-server/config_db
     66            rmdir /etc/lliurex-analytics-server
     67        else
     68            echo "Warning: config_db file not found! "
     69        fi
    6470        exit 0
    6571    ;;
Note: See TracChangeset for help on using the changeset viewer.