Best unofficial Apache Server developers community
Username
Forgot password?
Sign in with Twitter account
Sign in with Facebook account
List archives

Re: Re: Newbie: Confused about where to start managing users...

puppet, virtualenv, and .bashrc
(62 lines)
Creating user with random password (only once)
(43 lines)
Feb 8, 2012
Peter Valdemar Mørch
Peter Valdemar Mørch
On Wed, Feb 8, 2012 at 4:23 PM, jcbollinger
<John.Bol### @stjude.org> wrote:
 To give you a good answer, I need to understand this a bit better, and
 I'm having trouble with that statement.  On Unix-like systems the
user
 name is the primary identifier, and UIDs are only secondary.  It is
 even possible for two or more users to have the same UID.  What,
then,
 does it mean for a user name to change while the UID remains
 constant?  I'm looking for the big picture here, not just the /etc/
 passwd view of the world.

The big picture:

We create an appliance (debian-in-a-pizza-box). In this appliance, one
can create users. There is a "users" database table. In that, the user
ID is unique, but the UI allows the user to modify user names (along
with e.g. password).

A new feature request is that it should be possible for such
configured users to log in vial SSH to the appliance, because it may
have network access to other networks than the user has from his
browser/workstation and use the appliance as a "jump host". So now the
task is to create local users based on the contents of our "users"
database table. The UI for his table also allows configuration of a
password (details about sha512 removed here) and SSH key. They must
have their own home dirs so they can use the appliance as a TFTP
server (details removed).

In order to get a little separation for these "CLI users", we create a
debootstrap/chroot for these users. So sshd_config's ChrootDirectory
is set up appropriately for these users, and for each user, we create
/jail/home/<username>,
/jail/home/<username>/.ssh/authorized_keys,
/home/<username> and /home/<username>/.ssh/authorized_keys that
is a
soft link to /jail/home/<username>/.ssh/authorized_keys (I want the
user to be able to add to configure his own authorized keys via CLI
too, and sshd reads .ssh/authorized_keys from the "outer" root, not
the jail, even for ChrootDirectory users, for some reason I don't
understand.)

As users come and go and get renamed, I expect /home, /jail/home,
/etc/passwd and /jail/etc/passwd to follow suit. I'm thinking that
doing the setup inside the jail can be done with installing puppet
inside the jail too and running puppet once again inside the jail with
setup from outside the jail. Exact same complication in the jail as
outside. Solve it for one and its solved for the other.

 If it would be sufficient to bound the purge range
 only below, then you could do this:

 resources { "user":
    purge => true,
    unless_system_user => 2000
 }

Cool! Yes, that is fine. We just want the possibility of creating real
non-system and non-chroot users too.

 Puppet probably can handle your complex renaming cases by transiently
 leveraging the ability (available on many, but not all, client OSs)
 for one UID to be assigned to multiple users:
...
 So far, none of this touches on user home directories.  Puppet's User
 resource does have the ability to manage home directories on most OSs
 (unless you are relying on LDAP for your user DB), but it's not clear
 to me what management, if any, you might want there.  This is where
my
 confusion over what you mean about renaming accounts comes most to
 bear.

The most important is the user "foo" has home dir "/home/foo" and
correct uid. Ideal would be that if a user is renamed from a to b,
that /home/a is renamed to /home/b. We can live with "sudo rm -r
/home/a; sudo mkdir /home/b; chown b: /home/b; #setup /home/b" too
(don't expect user renames to be frequent). Regardless of whether one
does a "mv" or "rm && mkdir" the complex ( "fred->barney" +
"barney->fred" ) rename will be a two-step process, I'm affraid. How
likely is it? Not very. But there is no good way to fail gracefully,
or alert the user by rejecting the second rename in the UI either.

Doing this:

resources { "user":
  purge => true,
  unless_system_user => 2000
}

user { 'barney':
  uid => 2003,
  allowdupe => true,
}

user { 'fred':
  uid => 2004,
  allowdupe => true,
}

etc.

Is it a valid assumption that this would end with exactly the correct
users created in /etc/passwd? If so, then I guess it wouldn't be hard
to code:

exec { 'handleHomedirs':
   # Prefer ruby in this crowd.. ;-)
   command => '/opt/product/bin/handleHomedirs.rb',
   require => [ User['barney'],..., Resources['user'] ]
}

Is adding "Resources['user']" to exec's require the way to ensure that
the exec gets executed after the purge of stale users?

I'm trying to get my feet wet with puppet with this feature, trying
find out what "the puppet way" is. Perhaps I didn't start with the
easiest of projects.... The handleHomedirs.rb strikes me as quite
non-puppet-esque... But perhaps this is an acceptable compromise :-)
We could just use puppet for so many things, and I decided to start
somewhere.

