1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-25 04:43:33 +00:00

New port for the "pptp-linux" VPN client. It allows a FreeBSD machine

to connect to a remote NT server, making it behave as if it were on
the same LAN.
This commit is contained in:
John Polstra 1999-06-19 22:41:33 +00:00
parent 2798541c26
commit f9c4cd9156
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=19577
12 changed files with 266 additions and 0 deletions

23
net/pptpclient/Makefile Normal file
View File

@ -0,0 +1,23 @@
# New ports collection makefile for: pptpclient
# Version required: 1.0.2
# Date created: 19 June 1999
# Whom: John Polstra <jdp@freebsd.org>
#
# $Id$
#
DISTNAME= pptp-linux-1.0.2
PKGNAME= pptpclient-1.0.2
CATEGORIES= net
MASTER_SITES= http://www.pdos.lcs.mit.edu/~cananian/Projects/PPTP/release/ \
ftp://ftp.kddlabs.co.jp/pub/inet/vpn/pptp-linux/ \
ftp://ftp.iks-jena.de/pub/software/linux/net/
MAINTAINER= jdp@freebsd.org
post-install:
${MKDIR} ${PREFIX}/share/examples/pptpclient
${INSTALL_DATA} ${FILESDIR}/README ${PREFIX}/share/examples/pptpclient
${INSTALL_DATA} ${FILESDIR}/ppp.conf ${PREFIX}/share/examples/pptpclient
.include <bsd.port.mk>

1
net/pptpclient/distinfo Normal file
View File

@ -0,0 +1 @@
MD5 (pptp-linux-1.0.2.tar.gz) = 257835dbb111673dcf80bdf927a1be87

View File

@ -0,0 +1,30 @@
Quickstart for the PPTP client.
Set up your /etc/ppp/ppp.conf based on the example in this directory.
Make these substitutions:
SERVER IP address of the PPTP server
LABEL PPP label to use (must be the same on the command
line and in the ppp.conf file)
USER Your account name on the server
PASSWORD Your password on the server
Change the "add" commands in ppp.conf to set up the routing
appropriately.
Note: your PPP program must be new enough to support MS-CHAP
authentication.
You must run the program as root. Use a command like this:
pptp SERVER LABEL
Kill it with ^C when you're done.
If you want to access the remote system from other hosts on your LAN,
be sure to turn on IP forwarding on the PPTP client machine.
John Polstra <jdp@freebsd.org>

View File

@ -0,0 +1,51 @@
--- Makefile.orig Wed Feb 18 14:42:14 1998
+++ Makefile Sat Jun 19 15:06:52 1999
@@ -1,19 +1,30 @@
VERSION = 1.0.2
VERSION_DEFINE = '-DPPTP_LINUX_VERSION="${VERSION}"'
-CC = gcc -Wall
-DEBUG = -g
+CC = gcc
+DEBUG =
INCLUDE =
-CFLAGS = -O9 $(VERSION_DEFINE) $(DEBUG) $(INCLUDE)
+CFLAGS = -O $(VERSION_DEFINE) $(DEBUG) $(INCLUDE)
LIBS =
LDFLAGS =
+RM = rm -f
#################################################################
-# CHANGE THIS LINE to point to the location of your pppd binary.
+# CHANGE THESE LINES to change where programs are installed.
+#################################################################
+# This is the directory where pptp gets installed:
+PPTP_BINDIR = ${PREFIX}/sbin
+
+# This is the directory where pptp_callmgr gets installed:
+CALLMGR_BINDIR = ${PREFIX}/libexec
-CFLAGS += '-DPPPD_BINARY="/usr/sbin/pppd"'
+# This is the pathname of your pppd binary:
+#CFLAGS += '-DPPPD_BINARY="/usr/sbin/pppd"'
+CFLAGS += '-DPPPD_BINARY="/usr/sbin/ppp"' -DUSER_PPP
#################################################################
+CFLAGS += '-DPPTP_CALLMGR_BINARY="$(CALLMGR_BINDIR)/$(CALLMGR_BIN)"'
+
PPTP_BIN = pptp
PPTP_OBJS = pptp.o pptp_gre.o ppp_fcs.o pty.o \
pptp_ctrl.o dirutil.o vector.o \
@@ -34,6 +45,12 @@
vector_test: vector_test.o vector.o
$(CC) -o vector_test vector_test.o vector.o
+
+install: all
+ test -d $(PPTP_BINDIR) || mkdir -p $(PPTP_BINDIR)
+ install -c -s -o root -g wheel -m 755 $(PPTP_BIN) $(PPTP_BINDIR)
+ test -d $(CALLMGR_BINDIR) || mkdir -p $(CALLMGR_BINDIR)
+ install -c -s -o root -g wheel -m 755 $(CALLMGR_BIN) $(CALLMGR_BINDIR)
clean:
$(RM) *.o *~

View File

