Changeset - c8caf99f43b5
[Not reviewed]
default
0 1 0
ethanzonca - 16 years ago 2009-10-10 17:45:08

Added keygrab for registration
1 file changed with 3 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/server/slavefuncs.c
Show inline comments
 
@@ -254,49 +254,51 @@ int ssh_keygen(){
 
    fprintf(stderr,"We successfully generated your key! Yay!\n");
 
    return 1;
 
  }
 
return 0;
 
}
 

	
 
/** Registers the user on the DistRen server */
 
int register_user(char *username, char *email)
 
{
 

	
 
/* Note: this code moved here from after the useradd code, so useradd doesn't happen if there is an existing key, etc */
 

	
 
  curlget("http://protofusion.org/distren/keys/setup_rsa", SYSCONFDIR "/setup_rsa"); // Grabs key to use for setup login
 

	
 
  /* puts the person's username in the conf */
 
  if(conf_replace(username) == 0){
 
    fprintf(stderr, "Failed!\n");
 
    return 0;
 
  }
 

	
 
  /* generates keys for login, @TODO: pub key must somehow be sent to the server. */
 
  if(ssh_keygen() == 0){
 
    fprintf(stderr, "Failed!\n");
 
    return 0;
 
  }
 

	
 
  /*
 
   * All created user accounts should be sandboxed accordingly, requiring a different skel, and the default shell to be rbash. Also,
 
   * a custom path defined in the .bashrc of the skel is needed.
 
   */
 
  int ret;
 
  char buf[10];
 
  struct execio *testrem;
 
  char *execargv[] =
 
    {
 
      "ssh",
 
      "distren_setup@protofusion.org",
 
      "-i",
 
      SYSCONFDIR "/setup_rsa", // @TODO: How will we distribute this key?
 
      SYSCONFDIR "/setup_rsa",
 
      "-p",
 
      "23",
 
      "newuser",
 
      "-M",
 
      "-c",
 
      email,
 
      "-d",
 
      "/home/distren",
 
      "--gid",
 
      "541",
 
      username,
 
      (char *)NULL
0 comments (0 inline, 0 general)