Community discussions

MikroTik App
 
User avatar
zipvault
Member Candidate
Member Candidate
Topic Author
Posts: 140
Joined: Fri Dec 23, 2016 8:15 am

VPN MAC OS

Fri Dec 23, 2016 8:46 am

Hello world

i need help with my mikrotik

im only new to mikrotik 1 week old, but i am a fast learner

i want to create secure connection on my router to my local networkcomputers,

also i have small debian apache server at home which i would like to access remotely through vpn also...

i believe i need to make l2tp vpn

as i use mac os


i have tried to make it but am struggling to get a connect


also i have been searching and reading forums/online for days now and still no luck but i feel as if im getting closer and closer every hour

is this the correct order of things i need to make

any help or guidance would be much appreciated,

is this the correct order??

-L2tp profile

-l2tp server

-add ppp secrets

-ipsec proposal

-ipsec peers

-ipsec policies

many thanks in advance


Image
 
User avatar
zipvault
Member Candidate
Member Candidate
Topic Author
Posts: 140
Joined: Fri Dec 23, 2016 8:15 am

Re: VPN MAC OS

Fri Dec 23, 2016 9:03 am

also in my further research it suggests

l2tp has issues with dropping due to nat

can this be configured appropriately, or

if i go down the open vpn route, how can i make my own certificates? do i use openssl?
 
User avatar
zipvault
Member Candidate
Member Candidate
Topic Author
Posts: 140
Joined: Fri Dec 23, 2016 8:15 am

Re: VPN MAC OS

Fri Dec 23, 2016 9:16 am

i found this, how can i do this for mac?


____________________________

Setting up your own Certificate Authority (CA) and generating certificates and keys for an OpenVPN server and multiple clients
Overview

The first step in building an OpenVPN 2.x configuration is to establish a PKI (public key infrastructure). The PKI consists of:

a separate certificate (also known as a public key) and private key for the server and each client, and
a master Certificate Authority (CA) certificate and key which is used to sign each of the server and client certificates.

OpenVPN supports bidirectional authentication based on certificates, meaning that the client must authenticate the server certificate and the server must authenticate the client certificate before mutual trust is established.

Both server and client will authenticate the other by first verifying that the presented certificate was signed by the master certificate authority (CA), and then by testing information in the now-authenticated certificate header, such as the certificate common name or certificate type (client or server).

This security model has a number of desirable features from the VPN perspective:

The server only needs its own certificate/key -- it doesn't need to know the individual certificates of every client which might possibly connect to it.
The server will only accept clients whose certificates were signed by the master CA certificate (which we will generate below). And because the server can perform this signature verification without needing access to the CA private key itself, it is possible for the CA key (the most sensitive key in the entire PKI) to reside on a completely different machine, even one without a network connection.
If a private key is compromised, it can be disabled by adding its certificate to a CRL (certificate revocation list). The CRL allows compromised certificates to be selectively rejected without requiring that the entire PKI be rebuilt.
The server can enforce client-specific access rights based on embedded certificate fields, such as the Common Name.

Note that the server and client clocks need to be roughly in sync or certificates might not work properly.
Generate the master Certificate Authority (CA) certificate & key

In this section we will generate a master CA certificate/key, a server certificate/key, and certificates/keys for 3 separate clients.

For PKI management, we will use easy-rsa, a set of scripts which is bundled with OpenVPN 2.2.x and earlier. If you're using OpenVPN 2.3.x, you need to download easy-rsa separately from here.

If you are using Linux, BSD, or a unix-like OS, open a shell and cd to the easy-rsa subdirectory. If you installed OpenVPN from an RPM or DEB file, the easy-rsa directory can usually be found in /usr/share/doc/packages/openvpn or /usr/share/doc/openvpn (it's best to copy this directory to another location such as /etc/openvpn, before any edits, so that future OpenVPN package upgrades won't overwrite your modifications). If you installed from a .tar.gz file, the easy-rsa directory will be in the top level directory of the expanded source tree.

If you are using Windows, open up a Command Prompt window and cd to \Program Files\OpenVPN\easy-rsa. Run the following batch file to copy configuration files into place (this will overwrite any preexisting vars.bat and openssl.cnf files):

init-config

Now edit the vars file (called vars.bat on Windows) and set the KEY_COUNTRY, KEY_PROVINCE, KEY_CITY, KEY_ORG, and KEY_EMAIL parameters. Don't leave any of these parameters blank.

Next, initialize the PKI. On Linux/BSD/Unix:

. ./vars
./clean-all
./build-ca

On Windows:

vars
clean-all
build-ca

The final command (build-ca) will build the certificate authority (CA) certificate and key by invoking the interactive openssl command:

