staging.inyokaproject.org

OpenVPN redet nicht mit Squid

Status: Ungelöst | Ubuntu-Version: Ubuntu 18.04 (Bionic Beaver)
Antworten |

Nazaled

Avatar von Nazaled

Anmeldungsdatum:
13. September 2018

Beiträge: 33

Einen schönen guten Tag,

wir haben bei uns zwei Server installiert. Auf dem einen läuft OpenVPN und auf den anderen Squid. Beide kann man wunderbar ansteuern. Also ich komme mit dem OpenVPN Zertifikat ins Netz oder halt mit den Proxy Daten ins Netz.

Nun sollen aber meine Daten über den VPN durch den Proxy ins Netz. Leider hängt der gute beim TCP. Hier mal die Log Daten der Verbindung.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
Wed Feb 13 12:46:45 2019 OpenVPN 2.4.6 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Apr 26 2018
Wed Feb 13 12:46:45 2019 Windows version 6.2 (Windows 8 or greater) 64bit
Wed Feb 13 12:46:45 2019 library versions: OpenSSL 1.1.0h  27 Mar 2018, LZO 2.10
Enter Management Password:
Wed Feb 13 12:46:45 2019 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
Wed Feb 13 12:46:45 2019 Need hold release from management interface, waiting...
Wed Feb 13 12:46:46 2019 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
Wed Feb 13 12:46:46 2019 MANAGEMENT: CMD 'state on'
Wed Feb 13 12:46:46 2019 MANAGEMENT: CMD 'log all on'
Wed Feb 13 12:46:46 2019 MANAGEMENT: CMD 'echo all on'
Wed Feb 13 12:46:46 2019 MANAGEMENT: CMD 'bytecount 5'
Wed Feb 13 12:46:46 2019 MANAGEMENT: CMD 'hold off'
Wed Feb 13 12:46:46 2019 MANAGEMENT: CMD 'hold release'
Wed Feb 13 12:46:46 2019 Outgoing Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Wed Feb 13 12:46:46 2019 Incoming Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Wed Feb 13 12:46:46 2019 TCP/UDP: Preserving recently used remote address: [AF_INET]XX.XX.XX.157:1194
Wed Feb 13 12:46:46 2019 Socket Buffers: R=[65536->65536] S=[65536->65536]
Wed Feb 13 12:46:46 2019 Attempting to establish TCP connection with [AF_INET]XX.XX.XX.157:1194 [nonblock]
Wed Feb 13 12:46:46 2019 MANAGEMENT: >STATE:1550058406,TCP_CONNECT,,,,,,
Wed Feb 13 12:46:52 2019 SIGTERM[hard,init_instance] received, process exiting
Wed Feb 13 12:46:52 2019 MANAGEMENT: >STATE:1550058412,EXITING,init_instance,,,,,

Und nun die Config Dateien.

server.conf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
port 443
;port 1194
proto tcp
;proto udp
dev tun
sndbuf 0
rcvbuf 0
ca ca.crt
cert server.crt
key server.key
dh dh.pem
auth SHA512
tls-auth ta.key 0
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 46.38.225.230"
push "dhcp-option DNS 46.38.252.230"
keepalive 10 120
cipher AES-256-CBC
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
crl-verify crl.pem

client.conf

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server.     #
#                                            #
# This configuration can be used by multiple #
# clients, however each client should have   #
# its own cert and key files.                #
#                                            #
# On Windows, you might want to rename this  #
# file so it has a .ovpn extension           #
##############################################

# Specify that we are a client and that we
# will be pulling certain config file directives
# from the server.
client

# Use the same setting as you are using on
# the server.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap
dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel
# if you have more than one.  On XP SP2,
# you may need to disable the firewall
# for the TAP adapter.
;dev-node MyTap

# Are we connecting to a TCP or
# UDP server?  Use the same setting as
# on the server.
proto tcp
;proto udp

# The hostname/IP and port of the server.
# You can have multiple remote entries
# to load balance between the servers.
remote my-server-1 1194
;remote my-server-2 1194

# Choose a random host from the remote
# list for load-balancing.  Otherwise
# try hosts in the order specified.
;remote-random

# Keep trying indefinitely to resolve the
# host name of the OpenVPN server.  Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
resolv-retry infinite

# Most clients don't need to bind to
# a specific local port number.
nobind

# Downgrade privileges after initialization (non-Windows only)
;user nobody
;group nogroup

# Try to preserve some state across restarts.
persist-key
persist-tun

# If you are connecting through an
# HTTP proxy to reach the actual OpenVPN
# server, put the proxy server/IP and
# port number here.  See the man page
# if your proxy server requires
# authentication.
http-proxy XX.XXX.XX.85 3128
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]

