Archive for August 2010

Reading time: < 1 minute

En un .txt tenia unes notes que havia pres sobre entorns de programació, escencialment la conferència de la que són les notes parlava sobre PHP i diferents formens de fer el desplegament dels projectes. Aquesta informació l'he passat a una pàgina del wiki amb la idea d'anar-la actualitzant per altres llenguatges especialment amb la idea de afegir-hi notes de python.

Així doncs l'enllaç del wiki és a: Notes about programming environments and deployment. Tal com podeu deduir amb el títol les notes són amb anglès, sento no recordar la conferència per afegir-hi la presentació.

A continuació enganxo el contingut de la wiki de forma dinàmica, així quan actualitzi la wiki s’actualitzarà l’article:

Notes about programming environments and deployment

Environments:

  • Staging: test your deployment process/scripting (not your code)
    • no developers access, unless they are also sysadmins
    • very restricted outbound networking
    • mirrors production as best as possible
  • Pre-production (optional): test the code in prod env wo/impacting customers
    • test app w/prod setting wo/customer interaction
  • Production: real live environment
    • developers not have access (they can be tempted to fix something)
    • deployment should be done wo/developer input
    • very limited inbound traffic, generally only the service that being served

PHP

Deployment options:

  • rsync
  • source control
  • PEAR
  • os-based

Which should you use?

  • something simple: rsync
  • multiple dispare platforms: pear
  • internal w/minimal dev input: os-based (like. yum/apt)

References:

Tags: , , ,

Reading time: 2 – 4 minutes

Al sentir parlar de formats de video, codecs, DivX, MPEG4, etc. sovint surten a la conversa termes com ara els I-frame, P-frame i B-frame. Cansat de que em soni a xinès he decidit fer-me un petit resum de què és tot plegat, sempre des del punt de vista d’algú que en sap ben poc d’aquests temes.

Podem dividir els ‘frames’ de video en 3 tipus:

  • I-Frame: també anomenat keyframe. No té cap frame de referència i pot ser decodificat per si mateix. Podem pensar que és algo semblant a un JPEG.
  • P-Frame: El contingut del mateix és dedueix d’un frame previ de tipus I o P, és impossible decodificar-lo sense mirar aquesta referència.
  • B-Frame: per decodificar-los cal mirar els frames anteriors i següents de tipus I i P.

Aquest últim tipus de frames són interessant per dues raons:

  • Són fàcils de predir
  • No impacten en la qualitat dels frames següents

Degut a que els B-frames depenen del passat i el futur, llavors el decodificador li calen frames I-P del passat i el futur per poder decodificar el frame B. Això ens porta als conceptes PTS/DTS.

  • PTS Presentation Time Stamp: també podem entendre’l com una forma de saber el número de frame, ordre en que es poden veure els frames decodificats.
  • DTS Decoder Time Stamp: ordre en que es processen els frames per ser decodificats.

Un exemple, per entendre-ho millor:

  • Suposem que això és un petit video: I-0 B-1 B-2 P-3
  • L’ordre DTS seria: I-0 P-3 B-1 B-2

Per tal de simplificar les coses el video s’enmagatzema en l’ordre DTS.

El problema

Arribat en aquest punt podeu imaginar-vos el problema que suposa mostrar un video en ordre, ja que el decodificador ha d’anar composant els frames per mostrar-los am és d’inserir frames on no n’hi han per mostrar el frame que toca.

DIVX (i Xvid)

Aquests famosos codecs per tal de d’atacar aquest problema fan servir un petit truc. La idea seria usar una variant dels frames PB i empaqueten diversos frames en un. Això fa que les aplicacions es pensin que només hi ha un frame i el codec oculta la resta.

Per exemple, si tenim un fitxer que te empaquetat el següent:

In (0 3 1 2) - - - ...

el codec haurà de treure això:

Out 0 1 2 3 ...

El codec posa frames de tipus ‘null’ en el lloc on hi haurien d’haver els frames que no té pel fet de tenir-los empaquetats en un frame. Els codecs ja saben que quan reben un frame null han de descartar-los.

Des del punt de vista del codificador, és important fixar-nos que no s’introdueix un delay corresponent als frames nulls. En un fitxer AVI no hi ha cap relació entre el PTS/DTS guardada enlloc per tal d’informar al decoder quan aquest ha de reproduir.

Tags: , , , , ,

Reading time: < 1 minute

