Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--config file Returning Error #28

Open
Morketh opened this issue Mar 3, 2025 · 6 comments
Open

--config file Returning Error #28

Morketh opened this issue Mar 3, 2025 · 6 comments

Comments

@Morketh
Copy link

Morketh commented Mar 3, 2025

cloudflare-ddns --file /etc/cloudflare-ddns/eample_domain.ext.ini
Record names cannot contain path separators!
im not exactly sure whats wrong with this command but it seems like its not parsing the command line arguments properly.
using --file=/path/to/domain.ini give me the following error message:
Bad usage! You can run the program without arguments and load the config in /etc/cloudflare-ddns/config.ini or pass the API token and the DNS record name as arguments
id like to avoid placing the API token on the command line due to multi-user environment and security issues.
having a unified configuration file would be ideal for multiple domain names as mentioned in #25 and in #22
having a --domain option would be a nice addition to the command line allowing the use of the API key to be in the configuration file while still being able to parse a comma separated list of domains

--domain domain1.ext,domain2.ext
or separately for clarity sake.
--domain domain1.ext --domain domain2.ext

the above approach lets users script multiple domains with a single API key stored in an INI file that is setup with the proper unix permissions for security while still maintaining ease of use and expand-ability.
so far this application has been the most usable solution to the DDNS problem..... its simple and straightforward with out a lot of extra fluff.

@Morketh
Copy link
Author

Morketh commented Mar 3, 2025

i was able to work around this with the following bash script:

# get installed path
DDNS = $(which cloudflare-ddns)

DOMAIN1 = "foo.ext"
DOMAIN2 = "bar.ext"

function perms() {
  # set permissions for the config file
  chown root:root /etc/cloudflare-ddns/config.ini
  chmod 600 /etc/cloudflare-ddns/config.ini
}

# copy files around and run the default config

cp /etc/cloudflare-ddns/$DOMAIN1.ini /etc/cloudflare-ddns/config.ini

perms

$DDNS

cp /etc/cloudflare-ddns/$DOMAIN2.ini /etc/cloudflare-ddns/config.ini

perms

$DDNS

while this works and i can set this up with the systemd service as described in the readme i find this solution to be way out of left field.
ill leave this here for anyone else that might need to use this for more then one domain.

@Tachi107
Copy link
Owner

Tachi107 commented Mar 4, 2025

Hi! Thanks for using cloudflare-ddns :)

I believe that the issue is that you're using --config=file as opposed to --config file. The parsing of arguments does not support using = instead of (space).

I don't think I'm going to add that possibility. Some major programs (like curl) do not support this GNU command line utilities convention either.

Let me know if this fixes your issue!

@Tachi107
Copy link
Owner

Tachi107 commented Mar 4, 2025

Note: I'm thinking of adding systemd credentials support to the tool, in order to make the token storage and retrieval even more secure.

@Morketh
Copy link
Author

Morketh commented Mar 4, 2025

It seems my original issue may not have been entirely clear.

When running the following command:

cloudflare-ddns --file /etc/cloudflare-ddns/example_domain.ext.ini

I receive the error:

Record names cannot contain path separators!

This command does not include an equality operator (=), so it appears that the argument parsing is not functioning as expected.

Additionally, when using an alternative syntax:

cloudflare-ddns --file=/path/to/domain.ini

I receive the following error message: (and have explained that you will not fix this aspect of the command-line)

Bad usage! You can run the program without arguments and load the config in /etc/cloudflare-ddns/config.ini or pass the API token and the DNS record name as arguments.

This suggests that the command-line switch --file is not being processed correctly. (Regardless of formatting or = being used)

To work around this issue, I resolved it by using a copy-paste script (as shared in my second reply). However, the underlying issue with the argument parsing remains.

Would appreciate any insights into why this behavior is occurring and hopefully a software patch.

Feature Suggestion: --domain Option

It would be helpful to have a --domain option that allows specifying domains while keeping the API key inside a secured INI file. For example:

--domain domain1.ext,domain2.ext

or, for clarity:

--domain domain1.ext --domain domain2.ext

This approach would allow users to script multiple domains with a single API key stored securely, ensuring proper UNIX permissions while maintaining usability and expandability.

Feel free to ask for additional information so we can resolve this issue in its entirety.

@Tachi107
Copy link
Owner

Tachi107 commented Mar 4, 2025

Oh, are you actually using --file? It's --config :)

P.S. thanks for the --domain suggestion, I'll think about it

@Tachi107
Copy link
Owner

Tachi107 commented Mar 4, 2025

What is happening is that the tool is interpreting --file as the API token and /etc/cloudflare-ddns/example_domain.ext.ini as the record name --- which is why you get that error message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants