diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ca2a1d9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +debian/*.debhelper.log +debian/*.substvars +debian/alternc-* +debian/files +debian/.debhelper +debian/debhelper-build-stamp +*.gpg diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..776c165 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,15 @@ +alternc-proxy (0.0.0+211221102517) UNRELEASED; urgency=medium + + * autobuild + * autobuild + * autobuild + + -- Camille Lafitte Tue, 21 Dec 2021 10:25:17 +0100 + +alternc-proxy (0.0.1) stable; urgency=low + + * Provide a proxy template + Redirect domain to other server + + -- Camille Lafitte Tue, 21 Dec 2021 09:52:00 +0200 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..d86cfdf --- /dev/null +++ b/debian/control @@ -0,0 +1,16 @@ +Source: alternc-proxy +Section: admin +Priority: optional +Maintainer: Benjamin Sonntag +Build-Depends: debhelper (>= 9), + devscripts, + git +Standards-Version: 3.9.8 + +Package: alternc-proxy +Architecture: all +Depends: apt-utils, + , debconf + , alternc (>= 3.5.0~rc1), +Description: Provide proxy templating +Homepage: https://alternc.com/ \ No newline at end of file diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..21ded8d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,29 @@ + +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: alternc-acme +Source: https://github.com/AlternC/alternc-acme + +Files: * +Copyright: Copyright 2015-2017 AlternC's development Team +License: GPL-3 + This program is free software; you can redistribute it + and/or modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later + version. + . + This program is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied + warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the GNU General Public License for more + details. + . + You should have received a copy of the GNU General Public + License along with this package; if not, write to the Free + Software Foundation, Inc., 51 Franklin St, Fifth Floor, + Boston, MA 02110-1301 USA + . + On Debian systems, the full text of the GNU General Public + License version 3 can be found in the file + `/usr/share/common-licenses/GPL-3'. + diff --git a/debian/install b/debian/install new file mode 100644 index 0000000..a21a7ee --- /dev/null +++ b/debian/install @@ -0,0 +1 @@ +src/* . \ No newline at end of file diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 0000000..d390001 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,32 @@ +#! /bin/bash +# postinst script +# + +set -e + +case "$1" in + configure) + + if [ -e /usr/share/apache2/apache2-maintscript-helper ]; then + . /usr/share/apache2/apache2-maintscript-helper + apache2_has_module proxy_http || apache2_invoke enmod proxy_http 2>/dev/null || exit $? + fi + + echo "Installing mysql table" + mysql --defaults-file=/etc/alternc/my.cnf -e " + INSERT IGNORE INTO domaines_type SET name='proxy', description='Proxy to remote server', target='DOMAIN', entry='%SUB% IN A @@PUBLIC_IP@@', compatibility='txt,defmx,defmx2,mx,mx2', enable='ALL', need_dns=0, has_https_option=0, create_targetdir=0; + UPDATE sub_domaines SET web_action='UPDATE' WHERE type IN ('proxy'); + " + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/postrm b/debian/postrm new file mode 100755 index 0000000..030e69a --- /dev/null +++ b/debian/postrm @@ -0,0 +1,37 @@ +#! /bin/bash +# postrm script +# + +set -e + +case "$1" in + remove|purge) + + echo "Remove template configuration" + mysql --defaults-file=/etc/alternc/my.cnf -e " + DELETE FROM domaines_type WHERE name='proxy'; + " + # Run also specific purge action + ;& + + purge) + + if [ -e /usr/share/debconf/confmodule ]; then + # Source debconf library. + . /usr/share/debconf/confmodule + # Remove my changes to the db. + db_purge + fi + ;; + + upgrade|disappear|failed-upgrade|abort-install|abort-upgrade) + + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..ba9a9b2 --- /dev/null +++ b/debian/rules @@ -0,0 +1,32 @@ +#!/usr/bin/make -f +# Sample debian/rules that uses debhelper. +# This file is public domain software, originally written by Joey Hess. +# +# This version is for a multibinary package. It also allows you to build any +# of the binary packages independantly, via binary- targets. + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +#Define version packaging +#Exclude nighly version +VERSION=$(shell git tag -l --points-at HEAD |grep -v 'nightly') +ifeq ($(strip $(VERSION)),) + VERSION=$(shell git tag | sort -V |grep -v nightly|tail -1) + ifeq ($(strip $(VERSION)),) + export VERSION="0.0.0" + endif + VERSION:=$(VERSION)+$(shell date +'%y%m%d%H%M%S') + IS_NIGHTLY=1 +endif + +clean: + dh clean + rm -f debian/files + (git rev-parse --git-dir > /dev/null 2>&1 && git checkout debian/changelog) || true +ifeq ($(strip $(IS_NIGHTLY)),1) + (git rev-parse --git-dir > /dev/null 2>&1 && dch -m -b -v $(VERSION) autobuild) || true +endif +%: + dh $@ + diff --git a/src/etc/alternc/templates/apache2/proxy.conf b/src/etc/alternc/templates/apache2/proxy.conf new file mode 100644 index 0000000..9b5f2ec --- /dev/null +++ b/src/etc/alternc/templates/apache2/proxy.conf @@ -0,0 +1,27 @@ + + ServerName %%fqdn%% + + ProxyPreserveHost On + ProxyPass / http://%%%redirect%%%/ + ProxyPassReverse / http://%%redirect%%/ + + + + ServerName %%fqdn%% + + SSLEngine On + SSLCertificateFile %%CRT%% + SSLCertificateKeyFile %%KEY%% + %%CHAINLINE%% + + SSLProxyEngine on + SSLProxyVerify none + SSLProxyCheckPeerCN off + + SSLProxyCheckPeerName off + SSLProxyCheckPeerExpire off + + ProxyPreserveHost On + ProxyPass / https://%%redirect%%/ + ProxyPassReverse / https://%%redirect%%/ + \ No newline at end of file