WebHook logo
Un WebHook és una HTTP callback, o sigui, un HTTP POST que es dona quan algo passa (un event); o sigui, que podem definir WebHook com a sistema de notificació d’events per HTTP POST.

El valor més important dels WebHooks és la possibilitat de poder rebre events quan aquest passen no a través dels ineficaços mecanismes de polling.

Si voleu més informació sobre aquest tema: WebHooks site.

Tags: , , , , , , , ,

Reading time: < 1 minute

Al meu wiki he començat a construir un glossari sobre seguretat, com sempre relacionat amb linux. Bàsicament són petits resums, sovint en anglès, sobre com funcionen certs protocols, mecanismes, estàndards, llibreries, software, etc.

L'enllaç original del contingut és: Gloassari de seguretat

A continuació incrusto de forma dinàmica la pàgina del wiki, perquè s’actualitzi l’article en temps real. Potser això no serà visible des de l’RSS, ho desconec. Per tant, aquesta pàgina estarà en construcció indefinidament, ja que l’usaré com a quadern de notes per aquests temes. De la definició de certs termes se’n poden derivar, podcasts, screencasts, articles, etc.

Glossari

  • Public-key cryptography is a cryptographic approach which involves the use of asymmetric key algorithms instead of or in addition to symmetric key algorithms.
  • Asymmetric key algorithms are used to create a mathematically related key pair: a secret private key and a published public key.
  • public key fingerprint: is a short sequence of bytes used to authenticate or look up a longer public key. Fingerprints are created by applying a cryptographic hash function to a public key. Since fingerprints are shorter than the keys they refer to, they can be used to simplify certain key management tasks.

Public-key cryptography, how it works: Wikipedia

  • Authenticity: we can create a digital signature of a message with private key and it can be validated with public key.
  • Confidentiality and Integrity: encrypt message using public key, only can be uncrypted with private key.
  • Creating pub and private key: An unpredictable (typically a large randomly chosen) number is used to begin generation of an acceptable pair of keys suitable for use by an asymmetric key algorithm.

  • Example of encryption:In an asymmetric key encryption scheme, anyone can encrypt messages using the public key, but only the holder of the paired private key can decrypt. Security depends on the secrecy of that private key.

  • Example of signature: In some related signature schemes, the private key is used to sign a message; but anyone can check the signature using the public key. Validity depends on private key security.

  • Diffie-Hellman fundamentals:In the Diffie–Hellman key exchange scheme, each party generates a public/private key pair and distributes the public key. After obtaining an authentic copy of each other's public keys, Alice and Bob can compute a shared secret offline. The shared secret can be used as the key for a symmetric cipher.

