LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-13-2020, 08:36 AM   #1
kzo81
Member
 
Registered: Aug 2014
Location: Hungary
Distribution: Debian, Linux Mint, CentOS
Posts: 197

Rep: Reputation: Disabled
embed into ovpn client file


Hi, I'd like to inline embed the ca.crt's data into the client.conf file like this:

Code:
cat base.conf 
<(echo -e '<ca>') ~/client-configs/keys/ca.crt <(echo -e '</ca>') 
<(echo -e '<cert>') ~/client-configs/keys/client1.crt <(echo -e '</cert>n')
<(echo -e '<key>') ~/client-configs/keys/client1.key <(echo -e '</key>n')
<(echo -e '<tls-auth>') ~/etc/openvpn/ta.key <(echo -e '</tls-auth>') >> client1.ovpn
But I got this error:
Code:
bash: /dev/fd/63: Permission denied
I did it as root. Obviously there us something going on wrong the way I try to embed in. Do you know how to do it properly?

Last edited by kzo81; 01-13-2020 at 08:43 AM.
 
Old 02-12-2020, 11:47 AM   #2
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,281

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
It should be in one line. Or use line continuation character at end of each line, it is backslash in Bash (\).
 
1 members found this post helpful.
Old 02-12-2020, 12:29 PM   #3
kzo81
Member
 
Registered: Aug 2014
Location: Hungary
Distribution: Debian, Linux Mint, CentOS
Posts: 197

Original Poster
Rep: Reputation: Disabled
Wink

This was the solution, thanks though

#!/bin/bash

f=$1

cat base.conf > client"$1".ovpn

echo <ca> >> client"$1".ovpn
cat ~/client-configs/keys/ca.crt >> client"$1".ovpn
echo </ca> >> client"$1".ovpn

etc...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash cronjob script to kill openvpn and run client.ovpn toxine Linux - General 14 06-10-2018 08:34 AM
No internet connection after .ovpn file run (OpenVPN) snovosel112811 Linux - Server 2 01-21-2017 08:51 AM
using .ovpn file on Gadmin-OpenVPN-Client LadyIris Linux - Networking 1 06-02-2015 10:04 PM
selinux in fedora conflict with ovpn hnml Linux - Newbie 1 11-10-2014 06:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration