Merge pull request #5 from yunusem/master

Ahenk 1.0.0 tagged master and debian/1.0.0-2 tagged debian branch
This commit is contained in:
ismail başaran 2017-11-22 14:44:57 +03:00 committed by GitHub
commit 61ce1123f1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
95 changed files with 18 additions and 158 deletions

View file

@ -3,7 +3,7 @@ logconfigurationfilepath = /etc/ahenk/log.conf
dbpath = /etc/ahenk/ahenk.db
[PLUGIN]
pluginfolderpath = /opt/ahenk/plugins/
pluginfolderpath = /usr/share/ahenk/plugins/
mainmodulename = main
[CONNECTION]

View file

@ -1,4 +0,0 @@
opt/ /
etc/ /
lib/ /
usr/ /

5
debian/changelog vendored
View file

@ -1,5 +0,0 @@
ahenk (1.0) unstable; urgency=low
* Ahenk core app
-- volkansahin <volkan.sahin@agem.com.tr> Thu, 10 Dec 2015 22:21:04 +0200

1
debian/compat vendored
View file

@ -1 +0,0 @@
9

12
debian/control vendored
View file

@ -1,12 +0,0 @@
Source: ahenk
Section: unknown
Priority: optional
Maintainer: TUBITAK ULAKBIM
Build-Depends: debhelper (>= 9)
Standards-Version: 3.9.5
Homepage: http://www.liderahenk.org.tr
Package: ahenk
Architecture: any
Depends: bash, python3 (>= 3), cython, libidn11, libidn11-dev, python3-dev, python3-pip, python3-watchdog, libffi-dev, libssl-dev, python3-paramiko, python3-cpuinfo, python3-psutil (>= 4), libpam-script, python3-sleekxmpp, dmidecode, python3-easygui, notify-osd, read-edid
Description: Lider Ahenk is an open source project which provides solutions to manage, monitor and audit unlimited number of different systems and users on a network.

1
debian/files vendored
View file

@ -1 +0,0 @@
ahenk_1.0_amd64.deb unknown optional

44
debian/postinst vendored
View file

@ -1,44 +0,0 @@
#!/bin/bash
# postinst script for ahenk
#
# see: dh_installdeb(1)
set -e
case "$1" in
configure)
while true; do
read -p "Eğer makinada var olan bir pam konfigurasyonu varsa geçersiz hale gelecektir.Devam etmek istiyor musunuz? [e/H]" eH
case $eH in
[e] )
if [ -d /usr/share/pam-configs ]
then
echo -e "Name: Support for authentication by external scripts\nDefault: yes\nPriority: 257\nSession-Type: Additional\nSession:\n\toptional\tpam_script.so" > /usr/share/pam-configs/pam_script
DEBIAN_FRONTEND=noninteractive pam-auth-update
fi
break;;
[H] ) exit;;
* ) echo "Lütfen e ya da H karakterleri ile yanıtlayın!";;
esac
done
systemctl --system daemon-reload
systemctl enable ahenk.service
update-rc.d ahenk defaults
/etc/init.d/ahenk start
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
exit 0

5
debian/prerm vendored
View file

@ -1,5 +0,0 @@
#!/bin/bash
# prerm script for ahenk
#
/usr/bin/python3 /opt/ahenk/ahenkd.py clean
find /opt/ahenk | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf

28
debian/rules vendored
View file

@ -1,28 +0,0 @@
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1
# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
# main packaging script based on dh7 syntax
%:
dh $@
# debmake generated override targets
# This is example for Cmake (See http://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- \
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

View file

@ -25,6 +25,6 @@ if [ -n $PAM_USER ] && [ $PAM_USER != "root" ]; then
TTY_DISPLAY="$PAM_TTY"
fi
log "logout: $PAM_USER service: $SERVICE tty: $TTY_DISPLAY"
sudo python3 /opt/ahenk/ahenkd.py logout $PAM_USER
sudo python3 /usr/share/ahenk/ahenkd.py logout $PAM_USER
fi
fi

View file