# Wireless networks often produce a lot
# of duplicate packets.  Set this flag
# to silence duplicate packet warnings.
;mute-replay-warnings

# SSL/TLS parms.
# See the server config file for more
# description.  It's best to use
# a separate .crt/.key file pair
# for each client.  A single ca
# file can be used for all clients.
ca ca.crt
cert client.crt
key client.key

# Verify server certificate by checking that the
# certicate has the correct key usage set.
# This is an important precaution to protect against
# a potential attack discussed here:
#  http://openvpn.net/howto.html#mitm
#
# To use this feature, you will need to generate
# your server certificates with the keyUsage set to
#   digitalSignature, keyEncipherment
# and the extendedKeyUsage to
#   serverAuth
# EasyRSA can do this for you.
remote-cert-tls server

# If a tls-auth key is used on the server
# then every client must also have the key.
tls-auth ta.key 1

# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
# Note that v2.4 client/server will automatically
# negotiate AES-256-GCM in TLS mode.
# See also the ncp-cipher option in the manpage
cipher AES-256-CBC

# Enable compression on the VPN link.
# Don't enable this unless it is also
# enabled in the server config file.
#comp-lzo

# Set log file verbosity.
verb 3

# Silence repeating messages
;mute 20

Danke schön für jede Hilfe.

Nazaled

(Themenstarter)
Avatar von Nazaled

Anmeldungsdatum:
13. September 2018

Beiträge: 33

Leider habe ich den Beitrag in den falschen Bereich gepostet und keine Möglichkeit gefunden den zu verschieben. Bitte als nicht meckern.

Einen schönen guten Tag,

wir haben bei uns zwei Server installiert. Auf dem einen läuft OpenVPN und auf den anderen Squid. Beide kann man wunderbar ansteuern. Also ich komme mit dem OpenVPN Zertifikat ins Netz oder halt mit den Proxy Daten ins Netz.

Nun sollen aber meine Daten über den VPN durch den Proxy ins Netz. Leider hängt der gute beim TCP. Hier mal die Log Daten der Verbindung.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
Wed Feb 13 12:46:45 2019 OpenVPN 2.4.6 x86_64-w64-mingw32 [SSL (OpenSSL)] [LZO] [LZ4] [PKCS11] [AEAD] built on Apr 26 2018
Wed Feb 13 12:46:45 2019 Windows version 6.2 (Windows 8 or greater) 64bit
Wed Feb 13 12:46:45 2019 library versions: OpenSSL 1.1.0h  27 Mar 2018, LZO 2.10
Enter Management Password:
Wed Feb 13 12:46:45 2019 MANAGEMENT: TCP Socket listening on [AF_INET]127.0.0.1:25340
Wed Feb 13 12:46:45 2019 Need hold release from management interface, waiting...
Wed Feb 13 12:46:46 2019 MANAGEMENT: Client connected from [AF_INET]127.0.0.1:25340
Wed Feb 13 12:46:46 2019 MANAGEMENT: CMD 'state on'
Wed Feb 13 12:46:46 2019 MANAGEMENT: CMD 'log all on'
Wed Feb 13 12:46:46 2019 MANAGEMENT: CMD 'echo all on'
Wed Feb 13 12:46:46 2019 MANAGEMENT: CMD 'bytecount 5'
Wed Feb 13 12:46:46 2019 MANAGEMENT: CMD 'hold off'
Wed Feb 13 12:46:46 2019 MANAGEMENT: CMD 'hold release'
Wed Feb 13 12:46:46 2019 Outgoing Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Wed Feb 13 12:46:46 2019 Incoming Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication
Wed Feb 13 12:46:46 2019 TCP/UDP: Preserving recently used remote address: [AF_INET]XX.XX.XX.157:1194
Wed Feb 13 12:46:46 2019 Socket Buffers: R=[65536->65536] S=[65536->65536]
Wed Feb 13 12:46:46 2019 Attempting to establish TCP connection with [AF_INET]XX.XX.XX.157:1194 [nonblock]
Wed Feb 13 12:46:46 2019 MANAGEMENT: >STATE:1550058406,TCP_CONNECT,,,,,,
Wed Feb 13 12:46:52 2019 SIGTERM[hard,init_instance] received, process exiting
Wed Feb 13 12:46:52 2019 MANAGEMENT: >STATE:1550058412,EXITING,init_instance,,,,,

Und nun die Config Dateien.

