Skip to content

Commit

Permalink
Initial working commit of tun/tap vpn.
Browse files Browse the repository at this point in the history
Certificates are random and just used for testing.
  • Loading branch information
justin-lathrop committed Dec 15, 2013
1 parent 8e33357 commit 20d2234
Show file tree
Hide file tree
Showing 11 changed files with 1,368 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vpn/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
INC=/usr/local/ssl/include/
LIB=/usr/local/ssl/lib/

all:
gcc -I$(INC) -L$(LIB) minivpn.c -o minivpn -lssl -lcrypto -ldl

clean:
rm -rf *~ minivpn
10 changes: 10 additions & 0 deletions vpn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<center><h3>VPN</h3></center>
<hr />

VPN written in all C using OPENSSL and TUN/TAP interface to allow a computer to computer, gateway to gateway connection.

This will encrypt all connections sent out of the gateways/computers and only be able to be decrypted by the correct certificate signed by the certificate authority given.

This has only been developed and tested for use on Ubuntu 12.04. OpenSSL and TUN/TAP will need to be accessable upon compilation/runtime.

Will in runtime you can change your secret key (password) and refresh the connection at anytime.
Binary file added vpn/ca.crt
Binary file not shown.
62 changes: 62 additions & 0 deletions vpn/client.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 4098 (0x1002)
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=US, ST=New-York, L=Syracuse, O=Seed, OU=Internet Security, CN=Justin Lathrop/[email protected]
Validity
Not Before: Apr 23 05:16:40 2013 GMT
Not After : Apr 23 05:16:40 2014 GMT
Subject: C=US, ST=New-York, O=Seed, OU=Internet Security, CN=pkilabserver.com/[email protected]
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public Key: (1024 bit)
Modulus (1024 bit):
00:c0:b3:2f:e3:45:23:12:85:61:fe:6a:d7:f6:62:
99:13:61:f2:3d:de:51:e0:1a:45:97:ff:4c:df:a8:
a2:7e:80:9d:8b:30:54:09:31:8c:d5:4e:f2:63:32:
e2:65:1e:b4:20:3c:8a:3f:20:70:00:f4:c9:c9:e2:
3b:6f:d7:55:2a:0a:d4:ec:c0:27:ca:db:5f:9a:cf:
f9:3d:08:78:55:c6:60:31:4f:43:8a:4a:9a:03:08:
43:50:b7:80:cf:dc:11:33:b9:c6:84:18:df:c4:7c:
f3:2a:61:b3:23:73:1f:0c:e9:d7:8c:4c:db:06:c3:
0e:33:59:50:ba:67:c4:c6:7f
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
0E:91:60:4F:86:F9:1E:56:A7:23:9D:A9:2C:87:6A:11:1F:17:76:88
X509v3 Authority Key Identifier:
keyid:AA:04:92:3F:73:CE:1C:81:E5:81:67:48:A4:83:6B:3A:9A:56:DB:7F