My own schemas:

  • encrypt a document: send a document encrypted using your private key but it can be decrypted with your public key, this is a guarantee for athenthicity, only you can do a document that can be decrypted with your public key



  • sign package: with private key can sign a package, then when anybody has package using the public key can verify that is a trust package


  • sign raw data: the process and result is the same, when sign a package


  • secure mail:
    • for sign and crypt a raw email, the procedure is create a hash signature of raw data, then signature is encrypted with private key finally raw data + signature are encrypted with public key of the recipient.
    • when recipient recieves secure mail, using private key decrypts de package and gets raw email + mail signature. Now recipient can read email but after decrypting signature with public key of sender obtains mail hash signature after validating the signature recipient knows authenticity of mail.


  • ssl_basics and diffie hellman: using priv key #1 and pub key #2 can get a key, and using priv key #2 and pub key #1 can get the same key. This shared key is not exchanged over the network and only user #1 and #2 can get it, then they use the key for a symetric cypher mechanism because it needs less resources than use pub-key mechanisms to encrypt packets. Cypher mechanisms used by SSL typecaly are: AES, DES, 3DES, Blowfish, RC4, etc.


  • PKI:
  • PGP uses web of trust instead of PKI
  • SSL v2 and v3. The Secure Sockets Layer (SSL) protocol allows mutual authentication between a client and server and the establishment of an authenticated and encrypted connection.
  • TLS v1 (RFC 2246). The Transport Layer Security (TLS) protocol from the IETF will eventually supersede SSL while remaining backward-compatible with SSL implementations.
  • PKCS #1. RSA standard that governs implementation of public-key cryptography based on the RSA algorithm.
  • PKCS #3. RSA standard that governs implementation of Diffie-Hellman key agreement.
  • PKCS #5. RSA standard that governs password-based cryptography, for example to encrypt private keys for storage.
  • PKCS #7. RSA standard that governs the application of cryptography to data, for example digital signatures and digital envelopes.
  • PKCS #8. RSA standard that governs the storage and encryption of private keys.
  • PKCS #9. RSA standard that governs selected attribute types, including those used with PKCS #7, PKCS #8, and PKCS #10.
  • PKCS #10. RSA standard that governs the syntax for certificate requests.
  • PKCS #11. RSA standard that governs communication with cryptographic tokens (such as hardware accelerators and smart cards) and permits application independence from specific algorithms and implementations.
  • PKCS #12. RSA standard that governs the format used to store or transport private keys, certificates, and other secret material.
  • S/MIME (RFC 2311 and RFC 2633). IETF message specification (based on the popular Internet MIME standard) that provides a consistent way to send and receive signed and encrypted MIME data.
  • X.509 v3. ITU standard that governs the format of certificates used for authentication in public-key cryptography.
  • OCSP (RFC 2560). The Online Certificate Status Protocol (OCSP) governs real-time confirmation of certificate validity.
  • PKIX Certificate and CRL Profile (RFC 3280). The first part of the four-part standard under development by the Public-Key Infrastructure (X.509) working group of the IETF (known at PKIX) for a public-key infrastructure for the Internet.
  • RSA, DSA, ECDSA, Diffie-Hellman, EC Diffie-Hellman, AES, Triple DES, DES, RC2, RC4, SHA-1, SHA-256, SHA-384, SHA-512, MD2, MD5, HMAC: Common cryptographic algorithms used in public-key and symmetric-key cryptography.
  • FIPS 186-2 pseudorandom number generator.
  • SPNEGO (Simple and Protected GSSAPI Negotiation Mechanism) – is a GSSAPI “pseudo mechanism” that is used to negotiate one of a number of possible real mechanisms.
    • SPNEGO is used when a client application wants to authenticate to a remote server, but neither end is sure what authentication protocols the other supports.
    • The pseudo-mechanism uses a protocol to determine what common GSSAPI mechanisms are available, selects one and then dispatches all further security operations to it. This can help organizations deploy new security mechanisms in a phased manner.
    • SPNEGO's most visible use is in Microsoft's “HTTP Negotiate” authentication extension. It was first implemented in Internet Explorer 5.01 and IIS 5.0 and provided single sign-on capability later marketed as Integrated Windows Authentication. The negotiable sub-mechanisms included NTLM and Kerberos, both used in Active Directory.
    • RFC 4178
  • SASL (Simple Authentication and Security Layer) is a framework for authentication and data security in Internet protocols. It decouples authentication mechanisms from application protocols, in theory allowing any authentication mechanism supported by SASL to be used in any application protocol that uses SASL.
    • Authentication mechanisms can also support proxy authorization, a facility allowing one user to assume the identity of another.
    • They can also provide a data security layer offering data integrity and data confidentiality services.
    • DIGEST-MD5 provides an example of mechanisms which can provide a data-security layer.
    • Application protocols that support SASL typically also support Transport Layer Security (TLS) to complement the services offered by SASL.
    • SASL mechanisms
      • “EXTERNAL”, where authentication is implicit in the context (e.g., for protocols already using IPsec or TLS)
      • “ANONYMOUS”, for unauthenticated guest access
      • “PLAIN”, a simple cleartext password mechanism. PLAIN obsoleted the LOGIN mechanism.
      • OTP”, a one-time password mechanism. OTP obsoleted the SKEY Mechanism.
      • “SKEY”, an S/KEY mechanism.
      • “CRAM-MD5”, a simple challenge-response scheme based on HMAC-MD5.
      • “DIGEST-MD5”, HTTP Digest compatible challenge-response scheme based upon MD5. DIGEST-MD5 offers a data security layer.
      • “NTLM”, an NT LAN Manager authentication mechanism
      • “GSSAPI”, for Kerberos V5 authentication via the GSSAPI. GSSAPI offers a data-security layer.
      • GateKeeper (& GateKeeperPassport), a challenge-response mechanism developed by Microsoft for MSN Chat
  • PAM (Pluggable Authentication Modules) – can use kerberos but not support SSO
  • SSH uses PAM, if we want to use SSO with kerberos needs a GSSAPI patch
  • SSSD (System Security Services Daemon ) – It's primary function is to provide access to identity and authentication remote resource through a common framework that can provide caching and offline support to the system.
    • NSS interface
    • PAM interface
    • Offline credentials
    • DBUS service called InfoPIPE
  • RADIUS = AAAA (Autenticación, Autorización, Accounting y Auditing)

