lunes, 5 de mayo de 2014

Seguridad informática

OpenPGP
The GNU Privacy Guard
Transport Layer Security - Wikipedia, the free encyclopedia
OpenSSL: The Open Source toolkit for SSL/TLS
Gentoo Forums :: View topic - openssl vs gnupg in initrd for encrypting LUKS-keyfile
OpenPGP "añade un poco de sal" al rededor del mensaje en claro en el proceso de encriptación. Si lo que estoy encriptando es un mensaje expresado en lenguajes naturales (inglés, español, símbolos matemáticos, etc.), esta "sal agregada" contribuye a la dificultad de someter el mensaje encriptado a análisis estadísticos. En cambio, si lo que estoy encriptando es un código generado por un random-number-generator, como ser la key de una partición LUKS, no añade valor criptográficamente hablando.
encryption - Are private keys generated by different software packages compatible? - Information Security Stack Exchange
RSA (cryptosystem) - Wikipedia, the free encyclopedia
Uso de un criptosistema para la encriptación / desencriptación de documentos:
A public and private key each have a specific role when encrypting and decrypting documents. A public key may
be thought of as an open safe. When a correspondent encrypts a document using a public key, that document is
put in the safe, the safe shut, and the combination lock spun several times. The corresponding private key is the
combination that can reopen the safe and retrieve the document. In other words, only the person who holds the
private key can recover a document encrypted using the associated public key.
Open safe
Uso de un criptosistema para la firma / verificación de documentos:

Creating and verifying signatures uses the public/private keypair in an operation different from encryption and decryption. A signature is created using the private key of the signer. The signature is verified using the corresponding public key.

Signature



Moving/Copying your PGP Keys

Encriptar una Partición:
Comparación de técnicas: Encrypting an entire system (ver la tabla comparativa en "Overview").
Otra técnica: En lugar de encriptar la partición entera, encripta a nivel de archivo individual encfs
Paso a paso: How To Migrate to a full encrypted LVM system

Bases de datos de contraseñas en Debian:
pwsafe es un administrador de contraseñas por línea de comandos.
A partir de Wheezy, no existe más el package pwsafe en el repositorio oficial. Repositorio alternativo. Aplicación alternativa: KeePass2.
Referencias:
http://blog.steve.org.uk/a_mixed_week_with_minor_tweaks.html
http://forums.debian.net/viewtopic.php?f=10&t=105015



Temas relacionados en este Blog: Seguridad informática en Java

sábado, 5 de abril de 2014

Creación de sitios web con Drupal

Sitios multi idioma:
- El orden en que se crean los contenidos multi idioma no afecta al funcionamiento correcto de multi idioma. Es decir, se puede crear primero en inglés o bien en otro idioma.
- Si el idioma L1 no tiene path prefijo (1) (ej. sin prefijo: inglés -> misitio.com ; ej. con prefijo: castellano -> misitio.com/es) Cuando el idioma detectado (2) no es L1, no se puede pasar a L1 a través del bloque idiomas (3).
(1) Configuration › Regional and language > Languages (misitio.com/admin/config/regional)
(2) Configuration > Regional and Language > Languages > Language Detection and Selection,  
(3) Structure > Blocks > Language switcher (User interface text)
Ejemplo 1:
El sitio web tiene contenido de la home page en idiomas L1 (misitio.com) y en L2 (misitio.com/l2)
El usuario entra a la home: misitio.com
La detección del idioma del usuario es: L1
Se puede cambiar de L1 a L2 y vice versa
Ejemplo 2:
El sitio web tiene contenido de la home page en idiomas L1 (misitio.com/l1) y en L2(misitio.com/l2)
Otro usuario entra a la página home: misitio.com
La detección del idioma de este usuario es: L2
La página se muestra en L2
El link a la versión en L1 en el bloque de idiomas apunta a la URL en L1 de la home (misitio.com), pero al ir ahí, el contenido se presenta siempre en L2.
Solución de compromiso: setear path prefijo a todos los idiomas, incluso inglés.

Referencias externas:
HowTo: Different home page (default front page) for each language
multilingual front pages (Lo mismo que el de arriba para Drupal 6.x)
Front page redirect

Module Redirect
Module globalredirect (mergeado en Redirect, se puede usar en forma separada)
Drupal 7's new multilingual systems (part 8) - Menu languages and translation

Module Pathologic (Cuando se mueve un sitio Drupal de carpeta raíz, y preservar los links sanos)
Está implementado como un Input Filter. Dado que los Input Filter están pensados para filtrar el contenido que ingresa el usuario (page, story, article), hay que ver si está contemplado el arreglo de links en un contenido que ya está guardado, al momento de servirlo (cuando el usuario lo accede / le hace un hit).
Module Pathauto
Genera path alias para los contenidos (story, article, page), a partir de sus atributos (título, fecha de creación, usuario del post) basado en un patrón de generación.

