Tried several tests, including using SCP instead of WinSCP...executing the script continues to fail, when downloaded as a snippet and uploaded to /tmp.
The only way I could get it to work was to copy and paste the entire contents of the script directly in to SSH.
It appears if the script is downloaded through the web browser on a Windows machine, the file will have Windows EOLs [CRLF]. When I have time this morning, I'll boot up my Ubuntu VM and see if downloading via Ubuntu FireFox results with Linux EOLs.
If it does, I'll need to do some research on DokuWiki's file plugin's wiki page to determine if there's a way to force EOLs, regardless of OS used to download. The code block is specified as bash, hence the syntax highlighting, so one would think the file plugin would have been coded to recognize the EOLs should match the shell type.
I just confirmed if using wget on Windows (included with Git for Windows, GitHub Desktop, and Cygwin), it downloads the script with the correct LF EOL.
I'm not sure if dos2unix is apart of the default BusyBox config, and if not, perhaps it could be suggested to include it in the default BusyBox config.
If any have it installed, issue the following: dos2unix -u ./create-certs.sh && chmod 754 ./create-certs.sh && ./create-certs.sh
Else, with Windows, one can utilize Notepad++ or Atom to change the EOLs before copying to the router
It didn't occur to me users would download it via a web browser versus wget on the router, so that's a glaring oversight. This is what I did:
When using the File Plugin, all code snippets are chronologically ordered, so the next code block down would end in codeblock=4, etc. This makes it convenient if one if downloading multiple scripts from a wiki, as they don't need to revisit the page each time to get a new link.
The issue is not with the file plugin, and would exist if someone copied the code into notepad on Windows, saved it, then copied the script to their router, as the EOLs would be incorrect, hence the issue.
You claim everything is not working as expected... perhaps you missed this post, of which shows there is no issue with the script or the file plugin
[root@LEDE] /tmp : ./create-certs_crlf.sh
-ash: ./create-certs_crlf.sh: not found
[root@LEDE] /tmp : dos2unix -u ./create-certs_crlf.sh && ./create-certs_crlf.sh
# Creating Directory Structure #
------------------------------------------------------------
# Customizing openssl.cnf #
------------------------------------------------------------
# Generating Server PSK and CA, Server, & Client Certs #
------------------------------------------------------------
...Generating Certifcate Authority Cert & Key...
------------------------------------------------------------
Generating a 4096 bit RSA private key
..^C
[root@LEDE] /tmp : ^C
[root@LEDE] /tmp : dos2unix -d create-certs_crlf.sh && ./create-certs_crlf.sh
-ash: ./create-certs_crlf.sh: not found
Exacerbating the EOL issue with the OP is likely non-English language packs (and a different text encoding) due to the mispelled terminal output, as even with the script having a CRLF EOL, if one opens the script in the terminal and copies from it, those commands will execute successfully (or at least do on the 17.x LEDE development branch 4.9.73- 2018.01.09, r5695-56767dfa42)
@stangri I've added three annotations regarding the downloadable snippets under Generate Certficates
Please review and change as necessary.
@tmomas I haven't ran a stock build of OpenWrt since 2015, so this may be moot, but since a lot, if not most, users also use Windows, perhaps CONFIG_BUSYBOX_CONFIG_DOS2UNIX=y could be added to the master openwrt .config
I assume the master .config would be easier than the config.seeds of every device.
well, i am most impressed with the reponses that i sparked but a classic linux newbie problem. the issues of cr/lf.
i have been a microsoft bunky since 1978 but i thought wanted to run openvpn and decided to purchase a shiny, expensive linksys wrt3200acm. it was so easy to install openwrt and get myself onto the internet using the gui.
so i tried to get openvpn working, the reason why i purchased the router. i failed and posted for help at the openwrt forum. i am impressed with the help i got.
last night, i realized the issue was to do with text conversion between dos/windows and linux.
i did try to post my realization as soon as i realized it but it seems as a new user of the forum i could only post 20 messages in the first 24 hours of signing up. so of course, i was trying to post the 20th message with my solution and i got a popup telling me i could not post. "You've reached the maximum number of replies a new user can create on their first day. "
in the mean time, you all figured it out and made change to the webpage for openvpn support, most impressive, very quick!
now that openvpn is running on my router, i tried to connect using the .opvn file but every time i try to import the .opvn fails to import into my openvpn client. it just will not import.
not sure if i should be asking for help via the openwrt forum or not?
I can't be bothered with little scripts.
This is what I do to run a OpenVPN server.
I generate my own CA, server and client certs with this, and export them in PEM format
Server cert must have Digital Signature, Key Encipherment, TLS Web Server Authentication extensions
Client cert must have Digital Signature, TLS Web Client Authentication extensions
generate DH param with openssl openssl dhparam -out dhparam.pem 1024
put everything in a ovpn file (it's a simple text file like the one bellow)
then bring it via scp on the router and run it openvpn --config /path/to/my/config.ovpn