Compare commits

...

10 Commits

Author SHA1 Message Date
Jörg Deckert 88f2e71b24 Zabbix: add odbc use flag to php 2022-12-05 14:04:37 +01:00
Jörg Deckert 74e940d1d7 Zabbix: add odbc use flag 2022-12-05 12:20:55 +01:00
Jörg Deckert 4639943bae Zabbix: add net-analyzer/traceroute 2022-11-08 13:31:30 +01:00
Jörg Deckert b8567e3357 FFGW: update kernel config 2022-11-08 13:27:44 +01:00
Jörg Deckert 63afcd8bce version bump, better default configs, save some var dirs 2022-10-14 15:12:09 +02:00
Jörg Deckert c972d568ae privacyIDEA: update dependencies 2022-08-12 18:32:52 +02:00
Jörg Deckert 1ad5d5d3e5 new appliance: ASSP 2022-08-05 19:00:35 +02:00
Jörg Deckert 0479880a81 ISL Online appliance 2022-03-11 15:57:04 +01:00
Jörg Deckert 2866c52b9e Git appliance (Gitea based) 2022-02-26 23:21:57 +01:00
Jörg Deckert 0c2fcc0cbc Zabbix: version 6.0; fix repo definition 2022-02-24 18:21:00 +01:00
43 changed files with 1082 additions and 3649 deletions

26
assp/Makefile Normal file
View File

@ -0,0 +1,26 @@
install_assp = /opt/assp
assp.service = $(CHROOT)/lib/systemd/system/assp.service
ASSP_SNAPSHOT ?= r325
ASSP_MOD_INST_VER ?= 2.10
ASSP_FC_VER ?= 1.05
ASSP_ZIP = assp-svn-$(ASSP_SNAPSHOT).zip
ASSP_URL = https://sourceforge.net/code-snapshots/svn/a/as/assp/svn/$(ASSP_ZIP)
$(CHROOT)$(install_assp):
RUN test -f /var/cache/distfiles/$(ASSP_ZIP) || \
RUN wget $(ASSP_URL) -O /var/cache/distfiles/$(ASSP_ZIP)
RUN sh -c '(echo y;echo manual;echo o conf prerequisites_policy follow;echo o conf commit)|cpan'
RUN sh -c 'cd /opt && unzip /var/cache/distfiles/$(ASSP_ZIP) && mv /opt/assp-svn-$(ASSP_SNAPSHOT)/assp2/trunk $(install_assp) && rm -rf /opt/assp-svn-$(ASSP_SNAPSHOT)'
echo "AsADaemon:=1" > $(CHROOT)$(install_assp)/assp.cfg
RUN sh -c 'mkdir -p /tmp/mod_inst && cd /tmp/mod_inst && unzip $(install_assp)/mod_inst.pl.$(ASSP_MOD_INST_VER).zip && perl mod_inst.pl && perl mod_inst_ocr.pl'
RUN sh -c 'cd $(install_assp) && unzip images/images.zip && rm images/images.zip'
RUN sh -c 'cd $(install_assp) && unzip filecommander/$(ASSP_FC_VER).ZIP && rm -rf filecommander/$(ASSP_FC_VER).ZIP && mv $(ASSP_FC_VER)/images/* images/ && mv $(ASSP_FC_VER)/lib/* lib/ && rm -rf $(ASSP_FC_VER)'
rm -rf $(CHROOT)/root/.cpan/build $(CHROOT)/root/.cpan/sources
$(assp.service): assp/assp.service
cp $< $@
preinstall:
postinstall: $(CHROOT)$(install_assp) $(assp.service)

2
assp/assp.cfg Normal file
View File

@ -0,0 +1,2 @@
REPO_NAMES += unitas-mail
REPO_URI_unitas-mail = https://git.unitas-network.de/Gentoo/unitas-mail.git

13
assp/assp/assp.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=AntiSpam SMTP Proxy
After=network.target clamd.service
[Service]
Type=forking
WorkingDirectory=/opt/assp
ExecStart=/usr/bin/perl /opt/assp/assp.pl /opt/assp/
RestartSec=60
Restart=always
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1 @@
app-antivirus/clamav-unofficial-sigs

14
assp/package.use Normal file
View File

@ -0,0 +1,14 @@
dev-lang/perl berkdb ithreads
mail-mta/postfix cdb ldap mysql
app-text/tesseract jpeg png tiff webp
media-libs/leptonica tiff webp jpeg png
media-gfx/imagemagick jpeg perl png tiff webp wmf
media-libs/gd jpeg png fontconfig
x11-libs/gdk-pixbuf -introspection
dev-java/openjdk-bin headless-awt
app-text/poppler png tiff
x11-libs/libxkbcommon X
dev-libs/libpcre2 pcre16
media-libs/libglvnd X
media-libs/mesa -llvm
media-libs/harfbuzz -cairo

29
assp/world Normal file
View File

@ -0,0 +1,29 @@
app-antivirus/clamav
app-antivirus/clamav-unofficial-sigs
app-arch/arj
app-arch/libarchive
app-arch/p7zip
app-arch/unrar
app-arch/unzip
app-text/pdftk
app-text/poppler
app-text/tesseract
app-text/xpdf
dev-db/mariadb
dev-lang/perl
dev-perl/IO-Socket-SSL
mail-filter/dcc
mail-mta/postfix
media-gfx/imagemagick
net-analyzer/net-snmp
net-analyzer/tcpdump
net-analyzer/traceroute
net-dns/bind-tools
net-dns/pdns-recursor
net-misc/netkit-telnetd
net-misc/ntp
net-nds/openldap
sys-apps/dmidecode
sys-block/parted
sys-libs/db
virtual/perl-CPAN

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3,12 +3,6 @@
net-misc/bird
net-vpn/tinc
#
# ab systemd-248 gibts Batman-Support
sys-apps/systemd
#
# ebtables-2.0.11-r2 sucht ethertypes nicht in /etc, sondern im Doku-Verzeichnis
=net-firewall/ebtables-2.0.11-r3
#
# eigene Ebuilds
dev-libs/libuecc
net-misc/batctl

49
git/Makefile Normal file
View File

@ -0,0 +1,49 @@
02firstboot = $(CHROOT)/usr/local/bin/02firstboot.start
cert-renew.sh = $(CHROOT)/etc/ssl/cert-renew.sh
apache_conf = $(CHROOT)/etc/apache2/vhosts.d/default_vhost.include.applorig
systemd-units: appliance/MySQL-Backup.sh appliance/backup.service appliance/backup.timer appliance/cert-renew.service appliance/cert-renew.timer
cp appliance/MySQL-Backup.sh $(CHROOT)/usr/local/bin/
cp appliance/backup.service appliance/backup.timer appliance/cert-renew.service appliance/cert-renew.timer $(CHROOT)/etc/systemd/system/
$(02firstboot): appliance/02firstboot.start
mkdir -p $(CHROOT)/etc/local.d
cp $< $@
touch $(CHROOT)/02firstboot
$(cert-renew.sh): appliance/cert-renew.sh
mkdir -p $(CHROOT)/etc/ssl
cp $< $@
$(apache_conf): apache/default_vhost.include
sed -i 's/-D LANGUAGE/-D LANGUAGE -D PROXY/' $(CHROOT)/etc/conf.d/apache2
mv $(CHROOT)/etc/apache2/vhosts.d/default_vhost.include $@
cp $< $(CHROOT)/etc/apache2/vhosts.d/default_vhost.include
$(CHROOT)/var/lib/mysql: mariadb/my.cnf.root
# MariaDB-Konfiguration ($$, weil make ein $ entfernt)
sed -i "s/^character-set-server.*$$/character-set-server = utf8mb4/" $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
sed -iE 's/^\(log-bin\)/#\1/' $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
echo >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
echo "collation-server = utf8mb4_general_ci" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
echo "transaction_isolation = READ-COMMITTED" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
echo "binlog_format = ROW" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
echo "expire_logs_days = 3" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
echo "innodb_file_per_table = 1" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
echo "innodb_large_prefix = on" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
echo "innodb_buffer_pool_size = 2G" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
echo "innodb_strict_mode = OFF" >> $(CHROOT)/etc/mysql/mariadb.d/50-distro-server.cnf
cp mariadb/my.cnf.root $(CHROOT)/root/.my.cnf
chmod 0600 $(CHROOT)/root/.my.cnf
rm -rf $(CHROOT)/var/lib/mysql/*
RUN bash -c 'yes gentoo | emerge --config dev-db/mariadb'
preinstall:
postinstall: systemd-units $(apache_conf) $(02firstboot) $(cert-renew.sh) $(CHROOT)/var/lib/mysql
# Apache-Konfiguration
sed -i 's/-D LANGUAGE/-D LANGUAGE -D PROXY/' $(CHROOT)/etc/conf.d/apache2
mv $(CHROOT)/etc/apache2/vhosts.d/default_vhost.include $(CHROOT)/etc/apache2/vhosts.d/default_vhost.include.orig
cp apache/default_vhost.include $(CHROOT)/etc/apache2/vhosts.d/

View File

@ -0,0 +1,17 @@
ServerAlias letsencrypt
ServerAlias gitea
ServerAdmin root@localhost
DocumentRoot "/var/www/localhost/htdocs"
<Directory "/var/www/localhost/htdocs">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ProxyPreserveHost On
ProxyRequests off
AllowEncodedSlashes NoDecode
ProxyPass / http://localhost:3000/ nocanon
ProxyPassReverse / http://localhost:3000/

131
git/appliance/02firstboot.start Executable file
View File

@ -0,0 +1,131 @@
#!/bin/bash
# variables
LABEL="DATA"
DATABASE_PASS=$(head -c 300 /dev/urandom | tr -cd 'a-zA-Z0-9' | head -c 16)
TLD="example.com"
HOST="git"
ORGNAME="git example"
# start
set -e
[ -e /01firstboot ] && exit 0
[ -e /02firstboot ] || exit 0
# Gitea configuration
if [ ! -L /etc/gitea/app.ini ]; then
if [ ! -f "/$LABEL/etc/gitea/app.ini" ]; then
echo 'Create Gitea config...'
mkdir -p /$LABEL/etc/gitea
cp /etc/gitea/app.ini /$LABEL/etc/gitea/app.ini
mv /etc/gitea/app.ini /$LABEL/etc/gitea/app.ini.orig
chown -R git:git /$LABEL/etc/gitea
ln -s /$LABEL/etc/gitea/app.ini /etc/gitea/app.ini
echo 'Configure Gitea...'
sed -i 's#^HOST = 127.0.0.1:3306#HOST = /run/mysqld/mysqld.sock#' /$LABEL/etc/gitea/app.ini
sed -i 's/^NAME = gitea/NAME = giteadb/' /$LABEL/etc/gitea/app.ini
sed -i 's/^USER = root/USER = gitea/' /$LABEL/etc/gitea/app.ini
sed -i 's/^LFS_JWT_SECRET.*=.*$/LFS_JWT_SECRET = '`gitea generate secret LFS_JWT_SECRET`'/g' /$LABEL/etc/gitea/app.ini
sed -i 's/^INTERNAL_TOKEN.*=.*$/INTERNAL_TOKEN = '`gitea generate secret INTERNAL_TOKEN`'/g' /$LABEL/etc/gitea/app.ini
sed -i 's/^SECRET_KEY.*=.*$/SECRET_KEY = '`gitea generate secret SECRET_KEY`'/g' /$LABEL/etc/gitea/app.ini
else
echo 'Linking Gitea config...'
cp /$LABEL/etc/gitea/app.ini /$LABEL/etc/gitea/app.ini.alt
rm -f /$LABEL/etc/gitea/app.ini.orig
mv /etc/gitea/app.ini /$LABEL/etc/gitea/app.ini.orig
chown -R git:git /$LABEL/etc/gitea
ln -s /$LABEL/etc/gitea/app.ini /etc/gitea/app.ini
fi
fi
if [ ! -d "/$LABEL/var/lib/gitea" ]; then
mkdir -p /$LABEL/var/lib/gitea
chown git:git /$LABEL/var/lib/gitea
cp -a /var/lib/gitea/. /$LABEL/var/lib/gitea
fi
mv /var/lib/gitea /var/lib/gitea.orig
ln -s /$LABEL/var/lib/gitea /var/lib/gitea
# Database
if [ ! -L /var/lib/mysql ]; then
systemctl stop mariadb
if [ ! -d "/$LABEL/var/lib/mysql/giteadb" ]; then
echo 'Initialize MariaDB...'
mkdir -p "/$LABEL/var/lib"
rm -rf "/$LABEL/var/lib/mysql"
cp -a "/var/lib/mysql" "/$LABEL/var/lib/mysql"
mv "/var/lib/mysql" "/$LABEL/var/lib/mysql.orig"
ln -s "/$LABEL/var/lib/mysql" "/var/lib/mysql"
systemctl start mariadb
sleep 5
echo 'Create Gitea database...'
mysql -u root -e "CREATE USER 'gitea'@'localhost' IDENTIFIED BY '$DATABASE_PASS';"
mysql -u root -e "CREATE DATABASE giteadb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_unicode_ci';"
mysql -u root -e "GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'localhost' IDENTIFIED by '$DATABASE_PASS';"
mysql -u root -e "FLUSH PRIVILEGES;"
else
echo 'Start MariaDB...'
rm -rf "/$LABEL/var/lib/mysql.orig"
mv "/var/lib/mysql" "/$LABEL/var/lib/mysql.orig"
ln -s "/$LABEL/var/lib/mysql" "/var/lib/mysql"
systemctl start mariadb
sleep 5
mysql -u root -e "GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'localhost' IDENTIFIED by '$DATABASE_PASS';"
fi
else
echo 'Set new database password...'
systemctl restart mariadb
sleep 5
mysql -u root -e "GRANT ALL PRIVILEGES ON giteadb.* TO 'gitea'@'localhost' IDENTIFIED by '$DATABASE_PASS';"
fi
# update Gitea config with new database password
sed -i "s/.*PASSWD = .*;Use PASSWD =/PASSWD = $DATABASE_PASS ;Use PASSWD =/" /$LABEL/etc/gitea/app.ini
# Certificate
if [ -x "/$LABEL/etc/ssl/cert-renew.sh" ]; then
# angepaßtes Zertifikat vorhanden (kein example)
if [ ! -L /etc/ssl/cert-renew.sh ]; then
rm -f "/$LABEL/etc/ssl/cert-renew.sh.orig"
mv "/etc/ssl/cert-renew.sh" "/$LABEL/etc/ssl/cert-renew.sh.orig"
else
rm -f "/etc/ssl/cert-renew.sh"
fi
ln -s "/$LABEL/etc/ssl/cert-renew.sh" "/etc/ssl/cert-renew.sh"
else
echo 'Create example certificate...'
mkdir -p "/$LABEL/CERTS/KEYS/"
mkdir -p "/$LABEL/CERTS/$HOST.$TLD"
echo "FQDN = $HOST.$TLD" > "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf"
echo "ORGNAME = $ORGNAME" >> "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf"
echo "ALTNAMES = DNS:$HOST.$TLD , DNS:$TLD" >> "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf"
echo -e "\n[ req ]\ndefault_bits = 4096\ndefault_md = sha256\nprompt = no\nencrypt_key = no\ndistinguished_name = dn\nreq_extensions = req_ext\ndefault_keyfile = ../KEYS/\$FQDN-key.pem\n" >> "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf"
echo -e "\n[ dn ]\nC = DE\nO = \$ORGNAME\nCN = \$FQDN\n" >> "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf"
echo -e "\n[ req_ext ]\nsubjectAltName = \$ALTNAMES" >> "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf"
openssl req -x509 -new -config "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf" -out "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD-cert.pem" -keyout "/$LABEL/CERTS/KEYS/$HOST.$TLD-key.pem"
cp "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD-cert.pem" "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD-fullchain.pem"
touch "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD-chain.pem"
fi
rm -rf /etc/ssl/apache2
mkdir -p /etc/ssl
ln -sf "/$LABEL/etc/ssl/apache2" "/etc/ssl/apache2"
/etc/ssl/cert-renew.sh
echo
echo "Success!"
echo "Do not forget to upgrade the MySQL database:"
echo " # mysql_upgrade"
echo
systemctl enable mariadb
systemctl enable apache2
systemctl enable gitea
systemctl restart gitea
systemctl restart apache2
rm /02firstboot

32
git/appliance/MySQL-Backup.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
DIR="/DATA/Backup/MySQL"
if [ -z $1 ]; then
echo "database name missing! use --all for all db's"
exit 1;
elif [ $1 = '--all' ]; then
echo "full backup"
for i in `mysqlshow --defaults-file=/root/.my.cnf | awk '{print $2}' | grep -v Databases`; do
if [ "$i" != "information_schema" ] && [ "$i" != "performance_schema" ]; then
if test -f ${DIR}/${i}.sql; then
echo "Move ${DIR}/${i}.sql to ${DIR}/${i}.sql.1"
mv ${DIR}/${i}.sql ${DIR}/${i}.sql.1
fi
echo "dump ${i} to ${DIR}/${i}.sgl"
mysqldump --defaults-file=/root/.my.cnf --single-transaction --events --opt -QF -r${DIR}/${i}.sql $i
chmod 600 ${DIR}/${i}.sql
fi
done;
elif [ -n $1 ]; then
echo "Starting backup of $1"
if test -f $DIR/$1.sql; then
echo "Move $DIR/$1.sql to $DIR/$1.sql.1"
mv ${DIR}/${1}.sql ${DIR}/${1}.sql.1
fi
mysqldump --defaults-file=/root/.my.cnf --single-transaction --opt -QF -r${DIR}/${1}.sql $1
chmod 600 ${DIR}/${1}.sql
fi
echo "Done"
exit 0;

View File

@ -0,0 +1,8 @@
[Unit]
Description=execute backup tasks
RefuseManualStart=no
RefuseManualStop=yes
[Service]
Type=oneshot
ExecStart=/usr/local/bin/MySQL-Backup.sh --all

View File

@ -0,0 +1,12 @@
[Unit]
Description=execute backup tasks
RefuseManualStart=no
RefuseManualStop=no
[Timer]
Persistent=false
OnCalendar=Sun *-*-* 02:19:00
Unit=backup.service
[Install]
WantedBy=default.target

View File

@ -0,0 +1,8 @@
[Unit]
Description=renew certificates from git store
RefuseManualStart=no
RefuseManualStop=yes
[Service]
Type=oneshot
ExecStart=/etc/ssl/cert-renew.sh

52
git/appliance/cert-renew.sh Executable file
View File

@ -0,0 +1,52 @@
#!/bin/bash
HOST="git"
TLD="example.com"
FQDN="$HOST.$TLD"
LABEL="DATA"
CERT_DIR=/$LABEL/CERTS
CERT_APACHE=/$LABEL/etc/ssl/apache2
GETREPO=""
GETUSER=""
GETPASS=""
function getCurrentVersion() {
# Get hash from latest revision
git log --format=format:%H -1
}
cd $CERT_DIR
if [ -z "$GETREPO" ]; then
GIT_REVISION=0
GIT_NEW_REVISION=1
cd $FQDN
elif [ ! -d "$FQDN" ]; then
GIT_REVISION=0
git clone "https://$GETUSER:$GETPASS@$GETREPO"
cd $FQDN
GIT_NEW_REVISION=$(getCurrentVersion)
else
cd $FQDN
GIT_REVISION=$(getCurrentVersion)
git commit -m "CRON: auto commit"
git fetch
git merge origin/master -m "Auto Merge"
GIT_NEW_REVISION=$(getCurrentVersion)
fi
echo "old: $GIT_REVISION"
echo "new: $GIT_NEW_REVISION"
if [ $GIT_REVISION != $GIT_NEW_REVISION ]
then
echo "Update Apache certificate..."
mkdir -p $CERT_APACHE
cp $CERT_DIR/$FQDN/$FQDN-fullchain.pem $CERT_APACHE/server.crt
cp $CERT_DIR/KEYS/$FQDN-key.pem $CERT_APACHE/server.key
echo "Restarting Apache..."
systemctl is-active --quiet apache2 && systemctl restart apache2
fi
exit 0

View File

@ -0,0 +1,12 @@
[Unit]
Description=renew certificates from git store
RefuseManualStart=no
RefuseManualStop=no
[Timer]
Persistent=false
OnCalendar=Sun *-*-* 04:03:00
Unit=cert-renew.service
[Install]
WantedBy=default.target

2
git/git.cfg Normal file
View File

@ -0,0 +1,2 @@
REPO_NAMES += unitas-letsencrypt
REPO_URI_unitas-letsencrypt = https://git.unitas-network.de/Gentoo/unitas-letsencrypt.git

11
git/mariadb/my.cnf.root Normal file
View File

@ -0,0 +1,11 @@
[mysqladmin]
user = root
password = gentoo
[mysql]
user = root
password = gentoo
[client]
user = root
password = gentoo

View File

@ -0,0 +1,3 @@
# Gitea
dev-vcs/git-crypt
www-apps/gitea

5
git/package.use Normal file
View File

@ -0,0 +1,5 @@
# Apache
www-servers/apache apache2_modules_proxy apache2_modules_proxy_ajp apache2_modules_proxy_connect apache2_modules_proxy_http apache2_modules_proxy_wstunnel
# Gitea
acct-user/git gitea

7
git/world Normal file
View File

@ -0,0 +1,7 @@
app-arch/unzip
app-crypt/certbot-apache
app-crypt/certbot-dns-hetzner
dev-db/mariadb
dev-vcs/git-crypt
www-servers/apache
www-apps/gitea

27
isl/Makefile Normal file
View File

@ -0,0 +1,27 @@
02firstboot = $(CHROOT)/usr/local/bin/02firstboot.start
cert-renew.sh = $(CHROOT)/etc/ssl/cert-renew.sh
install_confproxy = $(CHROOT)/opt/confproxy
CONFPROXY_URL = https://www.islonline.com/system/installer_latest_linux64
systemd-units: appliance/cert-renew.service appliance/cert-renew.timer
cp appliance/cert-renew.service appliance/cert-renew.timer $(CHROOT)/etc/systemd/system/
$(02firstboot): appliance/02firstboot.start
mkdir -p $(CHROOT)/usr/local/bin
cp $< $@
touch $(CHROOT)/02firstboot
$(cert-renew.sh): appliance/cert-renew.sh
mkdir -p $(CHROOT)/etc/ssl
cp $< $@
$(install_confproxy):
# user islcp with fixed uid 950
-RUN useradd --system --comment="ISL ConfProxy User" --home-dir="/opt/confproxy" --shell="/bin/sh" --no-create-home --uid 950 --user-group islcp
# virtual-appliance starts the build environment with sh instead of systemd as pid1; skip start service
RUN sh -c 'wget $(CONFPROXY_URL) -O /tmp/confproxy-installer.bin && sed -e "s:\"systemd\":\"sh\":g" -e "s:status \"Starting ISL Conference Proxy (confproxy.service)\":exit 0:" -i /tmp/confproxy-installer.bin && sh /tmp/confproxy-installer.bin'
preinstall:
postinstall: systemd-units $(02firstboot) $(cert-renew.sh) $(install_confproxy)

50
isl/appliance/02firstboot.start Executable file
View File

@ -0,0 +1,50 @@
#!/bin/bash
# variables
LABEL="DATA"
TLD="example.com"
HOST="isl"
ORGNAME="ISL Online example"
# start
set -e
[ -e /01firstboot ] && exit 0
[ -e /02firstboot ] || exit 0
# Certificate
if [ -x "/$LABEL/etc/ssl/cert-renew.sh" ]; then
# angepaßtes Zertifikat vorhanden (kein example)
if [ ! -L /etc/ssl/cert-renew.sh ]; then
rm -f "/$LABEL/etc/ssl/cert-renew.sh.orig"
mv "/etc/ssl/cert-renew.sh" "/$LABEL/etc/ssl/cert-renew.sh.orig"
else
rm -f "/etc/ssl/cert-renew.sh"
fi
ln -s "/$LABEL/etc/ssl/cert-renew.sh" "/etc/ssl/cert-renew.sh"
else
echo 'Create example certificate...'
mkdir -p "/$LABEL/CERTS/KEYS/"
mkdir -p "/$LABEL/CERTS/$HOST.$TLD"
echo "FQDN = $HOST.$TLD" > "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf"
echo "ORGNAME = $ORGNAME" >> "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf"
echo "ALTNAMES = DNS:$HOST.$TLD , DNS:$TLD" >> "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf"
echo -e "\n[ req ]\ndefault_bits = 4096\ndefault_md = sha256\nprompt = no\nencrypt_key = no\ndistinguished_name = dn\nreq_extensions = req_ext\ndefault_keyfile = ../KEYS/\$FQDN-key.pem\n" >> "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf"
echo -e "\n[ dn ]\nC = DE\nO = \$ORGNAME\nCN = \$FQDN\n" >> "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf"
echo -e "\n[ req_ext ]\nsubjectAltName = \$ALTNAMES" >> "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf"
openssl req -x509 -new -config "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD.cnf" -out "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD-cert.pem" -keyout "/$LABEL/CERTS/KEYS/$HOST.$TLD-key.pem"
cp "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD-cert.pem" "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD-fullchain.pem"
touch "/$LABEL/CERTS/$HOST.$TLD/$HOST.$TLD-chain.pem"
fi
rm -rf /opt/confproxy/ssl
rm -rf /etc/ssl/nginx
mkdir -p /etc/ssl
ln -sf "/$LABEL/opt/confproxy/ssl" "/opt/confproxy/ssl"
ln -sf "/$LABEL/etc/ssl/nginx" "/etc/ssl/nginx"
/etc/ssl/cert-renew.sh
systemctl restart confproxy
rm /02firstboot

View File

@ -0,0 +1,8 @@
[Unit]
Description=renew certificates from git store
RefuseManualStart=no
RefuseManualStop=yes
[Service]
Type=oneshot
ExecStart=/etc/ssl/cert-renew.sh

64
isl/appliance/cert-renew.sh Executable file
View File

@ -0,0 +1,64 @@
#!/bin/bash
HOST="isl"
TLD="example.com"
FQDN="$HOST.$TLD"
LABEL="DATA"
CERT_DIR=/$LABEL/CERTS
CERT_EJABBERD=/$LABEL/etc/ssl/ejabberd
CERT_CONFPROXY=/$LABEL/opt/confproxy/ssl
GETREPO=""
GETUSER=""
GETPASS=""
function getCurrentVersion() {
# Get hash from latest revision
git log --format=format:%H -1
}
cd $CERT_DIR
if [ -z "$GETREPO" ]; then
GIT_REVISION=0
GIT_NEW_REVISION=1
cd $FQDN
elif [ ! -d "$FQDN" ]; then
GIT_REVISION=0
git clone "https://$GETUSER:$GETPASS@$GETREPO"
cd $FQDN
GIT_NEW_REVISION=$(getCurrentVersion)
else
cd $FQDN
GIT_REVISION=$(getCurrentVersion)
git commit -m "CRON: auto commit"
git fetch
git merge origin/master -m "Auto Merge"
GIT_NEW_REVISION=$(getCurrentVersion)
fi
echo "old: $GIT_REVISION"
echo "new: $GIT_NEW_REVISION"
if [ $GIT_REVISION != $GIT_NEW_REVISION ]
then
echo "Update ISL Conference Proxy certificate..."
mkdir -p $CERT_CONFPROXY
cp $CERT_DIR/$FQDN/$FQDN-cert.pem $CERT_CONFPROXY/cert.pem
cp $CERT_DIR/$FQDN/$FQDN-chain.pem $CERT_CONFPROXY/chain.pem
cp $CERT_DIR/$FQDN/$FQDN-key.pem $CERT_CONFPROXY/privkey.pem
echo "Restart ISL Conference Proxy..."
systemctl is-active --quiet confproxy && systemctl restart confproxy
echo "Update Nginx certificate..."
mkdir -p $CERT_NGINX
cp $CERT_DIR/$FQDN/$FQDN-fullchain.pem $CERT_NGINX/nginx.pem
cp $CERT_DIR/KEYS/$FQDN-key.pem $CERT_NGINX/nginx.key
chown nginx:nginx $CERT_NGINX/nginx.*
chmod 444 $CERT_NGINX/nginx.pem
chmod 400 $CERT_NGINX/nginx.key
echo "Restarting Nginx..."
systemctl is-active --quiet nginx && systemctl restart nginx
fi
exit 0

View File

@ -0,0 +1,12 @@
[Unit]
Description=renew certificates from git store
RefuseManualStart=no
RefuseManualStop=no
[Timer]
Persistent=false
OnCalendar=Sun *-*-* 01:47:00
Unit=cert-renew.service
[Install]
WantedBy=default.target

2
isl/package.use Normal file
View File

@ -0,0 +1,2 @@
# Nginx
www-servers/nginx nginx_modules_stream_map nginx_modules_stream_ssl_preread

4
isl/world Normal file
View File

@ -0,0 +1,4 @@
app-crypt/certbot-nginx
dev-perl/Authen-Radius
dev-perl/perl-ldap
www-servers/nginx

View File

@ -18,6 +18,7 @@ dev-python/sphinxcontrib-htmlhelp
dev-python/sphinxcontrib-serializinghtml
dev-python/sphinxcontrib-qthelp
dev-python/smpplib
dev-python/grpcio-tools
# grunt, wird nur zur privacyIDEA-Translation benötigt
dev-nodejs/*

View File

@ -8,9 +8,12 @@ sys-devel/gcc fortran
sci-libs/hdf5 -cxx -fortran -hl
# RADIUS (ohne Samba kein rlm_mschap.so)
net-dialup/freeradius kerberos ldap mysql -python samba
net-fs/samba ads gnutls ldap winbind
sys-libs/ldb ldap
net-dialup/freeradius kerberos ldap mysql python samba
net-dns/bind-tools gssapi
net-fs/samba ads gnutls ldap python winbind
sys-libs/ldb ldap python
sys-libs/tdb python
sys-libs/tevent python
# LDAP
net-nds/openldap overlays perl sasl

View File

@ -77,6 +77,7 @@ zabbix-syslog:
mkdir -p $(CHROOT)/etc/zabbix/scripts/lib
cp zabbix/zabbix-syslog/zabbix_syslog_create_urls.pl $(CHROOT)/etc/zabbix/scripts/zabbix_syslog_create_urls.pl
cp zabbix/zabbix-syslog/zabbix_syslog_lkp_host.pl $(CHROOT)/etc/zabbix/scripts/zabbix_syslog_lkp_host.pl
cp zabbix/zabbix-syslog/Template_syslog.xml $(CHROOT)/etc/zabbix/scripts/Template_syslog.xml
cp zabbix/zabbix-syslog/zabbix_syslog.cfg $(CHROOT)/etc/zabbix/zabbix_syslog.cfg
cp zabbix/zabbix-syslog/lib/ZabbixAPI.pm $(CHROOT)/etc/zabbix/scripts/lib/ZabbixAPI.pm
cp zabbix/zabbix-syslog/70-zabbix_rsyslog.conf $(CHROOT)/etc/rsyslog.d/70-zabbix_rsyslog.conf
@ -84,22 +85,56 @@ zabbix-syslog:
chmod +x $(CHROOT)/etc/zabbix/scripts/zabbix_syslog_create_urls.pl
chmod +x $(CHROOT)/etc/zabbix/scripts/zabbix_syslog_lkp_host.pl
fping:
zabbix-config:
sed -i \
-e 's:# PidFile=/tmp/zabbix_agent2.pid:PidFile=/run/zabbix/zabbix_agent2.pid:' \
-e 's:# LogFile=/tmp/zabbix_agent2.log:LogFile=/var/log/zabbix/zabbix_agent2.log:' \
$(CHROOT)/etc/zabbix/zabbix_agent2.conf
sed -i \
-e 's:LogFile=/tmp/zabbix_proxy.log:LogFile=/var/log/zabbix/zabbix_proxy.log:' \
-e 's:# PidFile=/tmp/zabbix_proxy.pid:PidFile=/run/zabbix/zabbix_proxy.pid:' \
$(CHROOT)/etc/zabbix/zabbix_proxy.conf
sed -i \
-e 's:LogFile=/tmp/zabbix_server.log:LogFile=/var/log/zabbix/zabbix_server.log:' \
-e 's:# PidFile=/tmp/zabbix_server.pid:PidFile=/run/zabbix/zabbix_server.pid:' \
-e 's:# StartPollers=5:StartPollers=15:' \
-e 's:# StartIPMIPollers=0:StartIPMIPollers=5:' \
-e 's:# StartPollersUnreachable=1:StartPollersUnreachable=15:' \
-e 's:# StartPingers=1:StartPingers=25:' \
-e 's:# StartDiscoverers=1:StartDiscoverers=5:' \
-e 's:# JavaGateway=:JavaGateway=127.0.0.1:' \
-e 's:# VMwareCacheSize=8M:VMwareCacheSize=16M:' \
-e 's:# VMwareTimeout=10:VMwareTimeout=30:' \
-e 's:# SNMPTrapperFile=/tmp/zabbix_traps.tmp:SNMPTrapperFile=/var/log/snmptt/snmptt.log:' \
-e 's:# CacheSize=8M:CacheSize=32M:' \
-e 's:# HistoryIndexCacheSize=4M:HistoryIndexCacheSize=8M:' \
-e 's:Timeout=4:Timeout=10:' \
-e 's:^# AlertScriptsPath=.*:AlertScriptsPath=/var/lib/zabbix/alertscripts:' \
-e 's:^# ExternalScripts=.*:ExternalScripts=/var/lib/zabbix/externalscripts:' \
-e 's:# ProxyConfigFrequency=3600:ProxyConfigFrequency=360:' \
-e 's:# ProxyDataFrequency=1:ProxyDataFrequency=60:' \
$(CHROOT)/etc/zabbix/zabbix_server.conf
fping-perm:
chmod u=rwsx,g=rx,o=rx $(CHROOT)/usr/sbin/fping
chmod u=rwsx,g=rx,o=rx $(CHROOT)/usr/sbin/fping6
snmp:
cp snmp/snmpd.conf $(CHROOT)/etc/snmp/snmpd.conf
cp snmp/snmptrapd.conf $(CHROOT)/etc/snmp/snmptrapd.conf
cp snmp/snmptt.conf $(CHROOT)/etc/snmp/snmptt.conf
snmp-conf:
cp -f snmp/snmpd.conf $(CHROOT)/etc/snmp/snmpd.conf
cp -f snmp/snmptrapd.conf $(CHROOT)/etc/snmp/snmptrapd.conf
cp -f snmp/snmptt.conf $(CHROOT)/etc/snmp/snmptt.conf
sed -i \
-e 's:net_snmp_perl_enable = 0:net_snmp_perl_enable = 1:' \
-e 's:translate_integers = 1:translate_integers = 0:' \
-e 's:#mibs_environment = ALL:mibs_environment = ALL:' \
-e 's.#date_time_format =.date_time_format = %H:%M:%S %Y/%m/%d.' \
-e 's:daemon_uid = snmptt:daemon_uid = zabbix:' \
-e 's:log_system_enable = 0:log_system_enable = 1:' \
-e 's:unknown_trap_log_enable = 0:unknown_trap_log_enable = 1:' \
-e 's:^mode = .*:mode = standalone:' \
-e 's:^net_snmp_perl_enable = .*:net_snmp_perl_enable = 1:' \
-e 's:^translate_log_trap_oid = .*:translate_log_trap_oid = 2:' \
-e 's:^translate_integers = .*:translate_integers = 0:' \
-e 's:^#mibs_environment = .*:mibs_environment = ALL:' \
-e 's.^#date_time_format =.date_time_format = %H:%M:%S %Y/%m/%d.' \
-e 's:^daemon_uid = .*:daemon_uid = zabbix:' \
-e 's:^log_system_enable = .*:log_system_enable = 1:' \
-e 's:^unknown_trap_log_enable = .*:unknown_trap_log_enable = 1:' \
-e 's:^syslog_level = .*:syslog_level = err:' \
-e 's:^syslog_system_level = .*:syslog_system_level = err:' \
$(CHROOT)/etc/snmp/snmptt.ini
mkdir -p $(CHROOT)/var/log/snmptt
chmod 0775 $(CHROOT)/var/log/snmptt
@ -107,4 +142,4 @@ snmp:
preinstall:
postinstall: systemd-units $(02firstboot) $(cert-renew.sh) $(CHROOT)/var/lib/mysql apache-php zabbix-services zabbix-webapp $(zabbix-userparameter) zabbix-syslog fping snmp
postinstall: systemd-units $(02firstboot) $(cert-renew.sh) $(CHROOT)/var/lib/mysql apache-php zabbix-services zabbix-webapp $(zabbix-userparameter) zabbix-syslog zabbix-config fping-perm snmp-conf

View File

@ -93,8 +93,32 @@ if [ "$zabbixtype" == "server" ]; then
ln -s /$LABEL/var/www/localhost/htdocs/zabbix/conf/zabbix.conf.php /var/www/localhost/htdocs/zabbix/conf/zabbix.conf.php
fi
fi
if [ ! -L /var/lib/net-snmp ]; then
echo 'Linking SNMP data directory...'
if [ ! -d "/$LABEL/var/lib/net-snmp" ]; then
mkdir -p /$LABEL/var/lib/net-snmp
cp -a /var/lib/net-snmp/. /$LABEL/var/lib/net-snmp
fi
rm -rf /var/lib/net-snmp.orig
mv /var/lib/net-snmp /var/lib/net-snmp.orig
ln -s /$LABEL/var/lib/net-snmp /var/lib/net-snmp
fi
fi
# Zabbix home directory
if [ ! -L /var/lib/zabbix ]; then
echo 'Linking Zabbix home directory...'
if [ ! -d "/$LABEL/var/lib/zabbix" ]; then
mkdir -p /$LABEL/var/lib/zabbix
chown zabbix:zabbix /$LABEL/var/lib/zabbix
cp -a /var/lib/zabbix/. /$LABEL/var/lib/zabbix
fi
rm -rf /var/lib/zabbix.orig
mv /var/lib/zabbix /var/lib/zabbix.orig
ln -s /$LABEL/var/lib/zabbix /var/lib/zabbix
fi
# Database
if [ ! -L /var/lib/mysql ]; then
systemctl stop mariadb
@ -102,6 +126,7 @@ if [ ! -L /var/lib/mysql ]; then
echo 'Initialize MariaDB...'
mkdir -p "/$LABEL/var/lib"
rm -rf "/$LABEL/var/lib/mysql"
rm -rf "/$LABEL/var/lib/mysql.orig"
cp -a "/var/lib/mysql" "/$LABEL/var/lib/mysql"
mv "/var/lib/mysql" "/$LABEL/var/lib/mysql.orig"
ln -s "/$LABEL/var/lib/mysql" "/var/lib/mysql"
@ -177,7 +202,7 @@ if [ "$zabbixtype" == "server" ]; then
fi
systemctl enable mariadb
systemctl enable zabbix-agentd
systemctl enable zabbix-agent2
if [ "$zabbixtype" == "server" ]; then
systemctl enable zabbix-server
systemctl enable apache2
@ -185,7 +210,7 @@ else
systemctl enable zabbix-proxy
fi
systemctl restart zabbix-agentd
systemctl restart zabbix-agent2
if [ "$zabbixtype" == "server" ]; then
systemctl restart zabbix-server
systemctl restart apache2

View File

@ -1,3 +1,2 @@
# Zabbix
net-analyzer/zabbix
net-analyzer/snmptt

View File

@ -1,2 +1,2 @@
# nur LTS-Versionen 5.0.x bauen
>=net-analyzer/zabbix-5.1
# nur LTS-Versionen 6.0.x bauen
>=net-analyzer/zabbix-6.1

View File

@ -3,10 +3,10 @@ app-admin/rsyslog dbi mysql openssl snmp systemd
app-eselect/eselect-php apache2
app-text/poppler -introspection -jpeg -jpeg2k
dev-java/openjdk-bin headless-awt
dev-lang/php apache2 bcmath curl gd ldap mysql mysqli sockets sysvipc truetype xmlreader xmlwriter
dev-lang/php apache2 bcmath curl gd ldap mysql mysqli odbc sockets sysvipc truetype xmlreader xmlwriter
media-libs/gd jpeg png
net-analyzer/zabbix curl frontend java ldap libxml2 mysql openipmi -postgres proxy server snmp ssh xmpp
net-analyzer/zabbix-headers curl frontend java ldap libxml2 mysql openipmi -postgres proxy server snmp ssh xmpp
net-analyzer/zabbix -agent agent2 curl frontend java ldap libxml2 mysql odbc openipmi -postgres proxy server snmp ssh xmpp
net-analyzer/zabbix-headers -agent agent2 curl frontend java ldap libxml2 mysql odbc openipmi -postgres proxy server snmp ssh xmpp
net-analyzer/net-snmp perl
net-analyzer/fping suid
net-print/cups-filters -foomatic -postscript

View File

@ -1 +1,2 @@
#mibs +SOME-OTHER-SPIFFY-MIB
mibs +ALL

View File

@ -1,16 +1,17 @@
app-admin/rsyslog
dev-db/mariadb
dev-db/phpmyadmin
dev-java/openjdk-bin:8
dev-java/openjdk-bin:11
dev-perl/Config-General
dev-perl/JSON-RPC
dev-perl/JSON-XS
dev-perl/libwww-perl
dev-tcltk/expect
net-analyzer/l2dm-lldp
net-analyzer/snmp-lldp
net-analyzer/net-snmp
net-analyzer/nmap
net-analyzer/snmptt
net-analyzer/traceroute
net-dns/bind-tools
net-im/sendxmpp
net-misc/netkit-telnetd

View File

@ -1,2 +1,2 @@
REPO_NAMES = unitas-zabbix
REPO_NAMES += unitas-zabbix
REPO_URI_unitas-zabbix = https://git.unitas-network.de/Gentoo/unitas-zabbix.git

View File

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>2.0</version>
<date>2015-03-13T14:27:56Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template_Syslog</template>
<name>Template_Syslog</name>
<description/>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>Log</name>
</application>
</applications>
<items>
<item>
<name>Syslog</name>
<type>2</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>syslog</key>
<delay>0</delay>
<history>3</history>
<trends>365</trends>
<status>0</status>
<value_type>2</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Log</name>
</application>
</applications>
<valuemap/>
<logtimefmt>yyyyxMMxddxhhxmmxssxxxxxx</logtimefmt>
</item>
</items>
<discovery_rules/>
<macros/>
<templates/>
<screens/>
</template>
</templates>
<triggers>
<trigger>
<expression>({Template_Syslog:syslog.str(.alert)}=1)and({Template_Syslog:syslog.nodata(900)}=0)</expression>
<name>[SYSLOG] Alert message received</name>
<url/>
<status>0</status>
<priority>4</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>({Template_Syslog:syslog.str(.crit)}=1)and({Template_Syslog:syslog.nodata(900)}=0)</expression>
<name>[SYSLOG] Critical message received</name>
<url/>
<status>0</status>
<priority>3</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>({Template_Syslog:syslog.str(.emerg)}=1)and({Template_Syslog:syslog.nodata(900)}=0)</expression>
<name>[SYSLOG] Emergency message received</name>
<url/>
<status>0</status>
<priority>5</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>({Template_Syslog:syslog.str(.err)}=1)and({Template_Syslog:syslog.nodata(900)}=0)</expression>
<name>[SYSLOG] Error received</name>
<url/>
<status>0</status>
<priority>2</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
<trigger>
<expression>({Template_Syslog:syslog.str(.warning)}=1)and({Template_Syslog:syslog.nodata(900)}=0)</expression>
<name>[SYSLOG] Warning received</name>
<url/>
<status>0</status>
<priority>1</priority>
<description/>
<type>0</type>
<dependencies/>
</trigger>
</triggers>
</zabbix_export>

View File

@ -9,7 +9,7 @@ use lib "$Bin/lib";
use Data::Dumper;
use Config::General;
use ZabbixAPI;
our $VERSION = 3.1;
our $VERSION = 4.0;
my $conf;
$conf = eval {Config::General->new('/usr/local/etc/zabbix_syslog.cfg')};
if ($@) {

View File

@ -13,7 +13,7 @@ use English '-no_match_vars';
use MIME::Base64 qw(encode_base64);
use IO::Socket::INET;
use Storable qw(lock_store lock_retrieve);
our $VERSION = 3.1;
our $VERSION = 4.0;
my $CACHE_TIMEOUT = 600;
my $CACHE_DIR = '/tmp/zabbix_syslog_cache_n';
@ -193,6 +193,7 @@ sub zabbix_send {
sprintf
"<req>\n<host>%s</host>\n<key>%s</key>\n<data>%s</data>\n</req>\n",
encode_base64($hostname), encode_base64($item), encode_base64($data);
my $packet = "ZBXD\1" . pack('V', length($request)) . "\0\0\0\0" . $request;
my $sock = IO::Socket::INET->new(
PeerAddr => $zabbixserver,
@ -202,7 +203,8 @@ sub zabbix_send {
);
die "Could not create socket: $ERRNO\n" unless $sock;
$sock->send($request);
$sock->send($packet);
my @handles = IO::Select->new($sock)->can_read($SOCK_TIMEOUT);
if ( $debug > 0 ) { print "host - $hostname, item - $item, data - $data\n"; }