![]() |
|
|||
![]()
Hi All,
I've recently got OpenBSD (AMDx64) installed on a 10 year old HP Probook laptop, and now I need to give it secure internet using my VPN subscription. I've currently got ExpressVPN, and I understand it might be possible for me to connect to it using OpenVPN running in OpenBSD? What do you think of this as a step by step guide for getting it working? Any other links you'd suggest? Looking ahead: even once I get an OpenVPN connection to ExpressVPN servers, I'm then going to use a combination of FFox (I believe I need the ESR release for it to work well with OpenBSD?) and my Lastpass PW manager. Now I understand there's a Lastpass port but what about the Yubikey that I need to login with? How on earth will that work in combination with the Lastpass CLI here ? |
|
||||
![]()
Just like with Firefox, there is an OpenBSD README installed with the OpenVPN package that provides OpenBSD-specific provisioning guidance.
I found a closed issue on Github from 2014 that mentions a working Yubikey in the problem description: https://github.com/lastpass/lastpass-cli/issues/47. But I have no other knowledge about the integration -- or lack thereof -- of Yubikeys and lastpass-cli. You might reach out to that project for guidance if needed. |
|
|||
![]()
Thanks jggimi. I think I'll be able to avoid the lastpass client now that I've got FFox installed. I should be able to goto lastpass.com and log in there and hopefully when it prompts me for the yubikey it will actually do so in the same way it does when i go there on my Macbook. I suspect not, but getting that device recognised/enabled may be a topic for another thread.
Of course I don't want to have my login credentials exposed over regular internet and so I still need to get this OpenVPN connection established to my VPN provided (ExpressVPN). As things are I'm writing these posts and doing all my OpenBSD article finding on this Macbook. I just tried looking up the OpenVPN provisioning guidance readme as you suggest using a duckduckgo search on this mac but found nothing (suprising actually) so I'm using this which is actually a pretty solid guide, as far as I can tell, for getting my OpenVPN client connection setup in OpenBSD.. So per the instructions on that page I've successfully downloaded the OpenVPN using Code:
pkg_add -v openvpn Now comes the main issue: The transferring of the ovpn config files that I've downloaded from within my ExpressVPN account from the USB stick to the OpenBSD system. For that I've used this excellent helper article here. Now before I get to the main issue I need help with, and so that I have a holistic understanding of whats going on when I employ these commands: is this mounting process basically about making a directory on the OpenBSD called /mnt/pen and then copying the entire USB drive's contents across (in this case my OVPN config files) to this newly created directory using the command: Code:
mount /dev/sd0i /mnt/pen After doing the mount / copy of the USB contents to the newly created /mnt/pen directory, I then tried to copy them across to /etc/openvpn where according to this they need to be for the final editing with vi. After using Code:
#cp /mnt/pen /etc/openvpn Code:
#ls -l Does it matter that when I copied the OVPN files originally to the USB it was done as a simple GUI interface copy on MacOS (not DD or CP in the mac terminal) If so, why am I able to see them fine when I mount the USB drive to /mnt/pen ? As you can see this is a pretty basic step I need to overcome to get the OpenVPN client up and running to secure my internet in OpenBSD. Any help would be appreciated! |
|
||||
![]() Quote:
Quote:
Quote:
$ pkg_info openvpn .Quote:
Code:
-R If source designates a directory, cp copies the directory and the entire subtree connected at that point. |
|
|||
![]() Quote:
Quote:
Quote:
Code:
man cp Code:
cd /usr/local/share/doc/pkg-readmes/ Code:
vi readme.txt UPDATE (since original version of this post): I've just gone back into my OpenBSD system to give this cp a retry using the -R argument and found that the files I mounted successfully yesterday to the /mnt/pen folder are no longer there. So I've gone through the mounting process again (In short: MKDIR /mnt/usb followed by mount /dev/sd0i /mnt/usb) to get the files available for the system. Now when I then navigate to the /mnt/usb and its subfolder to copy the OVPN files using this new -R argument method, I end up with the same Code:
total 0 I'm going to provide exactly what I'm inputting into the command line in case you can point out what I'm missing or doing wrong in my input: Code:
cp -R ._my_expressvpn_switzerland.udp.ovpn /etc/openvpn Do I need to specify the source directory within the command? Surely not since I'm already sitting within the relevant directory when issuing the cp command right? Does it really need to be this hard ![]() UPDATE 2: Have now also tried specifying the source directory and filename in the source component of the command line. ie. Code:
cp -R /mnt/usb/ExpressVPN\OpenVPN/ ._my_expressvpn_switzerland_udp.ovpn /etc/openvpn OMG it's been a long time since an operating system made me this frustrated! Somebody help me with this! Last edited by Entropic; 30th November 2022 at 01:05 PM. |
|
|||
![]() Quote:
I'm not sure if you've noticed but I've updated todays post a couple times after trying/retrying various forms of the cp -R command to no avail. I've just noticed that when I navigate to the /mnt/usb directory I can only type Code:
cd usb Code:
cd /mnt |
|
||||
![]()
I just happened by and noticed you edited your post to addI'm sorry that you're frustrated with using Unix/Linux utilities, which you've never used before. Briefly:
Here's an example of a recursive directory copy with cp(1). In this example I have created a directory "a" and then under it created files "b" and "c", a sub-directory "d" and within that files "e" and "f": Code:
t450$ ls -FR a a: b c d/ a/d: e f Code:
t450$ cp -R a g t450$ ls -FR g g: b c d/ g/d: e f |
|
|||
![]() Quote:
Code:
cd /mnt/pen (or /mnt/usb) Quote:
|
|
||||
![]()
Your file names appear to have leading dots, and that's atypical: on Unix-based platforms, files with leading dots are considered "hidden" in that some commands, such as ls(1), will not show them without the addition of the -a option. Perhaps, then, you have successfully copied files but do not see them with ls(1) because you are not using -a.
If using $ ls -a is not the solution, then more information will be needed. The use of script(1) to record a console session might shed more light on what is going on.
|
|
|||
![]() Quote:
Code:
ls -a Code:
. .. |
|
||||
![]()
It means there is nothing in the directory. The "." is a pointer to the current directory, and the ".." is a pointer to the directory above.
=== If you can produce one, I'd love to see a console log -- a "typescript" file, output from the script(1) utility -- from a new attempted copy session. If you are able to transfer the file, of course. In particular, I'd like to see the contents of the source directory structure you are trying to copy out of, using ls(1) with the -l option, so that the file types and file access modes are displayed, and, if there are any errors or warnings from the cp(1) command. |
|
|||
![]() Quote:
Code:
script -a cpfail.typescript In the meantime I'm going to briefly summarise this thread as its already getting quite long, and I've actually already faithfully listed all the command line inputs used to date anyway. In post #3 in this thread I showed how I'd mounted the OVPN config files to the newly made directory /mnt/pen (and later /mnt/usb). I confirmed that this had been successful because using ls-l from within the /mnt/usb directory showed the full contents of the USB that I know to exist from having put it on the USB in a MacOS system beforehand. Since then I've also done at least two posts showing my command line input of the cp command (including the recursive -R argument and including a form where I specified the full path to the sourcefile) Code:
cp -R ._my_expressvpn_switzerland.udp.ovpn /etc/openvpn Code:
ls -l When I use the copy command from within the mounted directory of USB contents I get no feedback from the console after pressing enter on the following Code:
cp *.ovpn /etc/openvpn Code:
cd Code:
cd /mnt Code:
cd usb |
|
|||
![]()
Because /mnt is a system/root directory you need to use the slash, but /mnt/usb is a sub directory of /mnt so you don't need it, if you are in /mnt, but if you aren't in /mnt, you need cd /mnt/usb.
__________________
Linux since 1999, & also a BSD user. ![]() |
|
|||
![]() Quote:
As a caveat, however, I had to delete the openvpn file in /etc before I could create a directory with the same name. I'm pretty sure the openvpn file I deleted in /etc was of no significance as it was something I'd probably created with an erroneous cp command early in my trials on doing this about a week ago, but I'm not 100% sure :/ It would be good as a learning experience to know how I created a file named openvpn in the first place mind you. From today's unix basics I think a file can only be created by typing vi /<filename> meaning I must have typed the following at some point in all of this? Code:
vi openvpn |
|
||||
![]()
You are correct that Firefox is restricted to only specific storage locations, such as /tmp and $HOME/Downloads.
Here -- as an example only -- is a set of commands that I would use to copy contents from a USB stick into a new directory. In this example, the commands are shown with with "#" in the prompt because they are performed as the superuser, root. First, when I insert the stick into my laptop, the kernel produces messages on the console informing me of the attachment and, on this laptop here, the assignment of the USB stick to sd(4) device number 2. This is the actual output, which is captured on the console and in my dmesg(8): Code:
umass0 at uhub0 port 12 configuration 1 interface 0 "INDMEM M-Trive" rev 3.00/1.00 addr 4 umass0: using SCSI over Bulk-Only scsibus4 at umass0: 2 targets, initiator 0 sd2 at scsibus4 targ 1 lun 0: <INDMEM, M-Trive, 0> serial.174c55aa6B7782967799 sd2: 114473MB, 512 bytes/sector, 234441648 sectors Code:
t450# disklabel sd2 # /dev/rsd2c: type: SCSI disk: SCSI disk label: M-Trive duid: 0000000000000000 flags: bytes/sector: 512 sectors/track: 63 tracks/cylinder: 255 sectors/cylinder: 16065 cylinders: 14593 total sectors: 234441648 boundstart: 34 boundend: 234441615 16 partitions: # size offset fstype [fsize bsize cpg] c: 234441648 0 unused i: 204800 2048 MSDOS j: 262144 206848 unknown k: 232736700 468992 NTFS I will mount that large "k" partition under /mnt, which on my laptop is just an empty directory. I've used ls with -a to prove it is empty to myself, then I mount partition k, and take a quick look at all the files and directories that get listed under /mnt: Code:
t450# ls /mnt t450# ls -a /mnt . .. t450# mount /dev/sd2k /mnt t450# ls -F /mnt $AttrDef $UpCase ESD System Volume Information $BadClus $Volume Garmin Users $Bitmap $WINDOWS.~BT Intel Windows $Boot $WinREAgent OneDriveTemp e9433bf69c2fde6e687b $Extend $Windows.~WS PerfLogs hiberfil.sys $LogFile AVScanner.ini Program Files inetpub $MFTMirr Config.Msi Program Files (x86) pagefile.sys $Recycle.Bin Documents and Settings ProgramData swapfile.sys $Secure DumpStack.log.tmp Recovery t450# ls -F /mnt $AttrDef* $UpCase* ESD/ System Volume Information/ $BadClus* $Volume* Garmin/ Users/ $Bitmap* $WINDOWS.~BT/ Intel/ Windows/ $Boot* $WinREAgent/ OneDriveTemp/ e9433bf69c2fde6e687b/ $Extend/ $Windows.~WS/ PerfLogs/ hiberfil.sys* $LogFile* AVScanner.ini* Program Files/ inetpub/ $MFTMirr* Config.Msi/ Program Files (x86)/ pagefile.sys* $Recycle.Bin/ Documents and Settings/ ProgramData/ swapfile.sys* $Secure* DumpStack.log.tmp* Recovery/ Code:
t450# ls -lR /mnt/Intel/ /mnt/Intel/: total 0 drwxr-xr-x 1 root wheel 0 Aug 22 2019 Logs drwxr-xr-x 1 root wheel 0 Nov 24 11:31 gp /mnt/Intel/Logs: total 576 -rwxr-xr-x 1 root wheel 0 Aug 22 2019 IntelCPHS.log -rwxr-xr-x 1 root wheel 210610 Jul 22 19:24 IntelGFX.log -rwxr-xr-x 1 root wheel 22588 Jul 22 19:24 IntelGFXCoin.log -rwxr-xr-x 1 root wheel 5158 Aug 22 2019 IntelICCS.log -rwxr-xr-x 1 root wheel 45330 Aug 22 2019 IntelOCL.log /mnt/Intel/gp: total 0 Code:
t450# ls -lR /etc/test ls: /etc/test: No such file or directory t450# cp -R /mnt/Intel /etc/test t450# ls -lR /etc/test /etc/test: total 8 drwxr-xr-x 2 root wheel 512 Dec 2 08:06 Logs drwxr-xr-x 2 root wheel 512 Dec 2 08:06 gp /etc/test/Logs: total 600 -rwxr-xr-x 1 root wheel 0 Dec 2 08:06 IntelCPHS.log -rwxr-xr-x 1 root wheel 210610 Dec 2 08:06 IntelGFX.log -rwxr-xr-x 1 root wheel 22588 Dec 2 08:06 IntelGFXCoin.log -rwxr-xr-x 1 root wheel 5158 Dec 2 08:06 IntelICCS.log -rwxr-xr-x 1 root wheel 45330 Dec 2 08:06 IntelOCL.log /etc/test/gp: total 0 Code:
t450# umount /mnt Code:
sd2 detached scsibus4 detached umass0 detached Last edited by jggimi; 2nd December 2022 at 01:18 PM. Reason: typo |
|
|||
![]()
Righteo, now that I've got my .ovpn files copied into /etc/openvpn apparently I just need to use vi to edit a file called hostname.tun0 that OpenVPN for BSD opens by default (if my interpretation of this page is correct).
So I used vi to "append" the following to the hostname.tun0 file. Firstly, I'm still not 100% sure if I needed to be editing "hostname.tun0" specifically, or whether it should be the name of my root user before .tun0? I'm assuming the former is correct given the pages instruction: "OpenVPN normally re-creates the tun/tap interface at startup. OpenVPN should be started from the hostname.tun0" As a precaution I edited the latter named .tun0 in vi by "appending" the same command as for the hostname.tun0 file to ensure that whichever one was the actual .tun0 file being referred to by the programme, that it would have the same scripting: Code:
up !/usr/local/sbin/openvpn --daemon --config /etc/openvpn/openbsd.ovpn So the next instruction is to run the following command to start the OpenVPN connection using the ovpn config files I copied over to /etc/openvpn: Code:
/usr/local/sbin/openvpn --daemon --config /etc/openvpn/openbsd.ovpn ![]() Code:
ifconfig tun0 |
|
||||
![]() Quote:
Code:
t450$ ls /etc/hostname.* /etc/hostname.em0 /etc/hostname.lo1 /etc/hostname.vlan0 /etc/hostname.iwm0 /etc/hostname.trunk0 /etc/hostname.wg0 Quote:
$ pgreg -lf openvpn . As I don't have any direct knowledge of OpenVPN use the thing that concerns me from your problem report is the prompt for authentication (userid, pw) during startup of the daemon. I would look for ways to provide a certificate or other authentication methods that don't require prompts, because the netstart(8) script doesn't have a way to operate interactively.You can either wait for an OpenVPN user to respond here, reach out to the author of the guide you are using for clarification, or obtain guidance on provisioning OpenVPN from your VPN service provider. |
|
|||
![]() Quote:
Code:
ls /etc/hostname.* Quote:
Quote:
What I have noticed since creating the hostname.tun0 file in /etc/openvpn is that when I start my OpenBSD system, it no longer goes straight through to the x-window login screen with the blowfish pic. Instead it prompts me beforehand, in terminal, for the user authentication and pw. I assume this is the openvpn daemon starting up at startup? Either way, when I enter the details (user and pass), and go through and login normally at the main login screen, a "ifconfig tun0" reveals "down" still for my openvpn connection, and thats in spite of having working internet otherwise.. I tried $ pgreg -lf openvpn and it says pgreg is not known in ksh..
|
|
|||
![]()
The shell cannot find 'pgreg' because that is not an existing program. Is a typo
![]() Code:
$ pgrep -lf openvpn
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenBSD Vlan setup | Crypt | OpenBSD Security | 6 | 13th August 2020 01:25 AM |
Your OpenBSD shell setup | hanzer | OpenBSD General | 11 | 23rd October 2017 09:35 PM |
OpenBSD Multiple VPN Setup | Dr-D | OpenBSD Security | 10 | 7th April 2014 10:50 AM |
OpenBSD VPN Setup | Dr-D | OpenBSD Security | 2 | 4th April 2014 01:23 PM |
how setup arpwatch for OpenBSD | mfaridi | OpenBSD Packages and Ports | 1 | 11th December 2008 05:22 PM |