SliTaz SliTaz Forum

You are not logged in.

#1 2014-04-22 11:53:04

Malk
Member
Registered: 2014-04-11
Posts: 18

Running Openvpn server on SliTaz

Openvpn installed in SliTaz.

[c]root@vps:~# tazpkg get-install openvpn[/c]

Once installed, the script to run Openvpn server in [c]/etc/init.d/[/c] does not appear.

How to run Openvpn in SliTaz?

Offline

#2 2014-04-27 09:04:15

Malk
Member
Registered: 2014-04-11
Posts: 18

Re: Running Openvpn server on SliTaz

Nobody has yet launched Openvpn in SliTaz?

Offline

#3 2014-04-27 11:49:32

erjo
Administrator
Registered: 2011-03-28
Posts: 86

Re: Running Openvpn server on SliTaz

Yes i use it in client mode in /etc/init.d/local.sh

I guess it can also function as a server

Offline

#4 2014-04-27 20:49:30

Malk
Member
Registered: 2014-04-11
Posts: 18

Re: Running Openvpn server on SliTaz

I have in [c]/etc/init.d/local.sh[/c] only here it

[c]

#!/bin/sh

# /etc/init.d/local.sh - Local startup commands.

#

# All commands here will be executed at boot time.

#

. /etc/init.d/rc.functions

echo "Starting local startup commands... "

[/c]

As you start the daemon Openvpn from [c]/etc/init.d/local.sh[/c]?

Offline

#5 2014-04-28 11:13:36

erjo
Administrator
Registered: 2011-03-28
Posts: 86

Re: Running Openvpn server on SliTaz

My /etc/init.d/local.sh file:

#!/bin/sh
# /etc/init.d/local.sh - Local startup commands.
#
# All commands here will be executed at boot time.
#
. /etc/init.d/rc.functions

echo "Starting local startup commands... "

[ -x /usr/bin/ntpclient ] && /usr/bin/ntpclient -s -h fr.pool.ntp.org

/usr/libexec/webmin/webmin-init start

/usr/sbin/openvpn --cd /etc/openvpn/ --config /etc/openvpn/server-udp-1194.ovpn

My config file for Openvpn:

dev tun
persist-tun
persist-key
cipher AES-128-CBC
auth SHA1
tls-client
client
resolv-retry infinite
remote Your.server.IP.here 1194 udp
lport 0
pkcs12 my_pkcs.p12
tls-auth my_tls.key 1
ns-cert-type server
comp-lzo
daemon

I used the keyword daemon in the config file to run Openvpn in background.

Offline

#6 2014-04-29 20:00:07

Malk
Member
Registered: 2014-04-11
Posts: 18

Re: Running Openvpn server on SliTaz

Thank you for your help.

Installed Openvpn

[c]tazpkg get-install openvpn[/c]

Has created certificates and keys.

Has created server.conf

[c]local SERVER.IP.here

port 3200

proto tcp

dev tun

ca ca.crt

cert server.crt

key server.key

dh dh1024.pem

server 10.8.0.0 255.255.255.0

ifconfig-pool-persist ipp.txt

push "redirect-gateway def1 bypass-dhcp"

push "dhcp-option DNS 8.8.8.8"

push "dhcp-option DNS 8.8.4.4"

client-to-client

keepalive 10 120

tls-auth ta.key 0

comp-lzo

user nobody

group nobody

persist-key

persist-tun

status openvpn-status.log

log /var/log/openvpn.log

verb 3

mute 20[/c]

Added to /etc/init.d/local.sh this line

[c]/usr/sbin/openvpn --cd /etc/openvpn/ --config /etc/openvpn/server.conf[/c]

Tried to run script

[c]/etc/init.d/local.sh start[/c]

but nothing happened.

Rebooted SliTaz. After rebooting the system will not boot with this error

[c]FATAL: No bootable medium found! System halted.[/c]

Offline

#7 2014-04-29 21:53:01

erjo
Administrator
Registered: 2011-03-28
Posts: 86

Re: Running Openvpn server on SliTaz

I'm not your boot problem is related to Openvpn.

/etc/init.d/local.sh is a regular shell script with no options.

I follow some parts of this guide : http://www.nedproductions.biz/wiki/configuring-a-proxmox-ve-2.x-cluster-running-over-an-openvpn-intranet/configuring-a-proxmox-ve-2.x-cluster-running-over-an-openvpn-intranet-part-1#2

My server.conf

mode server
tls-server

local 192.168.1.104
port 1194
proto tcp

