salt icon indicating copy to clipboard operation
salt copied to clipboard

Can't find a way to authenticate for pillars in a git over ssh with gitfs

Open arthurlutz opened this issue 12 years ago • 7 comments

Hi,

Am setting up gitfs with an ssh access. The publickey works fine for gitfs_remotes :

gitfs_remotes:
  - ssh://[email protected]/home/git/states:
    - pubkey: /root/.ssh/id_rsa_gitfs.pub
    - privkey: /root/.ssh/id_rsa_gitfs

but the ext_pillar doesn't seem to give the same possibility :

http://docs.saltstack.com/en/latest/topics/tutorials/gitfs.html#using-git-as-an-external-pillar-source

I tried using the .ssh/config trick but that doesn't seem to work (using a different name stored in /etc/hosts so as to enable "normal" ssh as usual between the two servers)

ext_pillar:
  - git: master ssh://[email protected]/home/git/pillars

arthurlutz avatar Sep 26 '14 15:09 arthurlutz

Thanks for the report. I know @terminalmage at some point wanted to get the ext_pillar in line and using basically the same code as the gitfs backend, but he's been way too busy to get to it. We'll get this fixed.

basepi avatar Sep 26 '14 17:09 basepi

@basepi So what are the cool kids doing these days in large organizations with multiple salt-master servers and many many minions? How do we share and version control Salt state files, pillar, etc...?

I was thinking I would try using the gitfs backend for both states and pillar by specifying the same Git repo with two different subdirectory/roots specified (i.e. repo/salt and repo/pillar).

juanqui avatar Nov 03 '14 20:11 juanqui

@juanqui That could totally work. I think gitfs is definitely the go-to, but I bet most organizations have separate state and pillar repos. The pillar repos have much more sensitive data in them.

basepi avatar Nov 03 '14 23:11 basepi

.ssh/config & git ext_pillar work great for me.

ext_pillar:
  - git: master git@github-salt:sprightco/salt.git root=pillar
  - git: master git@github-secrets:sprightco/secrets.git root=pillar
Host github-secrets
  IdentityFile /root/.ssh/id_rsa_secrets.private
  HostName github.com
  User git

Host github-salt
  IdentityFile /root/.ssh/id_rsa_salt.private
  HostName github.com
  User git

Make sure there's an entry for your git hostname (github.com in our case) in your known_hosts file, and that everything in .ssh has the correct permissions.

keeth avatar Feb 18 '15 21:02 keeth

+1; would be great to have ext_pillar git options be the same as gitfs; was looking to nuke my ~/.ssh/config file only to find out that my git ext_pillar stopped working :(

tehmaspc avatar Mar 23 '15 15:03 tehmaspc

+1; it's often to have sensitive info in the pillar, so the repository should be protected too, having gitfs with auth for the states but not pillars seems strange :)

mythus avatar Aug 19 '15 12:08 mythus

This is actually supported, starting in 2015.8. Basically, @terminalmage rewrote git_pillar for 2015.8.0 so that it shares the same codebase and functionality as gitfs. So git_pillar is in line with gitfs starting in that version.

Here are some relevant docs: http://docs.saltstack.com/en/develop/ref/pillar/all/salt.pillar.git_pillar.html#configuring-git-pillar-for-salt-releases-2015-8-0-and-later

I'm going to close this as resolved.

basepi avatar Aug 19 '15 16:08 basepi