summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@anylike.org>2009-12-25 07:03:57 +0000
committerChristian Pointner <equinox@anylike.org>2009-12-25 07:03:57 +0000
commit0e1cea62a10d5f24a60bb8c400e829fee6b919d2 (patch)
treed5f61147a19ba53cc5016eea653bdfe5e4f58592
parentadded initial files and directories (diff)
added configure, makefile and initial manpage
-rw-r--r--LICENSE4
-rw-r--r--doc/Makefile45
-rw-r--r--doc/anylike.8117
-rw-r--r--doc/anylike.8.txt102
-rw-r--r--src/Makefile132
-rwxr-xr-xsrc/configure211
6 files changed, 609 insertions, 2 deletions
diff --git a/LICENSE b/LICENSE
index 6d9063a..bcc0dc5 100644
--- a/LICENSE
+++ b/LICENSE
@@ -4,8 +4,8 @@
* anylike is a ...
*
*
- * Copyright (C) 2007-2008 Christian Pointner <equinox@anylike.org>
- * Copyright (C) 2007-2008 Markus Grueneis <equinox@anylike.org>
+ * Copyright (C) 2009-2010 Markus Grueneis <gimpf@anylike.org>
+ * Christian Pointner <equinox@anylike.org>
*
* This file is part of anylike.
*
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644
index 0000000..d65342f
--- /dev/null
+++ b/doc/Makefile
@@ -0,0 +1,45 @@
+##
+## anylike
+##
+## anylike is a ...
+##
+##
+## Copyright (C) 2007-2008 Markus Grueneis <gimpf@anylike.org>
+## Christian Pointner <equinox@anylike.org>
+##
+## This file is part of anylike.
+##
+## anylike 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
+## any later version.
+##
+## anylike 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 anylike. If not, see <http://www.gnu.org/licenses/>.
+##
+
+VERSION=$(shell cat ../version)
+
+.PHONY: clean
+
+all: manpage
+
+anylike.8: anylike.8.txt
+ a2x -f manpage $<
+ @ sed -i -e 's/\[FIXME: source\]/anylike ${VERSION}/' $@
+ @ sed -i -e 's/\[FIXME: manual\]/anylike user manual/' $@
+ @ sed -i -e 's/^anylike$$/\\fBanylike\\fR/' $@
+ @ sed -i -e 's/^ \[ \([^ ]*\)/ [ \\fB\1\\fR/' $@
+
+manpage: anylike.8
+
+clean:
+ rm -f anylike.8.xml
+
+realclean: clean
+ rm -f anylike.8
diff --git a/doc/anylike.8 b/doc/anylike.8
new file mode 100644
index 0000000..e565976
--- /dev/null
+++ b/doc/anylike.8
@@ -0,0 +1,117 @@
+'\" t
+.\" Title: anylike
+.\" Author: [see the "AUTHORS" section]
+.\" Generator: DocBook XSL Stylesheets v1.75.1 <http://docbook.sf.net/>
+.\" Date: 12/25/2009
+.\" Manual: anylike user manual
+.\" Source: anylike trunk
+.\" Language: English
+.\"
+.TH "ANYLIKE" "8" "12/25/2009" "anylike trunk" "anylike user manual"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+anylike \- lua based ikev2 implementation
+.SH "SYNOPSIS"
+.sp
+.nf
+uanytun
+ [ \fB\-h|\-\-help\fR ]
+ [ \fB\-D|\-\-nodaemonize\fR ]
+ [ \fB\-u|\-\-username\fR <username> ]
+ [ \fB\-g|\-\-groupname\fR <groupname> ]
+ [ \fB\-C|\-\-chroot\fR <path> ]
+ [ \fB\-P|\-\-write\-pid\fR <filename> ]
+ [ \fB\-L|\-\-log\fR <target>:<level>[,<param1>[,<param2>[\&.\&.]]] ]
+.fi
+.SH "DESCRIPTION"
+.sp
+\fBanylike\fR is a \&...
+.SH "OPTIONS"
+.sp
+The following options can be passed to the \fBanylike\fR daemon:
+.PP
+\fB\-D, \-\-nodaemonize\fR
+.RS 4
+This option instructs
+\fBanylike\fR
+to run in foreground instead of becoming a daemon which is the default\&.
+.RE
+.PP
+\fB\-u, \-\-username <username>\fR
+.RS 4
+run as this user\&. If no group is specified (\fB\-g\fR) the default group of the user is used\&. The default is to not drop privileges\&.
+.RE
+.PP
+\fB\-g, \-\-groupname <groupname>\fR
+.RS 4
+run as this group\&. If no username is specified (\fB\-u\fR) this gets ignored\&. The default is to not drop privileges\&.
+.RE
+.PP
+\fB\-C, \-\-chroot <path>\fR
+.RS 4
+Instruct
+\fBanylike\fR
+to run in a chroot jail\&. The default is to not run in chroot\&.
+.RE
+.PP
+\fB\-P, \-\-write\-pid <filename>\fR
+.RS 4
+Instruct
+\fBanylike\fR
+to write it\(cqs pid to this file\&. The default is to not create a pid file\&.
+.RE
+.PP
+\fB\-L, \-\-log <target>:<level>[,<param1>[,<param2>[\&.\&.]]]\fR
+.RS 4
+add log target to logging system\&. This can be invoked several times in order to log to different targets at the same time\&. Every target hast its own log level which is a number between 0 and 5\&. Where 0 means disabling log and 5 means debug messages are enabled\&.
+
+The file target can be used more the once with different levels\&. If no target is provided at the command line a single target with the config
+\fBsyslog:3,anylike,daemon\fR
+is added\&.
+
+The following targets are supported:
+.PP
+\fBsyslog\fR
+.RS 4
+log to syslog daemon, parameters <level>[,<logname>[,<facility>]]
+.RE
+.PP
+\fBfile\fR
+.RS 4
+log to file, parameters <level>[,<path>]
+.RE
+.PP
+\fBstdout\fR
+.RS 4
+log to standard output, parameters <level>
+.RE
+.PP
+\fBstderr\fR
+.RS 4
+log to standard error, parameters <level>
+.RE
+.RE
+.SH "EXAMPLES"
+.sp
+nothing yet\&.\&.
+.SH "BUGS"
+.sp
+Most likely there are some bugs in \fBanylike\fR\&. If you find a bug, please let the developers know at anylike@anylike\&.org\&. Of course, patches are preferred\&.
+.SH "AUTHORS"
+.sp
+Markus Grueneis <gimpf@anylike\&.org> Christian Pointner <equinox@anylike\&.org>
+.SH "RESOURCES"
+.sp
+Main web site: http://www\&.anylike\&.org/
+.SH "COPYING"
+.sp
+Copyright (C) 2009\-2010 Markus Grueneis and Christian Pointner\&. 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 any later version\&.
diff --git a/doc/anylike.8.txt b/doc/anylike.8.txt
new file mode 100644
index 0000000..4d5d3c9
--- /dev/null
+++ b/doc/anylike.8.txt
@@ -0,0 +1,102 @@
+anylike(8)
+==========
+
+NAME
+----
+
+anylike - lua based ikev2 implementation
+
+
+SYNOPSIS
+--------
+
+....
+uanytun
+ [ -h|--help ]
+ [ -D|--nodaemonize ]
+ [ -u|--username <username> ]
+ [ -g|--groupname <groupname> ]
+ [ -C|--chroot <path> ]
+ [ -P|--write-pid <filename> ]
+ [ -L|--log <target>:<level>[,<param1>[,<param2>[..]]] ]
+....
+
+
+DESCRIPTION
+-----------
+
+*anylike* is a ...
+
+
+OPTIONS
+-------
+
+The following options can be passed to the *anylike* daemon:
+
+*-D, --nodaemonize*::
+ This option instructs *anylike* to run in foreground
+ instead of becoming a daemon which is the default.
+
+*-u, --username <username>*::
+ run as this user. If no group is specified (*-g*) the default group of
+ the user is used. The default is to not drop privileges.
+
+*-g, --groupname <groupname>*::
+ run as this group. If no username is specified (*-u*) this gets ignored.
+ The default is to not drop privileges.
+
+*-C, --chroot <path>*::
+ Instruct *anylike* to run in a chroot jail. The default is
+ to not run in chroot.
+
+*-P, --write-pid <filename>*::
+ Instruct *anylike* to write it's pid to this file. The default is
+ to not create a pid file.
+
+*-L, --log <target>:<level>[,<param1>[,<param2>[..]]]*::
+ add log target to logging system. This can be invoked several times
+ in order to log to different targets at the same time. Every target
+ hast its own log level which is a number between 0 and 5. Where 0 means
+ disabling log and 5 means debug messages are enabled. +
+ The file target can be used more the once with different levels.
+ If no target is provided at the command line a single target with the
+ config *syslog:3,anylike,daemon* is added. +
+ The following targets are supported:
+
+ *syslog*;; log to syslog daemon, parameters <level>[,<logname>[,<facility>]]
+ *file*;; log to file, parameters <level>[,<path>]
+ *stdout*;; log to standard output, parameters <level>
+ *stderr*;; log to standard error, parameters <level>
+
+EXAMPLES
+--------
+
+nothing yet..
+
+
+BUGS
+----
+Most likely there are some bugs in *anylike*. If you find a bug, please let
+the developers know at anylike@anylike.org. Of course, patches are preferred.
+
+
+AUTHORS
+-------
+
+Markus Grueneis <gimpf@anylike.org>
+Christian Pointner <equinox@anylike.org>
+
+
+RESOURCES
+---------
+
+Main web site: http://www.anylike.org/
+
+
+COPYING
+-------
+
+Copyright \(C) 2009-2010 Markus Grueneis and Christian Pointner. 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 any later version.
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..4e2710f
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,132 @@
+##
+## anylike
+##
+## anylike is a ...
+##
+##
+## Copyright (C) 2007-2008 Markus Grueneis <gimpf@anylike.org>
+## Christian Pointner <equinox@anylike.org>
+##
+## This file is part of anylike.
+##
+## anylike 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
+## any later version.
+##
+## anylike 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 anylike. If not, see <http://www.gnu.org/licenses/>.
+##
+
+ifneq ($(MAKECMDGOALS),distclean)
+include include.mk
+endif
+
+EXECUTABLE := anylike
+
+OBJ := log.o \
+ string_list.o \
+ sig_handler.o \
+ sysexec.o \
+ options.o \
+ anylike.o
+
+
+SRC := $(OBJ:%.o=%.c)
+
+.PHONY: clean cleanall distclean manpage install install-bin install-etc install-man uninstall remove purge
+
+all: $(EXECUTABLE)
+
+%.d: %.c
+ @set -e; rm -f $@; \
+ $(CC) -MM $(CFLAGS) $< > $@.$$$$; \
+ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
+ rm -f $@.$$$$; echo '(re)building $@'
+
+ifneq ($(MAKECMDGOALS),distclean)
+-include $(SRC:%.c=%.d)
+endif
+
+$(EXECUTABLE): $(OBJ)
+ $(CC) $(OBJ) -o $@ $(LDFLAGS)
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $<
+
+
+strip: $(EXECUTABLE)
+ $(STRIP) -s $(EXECUTABLE)
+
+distclean: cleanall
+ find . -name *.o -exec rm -f {} \;
+ find . -name "*.\~*" -exec rm -rf {} \;
+ rm -f include.mk
+ rm -f version.h
+
+clean:
+ rm -f *.o
+ rm -f *.d
+ rm -f *.d.*
+ rm -f $(EXECUTABLE)
+
+cleanall: clean
+ $(MAKE) --directory="../doc/" clean
+
+manpage:
+ $(MAKE) --directory="../doc/" manpage
+
+
+INSTALL_TARGETS := install-bin install-etc
+REMOVE_TARGETS := remove-bin remove-etc
+
+ifdef MANDIR
+INSTALL_TARGETS += install-man
+REMOVE_TARGETS += remove-man
+endif
+
+ifdef EXAMPLESDIR
+INSTALL_TARGETS += install-examples
+REMOVE_TARGETS += remove-examples
+endif
+
+install: all $(INSTALL_TARGETS)
+
+install-bin: $(EXECUTABLE)
+ $(INSTALL) -d $(DESTDIR)$(SBINDIR)
+ $(INSTALL) -m 755 $(EXECUTABLE) $(DESTDIR)$(SBINDIR)
+
+install-etc:
+ $(INSTALL) -d $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)
+ @ echo "example configurations can be found at $(EXAMPLESDIR)/$(EXECUTABLE)" > $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/README
+
+install-examples:
+ $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)
+
+install-man: manpage
+ $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8/
+ $(INSTALL) -m 644 ../doc/anylike.8 $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
+
+uninstall: remove
+
+remove: $(REMOVE_TARGETS)
+
+remove-bin:
+ rm -f $(DESTDIR)$(SBINDIR)/$(EXECUTABLE)
+
+remove-etc:
+ rm -f $(DESTDIR)$(ETCDIR)/init.d/$(EXECUTABLE)
+
+remove-examples:
+ rm -rf $(DESTDIR)$(EXAMPLESDIR)/$(EXECUTABLE)/
+
+remove-man:
+ rm -f $(DESTDIR)$(MANDIR)/man8/$(EXECUTABLE).8
+
+purge: remove
+ rm -rf $(DESTDIR)$(ETCDIR)/$(EXECUTABLE)/
diff --git a/src/configure b/src/configure
new file mode 100755
index 0000000..73e9695
--- /dev/null
+++ b/src/configure
@@ -0,0 +1,211 @@
+#!/bin/sh
+#
+# anylike
+#
+# anylike is a ...
+#
+#
+# Copyright (C) 2007-2008 Markus Grueneis <gimpf@anylike.org>
+# Christian Pointner <equinox@anylike.org>
+#
+# This file is part of anylike.
+#
+# anylike 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
+# any later version.
+#
+# anylike 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 anylike. If not, see <http://www.gnu.org/licenses/>.
+
+TARGET=`uname -s`
+EBUILD_COMPAT=0
+
+CFLAGS='-g -O2'
+LDFLAGS='-g -Wall -O2'
+
+CRYPTO_LIB='gcrypt'
+
+PREFIX='/usr/local'
+SBINDIR=''
+ETCDIR=''
+MANDIR=''
+INSTALLMANPAGE=1
+EXAMPLESDIR=''
+INSTALLEXAMPLES=1
+
+print_usage() {
+ echo "configure --help print this"
+ echo " --target=<TARGET> build target i.e. Linux (default: autodetect)"
+ echo " --prefix=<PREFIX> the installation prefix (default: /usr/local)"
+ echo " --sbindir=<DIR> the path to the sbin directory (default: $PREFIX/sbin)"
+ echo " --sysconfdir=<DIR> the path to the system configuration directory (default: $PREFIX/etc"
+ echo " --mandir=<DIR> the path to the system man pages (default: $PREFIX/share/man)"
+ echo " --no-manpage dont't install manpage"
+ echo " --examplesdir=<DIR> the path to the examples files (default: $PREFIX/share/examples)"
+ echo " --no-examples dont't install example files"
+ echo " --use-ssl-crypto use ssl crypto library instead of libgcrypt"
+}
+
+for arg
+do
+ case $arg in
+ --target=*)
+ TARGET=${arg#--target=}
+ ;;
+ --prefix=*)
+ PREFIX=${arg#--prefix=}
+ ;;
+ --sbindir=*)
+ SBINDIR=${arg#--sbindir=}
+ ;;
+ --sysconfdir=*)
+ ETCDIR=${arg#--sysconfdir=}
+ ;;
+ --mandir=*)
+ MANDIR=${arg#--mandir=}
+ ;;
+ --no-manpage)
+ INSTALLMANPAGE=0
+ ;;
+ --examplesdir=*)
+ EXAMPLESDIR=${arg#--examplesdir=}
+ ;;
+ --no-examples)
+ INSTALLEXAMPLES=0
+ ;;
+ --use-ssl-crypto)
+ CRYPTO_LIB='ssl'
+ ;;
+ --ebuild-compat)
+ EBUILD_COMPAT=1
+ ;;
+ --help)
+ print_usage
+ exit 0
+ ;;
+ *)
+ ERRORS="$ERRORS $arg"
+ ;;
+ esac
+done
+
+if [ -n "$ERRORS" ] && [ $EBUILD_COMPAT -ne 1 ]; then
+ for error in $ERRORS; do
+ echo "Unknown argument: $error"
+ done
+
+ print_usage
+ exit 1
+fi
+
+rm -f version.h
+rm -f include.mk
+case $TARGET in
+ Linux)
+ ;;
+ OpenBSD|FreeBSD|NetBSD|GNU/kFreeBSD)
+ CFLAGS=$CFLAGS' -I/usr/local/include'
+ LDFLAGS=$LDFLAGS' -L/usr/local/lib'
+ ;;
+ *)
+ echo "platform not supported"
+ exit 1;
+ ;;
+esac
+
+
+case $CRYPTO_LIB in
+ gcrypt)
+ LDFLAGS=$LDFLAGS' -lgcrypt'
+ echo "using libgcrypt library"
+ ;;
+ ssl)
+ CFLAGS=$CFLAGS' -DUSE_SSL_CRYPTO'
+ LDFLAGS=$LDFLAGS' -lcrypto'
+ echo "using ssl crypto library"
+ ;;
+esac
+
+if [ -z "$SBINDIR" ]; then
+ SBINDIR=$PREFIX/sbin
+fi
+
+if [ -z "$ETCDIR" ]; then
+ ETCDIR=$PREFIX/etc
+fi
+
+if [ -z "$MANDIR" ]; then
+ MANDIR=$PREFIX/share/man
+fi
+
+if [ -z "$EXAMPLESDIR" ]; then
+ EXAMPLESDIR=$PREFIX/share/examples
+fi
+
+cat >> include.mk <<EOF
+# this file was created automatically
+# do not edit this file directly
+# use ./configure instead
+
+TARGET := $TARGET
+CC := gcc
+CFLAGS := $CFLAGS
+LDFLAGS := $LDFLAGS
+STRIP := strip
+INSTALL := install
+
+PREFIX := $PREFIX
+SBINDIR := $SBINDIR
+ETCDIR := $ETCDIR
+EOF
+
+if [ $INSTALLMANPAGE -eq 1 ]; then
+ echo "MANDIR := $MANDIR" >> include.mk
+ echo "installing manpage"
+else
+ echo "not installing manpage"
+fi
+
+if [ $INSTALLEXAMPLES -eq 1 ]; then
+ echo "EXAMPLESDIR := $EXAMPLESDIR" >> include.mk
+ echo "installing example files"
+else
+ echo "not installing example files"
+fi
+
+VERSION=`cat ../version`
+if which svn >/dev/null; then
+ SVN_REV=`svn info | grep "^Revision: " | awk '{print($2)}'`
+ if [ -n "$SVN_REV" ]; then
+ VERSION="$VERSION (svn$SVN_REV)"
+ fi
+fi
+HOSTNAME=`hostname`
+DATE=`date +"%d.%m.%Y %H:%M:%S %Z"`
+
+cat >> version.h <<EOF
+/*
+ * anylike version info
+ *
+ * this file was created automatically
+ * do not edit this file directly
+ * use ./configure instead
+ */
+
+#ifndef ANYLIKE_version_h_INCLUDED
+#define ANYLIKE_version_h_INCLUDED
+
+#define VERSION_STRING_0 "anylike version $VERSION"
+#define VERSION_STRING_1 "built on $HOSTNAME, $DATE"
+
+#endif
+
+EOF
+
+exit 0