ai:easy-rsa # ./build-ca
Generating a 1024 bit RSA private key
............++++++
...........++++++
writing new private key to 'ca.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [KG]:
State or Province Name (full name) [NA]:
Locality Name (eg, city) [BISHKEK]:
Organization Name (eg, company) [OpenVPN-TEST]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:OpenVPN-CA
Email Address [me@myhost.mydomain]:

Note that in the above sequence, most queried parameters were defaulted to the values set in the vars or vars.bat files. The only parameter which must be explicitly entered is the Common Name. In the example above, I used "OpenVPN-CA".
Generate certificate & key for server

Next, we will generate a certificate and private key for the server. On Linux/BSD/Unix:

./build-key-server server

On Windows:

build-key-server server

As in the previous step, most parameters can be defaulted. When the Common Name is queried, enter "server". Two other queries require positive responses, "Sign the certificate? [y/n]" and "1 out of 1 certificate requests certified, commit? [y/n]".
Generate certificates & keys for 3 clients

Generating client certificates is very similar to the previous step. On Linux/BSD/Unix:

./build-key client1
./build-key client2
./build-key client3

On Windows:

build-key client1
build-key client2
build-key client3

If you would like to password-protect your client keys, substitute the build-key-pass script.

Remember that for each client, make sure to type the appropriate Common Name when prompted, i.e. "client1", "client2", or "client3". Always use a unique common name for each client.
 
User avatar
zipvault
Member Candidate
Member Candidate
Topic Author
Posts: 140
Joined: Fri Dec 23, 2016 8:15 am

Re: VPN MAC OS

Fri Dec 23, 2016 9:18 am

or something along the lines of this tutorial ??? ->

https://major.io/2015/05/01/howto-mikro ... pn-server/
 
User avatar
lbachero
newbie
Posts: 38
Joined: Wed Oct 08, 2014 4:39 pm
Location: Dublin
Contact:

Re: VPN MAC OS

Fri Dec 23, 2016 12:09 pm

I'm using L2TP + IPSec (Because Sierra doesn't support PPTP).

Just enable L2TP-Server with IPSec option:

/interface l2tp-server server
set enabled=yes ipsec-secret=*shared-secret* use-ipsec=yes

I'm using login with Radius, so:
/ppp aaa
set use-radius=yes

It's not necessary to configure anything in IP > IPSEC.
 
User avatar
zipvault
Member Candidate
Member Candidate
Topic Author
Posts: 140
Joined: Fri Dec 23, 2016 8:15 am

Re: VPN MAC OS

Fri Dec 23, 2016 3:54 pm

my understanding now is

l2tp is the tunnel

and ipsec is the encryption i have set this up now

thanks

but still working on my certificates..
 
mpreissner
Member
Member
Posts: 357
Joined: Tue Mar 11, 2014 11:16 pm
Location: Columbia, MD

Re: VPN MAC OS

Fri Dec 23, 2016 3:57 pm

You can use any number of tools to generate your own certificates. I think MikroTik has the OpenSSL libraries in place to generate your own certs via command line, or you make your own from Terminal on your Mac. I like using the XCA application (available for Win, Mac, and *nix). It's a nice GUI program that makes running your own CA easy.
 
User avatar
zipvault
Member Candidate
Member Candidate
Topic Author
Posts: 140
Joined: Fri Dec 23, 2016 8:15 am

Re: VPN MAC OS

Fri Dec 23, 2016 4:14 pm

thankyou i will check this out,


here is ipsec tut

if anyone needs



SETTING UP IPSEC:
L2TP does not need IPSec but L2TP by itself does NOT provide any encryption as it is a Tunneling Protocol. Thus we use L2TP tunnels and use IPSec to encrypt the data going over the tunnel.
More Info: http://en.wikipedia.org/wiki/L2TP

Let’s get started.

Click on the IP Menu on Mikrotiks left side menu and then choose IPSec from the drop down list.

image
Click on the Peers TAB

image

Click the + to create a new Peer

image
Address: Leave this as 0.0.0.0/0 (Everyone can connect)
Port: 500
Auth. Method: pre shared key
Secret: set a secret(password) for the IPSec secret authentication (Make it good and strong)
Exchange Mode: change to “main l2tp”
Send Initial Contact: Check this box
NAT Traversal: Check this box (Most likely you will have users outside of the organization so they will need this checked. I won’t go into what it is. Google is your best friend!!! Look it up)
Proposal check: obey
Hash Algorithm: sha
Encryption Algorithm: 3des
DH Group: modp 1024
Generate Policy: Check this box
Lifetime: 1d 00:00:00 (1 Day)
DPD Interval: 120
DPD Max Failures: 5
Click the OK button.