@ -25,6 +25,6 @@ if [ -n $PAM_USER ] && [ $PAM_USER != "root" ]; then
TTY_DISPLAY="$PAM_TTY"
fi
log "login: $PAM_USER service: $SERVICE tty: $TTY_DISPLAY"
sudo python3 /opt/ahenk/ahenkd.py login $PAM_USER $SERVICE $TTY_DISPLAY
sudo python3 /usr/share/ahenk/ahenkd.py login $PAM_USER $SERVICE $TTY_DISPLAY
fi
fi

View file

@ -1,33 +0,0 @@
#!/bin/bash
###
# This script generates Ahenk package (ahenk.deb).
# Make sure you have debhelper & build-essential packages installed!
#
# Generated file can be found under /tmp/ahenk
###
set -e
pushd $(dirname $0) > /dev/null
PRJ_ROOT_PATH=$(dirname $(pwd -P))
popd > /dev/null
echo "Project path: $PRJ_ROOT_PATH"
# Generate Ahenk packages
echo "Generating Ahenk packages..."
cd "$PRJ_ROOT_PATH"
dpkg-buildpackage -b -uc
echo "Generated Ahenk packages"
EXPORT_PATH=/tmp/ahenk
echo "Export path: $EXPORT_PATH"
# Copy resulting files
echo "Copying generated Ahenk packages to $EXPORT_PATH..."
mkdir -p "$EXPORT_PATH"
cp -rf "$PRJ_ROOT_PATH"/../ahenk*.deb "$EXPORT_PATH"
cp -rf "$PRJ_ROOT_PATH"/../ahenk*.changes "$EXPORT_PATH"
echo "Copied generated Ahenk packages."
echo "Built finished successfully!"
echo "Files can be found under: $EXPORT_PATH"

View file

@ -1,13 +0,0 @@
#!/bin/bash
###
# This script updates the local repo with the latest changes from Github.
#
# The master branch will be REPLACED with what's in Github and all local changes
# will be LOST.
###
git checkout master
git fetch -f origin
git fetch --tags origin
git reset --hard origin/master

View file

@ -4,8 +4,8 @@ After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/python3 /opt/ahenk/ahenkd.py start
ExecStop=/usr/bin/python3 /opt/ahenk/ahenkd.py stop
ExecStart=/usr/bin/python3 /usr/share/ahenk/ahenkd.py start
ExecStop=/usr/bin/python3 /usr/share/ahenk/ahenkd.py stop
PIDFile=/var/run/ahenkd.pid
Restart=always

0
opt/ahenk/ahenkd.py → src/ahenkd.py Executable file → Normal file
View file

View file

@ -14,7 +14,7 @@ class Agreement:
self.message_manager = scope.get_message_manager()
self.messenger = scope.get_messenger()
self.db_service = scope.get_db_service()
self.ask_path = '/opt/ahenk/base/agreement/ask.py'
self.ask_path = '/usr/share/ahenk/base/agreement/ask.py'
self.logger.debug('Instance initialized.')
def agreement_contract_update(self):

View file

View file

View file

@ -10,6 +10,7 @@ import platform
import re
import socket
import struct
import netifaces
from uuid import getnode as get_mac
import cpuinfo
@ -460,9 +461,14 @@ class System:
@staticmethod
def ip_addresses():
arr = []
for iface in psutil.net_io_counters(pernic=True):
f = os.popen('ifconfig {0} | grep "inet\ addr" | cut -d: -f2 | cut -d" " -f1'.format(iface))
ip = str(f.read()).replace('\n', '')
for iface in netifaces.interfaces():
link = None
try:
link = netifaces.ifaddresses(iface)[netifaces.AF_INET][0]
except:
link = None
if link is not None:
ip = link['addr']
if re.match(r'^((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])$',
ip) and str(ip) != 'localhost' and str(ip) != '127.0.0.1':
arr.append(ip)

View file

@ -316,7 +316,7 @@ class Util:
@staticmethod
def ask_permission(display, username, message, title):
ask_path = '/opt/ahenk/base/agreement/confirm.py'
ask_path = '/usr/share/ahenk/base/agreement/confirm.py'
try:
if username is not None: