Puppet - Feature #174 [PATCH] A native authorized_key type is available

Similar documents
IT Services Security. The Dark Arts Of SSH. Author: John Curran Version: 0.1

Git. all meaningful operations can be expressed in terms of the rebase command. -Linus Torvalds, 2015

Git, the magical version control

Using GitHub to Share with SparkFun a

Software Development I

Git. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

git-flow Documentation

Linux System Management with Puppet, Gitlab, and R10k. Scott Nolin, SSEC Technical Computing 22 June 2017

Submitting your Work using GIT

EECS 470 Lab 4. Version Control System. Friday, 31 st January, 2014

Intro to Github. Jessica Young

Index. Alias syntax, 31 Author and commit attributes, 334

Using Git to Manage Source RTL

LPF Training Handbook!

Gitlab Setup/Usage by Yifeng Zhu modified by Vince Weaver 30 January 2019

Code Repository. P Blanchfield

projecto Documentation

Lecture 01 - Working with Linux Servers and Git

Assignment 1c: Compiler organization and backend programming

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

Pragmatic Guide to Git

Software Development. Using GIT. Pr. Olivier Gruber. Laboratoire d'informatique de Grenoble Université de Grenoble-Alpes

ssh and handson Matsuzaki maz Yoshinobu 1

Lesson 3 Transcript: Part 2 of 2 Tools & Scripting

Distributed Version Control

Puppet Labs Modules - Feature #11050 firewall: RFE that ensure could support ignore.

Getting the files for the first time...2. Making Changes, Commiting them and Pull Requests:...5. Update your repository from the upstream master...

Version control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison

Git and GitHub. Dan Wysocki. February 12, Dan Wysocki Git and GitHub February 12, / 48

Intro to Git. Getting started with Version Control. Murray Anderegg February 9, 2018

Setting up a Chaincoin Masternode

Git GitHub & secrets

FEEG Applied Programming 3 - Version Control and Git II

Django MFA Documentation

Assumptions. GIT Commands. OS Commands

Improving Your Life With Git

git-pr Release dev2+ng5b0396a

Chapter01.fm Page 1 Monday, August 23, :52 PM. Part I of Change. The Mechanics. of Change

Object Oriented Programming. Week 1 Part 2 Git and egit

What is git? Distributed Version Control System (VCS); Created by Linus Torvalds, to help with Linux development;

Git Workbook. Self-Study Guide to Git. Lorna Mitchell. This book is for sale at


Gunnery Documentation

The Old World. Have you ever had to collaborate on a project by

Ticketing Table of Contents:

This tutorial provides a basic understanding of the infrastructure and fundamental concepts of managing an infrastructure using Chef.

CSE 374 Programming Concepts & Tools. Hal Perkins Winter 2012 Lecture 16 Version control and svn

Creating a Patch. Created by Carl Heymann on 2010 Sep 14 1

Exploring UNIX: Session 3

2 Initialize a git repository on your machine, add a README file, commit and push

BGP Prex Origin Validation Extension for Quagga Manual

TDDC88 Lab 4 Software Configuration Management

Introduction to Supercomputing

Puppet Labs Modules - Bug #16262 mysql module - mysql::db doesnt use root password

CuteFlow-V4 Documentation

Software Development. Hack, hack, hack, hack, hack. Sorta works. Main.c. COMP s1

TELE301 Lab16 - The Secure Shell

Working in Teams CS 520 Theory and Practice of Software Engineering Fall 2018

contribution-guide.org Release

If you had a freshly generated image from an LCI instructor, make sure to set the hostnames again:

Chapter 3. Revision Control

Using Git For Development. Shantanu Pavgi, UAB IT Research Computing

Lab Exercise Git: A distributed version control system

Lab 4: Bash Scripting

Git. A fast distributed revision control system. Nils Moschüring PhD Student (LMU)

Using git to download and update BOUT++

Best Practices. Joaquim Rocha IT-DSS-TD

Win-Back Campaign- Re-Engagement Series

flask-dynamo Documentation

sainsmart Documentation

withenv Documentation

FPLLL. Contributing. Martin R. Albrecht 2017/07/06

Windows. Everywhere else

Introduction to distributed version control with git

Version Control: Gitting Started

ChiliProject - Bug # 529: builder is not part of the bundle. Add it to Gemfile

Agenda. - Final Project Info. - All things Git. - Make sure to come to lab for Python next week

Git Workflows. Sylvain Bouveret, Grégory Mounié, Matthieu Moy

Softether_on_R7000 BIG WARNING: THIS IS UTTERLY ALPHA, TESTING OUTPUT, NOT A SET OF INSTALL INSTRUCTIONS.

Common Git Commands. Git Crash Course. Teon Banek April 7, Teon Banek (TakeLab) Common Git Commands TakeLab 1 / 18

SECTION 2: HW3 Setup.

Git Resolve Conflict Using Mine Command Line

IC Documentation. Release 0.1. IC team

Puppet - Bug #11143 Puppet fails to cope with corrupt yaml files in {facts, nodes} and hangs

CSE 15L Winter Midterm :) Review

Composer and Drupal. CIDUG Meeting December 13, 2018 John Rearick

Bishop Blanchet Intranet Documentation

Lab 3. A Multi-Message Reader

Lab Exercise Test First using JUnit

MMS DATA SUBSCRIPTION SERVICES USER INTERFACE GUIDE

Lab #2 Physics 91SI Spring 2013

CS Lab 1: httpd

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Subversion (and Git) Winter 2019

django simple pagination Documentation

QGIS Application - Bug report #418 QGIS fails to read undefined projection from user datum in shape.prj file

A L A TEX-oriented intro to Git

Introduction, Instructions and Conventions

Practical Magic with SSH. By David F. Skoll Roaring Penguin Software Inc. 1 February

Paranoid Penguin rsync, Part I

Transcription:

Puppet - Feature #174 [PATCH] A native authorized_key type is available 06/14/2006 11:22 am - Redmine Admin Status: Closed Start date: Priority: Normal Due date: Assignee: Luke Kanies % Done: 0% Category: newfeature Estimated time: 0.00 hour Target version: 0.25.0 Affected Puppet version: Branch: Keywords: Description Hi, When i tested the type sshkey it does not update my ~/authorizedkey filebut the /etc/ssh/ssh_known_hosts file so it seem that there is an errorthere? i am using.17.2 sshkey { backup01: ensure => present, key => 'AAAABddfgdfgdorifjkshdkjflsdgmfgmsdiugfmiugsdmiufgmuisdgfmsodugfHLrwDE$ type => ssh-rsa } i got: core1:/root%(root)> more /etc/ssh/ssh_known_hosts # HEADER: This file was autogenerated at Wed Jun 14 10:40:34 CEST 2006 # HEADER: by puppet. While it can still be managed manually, it # HEADER: is definitely not recommended. backup01 ssh-rsa AAAAsdgfdsfsdfsdf... It seems then that the file updated is not the good one. or then the sshkey type should be named the sshknowhost type but there is a problem somewhere here. Lets say we talk about SSHkeys for user authentification as i understand it. I think it also needs a user parameters to specify which user will get the keyfile updated. The file which have the keys are ~/.ssh/authorized_keys user => ['root','backupuser'] Also, keys can have options like those from sshd manpage : 05/01/2016 1/7

The options (if present) consist of comma-separated option specifications. No spaces are permitted, except within double quotes. The following option specifications are supported (note that option keywords are case-insensitive): from="pattern-list" Specifies that in addition to public key authentication, the canonical name of the remote host must be present in the commaseparated list of patterns (@*' and @?' serve as wildcards). The list may also contain patterns negated by prefixing them with @!'; if the canonical host name matches a negated pattern, the key is not accepted. The purpose of this option is to optionally increase security: public key authentication by itself does not trust the network or name servers or anything (but the key); however, if somebody somehow steals the key, the key permits an intruder to log in from anywhere in the world. This additional option makes using a stolen key more difficult (name servers and/or routers would have to be compromised in addition to just the key). command="command" Specifies that the command is executed whenever this key is used for authentication. The command supplied by the user (if any) is ignored. The command is run on a pty if the client requests a pty; otherwise it is run without a tty. If an 8-bit clean channel is required, one must not request a pty or should specify no-pty. A quote may be included in the command by quoting it with a backslash. This option might be useful to restrict certain public keys to perform just a specific operation. An example might be a key that permits remote backups but nothing else. Note that the client may specify TCP and/or X11 forwarding unless they are explicitly prohibited. Note that this option applies to shell, command or subsystem execution. environment="name=value" Specifies that the string is to be added to the environment when logging in using this key. Environment variables set this way override other default environment values. Multiple options of this type are permitted. Environment processing is disabled by default and is controlled via the [[PermitUserEnvironment]] option. This option is automatically disabled if [[UseLogin]] is enabled. no-port-forwarding Forbids TCP forwarding when this key is used for authentication. Any port forward requests by the client will return an error. This might be used, e.g., in connection with the command option. no-x11-forwarding Forbids X11 forwarding when this key is used for authentication. Any X11 forward requests by the client will return an error. no-agent-forwarding 05/01/2016 2/7