script-security 2
dev tap0
up "/etc/openvpn/up.sh"
down "/etc/openvpn/down.sh"

persist-key
persist-tun
duplicate-cn
client-to-client

ca ca.crt
cert riton.crt
key riton.key  # This file should be kept secret
dh dh1024.pem
tls-auth openema.key 0 # This file is secret

ifconfig-pool-persist ipp.txt
server-bridge 10.0.0.1 255.255.255.0 10.0.0.100 10.0.0.110
max-clients 10

user nobody
group nogroup
keepalive 10 120
status openvpn-status.log
verb 3

daemon

Pay attention to the daemon keyword.

My local.sh

#!/bin/sh
# /etc/init.d/local.sh - Local startup commands.
#
# All commands here will be executed at boot time.
#
. /etc/init.d/rc.functions

echo "Starting local startup commands... "

echo "Create Network Bridge..."
/usr/sbin/brctl addbr vpn0
/usr/sbin/brctl addif  vpn0 dummy0
/sbin/ifconfig vpn0 10.0.0.1 netmask 255.255.255.0

echo "Starting OpenVPN..."
/usr/sbin/openvpn --cd /etc/openvpn --config /etc/openvpn/server.conf

After boot:

tap0      Link encap:Ethernet  HWaddr BA:F5:DF:23:0D:31
          inet6 addr: fe80::b8f5:dfff:fe23:d31/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 B)  TX bytes:1296 (1.2 KiB)

vpn0      Link encap:Ethernet  HWaddr 82:A5:80:CC:C7:A0
          inet addr:10.0.0.1  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::80a5:80ff:fecc:c7a0/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:648 (648.0 B)

Offline

#8 2014-05-03 20:41:13

Malk
Member
Registered: 2014-04-11
Posts: 18

Re: Running Openvpn server on SliTaz

Tried to configure Openvpn in Bridge

In server.conf, only altered the port and the file names of keys and certificates.

server.conf

[c]mode server

tls-server

local 10.0.2.15

port 3200

proto tcp

script-security 2

dev tap0

up "/etc/openvpn/up.sh"

down "/etc/openvpn/down.sh"

persist-key

persist-tun

duplicate-cn

client-to-client

ca ca.crt

cert server.crt

key server.key  # This file should be kept secret

dh dh1024.pem

tls-auth ta.key 0 # This file is secret

ifconfig-pool-persist ipp.txt

server-bridge 10.0.0.1 255.255.255.0 10.0.0.100 10.0.0.110

max-clients 10

user nobody

group nogroup

keepalive 10 120

status openvpn-status.log

verb 3

daemon[/c]

In [c]local.sh[/c] altered only the name created interface [c]br0[/c]

local.sh

[c]#!/bin/sh

# /etc/init.d/local.sh - Local startup commands.

#

# All commands here will be executed at boot time.

#

. /etc/init.d/rc.functions

echo "Starting local startup commands... "

echo "Create Network Bridge..."

/usr/sbin/brctl addbr br0

/usr/sbin/brctl addif  br0 dummy0

/sbin/ifconfig br0 10.0.0.1 netmask 255.255.255.0

echo "Starting OpenVPN..."

/usr/sbin/openvpn --cd /etc/openvpn --config /etc/openvpn/server.conf[/c]

As written in this manual http://openvpn.net/index.php/open-source/documentation/miscellaneous/76-ethernet-bridging.html installed bridge-utils

[c]tazpkg get-install bridge-utils[/c]

After restarting script local.sh, interfaces not created.

[c]root@slitaz:~# /etc/init.d/local.sh restart

Starting local startup commands...

Create Network Bridge...

add bridge failed: Package not installed

bridge br0 does not exist!

ifconfig: SIOCSIFADDR: No such device

Starting OpenVPN...[/c]

Which package you need to install to successfully create interfaces?

Offline

#9 2014-05-03 23:36:45

erjo
Administrator
Registered: 2011-03-28
Posts: 86

Re: Running Openvpn server on SliTaz

Add linux-bridge package.

Plus content of /etc/openvpn/up.sh and /etc/openvpn/down.sh

/etc/openvpn/up.sh

#!/bin/sh
/sbin/ifconfig br0 promisc
/sbin/ifconfig tap0 up promisc
/sbin/brctl addif br0 tap0

/etc/openvpn/down.sh

#!/bin/sh
/sbin/brctl delif br0 tap0
/sbin/ifconfig tap0 down -promisc
/sbin/ifconfig br0 -promisc

Offline