Software and libraries for pub-key infraestructure:

  • NSS – Network Security Services (NSS) is a set of libraries designed to support cross-platform development of security-enabled client and server applications. Applications built with NSS can support SSL v2 and v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME, X.509 v3 certificates, and other security standards. For detailed information on standards supported, see Overview of NSS.
  • GSSAPI or GSS-API (Generic Security Services Application) – applications programming interface for programs to access security services. IETF standard.
    • The definitive feature of GSSAPI applications is the exchange of opaque messages (tokens) that hide the implementation detail from the higher level application.
    • The client and server sides of the application are written to convey the tokens given to them by their respective GSSAPI implementations.
    • GSSAPI tokens can usually be sent over an insecure network as the mechanisms provide inherent message security. After some number of tokens have been exchanged, the GSSAPI implementations at both ends inform their local application that a security context has been established.
    • Typical protections guaranteed by GSSAPI are confidentiality and integrity. It's important to mention that authorization is not offered by GSSAPI.
    • In the API there about 45 procedure calls.
    • The GSSAPI allows Kerberos implementations to be API compatible.
    • GSSAPI support SPENGO it's a pseudo mechanism to negotiate new security mechanisms.
    • Known mechanisms: Kerberos, NTLM, DCE, SESAME, SPKM, LIPKEY.
  • WebAuth: Kerberos a Apache – http://webauth.stanford.edu/

Greatings

Wikipedia is the most important font of this gloassary. Thanks to everyone who makes it possible.

Tags: , ,

Reading time: 3 – 5 minutes

Dijous passat aterrarem a Barcelona després del viatge que hem fet per Costa Rica, així doncs, malgrat ja fa uns dies que treballo he pogut pujar les fotografies del viatge a l’àlbum de fotografies. Com sempre el teniu a:

Les fotografies estan protegies amb password que com sempre els que em coneixeu el sabreu en un moment i els que no, envieu-me un email i ús l’enviaré. Aprofito per recordar que el tinc protegit perquè hi ha algunes fotos que a vegades no és bo que estiguin a l’abast de tothom.

Pel que fa a la web del viatge malgrat ja l’he començat a fer encara li queda força feina per estar acabada, tan aviat com ho tingui ja avisaré. Pels que no voleu entrar a l’àlbum de fotografies i mentre la web no esta acabada podeu anar fent boca amb aquestes quatre notes i imatges que ús deixo a continuació.

Platja privada del parc natural de Manuel Antonio:

Costa Rica > P.N. Manuel Antonio

“Conopy Extrem” a Monteverde:

Costa Rica > Monteverde > Conopy Extrem

Volcà Arenal, foto feta des de l’hotel “Linda Vista del Norte”:

Costa Rica > Arenal > Volcà

Termes “Baldi” a La Fortuna (Arenal) on ens trobarem amb el Joan i la Patri: (esq-drt: Glòria, Torsten, Patri, Joan, Estefania i Oriol)

Costa Rica > Arenal > Termes Baldi

Posta de sol des del jardí de l’hotel Miss Junie a Tortuguero:

Costa Rica > Tortuguero

Caimà dels canals de Tortuguero:

Costa Rica > Tortuguero

Tour en canoa pels canals de Tortuguero amb el senyor Billy, un caçador de jaguars de Nicaragua que amb 84 anys tenia més força per remar que tots quatre junts:

Costa Rica > Tortuguero

Piscines naturals a les platges de Puerto Viejo, on visitarem al Josep Maria i la Carme:

Costa Rica > Puerto Viejo de Talamanca

Esmorzant a la ‘terrassa’ de l’apartament del Josep Maria i la Carme a Puerto Viejo:

Costa Rica > Puerto Viejo de Talamanca

Cocodril d’uns 2’5m que teniem a tocar al dinar del tour del cacao que ens va fer el Sr.Felipe prop de Hone Creek (zona sur Carib de Costa Rica):

Costa Rica > Hone Creek

Dinar al tour del cacao amb la Glòria i el Torsten els nostres companys de viatge:

Costa Rica > Hone Creek

Si en voleu més, ja ho sabeu: album de fotos > viatges > Costa Rica

Tags: , , , , , ,