viernes, 23 de diciembre de 2011

Unix Scripting: Create users

A continuación comparto un script simple para creación de usuarios en ambientes Unix:



HOME=/export/home
#/export/home


if [ $# -eq 4 ]
then
        echo "Creating user $1, nombre $2"
else
        echo "Usage:$0 <\"username\"> <\"Descripcion\"> <\"grupo\"> <\"UID\"> "
    #echo "    groups:"
    #echo "      lista separada por comas de los grupos a los que pertenecerá"
        exit 1
fi


user=$1
nombre=$2
grupos=$3
uid=$4


sudo /usr/sbin/useradd -c "$nombre" -g $grupos -m -d $HOME/$user -s /bin/sh -u $uid $user
if [ $? -ne 0 ]
then
        exit 1
fi


echo "Setting Password"
sudo /usr/bin/passwd $user
sudo /usr/sbin/usermod -f 90 $user
sudo /usr/bin/passwd -n 7 -x 30 -w 7 -f $user
sudo /usr/bin/passwd -f $user
echo "The user $user has been created"

viernes, 28 de octubre de 2011

FOCA 3



There is a new FOCA in town. After six months we got FOCA 3 FREE available for direct download in:

This new version has new fresh look and feel, and it is full of new features that you will love to discover. 

Also, we would like to remember you that we created MetaShield Protector as a solution to filter metadata in published documents through Windows Server 2008 / 2008 R2, IIS 7.0 / 7.5 and SharePoint 2007, Windows SharePoint Services and SharePoint 2010. More info at: http://www.metashieldprotector.com

Enjoy FOCA Lover!

miércoles, 5 de octubre de 2011

Windows: Password required vulnerability

Hay ciertas cuentas que genera Windows en forma predeterminada que no requieren password y son una vulnerabilidad, ya que es posible utilizarlas sin ingresar su password.

Para conocer si una cuenta requiere password o no, debemos ejecutar el siguiente comando:

>net user IUSR_testServer
User name                    IUSR_testServer
Full Name
Comment                      Built-in account for IIS
User's comment
Country code                 000 (System Default)
Account active               Yes
Account expires              Never
Password last set            03/06/2011 11:12:42 p.m.
Password expires             Never
Password changeable          03/06/2011 11:12:42 p.m.
Password required            No
User may change password     Yes
Workstations allowed         All
Logon script
User profile
Home directory
Last logon                   03/06/2011 11:12:42 p.m.
Logon hours allowed          All
Local Group Memberships      *Users
Global Group memberships     *None
The command completed successfully.

Una vez que detectamos estas cuentas debemos analizar si la aplicacion que la usa (En nuestro caso el IIS) puede reconfigurarse y setearle el password para que sea utilizado.

Una vez realizado este analisis es necesario forzar que requiera password con el siguiente comando:




net user /passwordreq:yes NombreUsusario


Una vez realizado esto, es recomendable reiniciar el servicio que utilice este usuario para comprobar que todo siga funcionando sin problemas.

Tambien será necesario controlar que el IIS tenga el password correcto ingresado en los sites que utilicen dicha cuenta. Si fuera otra aplicación verificar que la aplicación tenga el password correctamente ingresado.



martes, 27 de septiembre de 2011

How to force WSUS updates to install on a computer

LA forma de fozar a un computer (workstation o server) a que se comunique con WSUS y descargue los paquetes que tiene pendientes de instalación es reiniciando los servicios que utiliza WSUS:

Desde un CMD ejcutar lo siguiente:

net stop "windows installer"
net start "windows installer"
net stop "
automatic updates"
net start "automatic updates"
net stop "background intelligent Transfer Service"
net start "background intelligent Transfer Service"



Si quieren hacer un vbscript puede hacerlo de la siguiente forma:

'Iniciar servicios de Windows Update
WSHShell.run "cmd.exe /K net stop ""windows installer"" & net start ""windows installer"" & exit", 1, true
WSHShell.run "cmd.exe /K net stop ""automatic updates"" & net start ""automatic updates"" & exit", 1, true
WSHShell.run "cmd.exe /K net stop ""background intelligent Transfer Service"" & net start ""background intelligent Transfer Service"" & exit", 1, true



Para ver el log de windows update y chequear los mensajes, desde Inicio > Ejecutar peguen esto:

notepad %WinDir%\WindowsUpdate.log

sábado, 10 de septiembre de 2011

Unix Hands-on: hardening sendmail

En este post algunas recomendaciones de como segurizar sendmail:

1. Primero que nada debemos verificar version actual y si requiere upgrade. Esto es lo primero a evaluar en cuanto a seguridad en cualquier producto.


2. Para todas  estas configuraciones vamos a necesitar trabajar como root.
/usr/local/bin/sudo su - root

3. Vamos a hacer las configuraciones de seguridad del servicio.
-Cambiar el banner que muestra el servicio para que no sea facil detectar que servicio y version estamos usando. Esto sirve para dificultar la detección de vulnerabilidades conocidas.
-Cambiar las privacy options.

#Muestra config actual
cat /etc/mail/sendmail.cf | grep PrivacyOptions

#Hago copia de seguridad
cp  /etc/mail/sendmail.cf  /etc/mail/sendmail.copy_old

#Reemplazo las PrivacyOptions
sed '
/O PrivacyOptions/ c\
O PrivacyOptions=authwarnings,needmailhelo,needexpnhelo,novrfy,noexpn,restrictqrun,restrictmailq' /etc/mail/sendmail.cf  > /etc/mail/sendmail.cf2
mv /etc/mail/sendmail.cf2  /etc/mail/sendmail.cf

#Reemplazo el banner
sed "s/O SmtpGreetingMessage=\$j Sendmail \$v\/\$Z; \$b/O SmtpGreetingMessage=\$j myOwnMailService/" /etc/mail/sendmail.cf > /etc/mail/sendmail.cf2
mv /etc/mail/sendmail.cf2  /etc/mail/sendmail.cf

#Restart service Solaris 9
/etc/init.d/sendmail restart

#Restart service Solaris 10
/usr/sbin/svcadm  restart /network/smtp:sendmail
svcs /network/smtp:sendmail


#Muestra la nueva config
uname -a

cat /etc/mail/sendmail.cf | grep PrivacyOptions


Unix Hands-on: ssh keys

Las ssh keys nos permiten loguearnos de forma "segura" (no siempre) a los equipos definidos sin tener que ingresar un password. Esto es sobre todo util para usuarios de servicio que deban loguearse a otros equipos a ejecutar comandos.
Decía que no siempre es seguro, ya que depende de como esté configurado el su o sudo. Si el su no pide el password para root o para otros usuarios, es muy sencillo que un usuario no autorizado pueda loguearse en otros equipos utilizando las ssh keys de otro usuario. Por esto es que hay que tener cuidado en como se utilizan las ssh keys; pero sobre todo en como se configura su y sudo.

#Crear las ssh keys en el equipo cliente
mkdir ~/.ssh chmod 700 ~/.ssh ssh-keygen -q -f ~/.ssh/id_rsa -t rsa

# upload public key from client to server (o directamente lo apendo a authorized keys como esta abajo)
scp ~/.ssh/id_rsa.pub user@10.195.8.190:.ssh/authorized_keys

# Setup the public key on server
bash
cd ~
mkdir .ssh
chmod 700 .ssh

#Inserto mi public key en authorized keys
echo "ssh-rsa AAAB3NzaC1yc2EAAAAOIwAAAIEApF+hzf1x366jjC+qt61R267dtDM36lxIqvw3ICUbNhTNB5wP/628rfWNIdi16MeCxJaufaf42tm2TYrsdGUAKfVCbssmCWJLoRwgeHUzOPIueAHwVkiuyFIG5/EJW7gvvF65pQzXoAXlktq1sWOh7kL8HLGDgUwJe4xlwvDP4Lk= user@client" >> .ssh/authorized_keys
chmod 600 .ssh/authorized_keys

 Nota: ssh keys = llaves ssh (que mal que suena en castellano...)

Unix Hands-on: Como habiltiar auth.log

En caso que tengamos problemas con un usuario que no puede acceder y no sabemos por que... o seamos conscientes de que el día de mañana podemos llegar a necesitar saber si alguien bloqueo un usuario o estuvo intentando adivinar un password, les paso el método para habilitar el auth.log. o lo que es lo mismo el how to enable auth.log

#edit syslog
vi /etc/syslog.conf

#add this line
auth.debug /var/tmp/auth.log rotate time 15d
touch /var/tmp/auth.log
chmod 640 /var/tmp/auth.log

#Finally refresh the syslog daemon
refresh -s syslogd

#View connections
tail -f /var/tmp/auth.log

Notar que la rotacion del archivo fue seteado en 15 días, lo que implica que los eventos anteriores a los 15 dias seran removidos en forma automática. Esto es bueno tenerlo en cuenta para no generar un archivo de log demasiado grande.

Unix Hands-on: AIX Security files

Los siguientes archivos contienen las principales informaciones necesarias para adminsitrar la seguridad de un equipo


/etc/passwd
Contains the basic attributes of users.
/etc/security/user
Contains the extended attributes of users.
/etc/security/user.roles
Contains the administrative role attributes of users.
/etc/security/limits
Defines resource quotas and limits for each user.
/etc/security/environ
Contains the environment attributes of users.
/etc/security/audit/config
Contains audit configuration information.
/etc/security/lastlog
Contains the last login attributes of users.
/etc/group
Contains the basic attributes of groups.
/etc/security/group
Contains the extended attributes of groups.
/etc/security/login.cfg
Contains login restrictions and messages.

jueves, 8 de septiembre de 2011

Como evaluar que bloquea un usuario


Este post puede servir para identificar quien o que bloquea un usuario de dominio o local.

1. Primero ejecutar el tool EventCombMT.exe



Nota: Los números de eventos de Seguridad de Windows a utilizar pueden consultarse desde esta URL: 
http://support.microsoft.com/kb/174074 (Aplica para Windows Server 2003)
http://support.microsoft.com/kb/947226 (Aplica para Windows Server 2008)
*Tener en cuenta que en Windows Vista / Server 2008 / Seven / Server 2012 tienen códigos de eventos de Seguridad diferentes a Windows 2003. Lo bueno es que no se solapan, arrancan de una nuemeración distinta a la que posee 2003.



Nota 3: Como utilizar el EventCombMT en esta URL : 
http://support.microsoft.com/kb/824209 

Una vez que la herramienta finaliza generará un txt en el directorio %temp%. Una linea de ejemplo es la siguiente:

644,AUDIT SUCCESS,Security,Sat Sep 03 07:07:48 2011,NT AUTHORITY\SYSTEM,User Account Locked Out:     Target Account Name: usuario1    Target Account ID: %{S-1-5-21-3880413253-2914564469-1958111818-20410}     Caller Machine Name: server1 Caller User Name: DCServer$     Caller Domain: contoso     Caller Logon ID: (0x0,0x3E7)    


Con esto vemos que usuario1 se esta bloqueando en el dominio contoso por una intento fallido de login desde el server1, a traves del Domain Controller DCServer$

2.Analizar en el servidor desde donde se realiza el login (en nuestro ejemplo server1)
Debemos analizar si:
  • El usuario tiene tareas en ejecución logeado (desde un cmd TASKLIST /FI "USERNAME ne usuario1")
  • Existen procesos que corren con este usuario (services.msc)
  • Existen tareas programadas (taskschd.msc)

3. Si con el paso anterior no encontramos que es lo que bloquea al usuario, analicemos el EventId: 529 para determinar que proceso bloquea el usuario.

En este caso vemos que el usuario se bloquea desde el Process ID 2592, que corresponde al servicio de Reporting Services


lunes, 5 de septiembre de 2011

Como delegar permisos de Active Directory

Para delegar permisos de Active Directory a un grupo de usuarios y no morir en el intento, recomiendo utilizar la herramienta de linea de comando dsacls.


Si utilizan el wizard que ofrece Windows 2003 server, van a encontrar que genera problemas con la herencia la mayoría de las veces.


A continuación un ejemplo del comando applicado en una delegación concreta de permisos sobre un atributo de un objeto user


dsacls "OU=Sites,OU=Argentina,DC=dominio,DC=ccf" /I:S /G domino\group:WP;personalTitle;user


Ejemplo para permitir a un grupo modificar la expiracion de los usuarios:


Para delegar el permiso de modificar el atributo accountExpires

dsacls "CN=Pepe,OU=Usuarios,OU=ARGENTINA,DC=dominio,DC=ccf" /I:S /G SA\HelpServicesGroup:RPWP;accountExpires;user >> out.log


Para delegar el permiso de modificar el atributo expirationTime:

dsacls "CN=Pepe,OU=Usuarios,OU=ARGENTINA,DC=dominio,DC=ccf" /I:S /G SA\HelpServicesGroup:RPWP;expirationTime;user >> out.log

Se puede poner RP (read) y WP (write) seguidos en una misma línea, como están arriba (RPWP;) y no tener que hacer 2 líneas por separado para cada Property.
El “>> out.log” se puede usar para tener registro de los resultados, si vamos a ejecutar muchos comandos juntos. Puede que fallen si el nombre (CN=) tiene caracteres no permitidos (Ñ,  comilla simple, etc.).




Mas info sobre el comando:


This article describes how to use the Dsacls.exe tool (Dsacls.exe) to manage access control lists (ACLs) for directory services in Microsoft Windows Server 2003 and Microsoft Windows 2000 Server. Dsacls.exe is a command-line tool that you can use to query the security attributes and to change permissions and security attributes of Active Directory objects. It is the command-line equivalent of the Security tab in the Windows Active Directory snap-in tools such as Active Directory Users and Computers and Active Directory Sites and Services.

Dsacls.exe is included with the Windows Support Tools. To install the Support Tools, run Setup.exe from the Support\Tools folder on the Windows Server 2003 or Windows 2000 Server CD-ROM. 

You can use Dsacls.exe and another Windows Support Tool, ACL Diagnostics (Acldiag.exe), to provide security configuration and diagnosis functionality on Active Directory objects from the command prompt.

Note You can use Dsacls.exe to display and change permissions (access control entries) in the access control list (ACL) of objects in Active Directory Application Mode (ADAM) in Windows Server 2003.

Important Do not use Dsacls.exe to modify permissions if you have implemented a Hosting solution such as Windows-based Hosting, High Volume Exchange (HVE), Hosted Messaging and Collaboration, or Hosted Exchange, or if the customer is using Microsoft Provisioning Service. The Hosting solutions depend on specific security model to isolate the ISP's customers from each other. 
DsAcls uses the following syntax:

dsacls object [/a] [/d {user | group}:permissions [...]] [/g {user | group}:permissions [...]] [/i:{p | s | t}] [/n] [/p:{y | n}] [/r {user | group} [...]] [/s [/t]]
You can use the following parameters with Dsacls.exe:
  • object: This is the path to the directory services object on which to display or change the ACLs. This path must be a distinguished name (also known as RFC 1779 or x.500 format). For example:
    CN=Someone,OU=Software,OU=Engineering,DC=Microsoft,DC=Com
    To specify a server, add \\Servername\ before the object. For example:
    \\MyServer\CN=Someone,OU=Software,OU=Engineering,DC=Microsoft,DC=Com
    When you run the dsacls command with only the object parameter (dsacls object), the security information about the object is displayed.
  • /a : Use this parameter to display the ownership and auditing information with the permissions.
  • /d {user | group}:permissions: Use this parameter to deny specified permissions to a user or group.User must use either user@domain or domain\user format, and group must use either group@domain ordomain\group format. You can specify more than one user or group in a command. For more information about the correct syntax to use for permissions, see the <Permissions> Syntax section later in this article.
  • /g {user | group}:permissions: Use this parameter to grant specified permissions to a user or group.User must use either user@domain or domain\user format, and group must use either group@domain ordomain\group format. You can specify more than one user or group in a command. For more information about the correct syntax to use for permissions, see the <Permissions> Syntax section later in this article.
  • /i:{p | t} : Use this parameter to specify one of the following inheritance flags:
    • p: Use this option to propagate inheritable permissions one level only.
    • s: Use this option to propagate inheritable permissions to subobjects only.
    • t: Use this option to propagate inheritable permissions to this object and subobjects.
  • /n : Use this parameter to replace the current access on the object, instead of editing it.
  • /p:{n}: This parameter determines whether the object can inherit permissions from its parent objects. If you omit this parameter, the inheritance properties of the object are not changed. Use this parameter to mark the object as protected (y = yes) or not protected (n = no).

    Note This parameter changes a property of the object, not of an Access Control Entry (ACE). To determine whether an ACE is inheritable, use the /I parameter.
  • /r {user | group}: Use this parameter to remove all permissions for the specified user or group. You can specify more than one user or group in a command. User must use either user@domain or domain\userformat, and group must use either group@domain or domain\group format.
  • /s: Use this parameter to restore the security on the object to the default security for that object class, as defined in the Active Directory schema.
  • /t : Use this parameter to restore the security on the tree of objects to the default for each object class. This switch is valid only when you also use the /s parameter.

Permissions Syntax

You must use the following syntax for permissions when you use the /d {user | group}:permissions or /g {user |group}:permissions parameter :
[PermissionBits];[{Object|Property}];[InheritedObjectType]
  • PermissionBits can use any of the following values, which can be concatenated together without spaces:

    Generic Permissions
    GRGeneric Read
    GEGeneric Execute
    GWGeneric Write
    GAGeneric All

    Specific Permissions
    SDDelete
    DTDelete an object and all its child objects.
    RCRead security information
    WDChange security information
    WOChange owner information
    LCList the child objects of an object
    CCCreate child object. If {Object|Property} is not specified to define a specific property, this applies to all properties of an object. Otherwise, it applies to the specified property of the object.
    DCDelete child object. If {Object|Property} is not specified to define a specific property, this applies to all properties of an object. Otherwise, it applies to the specified property of the object.
    WSWrite to self object. If {Object|Property} is not specified to define a specific property, this applies to all properties of an object. Otherwise, it applies to the specified property of the object.
    RPRead property. If {Object|Property} is not specified to define a specific property, this applies to all properties of an object. Otherwise, it applies to the specified property of the object.
    WPWrite property. If {Object|Property} is not specified to define a specific property, this applies to all properties of an object. Otherwise, it applies to the specified property of the object.
    CAControl access right. If {Object|Property} is not specified to define a specific property, this applies to all properties of an object. Otherwise, it applies to the specified property of the object.
    LOList the object access. Can be used to grant list access to a specific object if List Children (LC) is not also granted to the parent. Can also be denied on specific objects to hide those objects if the user or group has LC on the parent. By default, Active Directory does not enforce this permission.
  • {Object|Property}: This represents the display name of the object type or property. For example, "user" (without the quotation marks) is the display name for user objects, and "telephone number" (without the quotation marks) is the display name for the telephone number property.

    For example, the following command permits the user to create all types of child objects:
    /G Domain\User:CC

    However, the following command permits the user to create only child computer objects:
    /G Domain\User:CC;computer
  • InheritedObjectType: This represents the display name of the object type by which the permissions are expected to be inherited.

    If an object type is not specified, the permission can be inherited by all object types. This parameter is used only when permissions are inheritable.

    For example, the following command permits all types of objects to inherit the permission:
    /G Domain\User:CC
    However, the following command permits only user objects to inherit the permission:
    /G Domain\User:CC;;user
IMPORTANT: Use permissions only when you define object-specific permissions that override the default permissions defined in the Active Directory schema for that object type. Use with caution and only if you have a full understanding of object-specific permissions. 






Examples of Permissions
  • SDRCWDWO;;user

    This notation represents Delete, Read security information, Change security information, and Change ownership permissions on objects of type "user".
  • CCDC;group;

    This notation represents Create child and Delete child permissions to create or delete objects of type "group".
  • RPWP;telephonenumber;

    This notation represents Read property and Write property permissions on the telephone number property.



miércoles, 31 de agosto de 2011

Listar grupos y usuarios a un txt

Para listar el contenido de un grupo local de una workstation o server, podemos ejecutar el siguiente comando:


Net localgroup administrators > %temp%\lstUsersAdministrators.txt


Para hacerlo en un equipo distinto del que estamos trabajando podemos ayudarnos de la tool psexec:


psexec.exe \\Target net localgroup administrators > %temp%\lstUsersAdministrators.txt




Para listar todos los usuarios de una workstation o server, podemos ejecutar el siguiente comando:


Net users > %temp%\lstUsers.txt

Copiar una estructura de carpetas sin su archivos

Este post es bastante simple y directo... como armar una estructura de carpetas vacia copiando otra que esta llena de archivo???


Muy simple:


xcopy pathOrigen pathDestino /t /e /i


enjoy!

Error on cacls

Como resolver el siguiente error que arroja cacls: The data area passed to a system call is too small.  ???


Muy simple....
El error se debe a que la cadena pasada es muy larga y el límite es 254 caracteres


por ejemplo use este comando que da permisos de lectura al grupo group:


cacls "E:\Share\propuestas\especiales\ " /E /C /T /G  dominio\group:R

y cuando llega a este archivo da error y no aplica los permisos:

E:\Share\propuestas\especiales\1-Gestao\Biblioteca\5 - Ingenieria_Pre-Ventas\03 - Competitividades\Comparativo de Ecuanos\Acesso\Wireless\Sinalas - Sucalata\LAP 1131 e WLC 4400 - KOJNE234 – Petrecasa\RPP - ET-0663.32-5517-762-PPT-001 - Equipamento WLAN.xls

y que da este error:
The data area passed to a system call is too small

Esta es una solución a este problema de path extensos al usar cacls:
Hay que acortar el path usando una substitución:



Antes:
cacls "E:\Share\propuestas\especiales\ " /E /C /T /G  dominio\group:r

Despues:
subst X: "E:\Share\propuestas\especiales"
cacls X: /E /C /T /G  dominio\group:r


Auditing file server permissions with cacls on Windows


Un método alternativo para listar permisos de Filesystem sin usar DUMPSEC.
Esta opción es nativa de Windows por lo que no requiere instalación alguna. Es una herramienta simple y rápida.

Pueden usar este comando directamente en un cmd para listar los permisos de un directorio y sus subdirectorios:

cacls e:\share /T /C /E > permissions_share_20100706.txt

Si lo quieren ejecutar para varios equipos en forma remota puede hacerlo usando el Psexec:

Ejemplo
psexec \\207.169.84.13 net cacls e:\share /T /C /E >> permissions_share_20100706.txt

El utilitario cacls tiene algunas falencias, por lo que Microsoft desarrollo el icacls a partir de Windows Vista.

El procedimiento con cacls que es un comando estándar y que lo pueden aplicar en cualquier equipo Windows 2003 Server.

  1. brir CMD
  2.     Pararse sobre la raíz del directorio que queremos analizar
  3.     Ejecutar el comando cacls . /T /C /E > c:\ACLLog.txt
  4.     Analizar el archivo para ver que diferencias hay en los permisos.


La herramienta CACLS no tiene una salida que permita fácilmente ordenar en columnas la salida, pero es muy rápida para generar la salida.
Donde tengan muchas subcarpetas es más recomendable usar Hyena o Dumpsec.

PD: Si tuvieran que agregar permisos en muchas subcarpetas se puede usar el cacls para hacer modificaciones.

Ejemplo:
cacls x:\carpeta /G grupo:W

/G user:perm  Grant specified user access rights.
              Perm can be: R  Read
                           W  Write
                           C  Change (write)
                           F  Full control






Aqui toda la configuración completa:

 Displays or modifies access control lists (ACLs) of files

 CACLS filename [/T] [/M] [/L] [/S[:SDDL]] [/E] [/C] [/G user:perm]
        [/R user [...]] [/P user:perm [...]] [/D user [...]]
    filename      Displays ACLs.
    /T            Changes ACLs of specified files in
                  the current directory and all subdirectories.
    /L            Work on the Symbolic Link itself versus the target
    /M            Changes ACLs of volumes mounted to a directory
    /S            Displays the SDDL string for the DACL.
    /S:SDDL       Replaces the ACLs with those specified in the SDDL string
                  (not valid with /E, /G, /R, /P, or /D).
    /E            Edit ACL instead of replacing it.
    /C            Continue on access denied errors.
    /G user:perm  Grant specified user access rights.
                  Perm can be: R  Read
                               W  Write
                               C  Change (write)
                               F  Full control
    /R user       Revoke specified user's access rights (only valid with /E).
    /P user:perm  Replace specified user's access rights.
                  Perm can be: N  None
                               R  Read
                               W  Write
                               C  Change (write)
                               F  Full control
    /D user       Deny specified user access.
 Wildcards can be used to specify more than one file in a command.
 You can specify more than one user in a command.

 Abbreviations:
    CI - Container Inherit.
         The ACE will be inherited by directories.
    OI - Object Inherit.
         The ACE will be inherited by files.
    IO - Inherit Only.
         The ACE does not apply to the current file/directory.
    ID - Inherited.
         The ACE was inherited from the parent directory's ACL.


Dumpsec command line Auditing Tool for Windows

Dumpsec es una herramienta para auditoría en Windows. Es usada frecuentemente para generar reportes de permisos en file system, usuarios, grupos, registry, etc.


Aca les paso los comandos de Dumpsec que pueden usar para agilizar cualquier necesidad de auditoría.
Tienen que ejecutarlo con un CMD parados en el dir donde este el Dumpsec.exe

Desde este link pueden descargar las tools imprecindibles de la gente de SystemTools -  www.systemtools.com

Dumpsec /rpt=dir=c:\ /saveas=csv /outfile=c:\temp\dirC.txt
Dumpsec /rpt=dir=d:\ /saveas=csv /outfile=c:\temp\dirD.txt
Dumpsec /rpt=dir=e:\ /saveas=csv /outfile=c:\temp\dirE.txt

Dumpsec /rpt=userscol /saveas=csv /outfile=C:\temp\userscol.txt
Dumpsec /rpt=Groupscol /saveas=csv /outfile=C:\temp\GroupsCol.txt
Dumpsec /rpt=groups /saveas=csv /outfile=C:\temp\Groups.csv
Dumpsec /rpt=Groupsonly /saveas=csv /outfile=C:\temp\GroupsOnly.csv

Dumpsec /rpt=rights /saveas=csv /outfile=C:\temp\Rights.txt
Dumpsec /rpt=services /saveas=csv /outfile="C:\temp\" + %computername% + "_Services.txt"
Dumpsec /rpt=allsharedirs /saveas=csv /outfile=C:\temp\Allshares.txt
Dumpsec /rpt=shares /saveas=csv /outfile=C:\temp\shares.txt
Dumpsec /rpt=Policy /saveas=csv /outfile=C:\temp\Policy.txt
Dumpsec /rpt=registry=HKEY_LOCAL_MACHINE /saveas=csv /outfile=C:\temp\RegistryMachine.txt
Dumpsec /rpt=registry=HKEY_USERS /saveas=csv /outfile=C:\temp\RegistryUser.txt
Dumpsec /rpt=printers /saveas=csv /outfile=C:\temp\Printers.txt

customizable
-------------
Dumpsec /rpt=share=sharename            Specific shared directory permissions report



Mas info:


Required parameters

/rpt=report type              Type of report to produce:
dir=drive:\path Directory permissions report (drive letter path)
dir=\\computer\sharepath         Directory permissions report (UNC path)
registry=hive     Registry permissios report (hive can be HKEY_LOCAL_MACHINE or HKEY_USERS)
share=sharename           Specific shared directory permissions report
allsharedirs         All non-special shared directories permissions report
printers                Printers permissions report
shares   Shares permissions report
users     Users report (table format, all fields except groups, groupcomment and grouptype)
usersonly            Users report (table format, only username, fullname and comment fields)
userscol               Users report (column format, same fields as users report)
groups  Groups report (table format, all fields)
Groupsonly        Groups report (table format, group info, no user info)
Groupscol           Groups report (column format, same fields as groups report)
Policy    Policy report
rights     Rights report
services                Services report
/outfile=drive:\path       File in which to store report. This file will be replaced if it already exists.
Optional parameters for all reports


/computer=computer   Computer for which to dump information. Ignored for directory reports (since computer is implied by computer associated with redirected drive). Default is to dump local information.
/saveas=format                Fomat in which to store report:
native   binary format, can be loaded back into Somarsoft DumpSec
csv          comma separated columns
tsv          tab separated columns
fixed      fixed width columns, padded with blanks
Default is to save as native format.
/noheader          Do not include timestamp and other header information in saved report. Default is to include this information.
Optional parameters for permissions reports only


/noowner           Do not dump owner. Default is to dump owner.
/noperms            Do not dump permissions. Default is to dump permissions.
/showaudit         Dump audit info. Default is not to dump audit info. Ignored if audit information cannot be displayed because the current user is not a member of the Administrators group.
(only one of the following options can be specified)

/showexceptions             Show directories, files, and registry keys whose permissions differ from those of the parent directory or registry key. This is the default.
/showexcdirs     Show directories (but not files) whose permissions differ from those of the parent directory.
/showalldirs       Show all directories. Show only those files whose permissions differ from those of the parent directory.
/showdirsonly   Show all directories. Do not show any files.
/showall               Show all directories, files and registry keys.
Optional parameters for users/groups reports only


/showtruelastlogon        Query all domain controllers for "true" last logon time, which can be time consuming. Default is to use last logon time from specified computer.
/showosid           Dump SID as part of users report, which requires some additional and possible time-consuming processing. Default is not to dump SID.
/showcomputers             Show computer accounts in users reports. Default is only to show normal user accounts.
Examples:


DumpSec.exe c:\temp\users.dcl

Start Somarsoft DumpSec interactively, load and display a report that was previously saved in native format in c:\temp\users.dcl.


DumpSec.exe /rpt=dir=c:\users /showaudit /outfile=c:\temp\users.dcl

Run Somarsoft DumpSec batch mode, produce a report of directory permissions for the c:\users directory showing owner, permissions and audit settings and store the report in native file format in c:\temp\users.dcl. The report will show only those directories and files whose permissions or audit settings differ from those of parent directory.

DumpSec.exe /computer=\\server1 /rpt=users /saveas=csv /outfile=c:\temp\users.txt

Run Somarsoft DumpSec in batch mode, produce a report showing all user information in table format for users defined on \\server1, and store the report in comma separated columns format in c:\temp\users.txt.


DumpSec.exe /computer=\\server1 /rpt=share=sales /outfile=c:\temp\users.dcl /showalldirs

Run Somarsoft DumpSec in batch mode, produce a report of permissions for the \\server1\sales shared directory, showing owner and permissions but not audit settings, and store the report in native file format in c:\temp\users.dcl. The report will show all directories under the \\server1\sales tree, and only those files whose permissions differ from those of the parent directory.

sábado, 11 de junio de 2011

Como seleccionar un producto tecnológico a implementar

A la hora de realizar implementaciones de soluciones tecnológicas la actividad más compleja consiste en elegir la mejor solución basado en las necesidades de la empresa.
Dada la gran cantidad de productos que existen en el mercado se hace muy complejo saber que implementar.
Siempre tenemos algún tipo de limitación y eso ayuda a restringir la búsqueda. Algunas limitaciones típicas que tenemos que contemplar:
  • Limite Presupuestario
  • Soporte local
  • Restricciones para importación (si debemos importarlo nosotros mismos)
  • Funcionalidad requerida
  • Integración con mi entorno
  • Recursos para capacitación del personal
  • Idiomas que soporta la solución
  • Cumplimiento de requerimientos normativos
  • Certificaciones
  • etc.
Luego de analizar las factores limitantes / influyentes que tenemos para nuestro proyecto de implementación debemos comenzar a analizar que soluciones se adaptan a nuestras necesidades.

Un buen punto de partida para comenzar a analizar es consultar los análisis realizados por terceros sobre los productos englobados en una categoría dada.

En mi caso siempre tomo como referencia los informes de Gartner "Magic Cuadrant".
Estos informes tienen un costo para poder obtenerlos. Pero en general las empresas mejor rankeadas compran los informes y lo ponen a disposición en forma gratuita.

A continuación un ejemplo de un reporte sobre "Secure Web Gateway" (SWG) que incluye soluciónes de proxy, antispam e antivirus de email:
http://www.websense.com/assets/reports/report-gartner-magic-quadrant-for-security-web-gateway-2011-en.pdf

A continuación un ejemplo de un reporte sobre "Security Information and Incident Management" (SIEM) que permite gestionar los eventos de seguridad:
http://www.arcsight.com/collateral/whitepapers/Gartner_Magic_Quadrant_2011.pdf

Luego de estudiar las características de cada producto debemos pasar a testear las funcionalidades y en lo posible hacer una prueba dentro de nuestra infraestructura.

Desde ya que como todo proyecto involucra una inversión monetaria, por lo cual debemos justificar y "vender" el proyecto por lo que es necesario documentar todo el proceso de selección. Debemos dejar nota de los motivos por lo cuales elegimos una solución en vez del resto.
Debemos participar a todas las posibles áreas involucradas en la gestión, instalación y mantenimiento, así como los responsables por las áreas afectadas. Por ejemplo si vamos a implementar un proxy deberíamos participar del proyecto a todas las áreas que acceden a internet y se puedan ver afectadas por la solución. Estas áreas pueden tener necesidades que el producto pre-seleccionado no cumpla o que impida realizar alguna tarea crítica de la operatoria.

Realizando y dando un correcto seguimiento a estas actividades nos garantizamos una implementación exitosa.