#10 2014-05-03 23:36:47

erjo
Administrator
Registered: 2011-03-28
Posts: 86

Re: Running Openvpn server on SliTaz

Add linux-bridge package.

Plus content of /etc/openvpn/up.sh and /etc/openvpn/down.sh

/etc/openvpn/up.sh

#!/bin/sh
/sbin/ifconfig br0 promisc
/sbin/ifconfig tap0 up promisc
/sbin/brctl addif br0 tap0

/etc/openvpn/down.sh

#!/bin/sh
/sbin/brctl delif br0 tap0
/sbin/ifconfig tap0 down -promisc
/sbin/ifconfig br0 -promisc

Offline

#11 2014-05-04 21:39:51

Malk
Member
Registered: 2014-04-11
Posts: 18

Re: Running Openvpn server on SliTaz

Thank you for your help. I found only the information that need to install the bridge-utils.

Package linux-bridge installed. Scripts added.

After restarting script local.sh

[c]root@slitaz:~# /etc/init.d/local.sh restart

Starting local startup commands...

Create Network Bridge...

Starting OpenVPN...[/c]

Interface br0 created. But Openvpn not started and tap0 interface is not created.

[c]root@slitaz:~# ifconfig
br0       Link encap:Ethernet  HWaddr 6A:D4:3F:AD:5B:83
          inet addr:10.0.0.1  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr 08:00:27:D4:54:B8
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11961 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6548 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5224380 (4.9 MiB)  TX bytes:1215614 (1.1 MiB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)[/c]
I added logging in server.conf having added

[c]log /var/log/openvpn.log[/c]

Here is the log start Openvpn

[c]root@slitaz:~# cat /var/log/openvpn.log

Tue Apr 22 00:52:52 2014 OpenVPN 2.2.1 i486-slitaz-linux [SSL] [LZO2] [EPOLL] [eurephia] built on Feb 27 2012

Tue Apr 22 00:52:52 2014 NOTE: when bridging your LAN adapter with the TAP adapter, note that the new bridge adapter will often take on its own IP address that is different from what the LAN adapter was previously set to

Tue Apr 22 00:52:52 2014 WARNING: --ifconfig-pool-persist will not work with --duplicate-cn

Tue Apr 22 00:52:52 2014 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts

Tue Apr 22 00:52:52 2014 Diffie-Hellman initialized with 1024 bit key

Tue Apr 22 00:52:52 2014 Control Channel Authentication: using 'ta.key' as a OpenVPN static key file

Tue Apr 22 00:52:52 2014 Outgoing Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication

Tue Apr 22 00:52:52 2014 Incoming Control Channel Authentication: Using 160 bit message hash 'SHA1' for HMAC authentication

Tue Apr 22 00:52:52 2014 TLS-Auth MTU parms [ L:1575 D:168 EF:68 EB:0 ET:0 EL:0 ]

Tue Apr 22 00:52:52 2014 Socket Buffers: R=[87380->131072] S=[16384->131072]

Tue Apr 22 00:52:52 2014 TUN/TAP device tap0 opened

Tue Apr 22 00:52:52 2014 TUN/TAP TX queue length set to 100

Tue Apr 22 00:52:52 2014 /etc/openvpn/up.sh tap0 1500 1575   init

/etc/openvpn/up.sh: line 4: /sbin/brctl: not found

Tue Apr 22 00:52:52 2014 WARNING: Failed running command (--up/--down): could not execute external program

Tue Apr 22 00:52:52 2014 Exiting[/c]

Offline

#12 2014-05-05 20:33:40

erjo
Administrator
Registered: 2011-03-28
Posts: 86

Re: Running Openvpn server on SliTaz

Tue Apr 22 00:52:52 2014 /etc/openvpn/up.sh tap0 1500 1575 init

/etc/openvpn/up.sh: line 4: /sbin/brctl: not found

Tue Apr 22 00:52:52 2014 WARNING: Failed running command (--up/--down): could not execute external program

Tue Apr 22 00:52:52 2014 Exiting

My bad. The path for brctl is /usr/sbin/brctl

Fix it in /etc/openvpn/up.sh and /etc/openvpn/down.sh

Offline

#13 2014-05-06 22:24:53

Malk
Member
Registered: 2014-04-11
Posts: 18

Re: Running Openvpn server on SliTaz

Now everything is fine. Interface tap0 created. Openvpn started.

Thank you.

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.023 seconds, 7 queries executed - Memory usage: 1.57 MiB (Peak: 1.77 MiB) ]