Síntoma: "warning safe restriction in effect the process whose uid is... cannot write to directory owned by..."
Problema: Unas pocas releases de PHP permitían el uso de una directiva "safe mode" para manejar temas de seguridad sobre el filesystem. El directorio de upload de IMCE en gral. no tiene problemas, pero el de upload de imágenes e íconos de los themes sí.
Solución: sacar "safe mode" por medio de php.ini, si bien en un host alquilado es probable que no se permita. Otra solución es apuntar el directorio temporal de uploads (la causa más común) a uno creado por nosotros, en Configuration > Media > Filesystem


Galerías de imágenes
https://www.drupal.org/project/content_menu
https://www.drupal.org/project/cck
https://www.drupal.org/project/cck_blocks
https://www.drupal.org/project/views
https://www.drupal.org/project/fbg
https://www.drupal.org/project/media_gallery
https://www.drupal.org/node/2152441
https://www.drupal.org/project/views_slideshow
http://megadrupal.com/blog/creating-an-image-gallery-in-drupal-7
https://www.drupal.org/project/node_gallery
https://www.drupal.org/project/facebook_album_fetcher
https://www.drupal.org/project/fbphoto
https://www.drupal.org/project/brilliant_gallery
https://www.drupal.org/project/fast_gallery
https://www.drupal.org/project/photos y https://www.drupal.org/node/2205931
http://jamestombs.co.uk/2011-05-26/create-album-based-image-gallery-drupal-7-using-fields-and-views
http://www.jacklmoore.com/colorbox/example2/
http://drupal.stackexchange.com/questions/1435/what-are-the-photo-gallery-album-module-choices-for-drupal-7

Diseño de Sitios web WYSIWYG sin Drupal (free software)

http://www.wysiwygwebbuilder.com/cms_tools.html
http://gpeasy.com/True_WYSIWYG
http://respondcms.com/
http://www.webgui.org/wiki/wysiwyg-editor-options
http://www.cmswire.com/cms/web-cms/goodbye-wysiwyg-for-web-content-management-systems-023207.php
http://www.wymeditor.org/

jueves, 3 de abril de 2014

Configuración de dominio personalizado para Blogger a través de NIC.ar y CDMon

Configuración de dominio personalizado para Blogger a través de NIC.ar y CDMon.

En NIC.ar

Dominios


Dominio
midominio.com.ar



Delegaciones


Host
IPv4
ns1.cdmon.net
ns2.cdmon.net
ns3.cdmon.net


En CDMon
Ejemplo de configuración 1: midominio.com.ar

En esta página puede configurar los registros DNS de su domino midominio.com.ar.

Listado registros DNS


Seleccionar
Acciones
Registros A Añadir Mostrar/ocultar registros
Subdominio Destino Acciones
@ 46.16.56.42 (Redirecciones web)
Registros CNAME Añadir Mostrar/ocultar registros
Subdominio Destino Acciones
* midominio.com.ar

Ejemplo de configuración 2: midominio2.com.ar

En esta página puede configurar los registros DNS de su domino midominio2.com.ar.


Listado registros DNS

Seleccionar
Acciones
Registros A Añadir Mostrar/ocultar registros
Subdominio Destino Acciones
www 46.16.56.41 (Redirecciones web)
Registros CNAME Añadir Mostrar/ocultar registros
Subdominio Destino Acciones
@ ghs.google.com
* midominio2.com.ar

En Blogger

 Publicación


Tutoriales:

miércoles, 12 de marzo de 2014

user-list.pl - programa en Perl para leer un formato determinado y crear una lista de usuarios

use strict;
use feature "switch";
open my $outfh, '>:encoding(utf8)', 'user-list.txt';
my %NOT_COLLECTED;
my @UNCLASSIFIED_FILE;
sub print_not_collected {
  print $outfh "-----------------------------------------\n";
  for (keys %NOT_COLLECTED) {
    print $outfh $_ . ' ' . join(' ', keys %{+{map +($_ => undef), @{$NOT_COLLECTED{$_}}}}) . "\n";
  }
  print $outfh "-----------------------------------------\n";
  print $outfh join "\n", @UNCLASSIFIED_FILE;
  close($outfh);
  exit(0);
}

use sigtrap 'handler' => \&print_not_collected, qw(INT QUIT);