Forbids authentication agent forwarding when this key is used for authentication. no-pty Prevents tty allocation (a request to allocate a pty will fail). permitopen="host:port" Limit local @@ssh -L_ port forwarding such that it may only connect to the specified host and port. IPv6 addresses can be specified with an alternative syntax: host/port. Multiple permitopen options may be applied separated by commas. No pattern matching is performed on the specified hostnames, they must be literal domains or addresses. etc see man sshd for complete list :) so i think an option parameters would be handy too. options => ['from=192.168.1.1','no-agent-forwarding'] As a last thing the doc should be update as it is obviously a cut and past from host ;) also i do think that the host parameters is in fact the option parameters that was copypasted without change :) So i think addind options support is easy by renaming the host name to options. One more tricky thing is the user part as it can be an array of user so it could affect the way puppet mmanage the entries in the key files. regards,ghislain. History #1-05/13/2008 12:25 am - Luke Kanies - Status changed from 1 to Closed - 7 set to fixed Merged and pushed. #2-05/06/2008 11:14 pm - Francois Deppierraz Tests are already included. #3-07/21/2006 09:39 pm - Luke Kanies I m converting this to an enhancement request. It would be nice if this class, or a subclass, also managed authorized keys files, but that s clearly a feature request, not a bug. 05/01/2016 3/7

#4-05/07/2008 10:06 pm - Francois Deppierraz Well, after messing a bit with git, everything is available in the ssh-authorized-key branch in my repository. #5-03/08/2007 02:29 am - Luke Kanies Renaming the ticket. Note there s a recipe available at Authorized_keysRecipe. #6-05/12/2008 05:57 pm - Francois Deppierraz Replying to [comment:18 anarcat]: You must checkout the correct branch if you want the latest version of this type. git clone git://francois.ctrlaltdel.ch/puppet.git cd puppet git checkout origin/ssh-authorized-key cp lib/puppet/type/ssh_authorized_key.rb /usr/lib/ruby/1.8/puppet/type/ mkdir /usr/lib/ruby/1.8/puppet/provider/ssh_authorized_key cp lib/puppet/provider/ssh_authorized_key/parsed.rb /usr/lib/ruby/1.8/puppet/provider/ssh_authorized_key/parsed.rb - if no type is defined, it is set to none and then is not parseable anymore and breaks puppet: Thanks for the report, this is fixed in my ssh-authorized-key branch. - @target@ should probably be named @path@ to follow the native @File@ type convention Many other types based on parsedfile (@host@, @interface@, etc.) are using a @target@ parameter. I think we should keep this name coherent with those types. 1. Puppet manages /root/.ssh/id_dsa{,.pub} on server N and provides facts ($ssh_pubkey_n) for those keys This could be provided by another custom type calling ssh-keygen and a fact which returns the public key of each user key. I can use the native File type or this patch to manage (3). The advantage of this patch over a File resource is that you can easily handle multiple keys in a single user account. But I don t feel this is the revolution I was waiting for, what am I missing? I had no revolutionary goals on this one ;) But it might a piece toward easier ssh keys management. Oh, and if I might add, the ssh_authorized_keys type should at least set proper permissions when you set the user parameter (which is chown user). 05/01/2016 4/7