Thanks for your response, and sorry to burden you with so much detail....

Peter





Reply
Tags: stjude orggood answerunix
Newbie: Confused about where to start managing users...
February 8, 2012 04:06:02 AM
Hi, Being a newbie, I'm trying to wrap my head around puppet. Here are my first stumbling blocks: We have an output from a database which is essentially a list of users that we want to manage in the uid 2001-2999 range: * No other users may be…
newbie question about managing parallel video encoding through multiple job servers
March 31, 2011 12:27:56 PM
Hi, Here is the situation: I developed a PHP application that runs ffmpeg locally to encode videos. For each submitted video, I encode 3 new versions of it (low/mid/high def). Submitted videos are handled one after the other, so that each version…
managing normal users with Puppet
November 5, 2010 12:34:01 PM
What are the recommended practices for adding regular users with a specific group and password ? I'd like to add new users to a cluster, and also to append an existing ssh key to authorized_keys on all the cluster nodes for some users. This is the…
Managing users and permissions programatically
June 11, 2010 09:45:36 AM
Hi, i would like to know if there is a way to manage users and permissions programmatically (maybe there is a service that expose the necessary methods?)... The issue i have to resolve is this: a user has to register and create a new account; i…
Re: want to start using mongo (from mysql)- some newbie questions :)
October 13, 2011 06:46:44 AM
can you show a step converting mysql database to MongoDB with example from my mysql database? I am still blind to convert it, this is my schema relation in…
Re: want to start using mongo (from mysql)- some newbie questions :)
October 25, 2011 06:02:31 PM
I read in http://www.mongodb.org/display/DOCS/Import+Export+Tools whether I should import one by one a table to CSV, then import from CSV to JSON?
Re: want to start using mongo (from mysql)- some newbie questions :)
October 20, 2011 10:19:36 PM
My database just for search engine, as an example I want to find the business_name, then that will appear starting from the province_name to the name of the business_name in ukm table. my database no update.
Total newbie to Apache Web Server with start up issue
March 22, 2011 02:55:36 PM
Greetings, First, I apologize in advance to anyone and everyone involved that I will insult, confuse, agitate, etc, if my email is NOT up to the standards documented on your site. I've read briefly your guidelines for posting and for users…
CouchDB quick start for Windows Users
August 5, 2010 04:46:51 AM
Hi folks FYI I've done a few notes based on FAQs on the list over recent weeks to help other windows users get relaxing quickly: http://dch.posterous.com/getting-started-with-couchdb-on-windows-in-4 - quick start guide, using couch.io hosting …
linux users who unload from zip file can't start tomcat
April 2, 2011 04:36:35 AM
i just noticed that users on a linux/unix system that unload tomcat7 from the zip file are going to have trouble running it since the bin/ scripts are not marked executable in the zip file. if tomcat7 is unloaded from the tar ball, then…
another stupid question about exporting valid users from windows 2008 domain to postfix valid users
January 8, 2011 09:56:02 AM
Does this still works for windows 2008 ad? : http://postfix.state-of-mind.de/patrick.koetter/mailrelay/#d0e149 or is there better way to do it?
Created: (AMQ-2872) Contention between concurrent connection start and new session creation - start
August 19, 2010 04:18:33 AM
Contention between concurrent connection start and new session creation - start can find partially created session
Created: (GERONIMO-5670) Webapp can not start because server said "couldn't start owb context&q
November 2, 2010 04:56:53 AM
Webapp can not start because server said "couldn't start owb context" although the app don't contain openwebbean context.
Created] (HDFS-2577) HA: NN fails to start since it tries to start secret manager in safemode
November 21, 2011 02:09:19 PM
HA: NN fails to start since it tries to start secret manager in safemode
Updated: (GERONIMO-5670) Webapp can not start because server said "couldn't start owb context&q
November 2, 2010 04:56:52 AM
[ https://issues.apache.org/jira/browse/GERONIMO-5670?page=com.atlassian .jira.plugin.system.issuetabpanels:all-tabpanel ] LiWenQin updated GERONIMO-5670:
Created] (HDFS-1943) fail to start datanode while start-dfs.sh is executed by root user
May 16, 2011 01:52:32 AM
fail to start datanode while start-dfs.sh is executed by root user
Resolved] (MAPREDUCE-1541) JobHistory page should list job start time rather than job-tracker start
January 28, 2012 08:28:55 PM
[ https://issues.apache.org/jira/browse/MAPREDUCE-1541?page=com.atlassia n.jira.plugin.system.issuetabpanels:all-tabpanel ] Devaraj K resolved MAPREDUCE-1541.
Updated: (HIVE-12) Point users to hive-users@publists.facebook.com instead of athusoo@facebok.com in
July 23, 2010 04:49:54 AM
[ https://issues.apache.org/jira/browse/HIVE-12?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Carl Steinbach updated HIVE-12:
DO NOT REPLY if apache doesn't start cleanly - SSL fails to start EVER (until after reboot)
February 12, 2011 08:52:54 AM
https://issues.apache.org/bugzilla/show_bug.cgi?id=21335 Joe Orton <jort### @redhat.com> changed: What |Removed |Added
Managing multiple users on the same MySQL server
March 11, 2011
So, I'm going to be offering a LAMP for myself and a few of my friends. I want to make it so each user can create databases and delete them, etc.…
Managing multiple accounts and users in SQL, and assets associated with an account
March 14, 2011
I am building an application that can have multiple users from multiple accounts. For example, an account could be Company ABC. Users X, Y, and Z…
/var/log/secure user activity. also, httpd can not start without two users
February 10, 2011
hello, i found some strange informations in /var/log/secure file: Feb 10 02:02:04 server2364 usermod[30750]: unlock user `username1' password Feb 10…
How to manually start and re-start Apache with mod_wsgi powering a password protected Python WSGI app?
March 18, 2011
I'm working on a project where I have to meet some regulatory requirements that require at least 3 out of 5 authorized users to start a backend web…
What is a good database structure for a website where users "follow"/"friend" other users?
March 5, 2011
I am building a database for a web application that includes users following each other. What would be a good design? I was thinking this: TABLE:…
Postfix allow local users and authenticated outside users to send mail
March 10, 2011
I currently have a Postfix setup on my VPS (CentOS 5.5) that allows for SMTP mail to be sent with the user being authenticated via a MySQL database.…
How to handle groups of users and single users in data models
April 14, 2011
I'm working on a CRM system that will have both individual users as well as "teams of users". I'm encountering a problem in assigning tasks as I…
Confused on SQL assignment
April 27, 2011
We are doing a database query in class. And it's using relational keys. I don't know how to get the query to run. Here is what is says. For each…
From mysql to PDO -- confused about the When and Where
February 25, 2011
I'm trying to switch from building query strings and calling mysql_query() and embrace PDO. I've read a handful of tutorials, and understand the…
Confused InnoDB
January 27, 2011
Hi guys, I'm very confused about use of InnoDB. I've a server with limited storage and I've read that InnoDB tables creates default size table at…
Managing a Cassandra Cluster ?
April 14, 2011
Suppose that one has set up a cassandra cluster. You've got a 10[TB] database that is distributed evenly between 10 nodes, everything runs smoothly…
Managing Regex in java
April 5, 2011
How we can manage regex in java ? Yes I did search regex topics but I think it is strange in java. What I would like to do is My team…
MYSQL newbie question
March 7, 2011
How do I combine table X and Y : table X (columnA, columnB, columnC) table Y (columnA, columnB, columnD) to get table Z? table Z (columnA, columnB,…
Managing Nonces in Apache/PHP
March 9, 2011
I have been going through the various questions here about nonce generation and PHP, but not found any discussions about the details of managing the…
Php: newbie modrewrite question
April 28, 2011
hi, i'm having a little issue with modrewrite under php. this is inside my .htaccess file: RewriteEngine On RewriteRule ^test.html$ test.php…
IOS (iphone) sdk. HTTPS for newbie
June 19, 2011
Can you advice me any workable example? I need to authorize and send any API request via HTTPS.
WCF newbie - how to install and use a SSL certificate?
January 2, 2011
This should be a snap for anyone who's done it before... I'm trying to set up a self-hosted WCF service using NetTcpBinding. I got a trial SSL…
Php newbie problem: regex
March 31, 2011
i'm sorry i've already asked for this but couldn't find a solution yet :( here's my string: (as you can see it has linebreaks) Webname: [webname]…
Mysql INSERT INTO newbie help
January 8, 2011
Hello, I'm a newbie so bare with me. Whenever I try to insert data into my database 'users' I always get a blank page. It doesn't give me any…
Php: newbie question: regex
March 30, 2011
hi all, i'm having some text like: name: [my_name] email: [my_email] i'd like to grab the fields in square brackets with regex - how would i do…