dannyman.toldme.com


Ansible, Linux, Technical

Ansible: Copy Agent Keys to Remote Servers

Link: https://dannyman.toldme.com/2016/07/01/ansible-use-ssh-add-to-set-authorized_key/

Background: you use SSH and ssh-agent and you can get a list of keys you presently have “ready to fire” via:

djh@djh-MBP:~/devops$ ssh-add -l
4096 SHA256:JtmLhsoPoSfBsFnrIsZc6XNScJ3ofghvpYmhYGRWwsU .ssh/id_ssh (RSA)

Aaaand, you want to set up passwordless SSH for the remote hosts in your Ansible. There are lots of examples that involve file lookups for blah blah blah dot pub but why not just get a list from the agent?

A playbook:

- hosts: all
  gather_facts: no
  tasks:
    - name: Get my SSH public keys
      local_action: shell ssh-add -L
      register: ssh_keys

    - name: List my SSH public keys
      debug: msg="{{ ssh_keys.stdout }}"

    - name: Install my SSH public keys on Remote Servers
      authorized_key: user={{lookup('env', 'USER')}} key="{{item}}"
      with_items: "{{ ssh_keys.stdout }}"

This is roughly based on a Stack Overflow answer.

The two tricky bits are:
1) Running a local_action to get a list of SSH keys.
2) Doing with_items to iterate if there are multiple keys.

A bonus tricky bit:
3) You may need to install sshpass if you do not already have key access to the remote servers. Last I knew, the brew command on Mac OS will balk at you for trying to install this.

Feedback Welcome


Excerpts, News and Reaction, Politics

. . . Convincing?

Link: https://dannyman.toldme.com/2016/07/18/sanders-endorses-clinton/

A “challenge” posted to Facebook:

clinton

A moment of thought and I realized the challenge was easy, and heartening. This speech has been given before:

“Hillary Clinton understands that we must fix an economy in America that is rigged and that sends almost all new wealth and income to the top one percent. Hillary Clinton understands that if someone in America works 40 hours a week, that person should not be living in poverty.

She believes that we should raise the minimum wage to a living wage. And she wants to create millions of new jobs by rebuilding our crumbling infrastructure. – our roads, bridges, water systems and wastewater plants.

This election is about which candidate will nominate Supreme Court justices who are prepared to overturn the disastrous Citizens United decision which allows billionaires to buy elections and undermine our democracy; about who will appoint new justices on the Supreme Court who will defend a woman’s right to choose, the rights of the LGBT community, workers’ rights, the needs of minorities and immigrants, and the government’s ability to protect the environment.

This campaign is about moving the United States toward universal health care and reducing the number of people who are uninsured or under-insured. Hillary Clinton wants to see that all Americans have the right to choose a public option in their health care exchange, which will lower the cost of health care.

She also believes that anyone 55 years or older should be able to opt in to Medicare and she wants to see millions more Americans gain access to primary health care, dental care, mental health counseling and low-cost prescription drugs through a major expansion of community health centers throughout this country.

Hillary is committed to seeing thousands of young doctors, nurses, psychologists, dentists and other medical professionals practice in underserved areas as we follow through on President Obama’s idea of tripling funding for the National Health Service Corps.

In New Hampshire, in Vermont and across the country we have a major epidemic of opiate and heroin addiction. People are dying every day from overdoses. Hillary Clinton understands that if we are serious about addressing this crisis we need major changes in the way we deliver mental health treatment. That’s what expanding community health centers will do and that is what getting medical personnel into the areas we need them most will do.

Hillary Clinton also understands that millions of seniors, disabled vets and others are struggling with the outrageously high cost of prescription drugs. She and I are in agreement that Medicare must negotiate drug prices with the pharmaceutical industry and that we must expand the use of generic medicine.

Drug companies should not be making billions in profits while one in five Americans are unable to afford the medicine they need. The greed of the drug companies must end.

This election is about the grotesque level of income and wealth inequality that currently exists, the worst it has been since 1928. Hillary Clinton knows that something is very wrong when the very rich become richer while many others are working longer hours for lower wages.

She knows that it is absurd that middle-class Americans are paying an effective tax rate higher than hedge fund millionaires, and that there are corporations in this country making billions in profit while they pay no federal income taxes in a given year because of loopholes their lobbyists created.

This election is about the thousands of young people I have met who have left college deeply in debt, the many others who cannot afford to go to college and the need for this country to have the best educated workforce in the world if we are to compete effectively in a highly competitive global economy.

Hillary Clinton believes that we must substantially lower student debt, and that we must make public colleges and universities tuition free for the middle class and working families of this country. This is a major initiative that will revolutionize higher education in this country and improve the lives of millions.

Think of what it will mean when every child in this country, regardless of the income of their family, knows that if they study hard and do well in school – yes, they will be able to get a college education and leave school without debt.

This election is about climate change, the greatest environmental crisis facing our planet, and the need to leave this world in a way that is healthy and habitable for our kids and future generations. Hillary Clinton is listening to the scientists who tell us that if we do not act boldly in the very near future there will be more drought, more floods, more acidification of the oceans, more rising sea levels.

She understands that we must work with countries around the world in transforming our energy system away from fossil fuels and into energy efficiency and sustainable energy – and that when we do that we can create a whole lot of good paying jobs.

This election is about the leadership we need to pass comprehensive immigration reform and repair a broken criminal justice system. It’s about making sure that young people in this country are in good schools or at good jobs, not in jail cells. Secretary Clinton understands that we don’t need to have more people in jail than any other country on earth, at an expense of $80 billion a year.”

Bernie Sanders

All I did was remove the few paragraphs where the T-word was mentioned.

Feedback Welcome


Technical, Technology, Testimonials, WordPress

Testimonial: SSLMate

Link: https://dannyman.toldme.com/2016/07/19/testimonial-sslmate/

I recently started using sslmate to manage SSL certificates. SSL is one of those complicated things you deal with rarely so it has historically been a pain in the neck.

But sslmate makes it all easy … you install the sslmate command and can generate, sign, and install certificates from the command-line. You then have to check your email when getting a signed cert to verify … and you’re good.

The certificates auto-renew annually, assuming you click the email. I did this for an important cert yesterday. Another thing you do (sslmate walks you through all these details) is set up a cron.

This morning at 6:25am the cron got run on our servers … with minimal intervention (I had to click a confirmation link on an email yesterday) our web servers are now running on renewed certs …. one less pain in the neck.

So … next time you have to deal with SSL I would say “go to sslmate.com and follow the instructions and you’ll be in a happy place.”

Feedback Welcome


Arrr! . . . Avast!
Site Archive