my @tmp_PIV;
while(<user-pivot-*.txt>) {
  my ($class) = /\d+/g;
  open my $ph, "<:encoding(utf8)", $_;
  push @tmp_PIV, \%{+{map {/(.*)/; $1=>$class} grep /.+/, <$ph>}};
}
my %DUP;
for my $i (0..$#tmp_PIV-1) {
  for my $j ($i+1..$#tmp_PIV) {
    for (keys %{$tmp_PIV[$i]}) {
      $DUP{$_}{$tmp_PIV[$i]{$_}} = $tmp_PIV[$j]{$_} if exists $tmp_PIV[$j]{$_};
    }
  }
}
for my $name (keys %DUP) {
    for my $i (keys %{$DUP{$name}}) {
        print "$name $i ${DUP{$name}{$i}}\n";
    }
}
die "Duplicated class entries." unless (keys %DUP)==0;
my %PIV_EQ_CLASS;
for (@tmp_PIV) {
  %PIV_EQ_CLASS = (%PIV_EQ_CLASS, %{$_});
}
my %NOT_PIV;
open my $nph, "<:encoding(utf8)", "user-not-pivot.txt";
%NOT_PIV = %{+{map {/(.*)/; $1=>0} grep /.+/, <$nph>}};
$NOT_PIV{''} = 0;   # we don't want to consider blank pivots
my @tmp = grep exists($NOT_PIV{$_}), keys %PIV_EQ_CLASS;
die 'Ambiguity pivot not pivot: ' . join "\n", @tmp unless @tmp==0;
local $/ = undef;
while(glob "HTML/**") {
  print "$_\n";
  open my $fh, "<:encoding(utf8)", $_;
  my $fname = $_;
  my $text = <$fh>;
  $text =~ /<!-- Parsed text .*-->\n/g;
  my @tmp = $text =~ /<!-- .* -->/g;
  my $text2 = join '', map {; s/<!-- //; s/ -->//; $_; } @tmp;
  $text2 =~ s/- ( *)(?=-)/-$1/g;
  my @FILE_CLASS;
  for ($text2 =~ /FriendlyName="(.*?)"/g) {
    push @FILE_CLASS, $PIV_EQ_CLASS{$_} if exists $PIV_EQ_CLASS{$_};
    push @{$NOT_COLLECTED{$_}}, $fname if not exists $PIV_EQ_CLASS{$_} and not exists $NOT_PIV{$_};
  }
  print $outfh $fname . ' ' . join(' ', keys %{+{map +($_ => undef), @FILE_CLASS}}) . "\n" unless @FILE_CLASS==0;
  push @UNCLASSIFIED_FILE, $fname if @FILE_CLASS==0;
}

print_not_collected;

lunes, 10 de marzo de 2014

DB2 - Consultas de metadatos - Consultas recursivas



DB2 – consulta de metadatos

Catalog Schema: Doc original / standard name: syscat à DB2 alias: ibm

triggers
select text from sysibm.sysTRIGGERS where tbname

secuencias
select * from sysibm.syssequences where owner

stored procedure / function
select * from SYSIBM.sysroutines where owner

PK, unique constraint, FK,
select * from SYSIBM.syskeycoluse where constname
select * from SYSIBM.SYSRELS where RELNAME
select * from SYSIBM.SYSFOREIGNKEYS where relname

tables
FROM SYSIBM.SYSTABLES 
FROM SYSIBM.SYSCOLUMNS where tbname and tbcreator

Dummy
sysibm.sysdummy1

Consultas recursivas en DB2 (jerarquía jerárquicas hierarchy hierarchial recursive)

/************************************************************************/
/************************************************************************/
/******************* COMPARE THE FOLLOWING 2 QUERIES  *******************/
/************************************************************************/
/************************************************************************/
-- TOP-DOWN
with MY_HIERARCHY (MY_NODE, MY_PARENTNODE) as (
      -- non-recursive exit
      select ROOT.MY_NODE, ROOT.MY_PARENTNODE
      from THETABLE ROOT where MY_NODE='value'   -- the root node in the tree

      union all
      -- recursive loop (it needs the non-recursive part in order not to be an empty set)
      select CHILD.MY_NODE, CHILD.MY_PARENTNODE
      from MY_HIERARCHY PARENT, THETABLE CHILD
      where CHILD.MY_PARENTNODE = PARENT.MY_NODE   -- top-down join

)
select * from MY_HIERARCHY


-- BOTTOM-UP
with MY_HIERARCHY (MY_NODE, MY_PARENTNODE) as (
      -- non-recursive exit
      select LEAF.MY_NODE, LEAF.MY_PARENTNODE
      from THETABLE LEAF where MY_NODE='value'   -- the leaf node in the tree

      union all
      -- recursive loop (it needs the non-recursive part in order not to be an empty set)
      select CHILD.MY_NODE, CHILD.MY_PARENTNODE
      from MY_HIERARCHY PARENT, THETABLE CHILD
      where CHILD.MY_NODE = PARENT.MY_PARENTNODE   -- bottom-up join

)
select * from MY_HIERARCHY