RELEASE 0.9.3
This commit is contained in:
@@ -8,9 +8,7 @@ $container = $_POST['container'];
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
// Unique to this template
|
||||
$step = isset( $_POST['step'] ) ? $_POST['step'] : null;
|
||||
if( ! $step )
|
||||
$step = 1;
|
||||
$step = isset( $_POST['step'] ) ? $_POST['step'] : 1;
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
@@ -76,7 +74,7 @@ if( $step == 2 )
|
||||
strlen( trim( $rdn ) ) != 0 or
|
||||
pla_error( "You left the RDN field blank" );
|
||||
|
||||
strlen( $container ) == 0 or dn_exists( $server_id, $container ) or
|
||||
strlen( trim( $container ) ) == 0 or dn_exists( $server_id, $container ) or
|
||||
pla_error( "The container you specified (" . htmlspecialchars( $container ) . ") does not exist. " .
|
||||
"Please go back and try again." );
|
||||
|
||||
@@ -84,19 +82,21 @@ if( $step == 2 )
|
||||
$oclasses = $_POST['object_classes'];
|
||||
if( count( $oclasses ) == 0 )
|
||||
pla_error( "You did not select any ObjectClasses for this object. Please go back and do so." );
|
||||
|
||||
// build a list of required attributes:
|
||||
$dn = $rdn . ',' . $container;
|
||||
|
||||
// incrementally build up the all_attrs and required_attrs arrays
|
||||
$schema_oclasses = get_schema_objectclasses( $server_id );
|
||||
$required_attrs = array();
|
||||
$all_attrs = array();
|
||||
foreach( $oclasses as $oclass_name ) {
|
||||
if( isset( $schema_oclasses[ strtolower( $oclass_name ) ] ) )
|
||||
$oclass = $schema_oclasses[ strtolower( $oclass_name ) ];
|
||||
else
|
||||
continue;
|
||||
$required_attrs = array_merge( $required_attrs, $oclass->getMustAttrNames( $oclasses ) );
|
||||
$all_attrs = array_merge( $oclass->getMustAttrNames(), $oclass->getMayAttrNames( $oclasses ) );
|
||||
$oclass = get_schema_objectclass( $server_id, $oclass_name );
|
||||
if( $oclass ) {
|
||||
$required_attrs = array_merge( $required_attrs,
|
||||
$oclass->getMustAttrNames( $schema_oclasses ) );
|
||||
$all_attrs = array_merge( $all_attrs,
|
||||
$oclass->getMustAttrNames( $schema_oclasses ),
|
||||
$oclass->getMayAttrNames( $schema_oclasses ) );
|
||||
}
|
||||
}
|
||||
|
||||
$required_attrs = array_unique( $required_attrs );
|
||||
|
@@ -21,6 +21,9 @@ $default_home_dir = '/dev/null';
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
|
||||
if( get_schema_objectclass( $server_id, 'sambaAccount' ) == null )
|
||||
pla_error( "You LDAP server does not have schema support for the sambaAccount objectClass. Cannot continue." );
|
||||
|
||||
?>
|
||||
|
||||
<center><h2>New Samba NT Machine</h2></center>
|
||||
|
173
templates/creation/new_security_object_template.php
Normal file
173
templates/creation/new_security_object_template.php
Normal file
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
require 'common.php';
|
||||
|
||||
// customize this to your needs
|
||||
$default_container = "ou=server";
|
||||
|
||||
// Common to all templates
|
||||
$container = $_POST['container'];
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
// Unique to this template
|
||||
$step = isset( $_POST['step'] ) ? $_POST['step'] : 1;
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
|
||||
?>
|
||||
|
||||
<script language="javascript">
|
||||
<!--
|
||||
|
||||
/*
|
||||
* Pipulates the user name field based on the first letter
|
||||
* of the firsr name concatenated with the last name
|
||||
* all in lower case.
|
||||
*/
|
||||
function autoFillUserName( form )
|
||||
{
|
||||
var first_name;
|
||||
var last_name;
|
||||
var user_name;
|
||||
|
||||
first_name = form.first_name.value.toLowerCase();
|
||||
last_name = form.last_name.value.toLowerCase();
|
||||
|
||||
if( last_name == '' ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
user_name = first_name.substr( 0,1 ) + last_name;
|
||||
form.user_name.value = user_name;
|
||||
autoFillHomeDir( form );
|
||||
}
|
||||
|
||||
/*
|
||||
* Pipulates the home directory field based on the username provided
|
||||
*/
|
||||
function autoFillHomeDir( form )
|
||||
{
|
||||
var user_name;
|
||||
var hime_dir;
|
||||
|
||||
user_name = form.user_name.value.toLowerCase();
|
||||
|
||||
home_dir = '/home/';
|
||||
home_dir += user_name;
|
||||
|
||||
form.home_dir.value = home_dir;
|
||||
|
||||
}
|
||||
|
||||
-->
|
||||
</script>
|
||||
|
||||
<center><h2>New Security Object</h2></center>
|
||||
|
||||
<?php if( $step == 1 ) { ?>
|
||||
|
||||
<form action="creation_template.php" method="post" id="user_form" name="user_form">
|
||||
<input type="hidden" name="step" value="2" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="template" value="<?php echo $_POST['template']; ?>" />
|
||||
|
||||
<center>
|
||||
<table class="confirm">
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td><img src="images/uid.png" /></td>
|
||||
<td class="heading">User name:</td>
|
||||
<td><input type="text" name="user_name" id="user_name" value=""
|
||||
onChange="autoFillHomeDir(this.form)" onExit="autoFillHomeDir(this.form)" /></td>
|
||||
</tr>
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td><img src="images/lock.png" /></td>
|
||||
<td class="heading">Password:</td>
|
||||
<td><input type="password" name="user_pass1" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Password:</td>
|
||||
<td><input type="password" name="user_pass2" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Encryption:</td>
|
||||
<td><select name="encryption">
|
||||
<option>clear</option>
|
||||
<option>md5</option>
|
||||
<option>crypt</option>
|
||||
<option>sha</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Container:</td>
|
||||
<td><input type="text" name="container" size="40"
|
||||
value="<?php if( isset( $container ) )
|
||||
echo htmlspecialchars( $container );
|
||||
else
|
||||
echo htmlspecialchars( $default_container . ',' . $servers[$server_id]['base'] ); ?>" />
|
||||
<?php draw_chooser_link( 'user_form.container' ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><center><br /><input type="submit" value="Proceed >>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<?php } elseif( $step == 2 ) {
|
||||
|
||||
$user_name = trim( stripslashes( $_POST['user_name'] ) );
|
||||
// $first_name = trim( stripslashes( $_POST['first_name'] ) );
|
||||
// $last_name = trim( stripslashes( $_POST['last_name'] ) );
|
||||
$password1 = stripslashes( $_POST['user_pass1'] );
|
||||
$password2 = stripslashes( $_POST['user_pass2'] );
|
||||
$encryption = stripslashes( $_POST['encryption'] );
|
||||
// $login_shell = trim( stripslashes( $_POST['login_shell'] ) );
|
||||
// $uid_number = trim( stripslashes( $_POST['uid_number'] ) );
|
||||
// $gid_number = trim( stripslashes( $_POST['group'] ) );
|
||||
$container = trim( stripslashes( $_POST['container'] ) );
|
||||
// $home_dir = trim( stripslashes( $_POST['home_dir'] ) );
|
||||
|
||||
/* Critical assertions */
|
||||
$password1 == $password2 or
|
||||
pla_error( "Your passwords don't match. Please go back and try again." );
|
||||
dn_exists( $server_id, $container ) or
|
||||
pla_error( "The container you specified (" . htmlspecialchars( $container ) . ") does not exist. " .
|
||||
"Please go back and try again." );
|
||||
|
||||
$password = password_hash( $password1, $encryption );
|
||||
|
||||
?>
|
||||
<center><h3>Confirm account creation:</h3></center>
|
||||
|
||||
<form action="create.php" method="post">
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="new_dn" value="<?php echo htmlspecialchars( 'uid=' . $user_name . ',' . $container ); ?>" />
|
||||
|
||||
<!-- ObjectClasses -->
|
||||
<?php $object_classes = rawurlencode( serialize( array( 'top', 'account','simpleSecurityObject' ) ) ); ?>
|
||||
|
||||
<input type="hidden" name="object_classes" value="<?php echo $object_classes; ?>" />
|
||||
|
||||
<!-- The array of attributes/values -->
|
||||
<input type="hidden" name="attrs[]" value="uid" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($user_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="userPassword" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($password);?>" />
|
||||
|
||||
<center>
|
||||
<table class="confirm">
|
||||
<tr class="even"><td class="heading">User name:</td><td><b><?php echo htmlspecialchars( $user_name ); ?></b></td></tr>
|
||||
<tr class="odd"><td class="heading">Password:</td><td>[secret]</td></tr>
|
||||
<tr class="odd"><td class="heading">Container:</td><td><?php echo htmlspecialchars( $container ); ?></td></tr>
|
||||
</table>
|
||||
<br /><input type="submit" value="Create Account" />
|
||||
</center>
|
||||
|
||||
<?php } ?>
|
156
templates/creation/new_smb3_nt_machine.php
Normal file
156
templates/creation/new_smb3_nt_machine.php
Normal file
@@ -0,0 +1,156 @@
|
||||
<?php
|
||||
|
||||
require 'common.php';
|
||||
|
||||
// Common to all templates
|
||||
$container = $_POST['container'];
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
|
||||
// Unique to this template
|
||||
$step = 1;
|
||||
if( isset($_POST['step']) )
|
||||
$step = $_POST['step'];
|
||||
|
||||
// get the available domains (see template_connfig.php for customization)
|
||||
$samba3_domains = get_samba3_domains();
|
||||
|
||||
$default_gid_number = 30000;
|
||||
$default_acct_flags = '[W ]';
|
||||
$default_home_dir = '/dev/null';
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
|
||||
if( get_schema_objectclass( $server_id, 'sambaSamAccount' ) == null )
|
||||
pla_error( "You LDAP server does not have schema support for the sambaSamAccount objectClass. Cannot continue." );
|
||||
|
||||
?>
|
||||
<script language="javascript">
|
||||
|
||||
function autoFillSambaRID( form ){
|
||||
var sambaSID;
|
||||
var uidNumber;
|
||||
|
||||
uidNumber = form.uid_number.value;
|
||||
sambaSID = (2 * uidNumber) + 1000;
|
||||
|
||||
form.samba3_rid.value = sambaSID;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
<center><h2>New Samba 3 NT Machine</h2></center>
|
||||
|
||||
<?php if( $step == 1 ) { ?>
|
||||
|
||||
<form action="creation_template.php" method="post" name="machine_form">
|
||||
<input type="hidden" name="step" value="2" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="template" value="<?php echo htmlspecialchars( $_POST['template'] ); ?>" />
|
||||
|
||||
<center>
|
||||
<table class="confirm">
|
||||
<tr class="spacer"><td colspan="3"></td></tr>
|
||||
<tr>
|
||||
<td><img src="images/server.png" /></td>
|
||||
<td class="heading">Machine Name:</td>
|
||||
<td><input type="text" name="machine_name" value="" /> <small>(hint: don't include "$" at the end)</small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">UID Number:</td>
|
||||
<td><input type="text" name="uid_number" value="" onChange="autoFillSambaRID(this.form);" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Sanba Sid:</td>
|
||||
<td><select name="samba3_domain_sid">
|
||||
<?php foreach($samba3_domains as $samba3_domain) ?>
|
||||
<option value="<?php echo $samba3_domain['sid'] ?>"><?php echo $samba3_domain['sid'] ?></option>
|
||||
</select> - <input type="text" name="samba3_rid" id="samba3_rid" value="" size="7"/></td>
|
||||
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Container:</td>
|
||||
<td><input type="text" size="40" name="container" value="<?php echo htmlspecialchars( $container ); ?>" />
|
||||
<?php draw_chooser_link( 'machine_form.container' ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><center><br /><input type="submit" value="Proceed >>" />
|
||||
<br /><br /><br /><br /><br /><br /></td>
|
||||
</tr>
|
||||
|
||||
<tr class="spacer"><td colspan="3"></td></tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
This will create a new NT machine with:<br />
|
||||
<small>
|
||||
<ul>
|
||||
<li>gidNumber <b><?php echo htmlspecialchars( $default_gid_number ); ?></b></li>
|
||||
<li>acctFlags <b><?php echo str_replace(' ', " ", htmlspecialchars($default_acct_flags)); ?></b></li>
|
||||
<li>in container <b><?php echo htmlspecialchars( $container ); ?></b></li>
|
||||
</ul>
|
||||
To change these values, edit the template file:
|
||||
<code>templates/creation/new_nt_machine.php</code><br />
|
||||
Note: You must have the samba schema installed on your LDAP server.
|
||||
</small>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<?php } elseif( $step == 2 ) {
|
||||
|
||||
$machine_name = trim( $_POST['machine_name'] );
|
||||
$uid_number = trim( $_POST['uid_number'] );
|
||||
$samba3_domain_sid = trim( $_POST['samba3_domain_sid'] );
|
||||
$samba3_computer_rid = trim( $_POST['samba3_rid'] );
|
||||
|
||||
dn_exists( $server_id, $container ) or
|
||||
pla_error( "The container you specified (" . htmlspecialchars( $container ) . ") does not exist. " .
|
||||
"Please go back and try again." );
|
||||
?>
|
||||
|
||||
<form action="create.php" method="post">
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="new_dn" value="<?php echo htmlspecialchars( 'uid=' . $machine_name . '$,' . $container ); ?>" />
|
||||
|
||||
<!-- ObjectClasses -->
|
||||
<?php $object_classes = rawurlencode( serialize( array( 'top', 'sambaSamAccount', 'posixAccount', 'account' ) ) ); ?>
|
||||
|
||||
<input type="hidden" name="object_classes" value="<?php echo $object_classes; ?>" />
|
||||
|
||||
<!-- The array of attributes/values -->
|
||||
<input type="hidden" name="attrs[]" value="gidNumber" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($default_gid_number);?>" />
|
||||
<input type="hidden" name="attrs[]" value="uidNumber" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($uid_number);?>" />
|
||||
<input type="hidden" name="attrs[]" value="uid" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($machine_name . '$');?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaSid" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($samba3_domain_sid."-".$samba3_computer_rid);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaAcctFlags" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($default_acct_flags);?>" />
|
||||
<input type="hidden" name="attrs[]" value="cn" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($machine_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="homeDirectory" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($default_home_dir);?>" />
|
||||
|
||||
<center>
|
||||
Realy create this new Samba machine?<br />
|
||||
<br />
|
||||
<table class="confirm">
|
||||
<tr class="even"><td>Name</td><td><b><?php echo htmlspecialchars($machine_name); ?></b></td></tr>
|
||||
<tr class="odd"><td>UID number</td><td><b><?php echo htmlspecialchars($uid_number); ?></b></td></tr>
|
||||
<tr class="even"><td>SambaSid</td><td><b><?php echo htmlspecialchars($samba3_domain_sid."-".$samba3_computer_rid); ?></b></td></tr>
|
||||
<tr class="odd"><td>Container</td><td><b><?php echo htmlspecialchars( $container ); ?></b></td></tr>
|
||||
</table>
|
||||
<br /><input type="submit" value="Create Machine" />
|
||||
</center>
|
||||
|
||||
<?php } ?>
|
315
templates/creation/new_smb3_user_template.php
Normal file
315
templates/creation/new_smb3_user_template.php
Normal file
@@ -0,0 +1,315 @@
|
||||
<?php
|
||||
require realpath( 'common.php' );
|
||||
|
||||
$samba3_domains = get_samba3_domains();
|
||||
|
||||
$default_container = "ou=Users";
|
||||
$default_home = "/home";
|
||||
|
||||
// Common to all templates
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
$step = 1;
|
||||
if( isset($_POST['step']) )
|
||||
$step = $_POST['step'];
|
||||
|
||||
//check if the sambaSamAccount objectClass is availaible
|
||||
if( get_schema_objectclass( $server_id, 'sambaSamAccount' ) == null )
|
||||
pla_error( "You LDAP server does not have schema support for the sambaSamAccount objectClass. Cannot continue." );
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
?>
|
||||
|
||||
<script language="javascript">
|
||||
<!--
|
||||
function autoFillUserName( form ) {
|
||||
var first_name;
|
||||
var last_name;
|
||||
var user_name;
|
||||
|
||||
first_name = form.first_name.value.toLowerCase();
|
||||
last_name = form.last_name.value.toLowerCase();
|
||||
if( last_name == '' ) {
|
||||
return false;
|
||||
}
|
||||
user_name = first_name.substr( 0,1 ) + last_name;
|
||||
|
||||
form.user_name.value = user_name;
|
||||
autoFillHomeDir( form );
|
||||
}
|
||||
function autoFillHomeDir( form ){
|
||||
var user_name;
|
||||
var home_dir;
|
||||
|
||||
user_name = form.user_name.value.toLowerCase();
|
||||
|
||||
home_dir = '<?php echo $default_home; ?>/';
|
||||
home_dir += user_name;
|
||||
form.home_dir.value = home_dir;
|
||||
|
||||
}
|
||||
function autoFillSambaRID( form ){
|
||||
var sambaRID;
|
||||
var uidNumber;
|
||||
|
||||
// TO DO:need to check if uidNumber is an integer
|
||||
uidNumber = form.uid_number.value;
|
||||
sambaRID = (2*uidNumber)+1000;
|
||||
form.samba3_user_rid.value = sambaRID;
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
|
||||
<center><h2>New Samba3 User Account</h2></center>
|
||||
|
||||
<?php if( $step == 1 ) { ?>
|
||||
|
||||
<form action="creation_template.php" method="post" id="user_form" name="user_form">
|
||||
<input type="hidden" name="step" value="2" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="template" value="<?php echo htmlspecialchars( $_POST['template'] ); ?>" />
|
||||
|
||||
<center>
|
||||
<table class="confirm">
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">UID Number:</td>
|
||||
<td><input type="text" name="uid_number" value="" onChange="autoFillSambaRID(this.form)" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading"><i>Samba SID:</i></td>
|
||||
<td><select name="samba3_domain_sid">
|
||||
<?php foreach($samba3_domains as $samba3_domain) ?>
|
||||
<option value="<?php echo $samba3_domain['sid'] ?>"><?php echo $samba3_domain['sid'] ?></option>
|
||||
</select> - <input type="text" name="samba3_user_rid" id="samba3_user_rid" value="" size="7"/></td>
|
||||
</tr>
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td><img src="images/uid.png" /></td>
|
||||
<td class="heading">First name:</td>
|
||||
<td><input type="text" name="first_name" id="first_name" value="" onChange="autoFillUserName(this.form)" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Last name:</td>
|
||||
<td><input type="text" name="last_name" id="last_name" value="" onChange="autoFillUserName(this.form)" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">User name:</td>
|
||||
<td><input type="text" name="user_name" id="user_name" value=""
|
||||
onChange="autoFillHomeDir(this.form)" onExit="autoFillHomeDir(this.form)" /></td>
|
||||
</tr>
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td><img src="images/lock.png" /></td>
|
||||
<td class="heading">Password:</td>
|
||||
<td><input type="password" name="user_pass1" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Password:</td>
|
||||
<td><input type="password" name="user_pass2" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Encryption:</td>
|
||||
<td>
|
||||
<input type="hidden" name="encryption" value="crypt"/>
|
||||
<i>crypt</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td><img src="images/terminal.png" /></td>
|
||||
<td class="heading">Login Shell:</td>
|
||||
<td>
|
||||
<select name="login_shell">
|
||||
<option value="/bin/bash">/bin/bash</option>
|
||||
<option value="/bin/csh">/bin/csh</option>
|
||||
<option value="/bin/ksh">/bin/ksh</option>
|
||||
<option value="/bin/tcsh">/bin/tcsh</option>
|
||||
<option value="/bin/zsh">/bin/zsh</option>
|
||||
<option value="/bin/sh">/bin/sh</option>
|
||||
<option value="/bin/false">/bin/false</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Container:</td>
|
||||
<td><input type="text" name="container" size="40"
|
||||
value="<?php if( isset( $container ) )
|
||||
echo htmlspecialchars( $container );
|
||||
else
|
||||
echo htmlspecialchars( $default_container . ',' . $servers[$server_id]['base'] ); ?>" />
|
||||
<?php draw_chooser_link( 'user_form.container' ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Unix Group:</td>
|
||||
<td><select name="group">
|
||||
<option value="1000">admins (1000)</option>
|
||||
<option value="2000">users (2000)</option>
|
||||
<option value="3000">staff (3000)</option>
|
||||
<option value="5000">guest (5000)</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Windows Group:</td>
|
||||
<td><select name="sambaPrimaryGroupSID">
|
||||
|
||||
<option value="S-1-5-32-544">Local Administrator (S-1-5-32-544)</option>
|
||||
<option value="S-1-5-32-545">Local Users (S-1-5-32-545)</option>
|
||||
<option value="S-1-5-32-546">Local Guests (S-1-5-32-546)</option>
|
||||
<option value="S-1-5-32-547">Local Power Users (S-1-5-32-547)</option>
|
||||
|
||||
<?php foreach($samba3_domains as $samba3_domain) { ?>
|
||||
<option value="<?php echo $samba3_domain['sid']; ?>-512">Domain Admins (<?php echo $samba3_domain['sid']; ?>-512)</option>
|
||||
<option value="<?php echo $samba3_domain['sid']; ?>-513">Domain Users (<?php echo $samba3_domain['sid']; ?>-513)</option>
|
||||
<option value="<?php echo $samba3_domain['sid']; ?>-514">Domain Guests (<?php echo $samba3_domain['sid']; ?>-514)</option>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Home Directory:</td>
|
||||
<td><input type="text" name="home_dir" value="" id="home_dir" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><center><br /><input type="submit" value="Proceed >>" /></td>
|
||||
</tr>
|
||||
<tr height="10"><td colspan="3"></tr>
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td><small><b>Note: </b></small></td>
|
||||
<td colspan="2"><small>To change the value(s) of the samba domain sid, please edit the file :<br /> <code>templates/template_config.php</small></code></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
|
||||
<?php } elseif( $step == 2 ) {
|
||||
|
||||
$user_name = trim( $_POST['user_name'] );
|
||||
$first_name = trim( $_POST['first_name'] );
|
||||
$last_name = trim( $_POST['last_name'] );
|
||||
$password1 = $_POST['user_pass1'];
|
||||
$password2 = $_POST['user_pass2'];
|
||||
$encryption = $_POST['encryption'];
|
||||
$login_shell = trim( $_POST['login_shell'] );
|
||||
$uid_number = trim( $_POST['uid_number'] );
|
||||
$gid_number = trim( $_POST['group'] );
|
||||
$container = trim( $_POST['container'] );
|
||||
$home_dir = trim( $_POST['home_dir'] );
|
||||
$samba3_user_rid = trim( $_POST['samba3_user_rid'] );
|
||||
$samba3_domain_sid = trim( $_POST['samba3_domain_sid'] );
|
||||
$samba3_primary_group_sid = trim( $_POST['sambaPrimaryGroupSID'] );
|
||||
|
||||
$sambaLMPassword="";
|
||||
$sambaNTPassword="";
|
||||
$smb_passwd_creation_success = 0;
|
||||
|
||||
/* Critical assertions */
|
||||
$password1 == $password2 or
|
||||
pla_error( "Your passwords don't match. Please go back and try again." );
|
||||
0 != strlen( $uid_number ) or
|
||||
pla_error( "You cannot leave the UID number blank. Please go back and try again." );
|
||||
is_numeric( $uid_number ) or
|
||||
pla_error( "You can only enter numeric values for the UID number field. Please go back and try again." );
|
||||
dn_exists( $server_id, $container ) or
|
||||
pla_error( "The container you specified (" . htmlspecialchars( $container ) . ") does not exist. " .
|
||||
"Please go back and try again." );
|
||||
|
||||
$password = password_hash( $password1, $encryption );
|
||||
|
||||
//build the mkntpwd command line string
|
||||
$sambaPassCommand = $mkntpwdCommand . " " . $password1;
|
||||
|
||||
// execute this command
|
||||
$sambaPassCommandOutput = shell_exec($sambaPassCommand);
|
||||
if($sambaPassCommandOutput){
|
||||
$sambaLMPassword = substr($sambaPassCommandOutput,0,strPos($sambaPassCommandOutput,':'));
|
||||
$sambaNTPassword = substr($sambaPassCommandOutput,strPos($sambaPassCommandOutput,':')+1);
|
||||
$smb_passwd_creation_success = 1;
|
||||
}
|
||||
|
||||
?>
|
||||
<center><h3>Confirm account creation:</h3></center>
|
||||
|
||||
<form action="create.php" method="post">
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="new_dn" value="<?php echo htmlspecialchars( 'uid=' . $user_name . ',' . $container ); ?>" />
|
||||
|
||||
<!-- ObjectClasses -->
|
||||
<?php $object_classes = rawurlencode( serialize( array( 'top', 'account', 'posixAccount', 'shadowAccount' , 'sambaSamAccount' ) ) ); ?>
|
||||
|
||||
<input type="hidden" name="object_classes" value="<?php echo $object_classes; ?>" />
|
||||
|
||||
<!-- The array of attributes/values -->
|
||||
<input type="hidden" name="attrs[]" value="cn" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($first_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="displayName" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($first_name . ' ' . $last_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="gecos" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($first_name . ' ' . $last_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="gidNumber" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($gid_number);?>" />
|
||||
<input type="hidden" name="attrs[]" value="homeDirectory" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($home_dir);?>" />
|
||||
<input type="hidden" name="attrs[]" value="loginShell" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($login_shell);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaAcctFlags" />
|
||||
<input type="hidden" name="vals[]" value="[U ]" />
|
||||
<input type="hidden" name="attrs[]" value="sambaPrimaryGroupSID" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($samba3_primary_group_sid);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaSID" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo $samba3_domain_sid."-".$samba3_user_rid; ?>" />
|
||||
<input type="hidden" name="attrs[]" value="shadowLastChange" />
|
||||
<input type="hidden" name="vals[]" value="11778" />
|
||||
<input type="hidden" name="attrs[]" value="uid" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($user_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="uidNumber" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($uid_number);?>" />
|
||||
<input type="hidden" name="attrs[]" value="userPassword" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($password);?>" />
|
||||
<?php if( $smb_passwd_creation_success ){?>
|
||||
<input type="hidden" name="attrs[]" value="sambaLMPassword" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($sambaLMPassword);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaNTPassword" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($sambaNTPassword);?>" />
|
||||
<!--
|
||||
<input type="hidden" name="attrs[]" value="sambaPwdCanChange" />
|
||||
<input type="hidden" name="vals[]" value="0" />
|
||||
<input type="hidden" name="attrs[]" value="sambaPwdLastSet" />
|
||||
<input type="hidden" name="vals[]" value="0" />
|
||||
<input type="hidden" name="attrs[]" value="sambaPwdMustChange" />
|
||||
<input type="hidden" name="vals[]" value="2147483647" />
|
||||
-->
|
||||
<?php } ?>
|
||||
|
||||
<center>
|
||||
<table class="confirm">
|
||||
<tr class="even"><td class="heading">User name:</td><td><b><?php echo htmlspecialchars( $user_name ); ?></b></td></tr>
|
||||
<tr class="odd"><td class="heading">First name:</td><td><b><?php echo htmlspecialchars( $first_name ); ?></b></td></tr>
|
||||
<tr class="even"><td class="heading">Last name:</td><td><b><?php echo htmlspecialchars( $last_name ); ?></b></td></tr>
|
||||
<tr class="odd"><td class="heading">UID Number:</td><td><?php echo htmlspecialchars( $uid_number ); ?></td></tr>
|
||||
<tr class="even"><td class="heading">Login Shell:</td><td><?php echo htmlspecialchars( $login_shell); ?></td></tr>
|
||||
<tr class="even"><td class="heading">Samba SID:</td><td><?php echo htmlspecialchars( $samba3_domain_sid."-".$samba3_user_rid ); ?></td></tr>
|
||||
<tr class="odd"><td class="heading">GID Number:</td><td><?php echo htmlspecialchars( $gid_number ); ?></td></tr>
|
||||
<tr class="even"><td class="heading">Container:</td><td><?php echo htmlspecialchars( $container ); ?></td></tr>
|
||||
<tr class="odd"><td class="heading">Home dir:</td><td><?php echo htmlspecialchars( $home_dir ); ?></td></tr>
|
||||
<?php if( $smb_passwd_creation_success ){ ?>
|
||||
<tr class="even"><td class="heading">Password:</td><td>[secret]</td></tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<br /><input type="submit" value="Create Samba Account" />
|
||||
</center>
|
||||
|
||||
<?php } ?>
|
199
templates/creation/new_smbgroup_template.php
Normal file
199
templates/creation/new_smbgroup_template.php
Normal file
@@ -0,0 +1,199 @@
|
||||
<?php
|
||||
require 'common.php';
|
||||
|
||||
// Common to all templates
|
||||
$rdn = isset( $_POST['rdn'] ) ? $_POST['rdn'] : null;
|
||||
$container = $_POST['container'];
|
||||
$server_id = $_POST['server_id'];
|
||||
|
||||
// Change this to suit your needs
|
||||
$default_number_of_members = 4;
|
||||
|
||||
// get the available domains (see template_connfig.php for customization)
|
||||
$samba3_domains = get_samba3_domains();
|
||||
|
||||
$step = 1;
|
||||
if( isset($_POST['step']) )
|
||||
$step = $_POST['step'];
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
|
||||
if( get_schema_objectclass( $server_id, 'sambaGroupMapping' ) == null )
|
||||
pla_error( "You LDAP server does not have schema support for the sambaGroupMapping objectClass. Cannot continue." );
|
||||
|
||||
?>
|
||||
<script language="javascript">
|
||||
/**
|
||||
* Populate the display name field from the group name field
|
||||
*/
|
||||
|
||||
function autoFillDisplayName( form ){
|
||||
var samba_group_name
|
||||
samba_group_name = form.samba_group_name.value;
|
||||
form.display_name.value = samba_group_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Populate the sambasid field from the the gid field
|
||||
* samba sid = 2*gid +1001 (default behaviour of net groupmad when no
|
||||
* sid is specified)
|
||||
* TODO: check if the gid is a number
|
||||
*
|
||||
**/
|
||||
|
||||
function autoFillSambaRID( form ){
|
||||
var sambaRID;
|
||||
var gidNumber;
|
||||
|
||||
gidNumber = form.gid_number.value;
|
||||
sambaRID = (2*gidNumber)+1001;
|
||||
form.samba3_rid.value = sambaRID;
|
||||
}
|
||||
</script>
|
||||
|
||||
<center><h2>New Samba Group Mapping</h2></center>
|
||||
|
||||
<?php if( $step == 1 ) { ?>
|
||||
|
||||
<form action="creation_template.php" method="post" name="posix_group_form">
|
||||
<input type="hidden" name="step" value="2" />
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="template" value="<?php echo htmlspecialchars( $_POST['template'] ); ?>" />
|
||||
|
||||
<center>
|
||||
<table class="confirm">
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Samba Group Name:</td>
|
||||
<td><input type="text" name="samba_group_name" value="" onChange="autoFillDisplayName(this.form)"/> <small>(example: admins, do not include "cn=")</small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading"><acronym title="Display Name">Display Name</acronym>:</td>
|
||||
<td><input type="text" name="display_name" value="" /> </small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading"><acronym title="Group Identification">GID</acronym> Number:</td>
|
||||
<td><input type="text" name="gid_number" value="" onChange="autoFillSambaRID(this.form)" /> <small>(example: 2000)</small></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading"><acronym title="Samba Security Identifier">SambaSID</acronym></td>
|
||||
<td><select name="samba3_domain_sid">
|
||||
<?php foreach($samba3_domains as $samba3_domain) ?>
|
||||
<option value="<?php echo $samba3_domain['sid'] ?>"><?php echo $samba3_domain['sid'] ?></option>
|
||||
</select> - <input type="text" name="samba3_rid" id="samba3_rid" value="" size="7"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Container <acronym title="Distinguished Name">DN</acronym>:</td>
|
||||
<td><input type="text" name="container" size="40" value="<?php echo htmlspecialchars( $container ); ?>" />
|
||||
<?php draw_chooser_link( 'posix_group_form.container' ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading"><acronym title="Samba Group Type">SambaGroupType</acronym> Number:</td>
|
||||
<td>
|
||||
<select name="group_type_number">
|
||||
<!-- <option value="1">1 - User</option> -->
|
||||
<option value="2" selected>2 - Domain Group</option>
|
||||
<!-- <option value="3">3 - Domain</option> -->
|
||||
<option value="4">4 - Local Group</option>
|
||||
<option value="5">5 - Well-known Group</option>
|
||||
<!-- <option value="6">6 - Deleted Account</option>
|
||||
<option value="7">7 - Invalid Account</option>
|
||||
<option value="8">8 - Unknown</option> -->
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Members:</td>
|
||||
<td><input type="text" name="member_uids[]" value="" /> <small>(example: dsmith)</small><br />
|
||||
<?php for( $i=1; $i<$default_number_of_members; $i++ ) { ?>
|
||||
<input type="text" name="member_uids[]" value="" /><br />
|
||||
<?php } ?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><center><br /><input type="submit" value="Proceed >>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
</form>
|
||||
|
||||
|
||||
<?php } elseif( $step == 2 ) {
|
||||
|
||||
$group_name = trim( $_POST['samba_group_name'] );
|
||||
$container = trim( $_POST['container'] );
|
||||
$gid_number = trim( $_POST['gid_number'] );
|
||||
$display_name = trim( $_POST['display_name'] );
|
||||
$samba3_domain_sid = trim( $_POST['samba3_domain_sid'] );
|
||||
$samba3_group_rid = trim( $_POST['samba3_rid'] );
|
||||
$group_type_number = trim( $_POST['group_type_number'] );
|
||||
$uids = $_POST['member_uids'];
|
||||
$member_uids = array();
|
||||
foreach( $uids as $uid )
|
||||
if( '' != trim( $uid ) && ! in_array( $uid, $member_uids ) )
|
||||
$member_uids[] = $uid;
|
||||
|
||||
dn_exists( $server_id, $container ) or
|
||||
pla_error( "The container you specified (" . htmlspecialchars( $container ) . ") does not exist. " .
|
||||
"Please go back and try again." );
|
||||
|
||||
?>
|
||||
|
||||
<form action="create.php" method="post">
|
||||
<input type="hidden" name="server_id" value="<?php echo $server_id; ?>" />
|
||||
<input type="hidden" name="new_dn" value="<?php echo htmlspecialchars( 'cn='.$group_name.','.$container ); ?>" />
|
||||
|
||||
<!-- ObjectClasses -->
|
||||
<?php $object_classes = rawurlencode( serialize( array( 'top', 'posixGroup','sambaGroupMapping' ) ) ); ?>
|
||||
|
||||
<input type="hidden" name="object_classes" value="<?php echo $object_classes; ?>" />
|
||||
|
||||
<!-- The array of attributes/values -->
|
||||
<input type="hidden" name="attrs[]" value="cn" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($group_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="gidNumber" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($gid_number);?>" />
|
||||
<input type="hidden" name="attrs[]" value="displayName" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($display_name);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaSid" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($samba3_domain_sid."-".$samba3_group_rid);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaGroupType" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($group_type_number);?>" />
|
||||
<?php foreach( $member_uids as $uid ) { ?>
|
||||
<input type="hidden" name="attrs[]" value="memberUid" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($uid);?>" />
|
||||
<?php } ?>
|
||||
|
||||
<center>
|
||||
Really create this new Posix Group entry?<br />
|
||||
<br />
|
||||
<table class="confirm">
|
||||
<tr class="even"><td>Name</td><td><b><?php echo htmlspecialchars($group_name); ?></b></td></tr>
|
||||
<tr class="odd"><td>Container</td><td><b><?php echo htmlspecialchars( $container ); ?></b></td></tr>
|
||||
<tr class="even"><td>display Name</td><td><b><?php echo htmlspecialchars($display_name); ?></b></td></tr>
|
||||
<tr class="odd"><td>gidNumber</td><td><b><?php echo htmlspecialchars( $gid_number ); ?></b></td></tr>
|
||||
<tr class="even"><td>sambaSid</td><td><b><?php echo htmlspecialchars($samba3_domain_sid."-".$samba3_group_rid); ?></b></td></tr>
|
||||
<tr class="odd"><td>sambaGroupType</td><td><b><?php echo htmlspecialchars( $group_type_number ); ?></b></td></tr>
|
||||
<tr class="even"><td>Member UIDs</td><td><b>
|
||||
<?php foreach( $member_uids as $i => $uid )
|
||||
echo htmlspecialchars($uid) . "<br />"; ?>
|
||||
</b></td></tr>
|
||||
</table>
|
||||
<br /><input type="submit" value="Create Group" />
|
||||
</center>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</body>
|
||||
</html>
|
@@ -1,11 +1,8 @@
|
||||
<?php
|
||||
require realpath( 'common.php' );
|
||||
|
||||
// customize this to your needs
|
||||
$default_samba_sid = "S-1-5-21-3509297442-4087397136-3591104989";
|
||||
$default_container = "ou=Users";
|
||||
$default_home = "/export/home";
|
||||
$mkntpwdCommand = "./templates/creation/mkntpwd";
|
||||
$default_home = "/home";
|
||||
|
||||
// Common to all templates
|
||||
$server_id = $_POST['server_id'];
|
||||
@@ -13,6 +10,10 @@
|
||||
$step = 1;
|
||||
if( isset($_POST['step']) )
|
||||
$step = $_POST['step'];
|
||||
|
||||
//check if the sambaSamAccount objectClass is availaible
|
||||
if( get_schema_objectclass( $server_id, 'sambaAccount' ) == null )
|
||||
pla_error( "You LDAP server does not have schema support for the sambaAccount objectClass. Cannot continue." );
|
||||
|
||||
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
|
||||
have_auth_info( $server_id ) or pla_error( "Not enough information to login to server. Please check your configuration." );
|
||||
@@ -31,7 +32,6 @@
|
||||
return false;
|
||||
}
|
||||
user_name = first_name.substr( 0,1 ) + last_name;
|
||||
user_name = first_name.substr( 0,8 );
|
||||
|
||||
form.user_name.value = user_name;
|
||||
autoFillHomeDir( form );
|
||||
@@ -47,20 +47,19 @@
|
||||
form.home_dir.value = home_dir;
|
||||
|
||||
}
|
||||
function autoFillSambaSID( form ){
|
||||
var sambaSID;
|
||||
function autoFillSambaRID( form ){
|
||||
var sambaRID;
|
||||
var uidNumber;
|
||||
|
||||
// TO DO:need to check if uidNumber is an integer
|
||||
uidNumber = form.uid_number.value;
|
||||
sambaSID = '<?php echo $default_samba_sid; ?>-'+(2*uidNumber+1000);
|
||||
|
||||
form.samba_sid.value = sambaSID;
|
||||
|
||||
sambaRID = (2*uidNumber)+1000;
|
||||
form.samba_user_rid.value = sambaRID;
|
||||
}
|
||||
-->
|
||||
</script>
|
||||
|
||||
<center><h2>New Samba3-User Account</h2></center>
|
||||
<center><h2>New Samba User Account</h2></center>
|
||||
|
||||
<?php if( $step == 1 ) { ?>
|
||||
|
||||
@@ -75,12 +74,12 @@
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">UID Number:</td>
|
||||
<td><input type="text" name="uid_number" value="" onChange="autoFillSambaSID(this.form)" /></td>
|
||||
<td><input type="text" name="uid_number" value="" onChange="autoFillSambaRID(this.form)" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading"><i>Samba SID:</i></td>
|
||||
<td><input type="text" name="samba_sid" value="" id="samba_sid" readonly=""/></td>
|
||||
<td class="heading"><i>RID:</i></td>
|
||||
<td><input type="text" name="samba_user_rid" id="samba_user_rid" value="" size="7"/></td>
|
||||
</tr>
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
@@ -120,11 +119,18 @@
|
||||
</tr>
|
||||
<tr class="spacer"><td colspan="3"></tr>
|
||||
<tr>
|
||||
<td><img src="images/nt.png" /></td>
|
||||
<td><img src="images/terminal.png" /></td>
|
||||
<td class="heading">Login Shell:</td>
|
||||
<td>
|
||||
<input type="hidden" name="login_shell" value="/bin/csh"/>
|
||||
<i>/bin/csh</i>
|
||||
<td>
|
||||
<select name="login_shell">
|
||||
<option value="/bin/bash">/bin/bash</option>
|
||||
<option value="/bin/csh">/bin/csh</option>
|
||||
<option value="/bin/ksh">/bin/ksh</option>
|
||||
<option value="/bin/tcsh">/bin/tcsh</option>
|
||||
<option value="/bin/zsh">/bin/zsh</option>
|
||||
<option value="/bin/sh">/bin/sh</option>
|
||||
<option value="/bin/false">/bin/false</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -139,7 +145,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="heading">Unix Group:</td>
|
||||
<td><select name="group">
|
||||
<option value="1000">admins (1000)</option>
|
||||
@@ -150,24 +156,18 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Windows Group:</td>
|
||||
<td><select name="sambaPrimaryGroupSID">
|
||||
<option value="S-1-5-32-547">Local Power Users</option>
|
||||
<option value="S-1-5-32-544">Local Administrator</option>
|
||||
<option value="S-1-5-32-545">Local Users</option>
|
||||
<option value="<?php echo $default_samba_sid; ?>-512">Domain Admins</option>
|
||||
<option value="<?php echo $default_samba_sid; ?>-513">Domain Users</option>
|
||||
<option value="<?php echo $default_samba_sid; ?>-514">Domain Guests</option>
|
||||
</select></td>
|
||||
<td class="heading">Primary Group Id:</td>
|
||||
<td><input type="text" name="primary_group_id">
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Home Directory:</td>
|
||||
<td><input type="text" name="home_dir" value="<?php echo $default_home ?>" id="home_dir" /></td>
|
||||
<td><input type="text" name="home_dir" value="" id="home_dir" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><center><br /><input type="submit" value="Proceed >>" /></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</center>
|
||||
|
||||
@@ -184,8 +184,12 @@
|
||||
$gid_number = trim( $_POST['group'] );
|
||||
$container = trim( $_POST['container'] );
|
||||
$home_dir = trim( $_POST['home_dir'] );
|
||||
|
||||
$samba_sid = trim( stripslashes( $_POST['samba_sid'] ) );
|
||||
$samba_user_rid = trim( $_POST['samba_user_rid'] );
|
||||
$samba_primary_group_id = trim( $_POST['primary_group_id'] );
|
||||
|
||||
$sambaLMPassword="";
|
||||
$sambaNTPassword="";
|
||||
$smb_passwd_creation_success = 0;
|
||||
|
||||
/* Critical assertions */
|
||||
$password1 == $password2 or
|
||||
@@ -200,10 +204,17 @@
|
||||
|
||||
$password = password_hash( $password1, $encryption );
|
||||
|
||||
//build the mkntpwd command line string
|
||||
$sambaPassCommand = $mkntpwdCommand . " " . $password1;
|
||||
|
||||
// execute this command
|
||||
$sambaPassCommandOutput = shell_exec($sambaPassCommand);
|
||||
$sambaLMPassword = substr($sambaPassCommandOutput,0,strPos($sambaPassCommandOutput,':'));
|
||||
$sambaNTPassword = substr($sambaPassCommandOutput,strPos($sambaPassCommandOutput,':')+1);
|
||||
if($sambaPassCommandOutput){
|
||||
$sambaLMPassword = substr($sambaPassCommandOutput,0,strPos($sambaPassCommandOutput,':'));
|
||||
$sambaNTPassword = substr($sambaPassCommandOutput,strPos($sambaPassCommandOutput,':')+1);
|
||||
$smb_passwd_creation_success = 1;
|
||||
}
|
||||
|
||||
?>
|
||||
<center><h3>Confirm account creation:</h3></center>
|
||||
|
||||
@@ -212,7 +223,7 @@
|
||||
<input type="hidden" name="new_dn" value="<?php echo htmlspecialchars( 'uid=' . $user_name . ',' . $container ); ?>" />
|
||||
|
||||
<!-- ObjectClasses -->
|
||||
<?php $object_classes = rawurlencode( serialize( array( 'top', 'account', 'posixAccount', 'shadowAccount' , 'sambaSamAccount' ) ) ); ?>
|
||||
<?php $object_classes = rawurlencode( serialize( array( 'top', 'account', 'posixAccount', 'shadowAccount' , 'sambaAccount' ) ) ); ?>
|
||||
|
||||
<input type="hidden" name="object_classes" value="<?php echo $object_classes; ?>" />
|
||||
|
||||
@@ -229,25 +240,12 @@
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($home_dir);?>" />
|
||||
<input type="hidden" name="attrs[]" value="loginShell" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($login_shell);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaAcctFlags" />
|
||||
<input type="hidden" name="attrs[]" value="acctFlags" />
|
||||
<input type="hidden" name="vals[]" value="[U ]" />
|
||||
<input type="hidden" name="attrs[]" value="sambaLMPassword" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($sambaLMPassword);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaNTPassword" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($sambaNTPassword);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaPrimaryGroupSID" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($sambaPrimaryGroupSID);?>" />
|
||||
<input type="hidden" name="attrs[]" value="sambaPwdCanChange" />
|
||||
<input type="hidden" name="vals[]" value="0" />
|
||||
<input type="hidden" name="attrs[]" value="sambaPwdLastSet" />
|
||||
<input type="hidden" name="vals[]" value="0" />
|
||||
<input type="hidden" name="attrs[]" value="sambaPwdMustChange" />
|
||||
<input type="hidden" name="vals[]" value="2147483647" />
|
||||
|
||||
<input type="hidden" name="attrs[]" value="sambaSID" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($samba_sid); ?>" />
|
||||
|
||||
|
||||
<input type="hidden" name="attrs[]" value="primaryGroupID" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($samba_primary_group_id);?>" />
|
||||
<input type="hidden" name="attrs[]" value="rid" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo $samba_user_rid; ?>" />
|
||||
<input type="hidden" name="attrs[]" value="shadowLastChange" />
|
||||
<input type="hidden" name="vals[]" value="11778" />
|
||||
<input type="hidden" name="attrs[]" value="uid" />
|
||||
@@ -256,20 +254,37 @@
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($uid_number);?>" />
|
||||
<input type="hidden" name="attrs[]" value="userPassword" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($password);?>" />
|
||||
<?php if( $smb_passwd_creation_success ){?>
|
||||
<input type="hidden" name="attrs[]" value="lmPassword" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($sambaLMPassword);?>" />
|
||||
<input type="hidden" name="attrs[]" value="ntPassword" />
|
||||
<input type="hidden" name="vals[]" value="<?php echo htmlspecialchars($sambaNTPassword);?>" />
|
||||
<!--
|
||||
<input type="hidden" name="attrs[]" value="pwdCanChange" />
|
||||
<input type="hidden" name="vals[]" value="0" />
|
||||
<input type="hidden" name="attrs[]" value="pwdLastSet" />
|
||||
<input type="hidden" name="vals[]" value="0" />
|
||||
<input type="hidden" name="attrs[]" value="pwdMustChange" />
|
||||
<input type="hidden" name="vals[]" value="2147483647" />
|
||||
-->
|
||||
<?php } ?>
|
||||
|
||||
<center>
|
||||
<table class="confirm">
|
||||
<tr class="even"><td class="heading">User name:</td><td><b><?php echo htmlspecialchars( $user_name ); ?></b></td></tr>
|
||||
<tr class="odd"><td class="heading">First name:</td><td><b><?php echo htmlspecialchars( $first_name ); ?></b></td></tr>
|
||||
<tr class="even"><td class="heading">Last name:</td><td><b><?php echo htmlspecialchars( $last_name ); ?></b></td></tr>
|
||||
<tr class="odd"><td class="heading">Password:</td><td>[secret]</td></tr>
|
||||
<tr class="odd"><td class="heading">UID Number:</td><td><?php echo htmlspecialchars( $uid_number ); ?></td></tr>
|
||||
<tr class="even"><td class="heading">Login Shell:</td><td><?php echo htmlspecialchars( $login_shell); ?></td></tr>
|
||||
<tr class="odd"><td class="heading">UID Number:</td><td><?php echo htmlspecialchars( $uid_number ); ?></td></tr>
|
||||
<tr class="even"><td class="heading">GID Number:</td><td><?php echo htmlspecialchars( $gid_number ); ?></td></tr>
|
||||
<tr class="odd"><td class="heading">Container:</td><td><?php echo htmlspecialchars( $container ); ?></td></tr>
|
||||
<tr class="even"><td class="heading">Home dir:</td><td><?php echo htmlspecialchars( $home_dir ); ?></td></tr>
|
||||
</table>
|
||||
<br /><input type="submit" value="Create Account" />
|
||||
<tr class="even"><td class="heading">Rid</td><td><?php echo htmlspecialchars( $samba_user_rid ); ?></td></tr>
|
||||
<tr class="odd"><td class="heading">GID Number:</td><td><?php echo htmlspecialchars( $gid_number ); ?></td></tr>
|
||||
<tr class="even"><td class="heading">Container:</td><td><?php echo htmlspecialchars( $container ); ?></td></tr>
|
||||
<tr class="odd"><td class="heading">Home dir:</td><td><?php echo htmlspecialchars( $home_dir ); ?></td></tr>
|
||||
<?php if( $smb_passwd_creation_success ){ ?>
|
||||
<tr class="even"><td class="heading">Password:</td><td>[secret]</td></tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
<br /><input type="submit" value="Create Samba Account" />
|
||||
</center>
|
||||
|
||||
<?php } ?>
|
||||
|
@@ -169,6 +169,11 @@ function autoFillHomeDir( form )
|
||||
<?php draw_chooser_link( 'user_form.container' ); ?></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Home Directory:</td>
|
||||
<td><input type="text" name="home_dir" value="/home/" id="home_dir" /></td>
|
||||
</tr>
|
||||
<?php
|
||||
// determining the next available uidNumber may take a moment.
|
||||
// give them something to look at in the mean time
|
||||
@@ -192,11 +197,6 @@ function autoFillHomeDir( form )
|
||||
<option value="5000">guest (5000)</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="heading">Home Directory:</td>
|
||||
<td><input type="text" name="home_dir" value="/home/" id="home_dir" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"><center><br /><input type="submit" value="Proceed" /></td>
|
||||
</tr>
|
||||
|
Reference in New Issue
Block a user