server.conf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
port 443
;port 1194
proto tcp
;proto udp
dev tun
sndbuf 0
rcvbuf 0
ca ca.crt
cert server.crt
key server.key
dh dh.pem
auth SHA512
tls-auth ta.key 0
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 46.38.225.230"
push "dhcp-option DNS 46.38.252.230"
keepalive 10 120
cipher AES-256-CBC
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
crl-verify crl.pem

client.conf

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server.     #
#                                            #
# This configuration can be used by multiple #
# clients, however each client should have   #
# its own cert and key files.                #
#                                            #
# On Windows, you might want to rename this  #
# file so it has a .ovpn extension           #
##############################################

# Specify that we are a client and that we
# will be pulling certain config file directives
# from the server.
client

# Use the same setting as you are using on
# the server.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap
dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel
# if you have more than one.  On XP SP2,
# you may need to disable the firewall
# for the TAP adapter.
;dev-node MyTap

# Are we connecting to a TCP or
# UDP server?  Use the same setting as
# on the server.
proto tcp
;proto udp

# The hostname/IP and port of the server.
# You can have multiple remote entries
# to load balance between the servers.
remote my-server-1 1194
;remote my-server-2 1194

# Choose a random host from the remote
# list for load-balancing.  Otherwise
# try hosts in the order specified.
;remote-random

# Keep trying indefinitely to resolve the
# host name of the OpenVPN server.  Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
resolv-retry infinite

# Most clients don't need to bind to
# a specific local port number.
nobind

# Downgrade privileges after initialization (non-Windows only)
;user nobody
;group nogroup

# Try to preserve some state across restarts.
persist-key
persist-tun

# If you are connecting through an
# HTTP proxy to reach the actual OpenVPN
# server, put the proxy server/IP and
# port number here.  See the man page
# if your proxy server requires
# authentication.
http-proxy XX.XXX.XX.85 3128
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]

# Wireless networks often produce a lot
# of duplicate packets.  Set this flag
# to silence duplicate packet warnings.
;mute-replay-warnings

# SSL/TLS parms.
# See the server config file for more
# description.  It's best to use
# a separate .crt/.key file pair
# for each client.  A single ca
# file can be used for all clients.
ca ca.crt
cert client.crt
key client.key

# Verify server certificate by checking that the
# certicate has the correct key usage set.
# This is an important precaution to protect against
# a potential attack discussed here:
#  http://openvpn.net/howto.html#mitm
#
# To use this feature, you will need to generate
# your server certificates with the keyUsage set to
#   digitalSignature, keyEncipherment
# and the extendedKeyUsage to
#   serverAuth
# EasyRSA can do this for you.
remote-cert-tls server

# If a tls-auth key is used on the server
# then every client must also have the key.
tls-auth ta.key 1

# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
# Note that v2.4 client/server will automatically
# negotiate AES-256-GCM in TLS mode.
# See also the ncp-cipher option in the manpage
cipher AES-256-CBC

# Enable compression on the VPN link.
# Don't enable this unless it is also
# enabled in the server config file.
#comp-lzo

# Set log file verbosity.
verb 3

# Silence repeating messages
;mute 20

Danke schön für jede Hilfe.

Moderiert von misterunknown:

Doppelpostings verstoßen gegen die Forenregeln.

misterunknown Team-Icon

Ehemalige
Avatar von misterunknown

Anmeldungsdatum:
28. Oktober 2009

Beiträge: 4403

Nazaled schrieb:

Beide kann man wunderbar ansteuern. Also ich komme mit dem OpenVPN Zertifikat ins Netz oder halt mit den Proxy Daten ins Netz.

Stehen die beiden Server im gleichen Subnetz?

Nun sollen aber meine Daten über den VPN durch den Proxy ins Netz. Leider hängt der gute beim TCP. Hier mal die Log Daten der Verbindung.

Du willst dich also per VPN mit dem einen Server verbinden, und über diese Verbindung den Proxy nutzen? Welchen Zweck hat das, wenn du an den Proxy auch so rankommst? Stehen die Server bei dir lokal oder an einem Ort im Internet?

Nazaled

(Themenstarter)
Avatar von Nazaled

Anmeldungsdatum:
13. September 2018

Beiträge: 33

Hi und danke für deine Antwort,

Stehen die beiden Server im gleichen Subnetz?

Nein, beide stehen in einem anderen Subnetz.

Du willst dich also per VPN mit dem einen Server verbinden, und über diese Verbindung den Proxy nutzen? Welchen Zweck hat das, wenn du an den Proxy auch so rankommst? Stehen die Server bei dir lokal oder an einem Ort im Internet?

Mein Chef will das so, ich bin Praktikant und wir sollen das umsetzen ☺

misterunknown Team-Icon

Ehemalige
Avatar von misterunknown

Anmeldungsdatum:
28. Oktober 2009

