Giter VIP home page Giter VIP logo

Comments (12)

carlalexander avatar carlalexander commented on July 19, 2024

$(hostname --fqdn) can be replaced by $(hostname -f). Here's the new error:

dnsdomainname: command not found

from ansible-pki.

drybjed avatar drybjed commented on July 19, 2024

I don't have access to a MacOS X system to test. I have asked specifically for MacOS X testers before merging the role, on IRC and on GitHub.

Does the script work if you change the shebang to #!/usr/bin/env bash? What does your $PATH look like, is /usr/local/bin listed before /bin (as it should be)?

Does hostname -f return the full FQDN (at least 1 dot), or just a hostname?

What do you get when you run type dnsdomainname in the terminal? I suppose that I can use an alternative method of getting the domain if this command is not available.

from ansible-pki.

carlalexander avatar carlalexander commented on July 19, 2024

hostname -f returns Carls-MacBook-Air-2.local. So there's the dot. I suggested it because according to the man page on Linux -f and --fqdn are the same.

dnsdomainname doesn't exist. I'm not sure what command to use for that one.

The other issue that I just looked at is that openssl is out-of-date. So that's something to keep in mind as well for Mac OS X users. Also there was some notes when I installed it, I'll copy them here in case they're useful:

A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
  /usr/local/etc/openssl/certs

and run
  /usr/local/opt/openssl/bin/c_rehash

This formula is keg-only, which means it was not symlinked into /usr/local.

Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/openssl/lib
    CPPFLAGS: -I/usr/local/opt/openssl/include

from ansible-pki.

drybjed avatar drybjed commented on July 19, 2024

I will take care of the dnsdomainname by parsing hostname -f, I hope that MacOS X handles Bash variable substitution, you never know...

How out of date that OpenSSL is? Can it be updated? I suppose that if you provide me with functions that handle certificate request generation, key generation, signing, etc., they could be added to the script. That's how it supports both OpenSSL and GnuTLS right now, so one more shouldn't hurt.

Although, as with GnuTLS right now, I'm not sure how extensive Apple-TLS-based CA would be. From my experiments, GnuTLS CA is pretty limited, that's why I chose OpenSSL as a default CA.

Did the new shebang do the trick?

from ansible-pki.

carlalexander avatar carlalexander commented on July 19, 2024

Yes! sorry forgot about that. The she bangs seems to have worked.

from ansible-pki.

drybjed avatar drybjed commented on July 19, 2024

OK then, I'm working on updates to the role.

from ansible-pki.

drybjed avatar drybjed commented on July 19, 2024

@carlalexander The #43 pull request should fix some issues on MacOSX.

from ansible-pki.

carlalexander avatar carlalexander commented on July 19, 2024

Thanks will test it out soon. I'm flying tomorrow so weekend more likely.

from ansible-pki.

carlalexander avatar carlalexander commented on July 19, 2024

I just tried it with your changes from #43. Works fine now!

from ansible-pki.

antoineco avatar antoineco commented on July 19, 2024

I would vote for reopening this, since some issues still prevent this role from working on OS X:

TASK [debops.pki : Sign certificate requests for current hosts] ****************
fatal: [ec2-1-2-3-4.eu-central-1.compute.amazonaws.com -> localhost]: FAILED! => {"changed": false, "cmd": ["./lib/pki-authority", "sign-by-host", "ec2-1-2-3-4", "ip-172-31-49-63.eu-central-1.compute.internal"], "delta": "0:00:00.015779", "end": "2016-09-02 23:08:54.622601", "failed": true, "rc": 2, "start": "2016-09-02 23:08:54.606822", "stderr": "./lib/pki-authority: line 82: declare: -g: invalid option\ndeclare: usage: declare [-afFirtx] [-p] [name[=value] ...]", "stdout": "", "stdout_lines": [], "warnings": []}

from ansible-pki.

drybjed avatar drybjed commented on July 19, 2024

@antoineco This is due to an old bash version on MacOS X. I suppose that the pki-authority and perhaps pki-realm scripts would need to be rewritten in Python to fix that permanently. I wrote them in Bash initially because most things they do is move/link files around and run openssl and certtool commands. In Python, I would probably use the respective libraries instead, but I didn't have the drive to learn that at the time. At that moment I was also doing the complete role redesign, and Bash for me seemed a good idea for a first implementation.

Alternatively, you could update your Bash to 4.x version, that should work fine.

from ansible-pki.

antoineco avatar antoineco commented on July 19, 2024

@drybjed you're right, I though the -g flag was the issue but actually associative arrays are also a feature added in bash 4.2.

On OS X a simple brew install bash will install GNU bash, version 4.3.46(1)-release (x86_64-apple-darwin15.5.0) and your script will use it automatically. Thanks for your answer!

from ansible-pki.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.