Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 2190

Přidáno uživatelem Ondřej Fibich před asi 11 roky(ů)

freenetis-redirection_2.2.0

Opravy:
- podpora localhostu v HTTP redirectoru
- closes #768: Opravit chyby baliku zjiatene lintianem, obsahuje: * manualove stranky skriptu * oprava prav k souborum * copywriding v /usr/share * changelog v /usr/share * oprava drobnych chyb

Zobrazit rozdíly:

freenetis/branches/1.1/AUTHORS
Tomáš Dulík <dulik@unart.cz>
Ondřej Fibich <ondrej.fibich@gmail.com>
Michal Kliment <kliment@freenetis.org>
David Raška <jeffraska@gmail.com>
Jiří Sviták <j.svitak@unart.cz>
Roman Ševčík <sevcik.roman@mail.unart.cz>
Copyright 2008-2013 Tomáš Dulík <dulik@unart.cz>
Copyright 2010-2013 Ondřej Fibich <ondrej.fibich@gmail.com>
Copyright 2018-2013 Michal Kliment <kliment@freenetis.org>
Copyright 2012-2013 David Raška <jeffraska@gmail.com>
Copyright 2008-2012 Jiří Sviták <j.svitak@unart.cz>
Copyright 2008-2012 Roman Ševčík <sevcik.roman@mail.unart.cz>
freenetis/branches/1.1/application/vendors/deb/freenetis-redirection/changelog
freenetis-redirection (1.9.0) stable; urgency=low
* First release
-- Ondrej Fibich <ondrej.fibich@gmail.com> Tue, 07 Aug 2012 15:05:33 +0200
freenetis-redirection (2.2.0) stable; urgency=high
* HTTP redirector supports localhost
* man pages for all scripts
* DEB package fixes (#768)
-- Ondrej Fibich <ondrej.fibich@gmail.com> Tue, 10 Sep 2013 10:57:19 +0200
freenetis-redirection (1.9.1) stable; urgency=high
* Fixes starting of HTTP redirector
-- Ondrej Fibich <ondrej.fibich@gmail.com> Mon, 13 Aug 2012 12:58:52 +0200
freenetis-redirection (2.1.0) stable; urgency=high
* Printing of version (#642)
* Support for multiple input interfaces (#683)
-- Michal Kliment <kliment@freenetis.org> Tue, 9 July 2013 14:21:03 +0200
freenetis-redirection (2.0.0) stable; urgency=high
* Support for debian wheezy (#261)
* Checking of working modules during running and its repairment (#549)
* start-stop-deamon (#568)
-- Ondrej Fibich <ondrej.fibich@gmail.com> Wed, 29 May 2013 15:53:03 +0200
freenetis-redirection (1.9.3) stable; urgency=high
* Improved building of ipset on squeeze (#454)
-- Ondrej Fibich <ondrej.fibich@gmail.com> Wed, 23 Jan 2013 14:31:56 +0100
freenetis-redirection (1.9.2) stable; urgency=high
* Fixes wrong initialization ipset rules (#399)
* Fixes printing of error message if socket cannot be open in HTTP redirector (#399)
-- Ondrej Fibich <ondrej.fibich@gmail.com> Tue, 23 Oct 2012 10:32:03 +0200
freenetis-redirection (1.9.3) stable; urgency=high
* Improved building of ipset on squeeze (#454)
-- Ondrej Fibich <ondrej.fibich@gmail.com> Wed, 23 Jan 2013 14:31:56 +0100
freenetis-redirection (1.9.1) stable; urgency=high
* Fixes starting of HTTP redirector
-- Ondrej Fibich <ondrej.fibich@gmail.com> Mon, 13 Aug 2012 12:58:52 +0200
freenetis-redirection (2.0.0) stable; urgency=high
* Support for debian wheezy (#261)
* Checking of working modules during running and its repairment (#549)
* start-stop-deamon (#568)
-- Ondrej Fibich <ondrej.fibich@gmail.com> Wed, 29 May 2013 15:53:03 +0200
freenetis-redirection (2.1.0) stable; urgency=high
* Printing of version (#642)
* Support for multiple input interfaces (#683)
-- Michal Kliment <kliment@freenetis.org> Tue, 9 July 2013 14:21:03 +0200
freenetis-redirection (1.9.0) stable; urgency=low
* First release
-- Ondrej Fibich <ondrej.fibich@gmail.com> Tue, 07 Aug 2012 15:05:33 +0200
freenetis/branches/1.1/application/vendors/deb/freenetis-redirection/conffiles
/etc/freenetis/freenetis-redirection.conf
/etc/init.d/freenetis-redirection
freenetis/branches/1.1/application/vendors/deb/freenetis-redirection/debianization.sh
mkdir deb_packages/tmp
cd deb_packages/tmp
mkdir DEBIAN
mkdir etc
mkdir etc/init.d
mkdir etc/freenetis
mkdir usr
mkdir usr/sbin
mkdir -m 755 DEBIAN
mkdir -m 755 etc
mkdir -m 755 etc/init.d
mkdir -m 755 etc/freenetis
mkdir -m 755 usr
mkdir -m 755 usr/sbin
mkdir -m 755 usr/share
mkdir -m 755 usr/share/doc
mkdir -m 755 usr/share/doc/${NAME}
mkdir -m 755 usr/share/man
mkdir -m 755 usr/share/man/man1
mkdir -m 755 usr/share/man/man8
# doc ##########################################################################
# change log
cat ../../${NAME}/changelog >> usr/share/doc/${NAME}/changelog
# debian change log is same
cp usr/share/doc/${NAME}/changelog usr/share/doc/${NAME}/changelog.Debian
# copyright
echo "This package was debianized by Ondrej Fibich <ondrej.fibich@gmail.com> on `date -R`" >> usr/share/doc/${NAME}/copyright
echo "It was downloaded from <http://freenetis.org/>\n" >> usr/share/doc/${NAME}/copyright
echo "Copyright:" >> usr/share/doc/${NAME}/copyright
cat ../../../../../AUTHORS >> usr/share/doc/${NAME}/copyright
echo "\nLicense:" >> usr/share/doc/${NAME}/copyright
cat ../../../../../COPYING >> usr/share/doc/${NAME}/copyright
echo "\nOn Debian systems, the complete text of the GNU General" >> usr/share/doc/${NAME}/copyright
echo "Public License can be found in \`/usr/share/common-licenses/GPL-3'.\n" >> usr/share/doc/${NAME}/copyright
echo -n "The Debian packaging is (C) `date +%Y`, Ondrej Fibich <ondrej.fibich@gmail.com> and" >> usr/share/doc/${NAME}/copyright
echo " it is licensed under the GPL, see above.\n" >> usr/share/doc/${NAME}/copyright
# man pages
cp ../../../redirection/man/freenetis-redirection.8 usr/share/man/man8/
cp ../../../redirection/man/freenetis-http-302-redirection.1 usr/share/man/man1/
# rights
chmod 644 usr/share/doc/${NAME}/changelog usr/share/doc/${NAME}/changelog.Debian \
usr/share/doc/${NAME}/copyright usr/share/man/man8/freenetis-redirection.8 \
usr/share/man/man1/freenetis-http-302-redirection.1
# compress doc
gzip --best usr/share/doc/${NAME}/changelog
gzip --best usr/share/doc/${NAME}/changelog.Debian
gzip --best usr/share/man/man8/freenetis-redirection.8
gzip --best usr/share/man/man1/freenetis-http-302-redirection.1
# copy content of package ######################################################
cp ../../../redirection/freenetis-redirection.init.sh etc/init.d/${NAME}
cp ../../../redirection/freenetis-redirection.sh usr/sbin/freenetis-redirection
cp ../../../redirection/freenetis-http-302-redirection.py usr/sbin/
cp ../../../redirection/freenetis-http-302-redirection.py usr/sbin/freenetis-http-302-redirection
cp ../../../redirection/freenetis-redirection.conf etc/freenetis/
# count size
......
echo "Installed-Size: ${SIZE}" >> DEBIAN/control
if [ "$DEBIAN" = lenny ] || [ "$DEBIAN" = squeeze ]; then
echo "Depends: coreutils, ipset, wget, grep, procps, python, ipset-source, module-assistant, lsb-release" >> DEBIAN/control
echo "Depends: coreutils (>= 6.10-6), ipset, wget (>= 1.11-4.1), grep (>= 2.5.3), procps, python, ipset-source, module-assistant, lsb-release" >> DEBIAN/control
else
echo "Depends: coreutils, ipset, wget, grep, procps, python, lsb-release" >> DEBIAN/control
echo "Depends: coreutils (>= 6.10-6), ipset, wget (>= 1.11-4.1), grep (>= 2.5.3), procps, python, lsb-release" >> DEBIAN/control
fi
cat ../../${NAME}/control >> DEBIAN/control
# change log
cat ../../${NAME}/changelog >> DEBIAN/changelog
# copywriting
echo "This package was debianized by Ondrej Fibich <ondrej.fibich@gmail.com> on" >> DEBIAN/copyright
date -R >> DEBIAN/copyright
echo "" >> DEBIAN/copyright
echo "It was downloaded from <http://freenetis.org/>" >> DEBIAN/copyright
echo "" >> DEBIAN/copyright
echo "Upstream Author:" >> DEBIAN/copyright
cat ../../../../../AUTHORS >> DEBIAN/copyright
echo "" >> DEBIAN/copyright
echo "License:" >> DEBIAN/copyright
cat ../../../../../COPYING >> DEBIAN/copyright
# scripts ######################################################################
cat ../../${NAME}/postinst >> DEBIAN/postinst
......
cat ../../${NAME}/postrm >> DEBIAN/postrm
cat ../../${NAME}/templates >> DEBIAN/templates
cat ../../${NAME}/config >> DEBIAN/config
cp -a -f ../../${NAME}/conffiles DEBIAN/conffiles
chmod +x DEBIAN/prerm DEBIAN/postinst DEBIAN/postrm DEBIAN/config
chmod 644 DEBIAN/control DEBIAN/md5sums DEBIAN/templates DEBIAN/conffiles \
etc/freenetis/freenetis-redirection.conf
chmod 755 DEBIAN/prerm DEBIAN/postinst DEBIAN/postrm DEBIAN/config etc/init.d/${NAME} \
usr/sbin/freenetis-redirection usr/sbin/freenetis-http-302-redirection
# create deb ###################################################################
# change owner of files to root (security)
freenetis/branches/1.1/application/vendors/deb/freenetis-redirection/postinst
# Make post install things
# 1) Rights
# 1) Startup at boot
# set rights
chmod u+x /etc/init.d/${NAME}
chmod u+x /usr/sbin/freenetis-redirection
chmod u+x /usr/sbin/freenetis-http-302-redirection.py
# 2) Startup at boot
# set on fire after boot
update-rc.d ${NAME} defaults
update-rc.d freenetis-redirection defaults
exit 0
freenetis/branches/1.1/application/vendors/deb/freenetis-redirection/postrm
CONFIGFILE=/etc/freenetis/freenetis-redirection.conf
# disable startup from update-rc.d
update-rc.d -f ${NAME} remove
update-rc.d -f freenetis-redirection remove
# remove all configuration if purge
if [ "$1" = purge ]; then
......
# remove dir if empty
[ "$(ls -A /etc/freenetis)" ] || rm -rf /etc/freenetis
fi
#DEBHELPER#
freenetis/branches/1.1/application/vendors/deb/freenetis-redirection/prerm
#!/bin/sh
# FreenetIS-redirection DEB: actions before uninstalling of package
set -e
. /usr/share/debconf/confmodule
NAME=freenetis-redirection
# stop daemon
/etc/init.d/$NAME stop
if [ -x /usr/sbin/invoke-rc.d ]; then
invoke-rc.d $NAME restart 3>/dev/null || true
else
/etc/init.d/$NAME stop 3>/dev/null || true
fi
#DEBHELPER#
exit 0
freenetis/branches/1.1/application/vendors/deb/freenetis-redirection/templates
Template: freenetis-redirection/hack_reload
Type: boolean
Default: true
Description: Hack:
Hack for propper working of loading package.
Description: Hack for propper working of loading package?
freenetis/branches/1.1/application/vendors/redirection/freenetis-http-302-redirection.py
sys.exit(2)
# url for redirect
if not re.match("^(https?)://([\w-]+\.)+[\w-]+(/[\w -./?\%&=]*)?$", sys.argv[2].strip()):
if not re.match("^(https?)://(([\w-]+\.)+[\w-]+|localhost)(/[\w -./?\%&=]*)?$", sys.argv[2].strip()):
logging.critical("Second argument has to be a URL.. Terminating")
sys.exit(3)
freenetis/branches/1.1/application/vendors/redirection/freenetis-redirection.init.sh
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop freenetis synchronization daemon
# Description: FreenetIS synchronization script.
# Description: FreenetIS redirection synchronization script.
### END INIT INFO
################################################################################
......
# email kliment@freenetis.org, sevcik.roman@slfree.net #
# #
# name freenetis-redirection.init.sh #
# version 2.1 #
# version 2.2 #
# #
################################################################################
......
REDIRECTION_PIDFILE=/var/run/freenetis-redirection.pid
# Path to HTTP 302 redirector
REDIRECTION_HTTP_REDIRECTOR=/usr/sbin/freenetis-http-302-redirection.py
REDIRECTION_HTTP_REDIRECTOR=/usr/sbin/freenetis-http-302-redirection
# Path to HTTP 302 redirector
REDIRECTION_HTTP_REDIRECTOR_PIDFILE=/var/run/freenetis-http-302-redirection.pid
#Load variables
if [ -f ${CONFIG} ]; then
. $CONFIG;
. $CONFIG;
else
echo "Config file is missing at path $CONFIG."
echo "Terminating..."
exit 0
echo "Config file is missing at path $CONFIG."
echo "Terminating..."
exit 0
fi
# Tests whether program is running
......
then
echo -n "Starting FreenetIS redirection daemon: "
start-stop-daemon --start --quiet --make-pidfile --pidfile="$REDIRECTION_PIDFILE" --background --exec "$REDIRECTION_FILE" -- run "$LOG_FILE" 2>> "$LOG_FILE"
sleep 2
sleep 2
if [ $? -eq 0 ];
then
echo "OK"
......
echo " start - starts FreenetIS redirection daemon"
echo " stop - stops FreenetIS redirection daemon"
echo " restart - restarts FreenetIS redirection daemon"
echo " reload - reloads configuration and restarts FreenetIS redirection daemon"
echo " status - returns actual status of FreenetIS redirection daemon"
echo " version - prints version"
echo " help - prints help"
......
exit 0
;;
restart)
restart|reload|force-reload) # reload is same thing as reload
stop_redirection
start_redirection
exit 0
freenetis/branches/1.1/application/vendors/redirection/freenetis-redirection.sh
# email kliment@freenetis.org, sevcik.roman@slfree.net #
# #
# name freenetis-redirection.sh #
# version 2.1 #
# version 2.2 #
# #
################################################################################
# Version
VERSION="2.1"
VERSION="2.2"
# Load variables from config file
CONFIG=/etc/freenetis/freenetis-redirection.conf
......
WGET=/usr/bin/wget
# Path to HTTP 302 redirector
REDIRECTION_HTTP_REDIRECTOR=/usr/sbin/freenetis-http-302-redirection.py
REDIRECTION_HTTP_REDIRECTOR=/usr/sbin/freenetis-http-302-redirection
# Path to HTTP 302 redirector
REDIRECTION_HTTP_REDIRECTOR_PIDFILE=/var/run/freenetis-http-302-redirection.pid
freenetis/branches/1.1/application/vendors/redirection/man/freenetis-http-302-redirection.1
.\" Manpage for freenetis-http-302-redirection.1.
.\" Contact ondrej.fibich@gmail.com.in to correct errors or typos.
.TH man 1 "09 September 2013" "1.0" "freenetis-http-302-redirection man page"
.SH NAME
freenetis-http-302-redirection \- HTTP redirector for FreenetIS redirection
.SH SYNOPSIS
freenetis-http-302-redirection port freenetis_path [log_file]
.SH DESCRIPTION
freenetis-http-302-redirection is a part of FreenetIS redirection it servers for listening on a port and redirect all its traffic to FreenetIS. This script should not be used directly.
.SH OPTIONS
The freenetis-http-302-redirection should not be run directly. It is commonly managed by an freenetis-redirection(8) demon.
It takes following arguments:
port Port number on which it listens for incoming HTTP connections
freenetis_path URL to base path of FreenetIS
log_file Optional file for logging
.SH AUTHOR
Ondrej Fibich <ondrej.fibich@gmail.com>
freenetis/branches/1.1/application/vendors/redirection/man/freenetis-redirection.8
.\" Manpage for freenetis-redirection.
.\" Contact ondrej.fibich@gmail.com.in to correct errors or typos.
.TH man 8 "09 September 2013" "1.0" "freenetis-redirection man page"
.SH NAME
freenetis-redirection \- redirection IP policy demon for FreenetIS
.SH SYNOPSIS
freenetis-redirection action [log_file]
.SH DESCRIPTION
freenetis-redirection demon is a part of FreenetIS redirection and it serves for redirection IP policy of IS FreenetIS. This script should not be used directly.
.SH OPTIONS
The freenetis-redirection should not be run directly. It is commonly managed by an init.d script.
It takes at least one argument action which may contains following values:
start - creates firewall rules and ipsets for redirection
stop - deletes firewall rules and ipsets for redirection
restart - deletes and recreates firewall rules and ipsets for redirection
sync - sync content of ipsets with FreenetIS
run - complete redirection in endless loop
version - print version
help - prints help for redirection
It can also take a second parameter that is a file that is used for logging.
.SH AUTHOR
Michal Kliment <kliment@freenetis.org>,
Roman Sevcik <sevcik.roman@slfree.net>
freenetis/branches/1.1/application/vendors/redirection/test/test.sh
#!/bin/bash
################################################################################
#
# Test script that access some web pages (should be run on a redirected device)
#
################################################################################
WWWs=('http://seznam.cz' 'http://google.com')
while true
do
for url in "${WWWs[@]}"
do
echo `date +"%Y-%m-%d %H:%M:%S"`" Connecting to: $url" 1>&2
out=`wget -q -O - "$url"`
echo `date +"%Y-%m-%d %H:%M:%S"`" Downloaded (\$? = $?)"
echo ""
done
done
freenetis/branches/1.1/application/vendors/redirection/test/http-302-redirection-test.sh
#!/bin/bash
################################################################################
#
# Test script that access some web pages (should be run on a redirected device)
#
################################################################################
WWWs=('http://seznam.cz' 'http://google.com')
while true
do
for url in "${WWWs[@]}"
do
echo `date +"%Y-%m-%d %H:%M:%S"`" Connecting to: $url" 1>&2
out=`wget -q -O - "$url"`
echo `date +"%Y-%m-%d %H:%M:%S"`" Downloaded (\$? = $?)"
echo ""
done
done

Také k dispozici: Unified diff