Code Monkey home page Code Monkey logo

Comments (4)

tenthirtyam avatar tenthirtyam commented on May 30, 2024

Would need to test that this does not impact the Packer build as it uses SSH user/pass for executing the machine image build.

Please use the issue template and provide additional detail for scenario and any results of testing with allow-pw: false.

Ryan

from packer-examples-for-vsphere.

tenthirtyam avatar tenthirtyam commented on May 30, 2024

Based on my testing, changing the user-data file to specify allow-pw:false instead of allow-pw:true will result in a build failure that will disconnect Packer during the build process as it will not longer be able to connect with the build_username / build_password.

A more appropriate solution would be to modify /scripts/linux/ubuntu-server-cleanup.sh to modify the sshd_config via sed.

This section:

### Configure SSH for Public Key Authentication. ###
echo '> Configuring SSH for Public Key Authentication ...'
sudo sed -i '/^PermitRootLogin/s/yes/no/' /etc/ssh/sshd_config
sudo sed -i "s/.*PubkeyAuthentication.*/PubkeyAuthentication yes/g" /etc/ssh/sshd_config

This would need to have the following additional setting changes at a minimum:

PasswordAuthentication no

This could be done by adding changing the scripts /scripts/linux/*-cleanup.sh ...

### Configure SSH for Public Key Authentication. ###
echo '> Configuring SSH for Public Key Authentication ...'
sudo sed -i '/^PermitRootLogin/s/yes/no/' /etc/ssh/sshd_config
sudo sed -i 's/#PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config
sudo sed -i 's/.*PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config

We'll mark this for testing.

Ryan

from packer-examples-for-vsphere.

tenthirtyam avatar tenthirtyam commented on May 30, 2024

By default, both Public Key Authentication and Password Authentication are enabled for Linux distributons. If you wish to disable Password Authentication and only use Public Key Authentication, comment or remove the portion of the associated script in the /scripts directory. Comments are added to the scripts to call out what to uncomment, if desired.

Example: /scripts/linux/ubuntu-server-cleanup.sh

### Configure SSH for Public Key Authentication. ###
echo '> Configuring SSH for Public Key Authentication ...'
### Comment or r4move the line below to to disable Public Key Authentication allow _only_ Password Authentication. ###
sudo sed -i 's/.*PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
### Uncomment the line below to to disable Password Authentication and enforce _only_ Public Key Authentication. ###
### sudo sed -i 's/#PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config

Ryan

from packer-examples-for-vsphere.

github-actions avatar github-actions commented on May 30, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

from packer-examples-for-vsphere.

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.