5504 links
  • GuiGui's Show

  • Home
  • Login
  • RSS Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
page 1 / 1
  • Debug authentification SMTP

    On s'intéresse uniquement aux mécanismes d'authentification simples, c'est à dire sans fonctions de hachage ou autre comme CRAM-MD5.

    Pour la théorie, c'est par là : https://tools.ietf.org/html/rfc4616.

    « The mechanism consists of a single message, a string of [UTF-8]
       encoded [Unicode] characters, from the client to the server.  The
       client presents the authorization identity (identity to act as),
       followed by a NUL (U+0000) character, followed by the authentication
       identity (identity whose password will be used), followed by a NUL
       (U+0000) character, followed by the clear-text password.  As with
       other SASL mechanisms, the client does not provide an authorization
       identity when it wishes the server to derive an identity from the
       credentials and use that as the authorization identity.

    [...]

       message   = [authzid] UTF8NUL authcid UTF8NUL passwd
       authcid   = 1*SAFE ; MUST accept up to 255 octets
       authzid   = 1*SAFE ; MUST accept up to 255 octets
       passwd    = 1*SAFE ; MUST accept up to 255 octets
       UTF8NUL   = %x00 ; UTF-8 encoded NUL character

       SAFE      = UTF1 / UTF2 / UTF3 / UTF4
                   ;; any UTF-8 encoded Unicode character except NUL »

    Pour la pratique (avec telnet/netcat, as usual) :
    EHLO <hostname>
    AUTH PLAIN <$(echo -ne "<login>\x00<login>\x00<mdp>" | openssl base64)>
      OU
    AUTH PLAIN <$(echo -ne "\x00<login>\x00<mdp>" | openssl base64)>
    (car « As with other SASL mechanisms, the client does not provide an authorization identity when it wishes the server to derive an identity from the credentials and use that as the authorization identity. »)

    OU :

    EHLO <hostname>
    AUTH LOGIN <$(echo -n "<login>" | openssl base64)>
    334 - UGFzc3dvcmQ6  [NDLR : « Password: » ]
    <$(echo -n "<mdp>" | openssl base64)>

      OU
    EHLO <hostname>
    AUTH LOGIN
    334 - VXNlcm5hbWU6 [NDLR : « Username: » ]
    <$(echo -n "<login>" | openssl base64)>
    334 - UGFzc3dvcmQ6
    <$(echo -n "<mdp>" | openssl base64)>

    Les serveurs SMTP bien configurés/récents réclameront STARTTLS avant de permettre toute authentification. On peut avoir un équivalent telnet avec STARTTLS en utilisant openssl s_client -connect <host>:<port> -starttls smtp

    Attention toutefois : http://serverfault.com/questions/336617/postfix-tls-over-smtp-rcpt-to-prompts-renegotiation-then-554-5-5-1-error-no-v -> « Pressing "R" in an s_client session causes openssl to renegotiate. Try entering "rcpt to:" instead of "RCPT TO". ». Même chose si vous utilisez le mécanisme d'authentification AUTH LOGIN et que votre login/mdp encodé en base64 comporte un « R ». Oui, même si vous copiez-collez. ÉDIT du 13/02/2015 à14h10 : b4n a approfondi le sujet : http://ban.netlib.re/shaarli/?rvCWJA FIN DE L'ÉDIT.
    Fri 13 Mar 2015 04:27:54 AM CET - permalink -
    - http://shaarli.guiguishow.info/?QBpzwg
    nomarkdown
Links per page: 20 50 100
page 1 / 1
Mentions légales identiques à celles de mon blog | CC BY-SA 3.0

Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community