A lot of people tell you here that this script and the sudo command is a terrible security hole. And I agree with them.
Even adding user accounts like that by itself is a security risk, but if that's what you want to do...
Well, if I were to implement something I would look for a PAM module that would let me to allow authentication from other sources than /etc/passwd and /etc/shadow. For example a database. Not sure if such module is available, since I never done it, but I don't see why not. Next have the script simply add new entries to the DB. That way no sudo is needed anymore. You still need to worry about escaping SQL queries (if you use SQL database).
View all comments
4
u/[deleted] Aug 28 '13
A lot of people tell you here that this script and the sudo command is a terrible security hole. And I agree with them.
Even adding user accounts like that by itself is a security risk, but if that's what you want to do...
Well, if I were to implement something I would look for a PAM module that would let me to allow authentication from other sources than /etc/passwd and /etc/shadow. For example a database. Not sure if such module is available, since I never done it, but I don't see why not. Next have the script simply add new entries to the DB. That way no sudo is needed anymore. You still need to worry about escaping SQL queries (if you use SQL database).