Changeset 2962


Ignore:
Timestamp:
Nov 30, 2016, 4:04:39 PM (3 years ago)
Author:
mabarracus
Message:

Add debug verbosity
Fixes confirmator logic
Fixes acl's

Location:
lliurex-statistics/trunk/fuentes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • lliurex-statistics/trunk/fuentes/debian/changelog

    r2952 r2962  
     1lliurex-statistics (0.2-2) xenial; urgency=medium
     2
     3  * Add debug verbosity
     4  * Fixes confirmator logic
     5  * Fixes acl's
     6
     7 -- M.Angel Juan <m.angel.juan@gmail.com>  Wed, 30 Nov 2016 13:11:00 +0100
     8
    19lliurex-statistics (0.2-1) xenial; urgency=medium
    210
  • lliurex-statistics/trunk/fuentes/debian/lliurex-statistics.postinst

    r2952 r2962  
    4848            echo -e "-a exit,always -F arch=b32 -F euid>999 -S execve\n" >> /etc/audit/rules.d/analytics.rules
    4949            touch /etc/lliurex-analytics/status
     50
     51            #USELESS INTO SQUASHED FS, LOGIC INTO STARTUP SERVICE
    5052            # 10003 (fixed group into ldap 4 teachers)
    51             setfacl -m g:10003:rw /etc/lliurex-analytics/status
    52             setfacl -m g:adm:rw /etc/lliurex-analytics/status
     53            #echo "setting acl's"
     54            #setfacl -m g:10003:rw /etc/lliurex-analytics/status
     55            #setfacl -m g:adm:rw /etc/lliurex-analytics/status
     56            #getfacl /etc/lliurex-analytics/status
     57           
    5358            service auditd restart
    5459    ;;
  • lliurex-statistics/trunk/fuentes/lliurex-statistics.install/etc/init.d/analytics

    r2776 r2962  
    2020PIDFILE=/var/run/"$NAME".pid
    2121SCRIPTNAME=/etc/init.d/"$NAME"
     22STATUS_FILE=/etc/lliurex-analytics/status
    2223
    2324# Exit if the package is not installed
     
    3031. /lib/lsb/init-functions
    3132
     33set_acls()
     34{
     35    if [ -w "${STATUS_FILE}" ]; then
     36        # fixed group 10003 for teachers into ldap
     37        setfacl -m g:10003:rw ${STATUS_FILE}
     38        setfacl -m g:adm:rw ${STATUS_FILE}
     39    fi
     40}
    3241#
    3342# Function that starts the daemon/service
     
    3948        #   1 if daemon was already running
    4049        #   2 if daemon could not be started
     50        set_acls
    4151        start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec "$DAEMON" -- \
    4252                $EXTRAOPTIONS \
  • lliurex-statistics/trunk/fuentes/lliurex-statistics.install/usr/bin/confirmator

    r2948 r2962  
    1919fi     
    2020DPKG="$(${WHICH} dpkg)"
    21 GREP="$(${WHICH} grep)"
     21GREP="$(${WHICH} egrep)"
    2222
    2323if [ -z "${DPKG}" -o -z "${GREP}" ]; then
     
    6262
    6363# INSTALLATION TYPE DETECTION & ACKNOWLEDGE TYPES
    64 RUN_ON_LIVE="$(${FINDMNT} -P -t squashfs|${GREP} 'target="/rofs" source="/dev/loop"')"
     64RUN_ON_LIVE="$(${FINDMNT} -P -t squashfs|${GREP} -i 'target="/rofs" source="/dev/loop[0-9]?"')"
    6565
    6666if [ -n "${RUN_ON_LIVE}" ]; then
     
    7676fi
    7777
    78 #NOT USED INSIDE CONFIRMATOR, THIS LOGIC IS INTO COLLECTOR
    79 SERVER_OVERRRIDE="$(${N4DCLI} -h server -c VariablesManager -m get_variable -a 'STATS_ENABLED'|${GREP} -i yes)"
    80 if [ -n "${SERVER_OVERRIDE}" ]; then
    81     exit 0
     78RUN_AS_CLIENT=$(${LLIUREX_VERSION} |${GREP} -i client)
     79RUN_AS_SERVER=$(${LLIUREX_VERSION} |${GREP} -i server)
     80RUN_AS_DESKTOP=""
     81if [ -z ${RUN_AS_CLIENT} -a -z ${RUN_AS_SERVER} ];then
     82    RUN_AS_DESKTOP="yes"
     83else
     84    #NOT USED INSIDE CONFIRMATOR, THIS LOGIC IS INTO COLLECTOR AND WILL BE ACCEPTED NOT NEED WRITE THE LOCAL FILE
     85    SERVER_OVERRRIDE="$(${N4DCLI} -h server -c VariablesManager -m get_variable -a 'STATS_ENABLED'|${GREP} '1')"
     86    if [ -n "${SERVER_OVERRIDE}" ]; then
     87        exit 0
     88    fi
    8289fi
    8390
     
    8693DEBCONF_ACKNOWLEDGE="$(echo get lliurex-statistics/acknowledge|${DEBCONF_COMM} 2>/dev/null |${GREP} -E -i -o 'true|false')"
    8794
    88 # NOT NEEDED
    89 #RUN_AS_CLIENT=$(${LLIUREX_VERSION} |${GREP} -i client)
    90 #RUN_AS_SERVER=$(${LLIUREX_VERSION} |${GREP} -i server)
    91 #RUN_AS_DESKTOP=""
    92 #if [ -z ${RUN_AS_CLIENT} -a -z ${RUN_AS_SERVER} ];then
    93 #    RUN_AS_DESKTOP="yes"
    94 #fi
    9595
    9696# DIALOG FUNCTION
  • lliurex-statistics/trunk/fuentes/lliurex-statistics.install/usr/sbin/analytics

    r2948 r2962  
    7979            # Send data to master server
    8080            send_data()
     81        else:
     82            debug("Sending not allowed when try to change file")
    8183        # Get new temporary filename
    8284        next_filename=get_filename(LOGPATH)
     
    108110        try:
    109111            if answer == "yes":
     112                debug("allow_send stats by check local acknowledge")
    110113                return True
    111114            else:
     115                debug("deny allow_send stats by check server & local acknowledge")
    112116                return False
    113117        except Exception as e:
     118            debug("deny allow_send stats by exception check server & local acknowledge")
    114119            return False
    115120    else:
     121        debug("allow_send stats by check server acknowledge")
    116122        return True
    117123#END def allow_send()
     
    129135            # Send data to master server
    130136            send_data()
     137        else
     138            debug("Sending not allowed when try send file")
    131139        # Clear database file
    132140        clear_db()
     
    279287    jsonobj=json.dumps({'uid':uid,'vers':version,'sab':sabor, 'stats': jsonobj });
    280288    payload = {'stats':jsonobj};
     289    try:
     290        debug("SENDING DATA:"+str(payload))
     291    except Exception as e:
     292        debug("Error debugging data to send")
     293
    281294    r = requests.post(url,data=payload,headers=headers);
    282295    debug("S("+r.text+')',2);
Note: See TracChangeset for help on using the changeset viewer.