Merhaba arkadaslar,
oncelikle ben vpn icin ubuntu 14.04 server surumunu tavsiye ediyorum.
oncelikle ubuntu packagelerimizi guncelleyelim
apt-get update
Sonra openvpn ve easy-rsa kurulumlarimizi gerceklestirelim
apt-get install openvpn easy-rsa
sonrasinda ornek server.conf dosyamizi gercek yerine tasiyalim
gunzip -c /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz > /etc/openvpn/server.conf
Sonra baslayalim server.conf dosyamizi duzenlemeye
vim /etc/openvpn/server.conf
Bu satiri bulup
dh dh1024.pem
Bu Hale getiriyoruz
dh dh2048.pem
Bu satirlarin basindaki ;i kaldiriyoruz
;push "redirect-gateway def1 bypass-dhcp"
;push "dhcp-option DNS 208.67.222.222"
;push "dhcp-option DNS 208.67.220.220"
;user nobody
;group nogroup
dosyayi kaydedip cikiyoruz.
sonrasinda bu komutu uyguluyoruz.
echo 1 > /proc/sys/net/ipv4/ip_forward
Sonrasinda /etc/sysctl.conf dosyasindaki satirin basindaki comment isaretini kaldiriyoruz
#net.ipv4.ip_forward=1
Eger sunucunuz da webserver olarak kullaniyorsaniz asagidaki komutlari uygulayiniz.(Ssh zorunludur daha sonra giremeyebilirsiniz)
ufw allow ssh --zorunlu
ufw allow 1194/udp --zorunlu
ufw allow apache
ufw allow ftp
ufw allow mysql
/etc/default/ufw Dosyamizi vim ile acip bu satirdaki DROP u ACCEPT yapiyoruz.
DEFAULT_FORWARD_POLICY="DROP"
DEFAULT_FORWARD_POLICY="ACCEPT"
kaydedip ciktiktan sonra bu kodlari /etc/ufw/before.rules dosyasina ekliyoruz
#
# rules.before
#
# Rules that should be run before the ufw command line added rules. Custom
# rules should be added to one of these chains:
# ufw-before-input
# ufw-before-output
# ufw-before-forward
#
# START OPENVPN RULES
# NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]
# Allow traffic from OpenVPN client to eth0
-A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE
COMMIT
# END OPENVPN RULES
# Don't delete these required lines, otherwise there will be errors
*filter
daha sonrasinda ufw yi aktif hale getiriyoruz
ufw enable
Gelen soruya y yazip gecin.
ufw status
komutuyla hangi portlarin acik oldugunu gorebilirsiniz
Easy-rsa yi open vpn e kopyalayip keys icin dizin acalim
cp -r /usr/share/easy-rsa/ /etc/openvpn
mkdir /etc/openvpn/easy-rsa/keys
/etc/openvpn/easy-rsa/vars dosyasini vim ile acip asagidaki satirlari duzenleyelim
export KEY_COUNTRY="US"
export KEY_PROVINCE="TX"
export KEY_CITY="Dallas"
export KEY_ORG="My Company Name"
export KEY_EMAIL="sammy@example.com"
export KEY_OU="MYOrganizationalUnit"
export KEY_NAME="server" -- seklinde duzenleyin
Ve dh2048 dosyamizi olusturalim bu birkac dakika surebilir
openssl dhparam -out /etc/openvpn/dh2048.pem 2048
Sonrasinda easy-rsa yi temizleyelim
cd /etc/openvpn/easy-rsa
. ./vars -- noktalar arasinda bosluk olmasina dikkat edin bundan sonra hata verecektir
./clean-all -- komutu ile temizleyelim tamamen
Vpn sertifkalarini olustralim
./build-ca
./build-key-server server
#A challenge password []:
#An optional company name []: kisimlarini enter diyerek bos birakiniz
#Sign the certificate? [y/n]
#1 out of 1 certificate requests certified, commit? [y/n] -- ikisine de yes diyiniz
## Write out database with 1 new entries
##Data Base Updated mesajini aldiysaniz islem basarili.
Sertifikalari yerine tasiyalim.
cp /etc/openvpn/easy-rsa/keys/{server.crt,server.key,ca.crt} /etc/openvpn
Ve vpn serverimizi baslatalim artik
service openvpn start
Son olarak ovpn dosyamizi olusturalim
cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf /etc/openvpn/easy-rsa/keys/client.ovpn
Islem tamamda biz nasil baglanacagiz ?
Windows da winscp veya ftp ile 4 dosyayi cekmeniz gerekiyor.
/etc/openvpn/easy-rsa/keys/server.crt
/etc/openvpn/easy-rsa/keys/server.key
/etc/openvpn/easy-rsa/keys/client.ovpn
/etc/openvpn/ca.crt
ornek winscp komutu
scp root@your-server-ip:/etc/openvpn/easy-rsa/keys/server.key Downloads/
Bunlari cekip ovpn dosyasini aktiflestirseniz bile baglanamadiginizi goreceksiniz. Neden mi cok basit. Ovpn dosyanizi bir metin editor ile acin ve bu satirlari degistirin
#my-server-1 yazan yere hostname niz veya ipniz gelecek
remote my-server-1 1194
#baslarindaki noktali virgulu kaldirin
user nobody
group nogroup
#ve sertifikasyon dosyalarinin ayni klasorde oldugna emin olun
ca ca.crt
cert server.crt
key server.key
Islem bu kadar. Ve asiri bir sekilde anonim bir vpn. Hic bir leak sitesinde ipnizi goremezsiniz.
Not :
Windows icin openvpn :
https://openvpn.net/index.php/open-s...downloads.html