@ -0,0 +1,43 @@
RCS file: /home/jdp/f5/pptp/cvs/pptp/pptp.c,v
retrieving revision 1.1.1.1
retrieving revision 1.3
diff -u -r1.1.1.1 -r1.3
--- pptp.c 1999/04/28 19:36:57 1.1.1.1
+++ pptp.c 1999/04/29 17:05:59 1.3
@@ -18,6 +18,7 @@
#include <signal.h>
#include <setjmp.h>
#include <errno.h>
+#include <fcntl.h>
#include <sys/wait.h>
#include "pptp_callmgr.h"
#include "pptp_gre.h"
@@ -235,13 +236,23 @@
void launch_pppd(char *ttydev, int argc, char **argv) {
char *new_argv[argc+4]; /* XXX if not using GCC, hard code a limit here. */
int i;
+ int newi = 0;
- new_argv[0] = PPPD_BINARY;
- new_argv[1] = ttydev;
- new_argv[2] = "38400";
+ new_argv[newi++] = PPPD_BINARY;
+#ifdef USER_PPP
+ new_argv[newi++] = "-direct";
+ if ((i = open(ttydev, O_RDWR)) == -1)
+ fatal("Cannot open %s: %s", ttydev, strerror(errno));
+ if (dup2(i, 0) == -1)
+ fatal("dup2 failed: %s", strerror(errno));
+ close(i);
+#else
+ new_argv[newi++] = ttydev;
+ new_argv[newi++] = "38400";
+#endif
for (i=0; i<argc; i++)
- new_argv[i+3] = argv[i];
- new_argv[i+3] = NULL;
+ new_argv[newi++] = argv[i];
+ new_argv[newi] = NULL;
execvp(new_argv[0], new_argv);
}

View File

@ -0,0 +1,14 @@
RCS file: /home/jdp/f5/pptp/cvs/pptp/pptp_callmgr.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- pptp_callmgr.h 1999/04/28 19:36:57 1.1.1.1
+++ pptp_callmgr.h 1999/04/28 19:43:06 1.2
@@ -6,4 +6,7 @@
*/
#define PPTP_SOCKET_PREFIX "/var/run/pptp/"
+
+#ifndef PPTP_CALLMGR_BINARY
#define PPTP_CALLMGR_BINARY "./pptp_callmgr"
+#endif

View File

@ -0,0 +1,28 @@
RCS file: /home/jdp/f5/pptp/cvs/pptp/pptp_gre.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- pptp_gre.c 1999/04/28 19:36:57 1.1.1.1
+++ pptp_gre.c 1999/04/28 19:43:56 1.2
@@ -5,10 +5,10 @@
* $Id: pptp_gre.c,v 1.5 1997/12/15 10:11:38 cananian Exp $
*/
+#include <sys/types.h>
+#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
-#include <sys/socket.h>
-#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h>
@@ -59,7 +59,7 @@
struct sockaddr_in src_addr;
int s, n, stat1, stat2;
- pptp_gre_call_id = call_id;
+ pptp_gre_call_id = peer_call_id;
/* Open IP protocol socket */
s = socket(AF_INET, SOCK_RAW, PPTP_PROTO);
if (s<0) { warn("socket: %s", strerror(errno)); return; }

View File

@ -0,0 +1,46 @@
RCS file: /home/jdp/f5/pptp/cvs/pptp/pty.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -r1.1.1.1 -r1.2
--- pty.h 1999/04/28 19:36:57 1.1.1.1
+++ pty.h 1999/04/28 19:42:34 1.2
@@ -6,18 +6,32 @@
* $Id: pty.h,v 1.2 1997/12/13 08:39:01 cananian Exp $
*/
-/* Hmm. PTYs can be anywhere.... */
-
#ifdef __linux__
-#define PTYDEV "/dev/ptyxx"
-#define TTYDEV "/dev/ttyxx"
+#define PTYCHAR1 "abcdepqrstuvwxyz"
+#define PTYCHAR2 "0123456789abcdef"
+#endif
-#define PTYMAX (strlen(PTYDEV)+1)
-#define TTYMAX (strlen(TTYDEV)+1)
+#ifdef __FreeBSD__
+#define PTYCHAR1 "pqrsPQRS"
+#define PTYCHAR2 "0123456789abcdefghijklmnopqrstuv"
+#endif
-#define PTYCHAR1 "abcdepqrstuvwxyz"
+/* Conservative defaults that will work for most systems. */
+#ifndef PTYDEV
+#define PTYDEV "/dev/ptyxx"
+#endif
+#ifndef TTYDEV
+#define TTYDEV "/dev/ttyxx"
+#endif
+#ifndef PTYCHAR1
+#define PTYCHAR1 "pqrs"
+#endif
+#ifndef PTYCHAR2
#define PTYCHAR2 "0123456789abcdef"
#endif
+
+#define PTYMAX (strlen(PTYDEV)+1)
+#define TTYMAX (strlen(TTYDEV)+1)
/* Get pty/tty pair, put filename in ttydev, ptydev (which must be
* at least PTYMAX characters long), and return file descriptor of

View File

@ -0,0 +1,8 @@
LABEL:
set authname USER
set authkey PASSWORD
set timeout 0
set ifaddr 0 0
add 192.168.11.0/24 HISADDR
add 192.168.101.0/24 HISADDR
alias enable yes

View File

@ -0,0 +1 @@
A PPTP client for establishing a VPN link with an NT server.

17
net/pptpclient/pkg-descr Normal file
View File

@ -0,0 +1,17 @@
This is a port of the "pptp-linux" PPTP client. It can establish a
PPP connection with an NT server, tunneled through a PPTP link over
the Internet. In effect, it makes the client machine behave as if
it were on the same LAN as the server.
I have fixed one serious bug in the program, and have patched it to
use FreeBSD's userland "ppp" package rather than "pppd" which it
was originally designed to use. I found that "ppp" supplied more
versatility and was easier to set up.
There is no manpage for this package, but you will find some
quickstart instructions and example configuration files in
"${PREFIX}/share/examples/pptpclient".
WWW: http://www.pdos.lcs.mit.edu/~cananian/Projects/PPTP/
John Polstra <jdp@freebsd.org>

4
net/pptpclient/pkg-plist Normal file
View File

@ -0,0 +1,4 @@
libexec/pptp_callmgr
sbin/pptp
share/examples/pptpclient/README
share/examples/pptpclient/ppp.conf