Yes, this is a good point. I m trying to found out how this could be implemented using the parsedfile provider. Should I better create file resources to set that or call File.chown myself? Any hint is welcome! #7-05/09/2008 01:00 am - anarcat - For those that want to try this out and that are not tracking puppet through git directly, it s fairly simple, provided you can clone a git repository, you don t need to deploy the whole puppet from git: git clone http://francois.ctrlaltdel.ch/dev/puppet.git cd puppet cp lib/puppet/type/ssh_authorized_key.rb /usr/lib/ruby/1.8/puppet/type/ mkdir /usr/lib/ruby/1.8/puppet/provider/ssh_authorized_key cp lib/puppet/provider/ssh_authorized_key/parsed.rb /usr/lib/ruby/1.8/puppet/provider/ssh_authorized_key/parsed.rb It seems to work generally well, for its intended function (namely to manage.ssh/authorized_keys), although there s a few caveats that should probably be fixed before being merged in the main tree: - if no type is defined, it is set to none and then is not parseable anymore and breaks puppet: err: //Node[mumia]/Ssh_authorized_key[/tmp/testkey]: Failed to retrieve current state of resource: Could not parse line none AAAA - @target@ should probably be named @path@ to follow the native @File@ type convention I also feel that there s some part of the puzzle missing. Now I can write /home/foo/.ssh/authorized_keys, great. But I could already write it before (through the native @File@ type). Sure I can set options and whatnot, but i still can t manage my ssh key on box A and make sure that box can log on box B through authorized_keys because I can t read /home/bar/.ssh/id_dsa.pub on box B. My use case is this: 1. I have a bunch of servers (N) that are managed under puppet and need to be backed up to backup server B 2. Puppet manages /root/.ssh/id_dsa{,.pub} on server N and provides facts ($ssh_pubkey_n) for those keys 3. Puppet manages /home/backup-n/.ssh/authorized_keys which is created with the $ssh_pubkey_n content I can do (1) with a string of exec and file directives (which I hacked over DavidS s ssh module in a so awful way I won t even show it here). I would have to write a facter (I guess) for (2). I can use the native File type or this patch to manage (3). But I don t feel this is the revolution I was waiting for, what am I missing? #8-04/28/2008 04:35 pm - James Turnbull - Status changed from 4 to 1 #9-04/20/2008 05:02 pm - Luke Kanies 05/01/2016 5/7

You are correct, thanks. I ll look at it tonight, hopefully. #10-05/09/2008 01:06 am - anarcat - Oh, and if I might add, the ssh_authorized_keys type should at least set proper permissions when you set the @user@ parameter (which is chown @user@). #11-04/20/2008 06:38 am - Luke Kanies I just tried pulling from your repo and got this: luke@phage(0) $ git remote add ctraltdel http://francois.ctrlaltdel.ch/dev/puppet.git luke@phage(0) $ git fetch ctrlaltdel fatal: 'ctrlaltdel': unable to chdir or not a git archive fatal: The remote end hung up unexpectedly Cannot get the repository state from ctrlaltdel luke@phage(0) $ #12-04/10/2008 07:56 pm - Francois Deppierraz You can pull a working version with tests included from my repository athttp://francois.ctrlaltdel.ch/dev/puppet.git on branch 0.24.x. Do you have some advice to have this merged in next release? #13-04/10/2008 08:16 pm - Luke Kanies - Status changed from Closed to 4-7 deleted (wontfix) #14-04/20/2008 09:05 am - Francois Deppierraz Mmmh, sounds like a typo: ctraltdel!= ctrlaltdel ;) #15-05/06/2008 10:18 pm - Luke Kanies Any chance I could get some tests for this? I m trying to hold a strict line on accepting types into core that don t have tests, because of how poorly the interface type has worked out. #16-11/24/2007 06:37 am - Luke Kanies - Status changed from 1 to Closed - 7 set to wontfix I agree it would be nice to have, but at this point, I m not sure it belongs in the ticket db. 05/01/2016 6/7

#17-06/16/2006 01:13 am - Luke Kanies I agree that this functionality should exist, and it can probably be done within the same type, but this is neither a major flaw nor a high-priority one. #18-06/17/2008 06:19 am - James Turnbull - Target version changed from 4 to 0.25.0 05/01/2016 7/7