How do one go about handling individual client configurations in OpenVPN where the common name of the certificate includes non-UTF8 characters (Such as Swedish names)?
I had a look at the OpenVPN logs and it says:
10.0.0.6:33157 [l vberg] Peer Connection Initiated with [AF_INET]...
l vberg/10.0.0.6:33157 MULTI_sva: pool returned IPv4...
l vberg/10.0.0.6:33157 MULTI: Learn: ...
l vberg/10.0.0.6:33157 SENT CONTROL [l vberg]: 'PUSH_REPLY...
So i dumped the "binary" representation of the log and this is what it actually says:
10.0.0.6:33157 [l\xef\xbf\xbd\xef\xbf\xbdvberg] Peer Connection Initiated with [AF_INET]...
Which translates to:
10.0.0.6:33157 [lövberg] Peer Connection Initiated with [AF_INET]...
Now, I thought of just naming the /etc/openvpn/ccd/lovberg
file to:
/etc/openvpn/ccd/lövberg
/etc/openvpn/ccd/lv\xef\xbf\xbd\xef\xbf\xbdberg
However none of which works. The easy solution here would obviously be to change the common name in the certificates and re-issue the certificate, but I would prefer to solve this without having to do so.
Is this possible?
Edit:
Yes, I used Python and I copied the output of the log from tail -f openvpn.log
into Python in order to get the "binary" representation of the ö
.
OpenVPN 2.3.10 i386-openbsd5.9 (OpenSSL)
u'lövberg'.encode('utf8').decode('ascii', 'replace').encode('utf8')
print([data])
gives you a rather accurate description of the content without modifying it first. The only downside being the terminal encoding but usually none of the.encode().decode()
chain problems.with open('/var/log/openvpn/openvpn.log', 'rb') as fh: print([fh.read()])
and that got me\xc3\x83\xc2\xb6
for theö
and renaming the client configuration to/etc/openvpn/ccd/l\xc3\x83\xc2\xb6vberg
worked. Write up a answer and the solution points are yours.