Your are now done making your IPSec Peer.



Now onto the Proposals Setup:
Click on Proposals TAB
Double click default Proposal from the list

image
Name: Leave as default
Auth. Algorithm: sha 1
Encr. Algorithms: 3des
(For IPhone 4 to work it needs Encr. Algorithms to also have aes-256 enabled)
Lifetime: 00:30:00
PFS Group: change to “none”
Click the OK button
You have now setup a IPSec proposal compatible with IPhone 4 using iOS 5.x at the time of this
 
User avatar
zipvault
Member Candidate
Member Candidate
Topic Author
Posts: 140
Joined: Fri Dec 23, 2016 8:15 am

Re: VPN MAC OS

Fri Dec 23, 2016 4:35 pm

!Fixed
Last edited by zipvault on Wed Dec 28, 2016 4:42 pm, edited 1 time in total.
 
User avatar
zipvault
Member Candidate
Member Candidate
Topic Author
Posts: 140
Joined: Fri Dec 23, 2016 8:15 am

Re: VPN MAC OS

Sat Dec 24, 2016 5:27 am

You can use any number of tools to generate your own certificates. I think MikroTik has the OpenSSL libraries in place to generate your own certs via command line, or you make your own from Terminal on your Mac. I like using the XCA application (available for Win, Mac, and *nix). It's a nice GUI program that makes running your own CA easy.

where should i find a trusted stable xca application?

all the ones on sourceforge look so dodgy
 
Revelation
Member
Member
Posts: 336
Joined: Fri Dec 25, 2015 5:59 am

Re: VPN MAC OS

Tue Jan 03, 2017 8:35 pm

3DES is not very secure anymore. I recommend going with AES256 as your encryption method.
 
User avatar
zipvault
Member Candidate
Member Candidate
Topic Author
Posts: 140
Joined: Fri Dec 23, 2016 8:15 am

Re: VPN MAC OS

Wed Jan 04, 2017 12:51 am

:D agreed
 
zapgadget
just joined
Posts: 2
Joined: Fri Jan 06, 2017 5:58 pm

Re: VPN MAC OS

Fri Jan 06, 2017 6:32 pm

I've been trying for two days now to get macOS Sierra connected to my Mikrotik running 6.38.

The closest I can get is lots of errors like:

failed to pre-process ph2 packet
peer sent packet for dead phase2


It's like it's halfway through the handshake, as an initial set of tunnels seems to be set up.

Anyone succeeded with Sierra and 6.38?
 
User avatar
zipvault
Member Candidate
Member Candidate
Topic Author
Posts: 140
Joined: Fri Dec 23, 2016 8:15 am

Re: VPN MAC OS

Sun Jan 08, 2017 1:47 am

I've been trying for two days now

You remind me of me two weeks ago :)

Once you figure it out its very easy

To make vpn If you follow the methods i posted on this forum page you should work it out


Basically there are two main things u need to set

Ppp> make a profile / then make a secret

You also going to want to adjust lease times so it doesnt cut every 30 minutes


I have 5 seperate vpn tunnels now


Different devices have extra features as i discovered some laptops can also handle things like compression on the profile and other devices cannot
 
zapgadget
just joined
Posts: 2
Joined: Fri Jan 06, 2017 5:58 pm

Re: VPN MAC OS

Wed Jan 11, 2017 1:03 am

You're right, it was easy, especially when I realised that I should replace both lines of my gre protocol (47) dstnat line with ipsec esp (50) to both input and forward
I did the input one, but forgot to add the forward one, not thinking properly.

For anyone searching later, if your symptom is:
failed to pre-process ph2 packet
Connecting from MacOS to Mikrotik, then you may have forgotten to set up input and forward accept lines in your firewall filters.

/ip firewall filter > print
...
chain=input action=accept protocol=ipsec-esp in-interface=ether1-gateway log=yes
chain=forward action=accept protocol=ipsec-esp in-interface=ether1-gateway log=yes
...

So in short, L2TP/IPSec from macOS Sierra to Mikrotik RouterOS 6.38 is working fine.
 
mpreissner
Member
Member
Posts: 357
Joined: Tue Mar 11, 2014 11:16 pm
Location: Columbia, MD

Re: VPN MAC OS

Wed Jan 11, 2017 3:19 pm


where should i find a trusted stable xca application?

all the ones on sourceforge look so dodgy
Sourceforge is the only reputable place to download XCA. True, the last update to the application was about 15 months ago, but I believe the developer still actively maintains it...just haven't been many bugs or feature requests lately.

Who is online

Users browsing this forum: heysoundude and 23 guests