Beiträge: 4403

Nazaled schrieb:

Mein Chef will das so, ich bin Praktikant und wir sollen das umsetzen ☺

Aha. Nur weil der Chef das will, macht das nicht unbedingt Sinn, aber gut. Wie sieht denn das Routing (bei bestehender VPN-Verbindung) auf dem Client aus?

ip r

Nazaled

(Themenstarter)
Avatar von Nazaled

Anmeldungsdatum:
13. September 2018

Beiträge: 33

Hier die Abfrage mit ip r

1
2
3
default via 92.60.36.1 dev eth0 proto static
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.1
92.60.36.0/22 dev eth0 proto kernel scope link src 92.60.39.157

misterunknown Team-Icon

Ehemalige
Avatar von misterunknown

Anmeldungsdatum:
28. Oktober 2009

Beiträge: 4403

In welchem Netz steht der Squid? Ich vermute das wird gar nicht über den Tunnel geroutet.

Nazaled

(Themenstarter)
Avatar von Nazaled

Anmeldungsdatum:
13. September 2018

Beiträge: 33

Ach dann habe ich das wohl falsch verstanden.

Das war jetzt einfach nur eine Verbindung mit den VPN die auch läuft.

Sollte ich den Befehl eingeben wenn der sich versucht mit dem Squid zu verbinden?

Nazaled

(Themenstarter)
Avatar von Nazaled

Anmeldungsdatum:
13. September 2018

Beiträge: 33

Bekomme hier die selbe Meldung.

Der openVPN Client hängt bei Thu Feb 14 14:33:39 2019 MANAGEMENT: >STATE:1550151219,TCP_CONNECT,,,,,,

Habe mit meinen Chef gesprochen, der Grund ist das die Schulen alle ein VPN haben, dahinter soll dann nachher der Proxy mit den IP/Domain Filtern der BPJM.

Der Squid steht im Netz : 85.235.67.85/22

misterunknown Team-Icon

Ehemalige
Avatar von misterunknown

Anmeldungsdatum:
28. Oktober 2009

Beiträge: 4403

Nazaled schrieb:

Der Squid steht im Netz : 85.235.67.85/22

Ja, das wird aber noch gar nicht über das VPN geroutet. Der hängt also weil er den Proxy direkt versucht zu erreichen, was vermutlich in irgendeiner Firewall verboten wird. Du brauchst also noch eine Route für die IP des Proxies (oder ggf. das gesamte Netz), welche über den Tunnel geht.

Nazaled

(Themenstarter)
Avatar von Nazaled

Anmeldungsdatum:
13. September 2018

Beiträge: 33

Meinst du jetzt die Firewall vom Squid? Die ist aus, auf dem VPN habe ich gar keine installiert.

misterunknown Team-Icon

Ehemalige
Avatar von misterunknown

Anmeldungsdatum:
28. Oktober 2009

Beiträge: 4403

Nazaled schrieb:

Meinst du jetzt die Firewall vom Squid? Die ist aus, auf dem VPN habe ich gar keine installiert.

Nein, ich meinte irgendeine Firewall. Das war aber nur eine Vermutung. Grundsätzlich geht halt der Client aktuell nicht über das VPN, wenn er den Squid erreichen will. Das ist das Problem.

Nazaled

(Themenstarter)
Avatar von Nazaled

Anmeldungsdatum:
13. September 2018

Beiträge: 33

Okay,

Wir bauen das morgen mal local auf mit 2 Pi. Ich schau dann mal wie das funktioniert.

Nazaled

(Themenstarter)
Avatar von Nazaled

Anmeldungsdatum:
13. September 2018

Beiträge: 33

Guten Tag,

nun stehen beide Pi im selben Netz.

Beim vpn gibt er folgendes aus

1
2
3
default via 192.168.178.1 dev wlan0 src 192.168.178.109 metric 303
10.8.0.0/24 dev tun0 proto kernel scope link src 10.8.0.1
192.168.178.0/24 dev wlan0 proto kernel scope link src 192.168.178.109 metric 303

Wie kann ich den sehen ob der Squid mein VPN überhaupt auf nimmt? muss man im Squid hier noch Änderungen vornehmen?

Nazaled

(Themenstarter)
Avatar von Nazaled

Anmeldungsdatum:
13. September 2018

Beiträge: 33

Okay, ich habe es falsch verstanden. Es soll nur ein Server genutzt werden. Auf diesem ist OpenVPN und Squid installiert. Der CLient stellt nun die Anfrage an OpenVPN und geht dann über den Proxy ins www. Ist das überhaupt so Möglich?

Gruß Sebastian

Antworten |