First commit
This commit is contained in:
commit
5fcdb763a5
|
@ -0,0 +1,2 @@
|
||||||
|
alldebfiles
|
||||||
|
repository
|
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
PROJECT=$1
|
||||||
|
if [ -d src/$PROJECT ] && [ "$1" != "" ]
|
||||||
|
then
|
||||||
|
echo Projet $PROJECT
|
||||||
|
else
|
||||||
|
ls src/
|
||||||
|
read -p"list " PROJECT
|
||||||
|
fi
|
||||||
|
|
||||||
|
VERSION=$(cat src/$PROJECT/DEBIAN/control | grep -i "version:" | cut -d " " -f 2)
|
||||||
|
NEW_VERSION=$(echo $VERSION | awk 'BEGIN { FS="." } { $2++; if ($2 > 99) { $2=0; $1++ } } { printf "%d.%02d\n", $1, $2 }')
|
||||||
|
|
||||||
|
sed -i -e "s/$(echo $VERSION)/$(echo $NEW_VERSION)/" src/$PROJECT/DEBIAN/control
|
||||||
|
|
||||||
|
fakeroot dpkg-deb -Z gzip --build src/$PROJECT alldebfiles/$PROJECT.deb
|
||||||
|
reprepro --ask-passphrase -Vb repository/ remove tools ${PROJECT%.*}
|
||||||
|
reprepro --ask-passphrase -Vb repository/ includedeb tools alldebfiles/$PROJECT.deb
|
||||||
|
rsync --delete -av -e "ssh -A -J lgy.fr " repository/* deb.net.lgy.fr:/var/www/html/
|
|
@ -0,0 +1,5 @@
|
||||||
|
2sman-client (1.0) stable; urgency=low
|
||||||
|
|
||||||
|
* Create
|
||||||
|
|
||||||
|
-- Legay Thomas <thomas@syngate.fr> mar. 28 avril 2020 10:55
|
|
@ -0,0 +1,7 @@
|
||||||
|
Package: 2sman-client
|
||||||
|
Version: 1.04
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Maintainer: Thomas Legay <thomas@syngate.fr>
|
||||||
|
Description: Package 2smanclient
|
|
@ -0,0 +1 @@
|
||||||
|
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 255 | head -n 1 > /etc/2sman/client/key
|
|
@ -0,0 +1,5 @@
|
||||||
|
#Change default server
|
||||||
|
#SERVER=http://192.168.24.191:8080
|
||||||
|
everytime system.mountpoint.freespace
|
||||||
|
everytime system.uptime
|
||||||
|
everytime system.temp
|
|
@ -0,0 +1 @@
|
||||||
|
i6ugWyYjhTIhYRa3SgFmXUIoAGQD1UXCemgk95xx9F1OeWdCP79zAefQgNTOkRkmEX8vjBDJGi450p6sHwPEBLCBmjUJZ5aNdWYRoUTZgK0celPDqKVOjTZTw916KZ4xQVYmihJXi5LmrZd68ae51KN05hOpBGiPafyIXYD75MwZyN1tW1PIa4mj3ryoKB1wVnVK270VCZgOPnTELSgBMgNEZ0jDIwdpIe3nuvynpOhiS5ZmiFfEi7hkKzNCQHf
|
|
@ -0,0 +1 @@
|
||||||
|
https://2sman.lgy.fr/
|
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
Description=2sman-client
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/bin/2sman-client
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=5s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/bash
|
||||||
|
CONFIG_PATH=/etc/2sman/client
|
||||||
|
KEY_FILE=$CONFIG_PATH/key
|
||||||
|
SERVER_FILE=$CONFIG_PATH/server
|
||||||
|
SCRIPT_PATH=/usr/share/2sman-client
|
||||||
|
DEVICES_PATH=$CONFIG_PATH/devices
|
||||||
|
DAILY_FILE=/var/run/2sman-client-daily
|
||||||
|
HOURLY_FILE=/var/run/2sman-client-hourly
|
||||||
|
LASTRUN_FILE=/var/run/2sman-client-lastrun
|
||||||
|
|
||||||
|
[ -f $KEY_FILE ] && DEFAULT_KEY=$(cat $KEY_FILE)
|
||||||
|
[ ! "$KEY" = "" ] && echo ERROR : Key file is empty $KEY_FILE && exit 1
|
||||||
|
[ -f $SERVER_FILE ] && DEFAULT_SERVER=$(cat $SERVER_FILE)
|
||||||
|
[ ! "$SERVER" = "" ] && echo ERROR : Server file is empty $KEY_FILE && exit 1
|
||||||
|
|
||||||
|
function everytime {
|
||||||
|
if [ -f $SCRIPT_PATH/$1 ]
|
||||||
|
then bash $SCRIPT_PATH/$* &
|
||||||
|
else echo WARNING : script $1 not exist 1>&2
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function hourly {
|
||||||
|
elapsedSeconds=$([ -f $HOURLY_FILE ] && echo $(( $(date +%s) - $(date +%s -r $HOURLY_FILE) )) || echo 3601)
|
||||||
|
if [ $elapsedSeconds -gt 3600 ] ; then
|
||||||
|
touch $DAILY_FILE
|
||||||
|
everytime $*
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function daily {
|
||||||
|
elapsedSeconds=$([ -f $DAILY_FILE ] && echo $(( $(date +%s) - $(date +%s -r $DAILY_FILE) )) || echo 86401)
|
||||||
|
if [ $elapsedSeconds -gt 86400 ]; then
|
||||||
|
touch $DAILY_FILE
|
||||||
|
everytime $*
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
for device_conf in $(find $DEVICES_PATH/ -name *.conf)
|
||||||
|
do
|
||||||
|
KEY=$DEFAULT_KEY
|
||||||
|
SERVER=$DEFAULT_SERVER
|
||||||
|
devicename=$(basename $device_conf .conf)
|
||||||
|
. $device_conf | tee $LASTRUN_FILE | curl -s $SERVER/$KEY/$devicename --data-binary @- > /dev/null
|
||||||
|
done
|
||||||
|
sleep 300
|
||||||
|
done
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
df -HP | grep -E '^/dev/|rootfs|^//' | awk '{ print $5 " " $1 }' | while read output;
|
||||||
|
do
|
||||||
|
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
|
||||||
|
partition=$(echo $output | awk '{ print $2 }' )
|
||||||
|
echo system\|mountpoint\|freespace\|$partition $usep
|
||||||
|
done
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$(systemd-detect-virt)" == "none" ]
|
||||||
|
then
|
||||||
|
sensors -u | while read ligne
|
||||||
|
do
|
||||||
|
echo $ligne | grep '^[A-Z].*' > /dev/null && main=$(echo $ligne | tr '\ ' '-' | tr -d ":")
|
||||||
|
echo $ligne | grep "_input" > /dev/null && echo system\|temp\|$main\|$( echo $ligne | tr -d ":")
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
echo system\|uptime $( cat /proc/uptime | cut -d " " -f 1)
|
|
@ -0,0 +1,7 @@
|
||||||
|
Package: amp-base
|
||||||
|
Version: 1.15
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Maintainer: Thomas Legay <thomas@syngate.fr>
|
||||||
|
Description: base file for all other package
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
[ -e /etc/apt/sources.list.d/pve-enterprise.list ] && rm /etc/apt/sources.list.d/pve-enterprise.list
|
||||||
|
|
||||||
|
apt update && apt upgrade -y && apt dist-upgrade -y && apt-get clean
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
TMP=$(mktemp)
|
||||||
|
apt-mark showmanual > $TMP
|
||||||
|
diff $TMP /var/lib/amp/lxc-debian-10/apt-mark-manual | grep -e "<" -e ">"
|
||||||
|
rm $TMP
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,2 @@
|
||||||
|
#!/bin/bash
|
||||||
|
for proc in /proc/[0-9]*; do awk '/VmSwap/ { print $2 "\t'`readlink $proc/exe | awk '{ print $1 }'`'" }' $proc/status; done | sort -n | awk '{ total += $1 ; print $0 } END { print total "\tTotal" }'
|
|
@ -0,0 +1,337 @@
|
||||||
|
adduser
|
||||||
|
apt
|
||||||
|
apt-listchanges
|
||||||
|
apt-utils
|
||||||
|
base-files
|
||||||
|
base-passwd
|
||||||
|
bash
|
||||||
|
bash-completion
|
||||||
|
bind9-host
|
||||||
|
bsdmainutils
|
||||||
|
bsdutils
|
||||||
|
bzip2
|
||||||
|
ca-certificates
|
||||||
|
coreutils
|
||||||
|
cpio
|
||||||
|
cpp
|
||||||
|
cpp-8
|
||||||
|
cron
|
||||||
|
dash
|
||||||
|
dbus
|
||||||
|
debconf
|
||||||
|
debconf-i18n
|
||||||
|
debian-archive-keyring
|
||||||
|
debian-faq
|
||||||
|
debianutils
|
||||||
|
diffutils
|
||||||
|
dmidecode
|
||||||
|
dmsetup
|
||||||
|
doc-debian
|
||||||
|
dpkg
|
||||||
|
e2fsprogs
|
||||||
|
fdisk
|
||||||
|
file
|
||||||
|
findutils
|
||||||
|
fontconfig-config
|
||||||
|
fonts-dejavu-core
|
||||||
|
gcc-8-base
|
||||||
|
gdbm-l10n
|
||||||
|
gettext-base
|
||||||
|
gpgv
|
||||||
|
grep
|
||||||
|
groff-base
|
||||||
|
gzip
|
||||||
|
hostname
|
||||||
|
ifupdown
|
||||||
|
init
|
||||||
|
init-system-helpers
|
||||||
|
iproute2
|
||||||
|
iptables
|
||||||
|
iputils-ping
|
||||||
|
isc-dhcp-client
|
||||||
|
isc-dhcp-common
|
||||||
|
kmod
|
||||||
|
krb5-locales
|
||||||
|
less
|
||||||
|
libacl1
|
||||||
|
libapparmor1
|
||||||
|
libapt-inst2.0
|
||||||
|
libapt-pkg5.0
|
||||||
|
libargon2-1
|
||||||
|
libattr1
|
||||||
|
libaudit-common
|
||||||
|
libaudit1
|
||||||
|
libbind9-161
|
||||||
|
libblkid1
|
||||||
|
libbsd0
|
||||||
|
libbz2-1.0
|
||||||
|
libc-bin
|
||||||
|
libc-l10n
|
||||||
|
libc6
|
||||||
|
libcap-ng0
|
||||||
|
libcap2
|
||||||
|
libcap2-bin
|
||||||
|
libcom-err2
|
||||||
|
libcryptsetup12
|
||||||
|
libcurl3-gnutls
|
||||||
|
libdb5.3
|
||||||
|
libdbus-1-3
|
||||||
|
libdebconfclient0
|
||||||
|
libdevmapper1.02.1
|
||||||
|
libdns-export1104
|
||||||
|
libdns1104
|
||||||
|
libdrm-amdgpu1
|
||||||
|
libdrm-common
|
||||||
|
libdrm-intel1
|
||||||
|
libdrm-nouveau2
|
||||||
|
libdrm-radeon1
|
||||||
|
libdrm2
|
||||||
|
libedit2
|
||||||
|
libelf1
|
||||||
|
libestr0
|
||||||
|
libexpat1
|
||||||
|
libext2fs2
|
||||||
|
libfastjson4
|
||||||
|
libfdisk1
|
||||||
|
libffi6
|
||||||
|
libfontconfig1
|
||||||
|
libfontenc1
|
||||||
|
libfreetype6
|
||||||
|
libfstrm0
|
||||||
|
libgcc1
|
||||||
|
libgcrypt20
|
||||||
|
libgdbm-compat4
|
||||||
|
libgdbm6
|
||||||
|
libgeoip1
|
||||||
|
libgl1
|
||||||
|
libgl1-mesa-dri
|
||||||
|
libglapi-mesa
|
||||||
|
libglvnd0
|
||||||
|
libglx-mesa0
|
||||||
|
libglx0
|
||||||
|
libgmp10
|
||||||
|
libgnutls30
|
||||||
|
libgpg-error0
|
||||||
|
libgssapi-krb5-2
|
||||||
|
libhogweed4
|
||||||
|
libice6
|
||||||
|
libicu63
|
||||||
|
libidn11
|
||||||
|
libidn2-0
|
||||||
|
libip4tc0
|
||||||
|
libip6tc0
|
||||||
|
libiptc0
|
||||||
|
libisc-export1100
|
||||||
|
libisc1100
|
||||||
|
libisccc161
|
||||||
|
libisccfg163
|
||||||
|
libisl19
|
||||||
|
libjson-c3
|
||||||
|
libk5crypto3
|
||||||
|
libkeyutils1
|
||||||
|
libkmod2
|
||||||
|
libkrb5-3
|
||||||
|
libkrb5support0
|
||||||
|
libldap-2.4-2
|
||||||
|
libldap-common
|
||||||
|
libllvm7
|
||||||
|
liblmdb0
|
||||||
|
liblocale-gettext-perl
|
||||||
|
liblockfile-bin
|
||||||
|
liblognorm5
|
||||||
|
liblwres161
|
||||||
|
liblz4-1
|
||||||
|
liblzma5
|
||||||
|
libmagic-mgc
|
||||||
|
libmagic1
|
||||||
|
libmnl0
|
||||||
|
libmount1
|
||||||
|
libmpc3
|
||||||
|
libmpdec2
|
||||||
|
libmpfr6
|
||||||
|
libncurses6
|
||||||
|
libncursesw6
|
||||||
|
libnetfilter-conntrack3
|
||||||
|
libnettle6
|
||||||
|
libnewt0.52
|
||||||
|
libnfnetlink0
|
||||||
|
libnftnl11
|
||||||
|
libnghttp2-14
|
||||||
|
libnss-systemd
|
||||||
|
libp11-kit0
|
||||||
|
libpam-modules
|
||||||
|
libpam-modules-bin
|
||||||
|
libpam-runtime
|
||||||
|
libpam-systemd
|
||||||
|
libpam0g
|
||||||
|
libpciaccess0
|
||||||
|
libpcre2-8-0
|
||||||
|
libpcre3
|
||||||
|
libperl5.28
|
||||||
|
libpipeline1
|
||||||
|
libpng16-16
|
||||||
|
libpopt0
|
||||||
|
libprocps7
|
||||||
|
libprotobuf-c1
|
||||||
|
libpsl5
|
||||||
|
libpython-stdlib
|
||||||
|
libpython2-stdlib
|
||||||
|
libpython2.7-minimal
|
||||||
|
libpython2.7-stdlib
|
||||||
|
libpython3-stdlib
|
||||||
|
libpython3.7-minimal
|
||||||
|
libpython3.7-stdlib
|
||||||
|
libreadline7
|
||||||
|
librtmp1
|
||||||
|
libsasl2-2
|
||||||
|
libsasl2-modules-db
|
||||||
|
libseccomp2
|
||||||
|
libselinux1
|
||||||
|
libsemanage-common
|
||||||
|
libsemanage1
|
||||||
|
libsensors-config
|
||||||
|
libsensors5
|
||||||
|
libsepol1
|
||||||
|
libslang2
|
||||||
|
libsm6
|
||||||
|
libsmartcols1
|
||||||
|
libsqlite3-0
|
||||||
|
libss2
|
||||||
|
libssh2-1
|
||||||
|
libssl1.1
|
||||||
|
libstdc++6
|
||||||
|
libsystemd0
|
||||||
|
libtasn1-6
|
||||||
|
libtext-charwidth-perl
|
||||||
|
libtext-iconv-perl
|
||||||
|
libtext-wrapi18n-perl
|
||||||
|
libtinfo6
|
||||||
|
libuchardet0
|
||||||
|
libudev1
|
||||||
|
libunistring2
|
||||||
|
libuuid1
|
||||||
|
libwrap0
|
||||||
|
libx11-6
|
||||||
|
libx11-data
|
||||||
|
libx11-xcb1
|
||||||
|
libxau6
|
||||||
|
libxaw7
|
||||||
|
libxcb-dri2-0
|
||||||
|
libxcb-dri3-0
|
||||||
|
libxcb-glx0
|
||||||
|
libxcb-present0
|
||||||
|
libxcb-shape0
|
||||||
|
libxcb-sync1
|
||||||
|
libxcb1
|
||||||
|
libxcomposite1
|
||||||
|
libxcursor1
|
||||||
|
libxdamage1
|
||||||
|
libxdmcp6
|
||||||
|
libxext6
|
||||||
|
libxfixes3
|
||||||
|
libxft2
|
||||||
|
libxi6
|
||||||
|
libxinerama1
|
||||||
|
libxkbfile1
|
||||||
|
libxml2
|
||||||
|
libxmu6
|
||||||
|
libxmuu1
|
||||||
|
libxpm4
|
||||||
|
libxrandr2
|
||||||
|
libxrender1
|
||||||
|
libxshmfence1
|
||||||
|
libxt6
|
||||||
|
libxtables12
|
||||||
|
libxtst6
|
||||||
|
libxv1
|
||||||
|
libxxf86dga1
|
||||||
|
libxxf86vm1
|
||||||
|
libzstd1
|
||||||
|
locales
|
||||||
|
login
|
||||||
|
logrotate
|
||||||
|
lsb-base
|
||||||
|
lsof
|
||||||
|
man-db
|
||||||
|
manpages
|
||||||
|
mawk
|
||||||
|
mime-support
|
||||||
|
mount
|
||||||
|
nano
|
||||||
|
ncurses-base
|
||||||
|
ncurses-bin
|
||||||
|
ncurses-term
|
||||||
|
netbase
|
||||||
|
netcat-traditional
|
||||||
|
openssh-client
|
||||||
|
openssh-server
|
||||||
|
openssh-sftp-server
|
||||||
|
openssl
|
||||||
|
passwd
|
||||||
|
perl
|
||||||
|
perl-base
|
||||||
|
perl-modules-5.28
|
||||||
|
postfix
|
||||||
|
procps
|
||||||
|
python
|
||||||
|
python-apt-common
|
||||||
|
python-minimal
|
||||||
|
python2
|
||||||
|
python2-minimal
|
||||||
|
python2.7
|
||||||
|
python2.7-minimal
|
||||||
|
python3
|
||||||
|
python3-apt
|
||||||
|
python3-certifi
|
||||||
|
python3-chardet
|
||||||
|
python3-debconf
|
||||||
|
python3-debian
|
||||||
|
python3-debianbts
|
||||||
|
python3-httplib2
|
||||||
|
python3-idna
|
||||||
|
python3-minimal
|
||||||
|
python3-pkg-resources
|
||||||
|
python3-pycurl
|
||||||
|
python3-pysimplesoap
|
||||||
|
python3-reportbug
|
||||||
|
python3-requests
|
||||||
|
python3-six
|
||||||
|
python3-urllib3
|
||||||
|
python3.7
|
||||||
|
python3.7-minimal
|
||||||
|
readline-common
|
||||||
|
reportbug
|
||||||
|
rsyslog
|
||||||
|
sed
|
||||||
|
sensible-utils
|
||||||
|
ssh
|
||||||
|
ssl-cert
|
||||||
|
systemd
|
||||||
|
systemd-sysv
|
||||||
|
sysvinit-utils
|
||||||
|
tar
|
||||||
|
tasksel
|
||||||
|
tasksel-data
|
||||||
|
telnet
|
||||||
|
traceroute
|
||||||
|
tzdata
|
||||||
|
ucf
|
||||||
|
udev
|
||||||
|
util-linux
|
||||||
|
vim-common
|
||||||
|
vim-tiny
|
||||||
|
wamerican
|
||||||
|
wget
|
||||||
|
whiptail
|
||||||
|
x11-apps
|
||||||
|
x11-common
|
||||||
|
x11-session-utils
|
||||||
|
x11-utils
|
||||||
|
x11-xkb-utils
|
||||||
|
x11-xserver-utils
|
||||||
|
xauth
|
||||||
|
xbase-clients
|
||||||
|
xinit
|
||||||
|
xxd
|
||||||
|
xz-utils
|
||||||
|
zlib1g
|
|
@ -0,0 +1,8 @@
|
||||||
|
Package: amp-prefered-config
|
||||||
|
Version: 1.03
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Depends: amp-base
|
||||||
|
Maintainer: Thomas Legay <thomas@syngate.fr>
|
||||||
|
Description: change debian default configuration
|
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
grep '$include /usr/lib/amp-prefered-config/inputrc' /etc/inputrc > /dev/null || echo '$include /usr/lib/amp-prefered-config/inputrc' >> /etc/inputrc
|
||||||
|
|
||||||
|
#sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/g' /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime
|
||||||
|
dpkg-reconfigure -f noninteractive tzdata
|
||||||
|
|
||||||
|
|
||||||
|
sed -i 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/g' /etc/locale.gen
|
||||||
|
echo "LANG=fr_FR.UTF-8" > /etc/default/locale
|
||||||
|
/usr/sbin/locale-gen
|
||||||
|
|
||||||
|
[ "$(systemd-detect-virt )" == "lxc" ] && grep '^MaxRetentionSec=' /etc/systemd/journald.conf || echo 'MaxRetentionSec=2week' >> /etc/systemd/journald.conf
|
|
@ -0,0 +1,2 @@
|
||||||
|
"\e[5~": history-search-backward
|
||||||
|
"\e[6~": history-search-forward
|
|
@ -0,0 +1,8 @@
|
||||||
|
Package: amp-proxmox-utils
|
||||||
|
Version: 1.07
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Depends: debootstrap
|
||||||
|
Maintainer: Thomas Legay <thomas@lgy.fr>
|
||||||
|
Description: Proxmox scripts
|
|
@ -0,0 +1,2 @@
|
||||||
|
MAX_ARCHIVE=5
|
||||||
|
MAX_LOG_DAYS=14
|
|
@ -0,0 +1,5 @@
|
||||||
|
BACKUP_DEST_IP=10.237.66.10
|
||||||
|
BACKUP_DEST_PATH=/pool/netbackup/dump
|
||||||
|
NB_ARCHIVE=3
|
||||||
|
BACKUP_DEST_USER=root
|
||||||
|
BACKUP_PORT=22
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/bash
|
||||||
|
for tmp in $(pct list | grep running | cut -c 1-3)
|
||||||
|
do
|
||||||
|
lxc-attach $tmp "[ -e /usr/bin/amp-full-upgrade ] && amp-full-upgrade "
|
||||||
|
done
|
|
@ -0,0 +1,21 @@
|
||||||
|
set -e
|
||||||
|
SRC_DEBOOTSTRAP=/usr/share/debootstrap/scripts
|
||||||
|
IMAGE=$1
|
||||||
|
TARBALL=$1-$(date +%Y%m%d).tar.gz
|
||||||
|
if [ -f $SRC_DEBOOTSTRAP/$IMAGE ] ;
|
||||||
|
then
|
||||||
|
TARGET=$(tempfile)
|
||||||
|
rm $TARGET
|
||||||
|
mkdir $TARGET
|
||||||
|
echo create rootfs in temporary folder $TARGET
|
||||||
|
debootstrap $IMAGE $TARGET > /dev/null
|
||||||
|
echo create archive $TARBALL
|
||||||
|
tar -C $TARGET -zcvf $TARBALL .
|
||||||
|
echo Remove temporary folder
|
||||||
|
rm -fr $TARGET
|
||||||
|
chmod ugo+r $TARBALL
|
||||||
|
echo lxc image available in $TARBALL
|
||||||
|
else
|
||||||
|
echo $(basename $0) \<version\>
|
||||||
|
ls $SRC_DEBOOTSTRAP
|
||||||
|
fi
|
|
@ -0,0 +1,62 @@
|
||||||
|
#!/bin/bash
|
||||||
|
RETOUR=0
|
||||||
|
if [ "$1" = "backup-end" ]
|
||||||
|
then
|
||||||
|
|
||||||
|
. /etc/amp-proxmox-utils/vzdump.hook.conf
|
||||||
|
|
||||||
|
echo "vzdump hook backup-end (by thomas Legay)"
|
||||||
|
VM_ID=$3
|
||||||
|
|
||||||
|
#Rename archive name with vm hostname
|
||||||
|
VM_HOSTNAME=$(pct config $VM_ID | grep hostname | cut -d " " -f 2)
|
||||||
|
ARCHIVE_DIR=$(dirname $TARFILE)
|
||||||
|
ARCHIVE_NAME=$(basename $TARFILE)
|
||||||
|
NEW_ARCHIVE_NAME=$(echo $ARCHIVE_NAME | awk -v VM_HOSTNAME="$VM_HOSTNAME" -F '[-]+' '{print $1"-"$2"-"$3"-"VM_HOSTNAME"-"$4"-"$5'})
|
||||||
|
ARCHIVE_PREFIX=$(echo $ARCHIVE_NAME | awk -F '[-]+' '{print $1"-"$2"-"$3"-"}')
|
||||||
|
echo "Rename $ARCHIVE_NAME to $NEW_ARCHIVE_NAME"
|
||||||
|
mv $TARFILE $ARCHIVE_DIR/$NEW_ARCHIVE_NAME
|
||||||
|
TMP=$?
|
||||||
|
[ $TMP -ne 0 ] && RETOUR=$TMP
|
||||||
|
|
||||||
|
#Remove old archive
|
||||||
|
nb=$(find $ARCHIVE_DIR -regex ".*/vzdump-lxc-$VM_ID-.*\(.tgz\|.tar.gz\|.tar\|.tar.zst\|.tar.lzo\)" | wc -l)
|
||||||
|
nb_delete=$(($nb - $MAX_ARCHIVE ))
|
||||||
|
echo "$nb archives ( $nb_delete to delete)"
|
||||||
|
if [ $nb_delete -gt 0 ]
|
||||||
|
then
|
||||||
|
count=0
|
||||||
|
for archive in $(find $ARCHIVE_DIR -regex ".*/vzdump-lxc-$VM_ID-.*\(.tgz\|.tar.gz\|.tar\|.tar.zst\|.tar.lzo\)" -printf "%T@ %p\n" | sort -n | cut -d " " -f 2)
|
||||||
|
do
|
||||||
|
count=$(( $count + 1 ))
|
||||||
|
delete_prefix=$(echo $archive | sed 's/\(.tgz\|.tar.gz\|.tar\|.tar.zst\|.tar.lzo\)//')
|
||||||
|
if [ $count -le $nb_delete ]
|
||||||
|
then
|
||||||
|
for file in $(ls $delete_prefix*)
|
||||||
|
do
|
||||||
|
echo "Remove $file"
|
||||||
|
rm "$file"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
#remove old log
|
||||||
|
find $ARCHIVE_DIR -type f -mtime +$MAX_LOG_DAYS -name "*.log" -delete
|
||||||
|
|
||||||
|
#export archive
|
||||||
|
for tmp in $(find /etc/amp-proxmox-utils/vzdump.hook.d/ -name '*.conf')
|
||||||
|
do
|
||||||
|
. $tmp
|
||||||
|
echo "copie de l'archive pour $*"
|
||||||
|
scp -P $BACKUP_PORT $ARCHIVE_DIR/$NEW_ARCHIVE_NAME $BACKUP_DEST_USER@$BACKUP_DEST_IP:$BACKUP_DEST_PATH
|
||||||
|
TMP=$?
|
||||||
|
[ $TMP -ne 0 ] && RETOUR=$TMP
|
||||||
|
for tmp in $( ssh -p $BACKUP_PORT $BACKUP_DEST_USER@$BACKUP_DEST_IP "ls -rt $BACKUP_DEST_PATH/*$3*" | grep -v -e .log | head -n -$NB_ARCHIVE);
|
||||||
|
do
|
||||||
|
echo "suppression distante de $tmp"
|
||||||
|
ssh -p $BACKUP_PORT -l $BACKUP_DEST_USER $BACKUP_DEST_IP rm $tmp
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
exit $RETOUR
|
|
@ -0,0 +1,11 @@
|
||||||
|
amp-tools-unifi (1.0) stable; urgency=low
|
||||||
|
|
||||||
|
* Create
|
||||||
|
|
||||||
|
-- Legay Thomas <thomas@syngate.fr> mar. 28 avril 2020 10:55
|
||||||
|
|
||||||
|
amp-tools-unifi (1.1) stable; urgency=low
|
||||||
|
|
||||||
|
* first issue :-p
|
||||||
|
|
||||||
|
-- Legay Thomas <thomas@syngate.fr> mar. 28 avril 2020 10:55
|
|
@ -0,0 +1,8 @@
|
||||||
|
Package: amp-tools-unifi
|
||||||
|
Version: 1.03
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Depends: jq, gnupg
|
||||||
|
Maintainer: Thomas Legay <thomas@lgy.fr>
|
||||||
|
Description: amp-tools-unifi
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
VERSION=$(wget --header='X-Requested-With: XMLHttpRequest' 'https://www.ui.com/download/?platform=unifi' -O - | jq '.downloads | .[] | select(.filename=="unifi_sysvinit_all.deb") | .version' | sed 's/"//g' | sort -V | tail -n 1)
|
||||||
|
|
||||||
|
wget https://dl.ui.com/unifi/$VERSION/unifi_sysvinit_all.deb -O - > /tmp/unifi_sysvinit_all.deb
|
||||||
|
|
||||||
|
dpkg -i /tmp/unifi_sysvinit_all.deb
|
||||||
|
apt install -f
|
||||||
|
rm /tmp/unifi_sysvinit_all.deb
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
Package: amp-upgrade-airsonic
|
||||||
|
Version: 1.01
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Depends: wget
|
||||||
|
Maintainer: Thomas Legay <thomas@syngate.fr>
|
||||||
|
Description: airsonic upgrade script
|
|
@ -0,0 +1 @@
|
||||||
|
AIRSONIC_ROOT=/var/www/html/
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
PROJECT_URL=https://github.com/airsonic/airsonic/
|
||||||
|
VERSION=$(wget -qO - $PROJECT_URL/releases.atom | grep "releases/tag" | head -n 1 | grep -o -P "/tag/[^\"]*" | cut -c 6-)
|
||||||
|
FILE=airsonic.war
|
||||||
|
|
||||||
|
wget -q $PROJECT_URL/releases/download/$VERSION/$FILE -O $AIRSONIC_ROOT/airsonic.war
|
||||||
|
systemctl restart airsonic.service
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
Package: amp-upgrade-baikal
|
||||||
|
Version: 1.01
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Depends: wget
|
||||||
|
Maintainer: Thomas Legay <thomas@lgy.fr>
|
||||||
|
Description: baikal upgrade script
|
|
@ -0,0 +1,3 @@
|
||||||
|
WEBROOT=/var/www/html/
|
||||||
|
USER=www-data
|
||||||
|
GROUP=www-data
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
PROJECT_URL=https://github.com/sabre-io/Baikal/
|
||||||
|
VERSION=$(wget -qO - $PROJECT_URL/releases.atom | grep "releases/tag" | head -n 1 | grep -o -P "/tag/[^\"]*" | cut -c 6-)
|
||||||
|
FILE=baikal-$VERSION.zip
|
||||||
|
|
||||||
|
TMP_PATH=$(mktemp -d)
|
||||||
|
|
||||||
|
wget -q $PROJECT_URL/releases/download/$VERSION/$FILE -O $TMP_PATH/$FILE
|
||||||
|
|
||||||
|
for tmp in $(find /etc/amp-upgrade-script/baikal.d/ -name '*.conf')
|
||||||
|
do
|
||||||
|
source $tmp
|
||||||
|
mkdir -p $TMP_PATH/baikal
|
||||||
|
|
||||||
|
if [ -e $WEBROOT ]
|
||||||
|
then
|
||||||
|
cp -fr $WEBROOT/Specific $TMP_PATH/baikal/Specific
|
||||||
|
cp -fr $WEBROOT/config $TMP_PATH/baikal/config
|
||||||
|
fi
|
||||||
|
unzip -u $TMP_PATH/$FILE -d $TMP_PATH
|
||||||
|
rm -fr $WEBROOT
|
||||||
|
cp -fr $TMP_PATH/baikal/ $WEBROOT
|
||||||
|
chown $USER:$GROUP $WEBROOT -R
|
||||||
|
rm -fr $TMP_PATH/baikal
|
||||||
|
done
|
||||||
|
rm -fr $TMP_PATH
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
Package: amp-upgrade-bitwardenrs
|
||||||
|
Version: 1.01
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Depends: rsync, wget, git
|
||||||
|
Maintainer: Thomas Legay <thomas@lgy.fr>
|
||||||
|
Description: bitwardenrs upgrade script
|
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd ~
|
||||||
|
find bitwarden_rs/target/* -maxdepth 0 -mtime +30 -exec rm -fr {} \;
|
||||||
|
|
||||||
|
#Backend
|
||||||
|
source ~/.cargo/env
|
||||||
|
|
||||||
|
cd ~/bitwarden_rs
|
||||||
|
git checkout master
|
||||||
|
git pull
|
||||||
|
git checkout $(git tag | sort -V | tail -n 1)
|
||||||
|
cargo build --release --features postgresql
|
||||||
|
|
||||||
|
#Frontend
|
||||||
|
cd ~
|
||||||
|
PROJECT_URL=https://github.com/dani-garcia/bw_web_builds
|
||||||
|
VERSION=$(wget -qO - $PROJECT_URL/releases.atom | grep "releases/tag" | head -n 1 | grep -o -P "/tag/[^\"]*" | cut -c 6-)
|
||||||
|
FILE=bw_web_$VERSION.tar.gz
|
||||||
|
|
||||||
|
RELEASE_TARGET=~/bitwarden_rs/target/release/
|
||||||
|
rm -fr $RELEASE_TARGET/web-vault/
|
||||||
|
wget -q $PROJECT_URL/releases/download/$VERSION/$FILE -O - | tar -zx -C $RELEASE_TARGET
|
||||||
|
|
||||||
|
#Deploy
|
||||||
|
rsync -a --info=progress2 bitwarden_rs/target/release/ /opt/bitwarden/
|
||||||
|
chown -R www-data: /opt/bitwarden
|
||||||
|
|
||||||
|
systemctl restart bitwarden
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
Package: amp-upgrade-element-web
|
||||||
|
Version: 1.01
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Depends: wget
|
||||||
|
Maintainer: Thomas Legay <thomas@lgy.fr>
|
||||||
|
Description: element web upgrade script
|
|
@ -0,0 +1 @@
|
||||||
|
AIRSONIC_ROOT=/var/www/html/
|
|
@ -0,0 +1,3 @@
|
||||||
|
WEBROOT=/var/www/html/
|
||||||
|
USER=www-data
|
||||||
|
GROUP=www-data
|
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
PROJECT_URL=https://github.com/vector-im/element-web
|
||||||
|
VERSION=$(wget -qO - $PROJECT_URL/releases.atom | grep "releases/tag" | head -n 1 | grep -o -P "/tag/[^\"]*" | cut -c 6-)
|
||||||
|
FILE=element-$VERSION.tar.gz
|
||||||
|
|
||||||
|
TMP_PATH=$(mktemp -d)
|
||||||
|
|
||||||
|
wget https://github.com/vector-im/element-web/releases/download/$VERSION/$FILE -O - | tar -zx -C $TMP_PATH
|
||||||
|
|
||||||
|
for tmp in $(find /etc/amp-upgrade-script/element-web.d/ -name '*.conf')
|
||||||
|
do
|
||||||
|
source $tmp
|
||||||
|
TMP_CONFIG=$(mktemp -d)
|
||||||
|
|
||||||
|
if [ -e $WEBROOT ]
|
||||||
|
then
|
||||||
|
[ $(find $WEBROOT/ -name '*.json' | wc -l) -ne 0 ] && mv $WEBROOT/config*.json $TMP_CONFIG
|
||||||
|
rm -fr $WEBROOT
|
||||||
|
fi
|
||||||
|
mv $TMP_PATH/element-$VERSION $WEBROOT
|
||||||
|
[ $(find $TMP_CONFIG/ -name '*.json' | wc -l) -ne 0 ] && mv $TMP_CONFIG/*.json $WEBROOT/
|
||||||
|
chown $USER:$GROUP $WEBROOT -R
|
||||||
|
rm -fr $TMP_CONFIG
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -fr $TMP_PATH
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
Package: amp-upgrade-golang
|
||||||
|
Version: 1.01
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Depends: wget
|
||||||
|
Maintainer: Thomas Legay <thomas@lgy.fr>
|
||||||
|
Description: golang upgrade script
|
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
URL=https://golang.org/$(wget -qO - https://golang.org/dl/ | grep downloadBox | grep linux-amd64 | cut -d "\"" -f 4)
|
||||||
|
wget -qO - $URL | tar -zx -C /opt/
|
||||||
|
for tmp in $(find /opt/go/bin -type f);
|
||||||
|
do
|
||||||
|
DST=/usr/bin/$(basename $tmp)
|
||||||
|
[ -e $DST ] && rm -fr $DST
|
||||||
|
ln -s $tmp $DST
|
||||||
|
done
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
Package: amp-upgrade-phpmyadmin
|
||||||
|
Version: 1.01
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Depends: unzip, wget
|
||||||
|
Maintainer: Thomas Legay <thomas@lgy.fr>
|
||||||
|
Description: phpmyadmin update script
|
|
@ -0,0 +1 @@
|
||||||
|
AIRSONIC_ROOT=/var/www/html/
|
|
@ -0,0 +1,3 @@
|
||||||
|
WEBROOT=/var/www/html/
|
||||||
|
USER=www-data
|
||||||
|
GROUP=www-data
|
|
@ -0,0 +1,3 @@
|
||||||
|
WEBROOT=/var/www/html/
|
||||||
|
USER=www-data
|
||||||
|
GROUP=www-data
|
|
@ -0,0 +1,3 @@
|
||||||
|
WEBROOT=/var/www/html/
|
||||||
|
USER=www-data
|
||||||
|
GROUP=www-data
|
|
@ -0,0 +1,3 @@
|
||||||
|
WEBROOT=/var/www/roundcube/
|
||||||
|
USER=www-data
|
||||||
|
GROUP=www-data
|
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
TMP_PATH=$(mktemp -d)
|
||||||
|
TMP_ZIP=$TMP_PATH/tmp.zip
|
||||||
|
|
||||||
|
wget -q https://www.phpmyadmin.net/ -O - | grep '\-all-languages.zip' | sed -n "s/.*\(https:\S*all-languages.zip\).*/\1/p" -O $TMP_PATH/tmp.zip
|
||||||
|
|
||||||
|
for tmp in $(find /etc/amp-upgrade-script/phpmysql.d/ -name '*.conf')
|
||||||
|
do
|
||||||
|
source $tmp
|
||||||
|
TMP_CONFIG=$(mktemp -d)
|
||||||
|
|
||||||
|
[ -e $WEBROOT ] && rm -fr $WEBROOT
|
||||||
|
mkdir -p $WEBROOT
|
||||||
|
unzip TMP_ZIP -d $WEBROOT
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
rm -fr $TMP_PATH
|
|
@ -0,0 +1 @@
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
Package: amp-upgrade-roundcube
|
||||||
|
Version: 1.01
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Depends: wget
|
||||||
|
Maintainer: Thomas Legay <thomas@lgy.fr>
|
||||||
|
Description: roundcube update script
|
|
@ -0,0 +1,3 @@
|
||||||
|
WEBROOT=/var/www/roundcube/
|
||||||
|
USER=www-data
|
||||||
|
GROUP=www-data
|
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
PROJECT_URL=https://github.com/roundcube/roundcubemail/
|
||||||
|
VERSION=$(wget -qO -$PROJECT_URL/releases.atom | grep "releases/tag" | grep -o -P "/tag/[^\"]*" | sort -rV | head -n 1 | cut -c 6-)
|
||||||
|
FILE=roundcubemail-$VERSION-complete.tar.gz
|
||||||
|
|
||||||
|
TMP_PATH=$(mktemp -d)
|
||||||
|
|
||||||
|
wget -q $PROJECT_URL/releases/download/$VERSION/$FILE -O - | tar -zx -C $TMP_PATH
|
||||||
|
cd $TMP_PATH/roundcubemail-$VERSION
|
||||||
|
|
||||||
|
for tmp in $(find /etc/amp-upgrade-script/roundcube.d/ -name '*.conf')
|
||||||
|
do
|
||||||
|
source $tmp
|
||||||
|
bin/installto.sh $WEBROOT
|
||||||
|
chown $USER:$GROUP $WEBROOT -R
|
||||||
|
rm -fr $TMP_PATH
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
Package: amp-webdav
|
||||||
|
Version: 1.01
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Depends: php-sabre-dav
|
||||||
|
Maintainer: Thomas Legay <thomas@syngate.fr>
|
||||||
|
Description: Package pour webdav
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
date_default_timezone_set('Europe/Paris');
|
||||||
|
$publicDir = $_SERVER['DOCUMENT_ROOT'];
|
||||||
|
$baseUri = '/';
|
||||||
|
|
||||||
|
require_once 'Sabre/autoload.php';
|
||||||
|
|
||||||
|
$root = new \Sabre\DAV\FS\Directory($publicDir);
|
||||||
|
$server = new \Sabre\DAV\Server($root);
|
||||||
|
if (isset($baseUri))
|
||||||
|
$server->setBaseUri($baseUri);
|
||||||
|
|
||||||
|
$lockBackend = new \Sabre\DAV\Locks\Backend\File('/locksdb');
|
||||||
|
$lockPlugin = new \Sabre\DAV\Locks\Plugin($lockBackend);
|
||||||
|
$server->addPlugin($lockPlugin);
|
||||||
|
|
||||||
|
$browser = new \Sabre\DAV\Browser\Plugin();
|
||||||
|
$server->addPlugin($browser);
|
||||||
|
|
||||||
|
// Automatically guess (some) contenttypes, based on extesion
|
||||||
|
$server->addPlugin(new \Sabre\DAV\Browser\GuessContentType());
|
||||||
|
|
||||||
|
// Temporary file filter
|
||||||
|
//$tempFF = new \Sabre\DAV\TemporaryFileFilterPlugin($tmpDir);
|
||||||
|
//$server->addPlugin($tempFF);
|
||||||
|
|
||||||
|
$server->exec();
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
date_default_timezone_set('Europe/Paris');
|
||||||
|
$publicDir = $_SERVER['DOCUMENT_ROOT'];
|
||||||
|
$baseUri = '/zdav';
|
||||||
|
|
||||||
|
require_once 'Sabre/autoload.php';
|
||||||
|
|
||||||
|
$root = new \Sabre\DAV\FS\Directory($publicDir);
|
||||||
|
$server = new \Sabre\DAV\Server($root);
|
||||||
|
if (isset($baseUri))
|
||||||
|
$server->setBaseUri($baseUri);
|
||||||
|
|
||||||
|
$lockBackend = new \Sabre\DAV\Locks\Backend\File('/locksdb');
|
||||||
|
$lockPlugin = new \Sabre\DAV\Locks\Plugin($lockBackend);
|
||||||
|
$server->addPlugin($lockPlugin);
|
||||||
|
|
||||||
|
$browser = new \Sabre\DAV\Browser\Plugin();
|
||||||
|
$server->addPlugin($browser);
|
||||||
|
|
||||||
|
// Automatically guess (some) contenttypes, based on extesion
|
||||||
|
$server->addPlugin(new \Sabre\DAV\Browser\GuessContentType());
|
||||||
|
|
||||||
|
// Temporary file filter
|
||||||
|
//$tempFF = new \Sabre\DAV\TemporaryFileFilterPlugin($tmpDir);
|
||||||
|
//$server->addPlugin($tempFF);
|
||||||
|
|
||||||
|
$server->exec();
|
|
@ -0,0 +1,31 @@
|
||||||
|
Sample to add in the apache host
|
||||||
|
|
||||||
|
Case on the root directory
|
||||||
|
|
||||||
|
php_flag output_buffering off
|
||||||
|
php_flag always_populate_raw_post_data off
|
||||||
|
php_flag magic_quotes_gpc off
|
||||||
|
php_flag mbstring.func_overload off
|
||||||
|
|
||||||
|
AliasMatch .* /usr/lib/amp-webdav/dav.php
|
||||||
|
<location / >
|
||||||
|
AuthType basic
|
||||||
|
AuthName "Mon serveur"
|
||||||
|
AuthUserFile /opt/htpasswd
|
||||||
|
Require valid-user
|
||||||
|
</location>
|
||||||
|
|
||||||
|
case with fake root /zdav/
|
||||||
|
|
||||||
|
php_flag output_buffering off
|
||||||
|
php_flag always_populate_raw_post_data off
|
||||||
|
php_flag magic_quotes_gpc off
|
||||||
|
php_flag mbstring.func_overload off
|
||||||
|
|
||||||
|
Alias /zdav /usr/lib/amp-webdav/zdav.php
|
||||||
|
<location /zdav >
|
||||||
|
AuthType basic
|
||||||
|
AuthName "Mon serveur"
|
||||||
|
AuthUserFile /opt/htpasswd
|
||||||
|
Require valid-user
|
||||||
|
</location>
|
|
@ -0,0 +1,5 @@
|
||||||
|
logveillance (1.00) stable; urgency=low
|
||||||
|
|
||||||
|
* Création
|
||||||
|
|
||||||
|
-- Legay Thomas <thomas@syngate.fr> jeu. 07 mai 2020 00:10
|
|
@ -0,0 +1,8 @@
|
||||||
|
Package: logveillance
|
||||||
|
Version: 1.17
|
||||||
|
Section: base
|
||||||
|
Priority: optional
|
||||||
|
Architecture: all
|
||||||
|
Maintainer: Thomas Legay <thomas@lgy.fr>
|
||||||
|
Depends: python3-requests
|
||||||
|
Description: paquet logveillance
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
systemctl enable logveillance
|
||||||
|
systemctl restart logveillance
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
systemctl disable logveillance
|
|
@ -0,0 +1,9 @@
|
||||||
|
[Unit]
|
||||||
|
Description=logveillance
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/usr/lib/logveillance/logveillance.py
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -0,0 +1,112 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
import time
|
||||||
|
import re
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
INTERVAL=10
|
||||||
|
LOOP_CONTROL_EVERY=6
|
||||||
|
|
||||||
|
f = open("/etc/logveillance/token")
|
||||||
|
TOKEN = f.readline().splitlines()[0]
|
||||||
|
f.close()
|
||||||
|
f = open("/etc/logveillance/room")
|
||||||
|
ROOM = f.readline().splitlines()[0]
|
||||||
|
f.close()
|
||||||
|
f = open("/etc/logveillance/server")
|
||||||
|
SERVER = f.readline().splitlines()[0]
|
||||||
|
f.close()
|
||||||
|
f = open("/etc/logveillance/logfile")
|
||||||
|
filename = f.readline().splitlines()[0]
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
URL=SERVER + "/_matrix/client/r0/rooms/"+ROOM+"/send/m.room.message?access_token=" + TOKEN
|
||||||
|
|
||||||
|
RULE = [
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*dhcpd\[\d*\]:\s*DHCPACK\s*on \S* to \S*( \(\S*\))?( via \S*)?",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*dhcpd\[\d*\]:\s*DHCPOFFER on \S* to \S*( \(\S*\))?( via \S*)?",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*dhcpd\[\d*\]:\s*DHCPREQUEST for \S*( \(\S*\))? from \S*( \(\S*\))?( via \S*)?",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*dhcpd\[\d*\]:\s*DHCPRELEASE of \S*( \(\S*\))? from \S*( \(\S*\))?( via \S*)?",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*dhcpd\[\d*\]:\s*reuse_lease: lease age .*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*dhcpd\[\d*\]:\s*Wrote .*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*dhcpd\[\d*\]:\s*uid lease \S*( \(\S*\))? for client \S* is duplicate on \S*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*\S* Succeeded.",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*Started\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*Starting\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*Reloaded\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*Reloading\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*Reached\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*Listening\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*Stopping\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*Stopped\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*Startup\s*finished\s*in\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*Created\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*Closed\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*systemd\[\d*\]:\s*Removed\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*ntpd\[\d*\]:\s*Listen\s*normally\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*ntpd\[\d*\]:\s*Listen\s*and\s*drop\s*on\s*.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*ntpd\[\d*\]:\s*Listening\s*on\s*routing\s*socket\s*on.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*CRON\[\d*\]:\s*\(\S*\)\s*CMD.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*in\.tftpd\[\d*\]:\s*RRQ\s*from\s*\S*\s*filename.*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*rsyslogd:\s*\[.*\] rsyslogd was HUPed",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*kernel:\s*\[.*\] EXT4-fs \(.*\): mounted filesystem without journal. Opts: .*",
|
||||||
|
"\w*\s*[0-9]{1,2}\s*\d*:\d*:\d*\s*\w*\s*EXT4-fs\s*\(\S*\): write access unavailable, skipping orphan cleanup"
|
||||||
|
]
|
||||||
|
|
||||||
|
def matchrule(ligne,rulelist):
|
||||||
|
res = False
|
||||||
|
cpt = len(rulelist)
|
||||||
|
while cpt != 0 and not res:
|
||||||
|
cpt = cpt - 1
|
||||||
|
objmatch = rulelist[cpt].fullmatch(ligne)
|
||||||
|
if objmatch != None:
|
||||||
|
res = True
|
||||||
|
return res
|
||||||
|
|
||||||
|
relist = []
|
||||||
|
for tmp in RULE:
|
||||||
|
relist.append(re.compile(tmp))
|
||||||
|
|
||||||
|
fd = open(filename)
|
||||||
|
firstline_control = fd.readline().splitlines()[0]
|
||||||
|
inode_control = os.stat(filename).st_ino
|
||||||
|
fd.seek(0,2)
|
||||||
|
loop_control = 0
|
||||||
|
content = ""
|
||||||
|
while True:
|
||||||
|
loop_control = (loop_control + 1) % LOOP_CONTROL_EVERY
|
||||||
|
where = fd.tell()
|
||||||
|
ligne = fd.readline()
|
||||||
|
if ligne:
|
||||||
|
ligne = ligne.splitlines()
|
||||||
|
if ligne != []:
|
||||||
|
ligne = ligne[0]
|
||||||
|
if not matchrule(ligne,relist):
|
||||||
|
content = content + ligne + '\n'
|
||||||
|
else:
|
||||||
|
time.sleep(INTERVAL)
|
||||||
|
fd.seek(where)
|
||||||
|
if loop_control == 0:
|
||||||
|
where = fd.tell()
|
||||||
|
fd.seek(0,0)
|
||||||
|
firstline = fd.readline().splitlines()[0]
|
||||||
|
fd.seek(where)
|
||||||
|
inode = os.stat(filename).st_ino
|
||||||
|
if inode_control != inode:
|
||||||
|
inode_control = inode
|
||||||
|
fd.close()
|
||||||
|
fd = open(filename)
|
||||||
|
firstline_control = fd.readline().splitlines()[0]
|
||||||
|
fd.seek(0,0)
|
||||||
|
if firstline_control != firstline:
|
||||||
|
firstline_control = firstline
|
||||||
|
fd.seek(0,0)
|
||||||
|
if content != "":
|
||||||
|
try:
|
||||||
|
payload=json.dumps({"msgtype":"m.text","body":content})
|
||||||
|
r = requests.post(URL, data=payload)
|
||||||
|
content = ""
|
||||||
|
except:
|
||||||
|
print("Unexpected error:", sys.exc_info()[0])
|
Loading…
Reference in New Issue