Signature Algorithm: sha1WithRSAEncryption
52:a2:e9:a7:ed:64:44:3c:b0:1f:86:67:77:00:24:01:e9:72:
ee:3c:74:2d:61:9b:7a:b8:b4:1e:84:07:c9:ed:9e:de:ba:33:
af:8b:bb:19:42:88:42:06:44:e7:45:45:4d:be:3f:65:bb:96:
d1:50:26:2e:c8:3b:5f:86:37:f9:72:d0:02:46:70:f1:63:ef:
a9:66:4f:60:40:21:6f:7a:35:fa:02:63:68:29:35:35:35:c1:
ba:1a:6c:33:76:3f:a8:6c:96:57:bc:30:06:01:cb:2f:76:73:
f8:c0:ae:09:c8:09:fe:61:68:d1:d6:30:84:d1:1d:ae:6f:99:
89:de
-----BEGIN CERTIFICATE-----
MIIDGTCCAoKgAwIBAgICEAIwDQYJKoZIhvcNAQEFBQAwgZsxCzAJBgNVBAYTAlVT
MREwDwYDVQQIEwhOZXctWW9yazERMA8GA1UEBxMIU3lyYWN1c2UxDTALBgNVBAoT
BFNlZWQxGjAYBgNVBAsTEUludGVybmV0IFNlY3VyaXR5MRcwFQYDVQQDEw5KdXN0
aW4gTGF0aHJvcDEiMCAGCSqGSIb3DQEJARYTamVsYXRocm9wQGdtYWlsLmNvbTAe
Fw0xMzA0MjMwNTE2NDBaFw0xNDA0MjMwNTE2NDBaMIGKMQswCQYDVQQGEwJVUzER
MA8GA1UECBMITmV3LVlvcmsxDTALBgNVBAoTBFNlZWQxGjAYBgNVBAsTEUludGVy
bmV0IFNlY3VyaXR5MRkwFwYDVQQDExBwa2lsYWJzZXJ2ZXIuY29tMSIwIAYJKoZI
hvcNAQkBFhNqZWxhdGhyb3BAZ21haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GN
ADCBiQKBgQDAsy/jRSMShWH+atf2YpkTYfI93lHgGkWX/0zfqKJ+gJ2LMFQJMYzV
TvJjMuJlHrQgPIo/IHAA9MnJ4jtv11UqCtTswCfK21+az/k9CHhVxmAxT0OKSpoD
CENQt4DP3BEzucaEGN/EfPMqYbMjcx8M6deMTNsGww4zWVC6Z8TGfwIDAQABo3sw
eTAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NMIEdlbmVyYXRlZCBD
ZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUDpFgT4b5HlanI52pLIdqER8XdogwHwYDVR0j
BBgwFoAUqgSSP3POHIHlgWdIpINrOppW238wDQYJKoZIhvcNAQEFBQADgYEAUqLp
p+1kRDywH4ZndwAkAely7jx0LWGberi0HoQHye2e3rozr4u7GUKIQgZE50VFTb4/
ZbuW0VAmLsg7X4Y3+XLQAkZw8WPvqWZPYEAhb3o1+gJjaCk1NTXBuhpsM3Y/qGyW
V7wwBgHLL3Zz+MCuCcgJ/mFo0dYwhNEdrm+Zid4=
-----END CERTIFICATE-----
13 changes: 13 additions & 0 deletions vpn/client.csr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-----BEGIN CERTIFICATE REQUEST-----
MIIB3jCCAUcCAQAwgZ0xCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhOZXctWW9yazER
MA8GA1UEBxMIU3lyYWN1c2UxDTALBgNVBAoTBFNlZWQxGjAYBgNVBAsTEUludGVy
bmV0IFNlY3VyaXR5MRkwFwYDVQQDExBwa2lsYWJzZXJ2ZXIuY29tMSIwIAYJKoZI
hvcNAQkBFhNqZWxhdGhyb3BAZ21haWwuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GN
ADCBiQKBgQDAsy/jRSMShWH+atf2YpkTYfI93lHgGkWX/0zfqKJ+gJ2LMFQJMYzV
TvJjMuJlHrQgPIo/IHAA9MnJ4jtv11UqCtTswCfK21+az/k9CHhVxmAxT0OKSpoD
CENQt4DP3BEzucaEGN/EfPMqYbMjcx8M6deMTNsGww4zWVC6Z8TGfwIDAQABoAAw
DQYJKoZIhvcNAQEFBQADgYEASbBURt03aUXsWIG6bvKThe2B9VwHkKOWRSD8TkTO
LcViwRuhTWO4rMn9myXvp7s1RgPz2N9krWb+iUvezBZiwZCwSR4iVmtkEJB9Fhkh
NRKvxxhKXILk6s5m72efLPNSK1zfkPQRMB7rC9QxKRJgJGSpWg1yCOa53ZD10Bgm
SzM=
-----END CERTIFICATE REQUEST-----
18 changes: 18 additions & 0 deletions vpn/client.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,21CADA3A71C65179

F6HrFcxD2d/QMLhpo14QhVJ5J9JCbFg4oWUnK3xmOQ0E0ys5U3g+2DkimdI6skHo
LgG6Glg+FvMEZer2ozV+Pfz0VfSX+xo7tEjoqVS12mxk6C2d5KN2UGNVQjqPHWBL
awexmQinWLI6NADRDr38pOtG5nO91xWoDQZjl2TEa7ddC5aL5aZkT/AQTbpGX9Xr
oEseHfzAS4XWIqelkcTalkY554l+6N3Ubrt/X7MMztPeJ/6tlvQWLk1xX4lbWut5
R/rNICtBGLBChQ/A9W5bGWPZTr3Iut6VCPMtdqjdVdEt2Dh9DS2gmAzc++kGj5mX
dAZoF8erMvVkR1Y9v1G6g5Leb4bss5gtCH+l+jxIJ4PmS+3Cftwyat0clowWlK3i
pQcFVMxcpFLBbANap4uTT0lrTHAW6IekI62SnejX6ZCrjkBvRDxLb/nsT4kwa2xz
bDJZiltaJEZEpOJWvdV3/u06tn7OP8NAx6wXnyJYhatHvfsBCDT2kxYwX4ZewSWx
Ioy4tdBUKBhCHwI+yYQWFJU9LyrWAWPWvuueU4nkOx7gSppSHNSKeMjnzruPOm8G
PVTjHYo4/Ycar2WD7VG1Fe+7PyRCCkkBE5zhfx55EUMH0ZFC2F9mVDR0YnvwKQAk
IbfpSSuCIN4vb7OcmifBLlL+OKLTCYIJZnaS27+62meeYkGp5EewCWsvV61eIwyd
6zI3Sc+IxWLViDEHNANFYVj3Gq3kx6gGT3huqKUxraDFqfDHjy0lmbd+RVNXt0QL
OPGrvzY1kEeJdborLqs33fCozW+5Afw1idxNQheox6n3lWPhLezL4A==
-----END RSA PRIVATE KEY-----
8 changes: 8 additions & 0 deletions vpn/configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cat ./configure.sh
ip addr add 10.0.4.1/24 dev toto0
ifconfig toto0 up
route add -net 10.0.5.0 netmask 255.255.255.0 dev toto0
sysctl net.ipv4.ip_forward=1
route add -net 10.0.10.0 netmask 255.255.255.0 gw 10.0.20.1
route add -net 10.0.10.0 netmask 255.255.255.0 dev toto0

Binary file added vpn/minivpn
Binary file not shown.
Loading

0 comments on commit 20d2234

Please sign in to comment.