L'uso di questo sito
autorizza anche l'uso dei cookie
necessari al suo funzionamento.
(Altre informazioni)

Wednesday, June 11, 2014

Demoiselle d'Ys

"Il Re in Giallo" è una raccolta di racconti, ''soprannaturali'' scritti  da Robert Chambers. Chambers, almeno in Italia, è poco conosciuto. Anche negli USA, è soprattutto ricordato per le influenze che ha avuto su altri, specialmente su H.P.Lovecraft e per essere stato di recente evocato dalla stupenda serie di telefilm "True Detective". Chambers era stato a sua volta influenzato, nello scrivere "Il Re in Giallo", da un racconto di Ambrose Bierce, ("An Inhabitant of Carcosa") a cui si ispira la poesia che introduce la raccolta: 

"Along the shore the cloud waves break,
The twin suns sink behind the lake,
The shadows lengthen
In Carcosa.
Strange is the night where black stars rise,
And strange moons circle through the skies,
But stranger still is
Lost Carcosa.
Songs that the Hyades shall sing,
Where flap the tatters of the King,
Must die unheard in
Dim Carcosa.
Song of my soul, my voice is dead,
Die thou, unsung, as tears unshed
Shall dry and die in
Lost Carcosa."

La raccolta è graziosa, ma non varrebbe, in fondo, la pena di una recensione: scritta nel solco che sta tra Edgar Allan Poe e Lovecraft, non eguaglia il primo ed è superato dal secondo (che precedette). Però contiene la notevole poesia che ho già riportato e, in uno dei racconti, descrive questo incontro, con una prosa e con  immagini che io ho trovato affascinanti. Lo riporto in lingua originale, riservandomi di  tradurlo quando avrò tempo.

Antefatto: il protagonista intraprende da solo una partita di caccia su una remota isola al largo della costa della Bretagna, e si smarrisce.

Now I knew that I had lost myself, as I sat there smoking, with the sea-wind blowing in my face. On every side stretched the moorland, covered with flowering gorse and heath and granite boulders. There was not a tree in sight, much less a house. After a while, I picked up the gun, and turning my back on the sun tramped on again.
There was little use in following any of the brawling streams which every now and then crossed my path, for, instead of flowing into the sea, they ran inland to reedy pools in the hollows of the moors. I had followed several, but they all led me to swamps or silent little ponds from which the snipe rose peeping and wheeled away in an ecstasy of fright. I began to feel fatigued, and the gun galled my shoulder in spite of the double pads. The sun sank lower and lower, shining level across yellow gorse and the moorland pools.
As I walked my own gigantic shadow led me on, seeming to lengthen at every step. The gorse scraped against my leggings, crackled beneath my feet, showering the brown earth with blossoms, and the brake bowed and billowed along my path. From tufts of heath rabbits scurried away through the bracken, and among the swamp grass I heard the wild duck's drowsy quack. Once a fox stole across my path, and again, as I stooped to drink at a hurrying rill, a heron flapped heavily from the reeds beside me. I turned to look at the sun. It seemed to touch the edges of the plain. When at last I decided that it was useless to go on, and that I must make up my mind to spend at least one night on the moors, I threw myself down thoroughly fagged out. The evening sunlight slanted warm across my body, but the sea-winds began to rise, and I felt a chill strike through me from my wet shooting-boots. High overhead gulls were wheeling and tossing like bits of white paper; from some distant marsh a solitary curlew called. Little by little the sun sank into the plain, and the zenith flushed with the after-glow. I watched the sky change from palest gold to pink and then to smoldering fire. Clouds of midges danced above me, and high in the calm air a bat dipped and soared. My eyelids began to droop. Then as I shook off the drowsiness a sudden crash among the bracken roused me. I raised my eyes. A great bird hung quivering in the air above my face. For an instant I stared, incapable of motion; then something leaped past me in the ferns and the bird rose, wheeled, and pitched headlong into the brake.
I was on my feet in an instant peering through the gorse. There came the sound of a struggle from a bunch of heather close by, and then all was quiet. I stepped forward, my gun poised, but when I came to the heather the gun fell under my arm again, and I stood motionless in silent astonishment. A dead hare lay on the ground, and on the hare stood a magnificent falcon, one talon buried in the creature's neck, the other planted firmly on its limp flank. But what astonished me, was not the mere sight of a falcon sitting upon its prey. I had seen that more than once. It was that the falcon was fitted with a sort of leash about both talons, and from the leash hung a round bit of metal like a sleigh-bell. The bird turned its fierce yellow eyes on me, and then stooped and struck its curved beak into the quarry. At the same instant hurried steps sounded among the heather, and a girl sprang into the covert in front. Without a glance at me she walked up to the falcon, and passing her gloved hand under its breast, raised it from the quarry. Then she deftly slipped a small hood over the bird's head, and holding it out on her gauntlet, stooped and picked up the hare.
She passed a cord about the animal's legs and fastened the end of the thong to her girdle. Then she started to retrace her steps through the covert. As she passed me I raised my cap and she acknowledged my presence with a scarcely perceptible inclination. I had been so astonished, so lost in admiration of the scene before my eyes, that it had not occurred to me that here was my salvation. But as she moved away I recollected that unless I wanted to sleep on a windy moor that night I had better recover my speech without delay. At my first word she hesitated, and as I stepped before her I thought a look of fear came into her beautiful eyes. But as I humbly explained my unpleasant plight, her face flushed and she looked at me in wonder.
"Surely you did not come from Kerselec!" she repeated.
Her sweet voice had no trace of the Breton accent nor of any accent which I knew, and yet there was something in it I seemed to have heard before, something quaint and indefinable, like the theme of an old song.
I explained that I was an American, unacquainted with Finistère, shooting there for my own amusement.
"An American," she repeated in the same quaint musical tones. "I have never before seen an American."
For a moment she stood silent, then looking at me she said. "If you should walk all night you could not reach Kerselec now, even if you had a guide."
This was pleasant news.
"But," I began, "if I could only find a peasant's hut where I might get something to eat, and shelter."
The falcon on her wrist fluttered and shook its head. The girl smoothed its glossy back and glanced at me.
"Look around," she said gently. "Can you see the end of these moors? Look, north, south, east, west. Can you see anything but moorland and bracken?"
"No," I said.
"The moor is wild and desolate. It is easy to enter, but sometimes they who enter never leave it. There are no peasants' huts here."
"Well," I said, "if you will tell me in which direction Kerselec lies, to-morrow it will take me no longer to go back than it has to come."
She looked at me again with an expression almost like pity.
"Ah," she said, "to come is easy and takes hours; to go is different—and may take centuries."
I stared at her in amazement but decided that I had misunderstood her. Then before I had time to speak she drew a whistle from her belt and sounded it.
"Sit down and rest," she said to me; "you have come a long distance and are tired."
She gathered up her pleated skirts and motioning me to follow picked her dainty way through the gorse to a flat rock among the ferns.
"They will be here directly," she said, and taking a seat at one end of the rock invited me to sit down on the other edge. The after-glow was beginning to fade in the sky and a single star twinkled faintly through the rosy haze. A long wavering triangle of water-fowl drifted southward over our heads, and from the swamps around plover were calling.
"They are very beautiful—these moors," she said quietly.
"Beautiful, but cruel to strangers," I answered.
"Beautiful and cruel," she repeated dreamily, "beautiful and cruel."
"Like a woman," I said stupidly.
"Oh," she cried with a little catch in her breath, and looked at me. Her dark eyes met mine, and I thought she seemed angry or frightened.
"Like a woman," she repeated under her breath, "How cruel to say so!" Then after a pause, as though speaking aloud to herself, "How cruel for him to say that!"
I don't know what sort of an apology I offered for my inane, though harmless speech, but I know that she seemed so troubled about it that I began to think I had said something very dreadful without knowing it, and remembered with horror the pitfalls and snares which the French language sets for foreigners. While I was trying to imagine what I might have said, a sound of voices came across the moor, and the girl rose to her feet.
"No," she said, with a trace of a smile on her pale face, "I will not accept your apologies, monsieur, but I must prove you wrong, and that shall be my revenge. Look. Here come Hastur and Raoul."
Two men loomed up in the twilight. One had a sack across his shoulders and the other carried a hoop before him as a waiter carries a tray. The hoop was fastened with straps to his shoulders, and around the edge of the circlet sat three hooded falcons fitted with tinkling bells. The girl stepped up to the falconer, and with a quick turn of her wrist transferred her falcon to the hoop, where it quickly sidled off and nestled among its mates, who shook their hooded heads and ruffled their feathers till the belled jesses tinkled again. The other man stepped forward and bowing respectfully took up the hare and dropped it into the game-sack.
"These are my piqueurs," said the girl, turning to me with a gentle dignity. "Raoul is a good fauconnier, and I shall some day make him grand veneur. Hastur is incomparable."
The two silent men saluted me respectfully.
"Did I not tell you, monsieur, that I should prove you wrong?" she continued. "This, then, is my revenge, that you do me the courtesy of accepting food and shelter at my own house."
Before I could answer she spoke to the falconers, who started instantly across the heath, and with a gracious gesture to me she followed. I don't know whether I made her understand how profoundly grateful I felt, but she seemed pleased to listen, as we walked over the dewy heather.
"Are you not very tired?" she asked.
I had clean forgotten my fatigue in her presence, and I told her so.
"Don't you think your gallantry is a little old-fashioned?" she said; and when I looked confused and humbled, she added quietly, "Oh, I like it, I like everything old-fashioned, and it is delightful to hear you say such pretty things."
The moorland around us was very still now under its ghostly sheet of mist. The plovers had ceased their calling; the crickets and all the little creatures of the fields were silent as we passed, yet it seemed to me as if I could hear them beginning again far behind us. Well in advance, the two tall falconers strode across the heather, and the faint jingling of the hawks' bells came to our ears in distant murmuring chimes.
Suddenly a splendid hound dashed out of the mist in front, followed by another and another until half-a-dozen or more were bounding and leaping around the girl beside me. She caressed and quieted them with her gloved hand, speaking to them in quaint terms which I remembered to have seen in old French manuscripts.
Then the falcons on the circlet borne by the falconer ahead began to beat their wings and scream, and from somewhere out of sight the notes of a hunting-horn floated across the moor. The hounds sprang away before us and vanished in the twilight, the falcons flapped and squealed upon their perch, and the girl, taking up the song of the horn, began to hum. Clear and mellow her voice sounded in the night air.
"Chasseur, chasseur, chassez encore,
Quittez Rosette et Jeanneton,
Tonton, tonton, tontaine, tonton,
Ou, pour, rabattre, dès l'aurore,
Que les Amours soient de planton,
Tonton, tontaine, tonton."
As I listened to her lovely voice a grey mass which rapidly grew more distinct loomed up in front, and the horn rang out joyously through the tumult of the hounds and falcons. A torch glimmered at a gate, a light streamed through an opening door, and we stepped upon a wooden bridge which trembled under our feet and rose creaking and straining behind us as we passed over the moat and into a small stone court, walled on every side. From an open doorway a man came and, bending in salutation, presented a cup to the girl beside me. She took the cup and touched it with her lips, then lowering it turned to me and said in a low voice, "I bid you welcome."
At that moment one of the falconers came with another cup, but before handing it to me, presented it to the girl, who tasted it. The falconer made a gesture to receive it, but she hesitated a moment, and then, stepping forward, offered me the cup with her own hands. I felt this to be an act of extraordinary graciousness, but hardly knew what was expected of me, and did not raise it to my lips at once. The girl flushed crimson. I saw that I must act quickly.
"Mademoiselle," I faltered, "a stranger whom you have saved from dangers he may never realize empties this cup to the gentlest and loveliest hostess of France."
"In His name," she murmured, crossing herself as I drained the cup. Then stepping into the doorway she turned to me with a pretty gesture and, taking my hand in hers, led me into the house, saying again and again: "You are very welcome, indeed you are welcome to the Château d'Ys."

Il racconto poi prosegue e diventa una storia di genere, ma senza tornare a raggiungere le suggestioni di questo momento sospeso nella sera di una immaginaria isola Bretone.

Monday, June 9, 2014

Inventi

E t'inventi che il mondo è un'altra cosa. Magari t'inventi che la competizione non esiste e che l'importante è davvero solo partecipare. Poi te lo dici sottovoce, e poi  lo ripeti ad alta voce a te stesso, e lo racconti a tutti quelli che ti vogliono stare ad ascoltare e che (forse) pensano che tu abbia capito qualcosa che, perbacco, nessun altro c'aveva mai pensato prima. E se sei davvero (ma davvero) convincente, riesci a non sentirti neanche tanto a disagio quando guardi fuori dalla finestra. Ma se qualcuno ti aveva creduto? Va beh dai, alla prossima invenzione.

"
Close your eyes
For your eyes will only tell the truth
And the truth isn't what you want to see
In the dark it is easy to pretend
That the truth is what it ought to be
"
The Phantom of the Opera


Tuesday, June 3, 2014

Fattoide culturale(?)

Il grafico degli aritcoli di (en) wikipedia categorizzati come "Romanzi pubblicati nell'anno xxx". In ascissa c'è l'anno xxx, ovviamente - dal 1814 al 2013. Cosa rivela? Dal mero punto di vista qualitativo, non tanto, è una curva con andamento vagamente esponenziale, come uno si aspetterebbe. Se si prende come statistica seria, niente; fra l'altro ha anche delle stranezze - dal 2006 ad oggi i numeri  crollano, ma il perchè non si sa: sono calati gli editor di wikipedia? Gli articoli non sono stati categorizzati bene? Non c'è ancora stato il tempo di scrivere tutti gli articoli sui libri che, si sa, sono stati pubblicati? Colpa di internet? Colpa di (gasp) Amazon? Boh.

Se, però,  la si chiama "La curva dei romanzi (forse) notevoli degli ultimi 200 anni", una cosa la si vede:  leggerli tutti è praticamente impossibile.

Romanzi pubblicati categorizzati su wikipedia, per anno di edizione

Glossario per programmatori



Come accade in tutte le professioni, anche la programmazione ha il suo gergo, espressioni comuni che assumono un significato tecnico a seconda del contesto in cui sono espresse. Di seguito alcuni esempi.(Fonte: the internet)



  • Originale:   Questo va risolto in user support 
    Traduzione:  Non ho idea di come risolvere il problema.
  • Originale:   E' sottospecificato
    Traduzione:  Non ho idea di come risolvere il problema.
  • Originale:   E' stato scritto secondo le specifiche
    Traduzione:  Non ho idea di come risolvere il problema.
  • Originale:   NOTABUG/WONTFIX
  • Traduzione:  Non ho idea di come risolvere il problema.
  • Originale:   Orribile accrocchio 
    Traduzione:  Chi ha scritto questo orribile accrocchio? 
  • Originale:   Soluzione temporanea 
    Traduzione:  Sì, l'ho scritto io, questo orribile accrocchio
  • Originale:   E' rotto 
    Traduzione:  Ci sono bachi nel tuo codice.
  • Originale:   Va perfezionato 
    Traduzione:  Ci sono bachi nel mio codice.
     

  • Originale:  
    Oscuro/Incomprensibile
    Traduzione:  Questo codice è privo di commenti
  • Originale:   Auto documentante 
    Traduzione:  
    Il mio codice è privo di commenti
  • Originale:   Ecco perché è un linguaggio imbattibile!
    Traduzione:  Facile da fare nel mio linguaggio preferito
  • Originale:   Non stai inquadrando correttamente il problema
    Traduzione:  Impossibile da fare nel 
    mio linguaggio preferito
  • Originale:   Mal Strutturato
    Traduzione:  Il tuo codice è mal organizzato
  • Originale:   Ha una struttura complessa
    Traduzione:  
    Il mio codice è mal organizzato
  • Originale:   Carenza
    Traduzione:  Questa feature manca, e a me piace
  • Originale:   Fuori specifica
    Traduzione:  
    Questa feature manca, e non m'interessa
  • Originale:   Un soluzione ottimale
    Traduzione:  Funziona e lo capisco
  • Originale:   Va riscritto
    Traduzione:  
    Funziona, ma non lo capisco
  • Originale:   vi è meglio di emacs
    Traduzione:  Ho voglia di litigare
  • Originale:   emacs è meglio di vi
    Traduzione:  
    Ho voglia di litigare
  • Originale:   IMHO
    Traduzione:  Ho ragione io.
  • Originale:   Codice legacy
    Traduzione:  
    Funziona, ma nessuno sa perchè
  • Originale:   ^X^Cquit^Zfg%^Y^D
    Traduzione:  Come ç@330 si esce da vi?

Sunday, June 1, 2014

Dhalgren. Una recensione

Mi è dispiaciuto che la mia copia di Dhalgren fosse un ebook,perché ci sono almeno due cose che, con un e-book, si fanno male: tirarlo contro un muro  e saltare qua e là quando si è deciso di mollarlo. Con questo romanzo di Samuel Delany avrei voluto fare entrambe le cose. (TL;DR alla fine del post).

La trama: il protagonista, un ragazzo semiamnesiaco  che non ricorda il suo nome e che indossa un solo sandalo, e che verrà nel seguito chiamato Kid o Kidd, arriva in una città, Bellona, semi-abbandonata perché colpita da una misteriosa catastrofe ed abitata solo da un migliaio di persone. Nel corso di 800+ pagine, fa cose, vede gente, scopa un sacco, cerca di diventare un poeta e diventa, incidentalmente, anche il capo di una gang di "scorpioni" ed è acclamato salvatore della città. La fine del romanzo si ripiega sull'inizio, e la struttura, se c'è, è circolare.

Molti hanno detto che questo romanzo è un classico della fantascienza, e uno dei migliori romanzi in lingua inglese, tout court, di tutto il XX secolo. Altri hanno detto che è un lavoro di genio (alcuni lasciando intendere che quelli a cui non piace hanno qualche deficit letterario da colmare). Altri lo detestano. William Gibson è tra i primi, P.K.Dick fu, forse, tra i secondi; assieme a me. Gibson, di Dhalgren, ha anche scritto un'introduzione, che è una delle cose migliori del libro (e mi ha fatto venire voglia di leggere i lavori di Gibson): concisa, interessante, in una prosa fluida ed elegante . In breve, l'introduzione è tutto quello che il romanzo non è.

Ci sono moltissime cose che Dhalgren non è, o non ha - e su questo gli estimatori e i detrattori sono d'accordo. Dhalgren non ha una trama, non ha personaggi interessanti, non è un'opera che cerchi di creare tensione riguardo all'andamento dell'azione - che quasi sempre manca -  o alla soluzione di qualche domanda. In senso stretto, Dhalgren non è neppure un romanzo di fantascienza. Gli avvenimenti che hanno reso Bellona quello che è non sono mai spiegati e tutti quanti sembrano darli per scontati. L'economia della città, e la sua stessa esistenza, sono inspiegabili: c'è acqua corrente, energia elettrica, cibo in apparente abbondanza senza che nessuno degli abitanti faccia nulla perché questo avvenga. C'è un barista, che serve da bere a chiunque glielo chieda, senza volere niente in cambio e, per il 90% del tempo, tutti pensano che sia una cosa normale. 

Bellona, insomma, è una specie  di Eden per hippies - e non a caso, visto che Dhalgren fu scritto nel 1974 e il suo tema sembra essere il trionfo della controcultura (della fine degli anni 60)  in un mondo capovolto dal caos. Non deve quindi meravigliare che tutti si comportino sempre come se fossero permanentemente fatti, o semplicemente fuori di testa. Forse per compensare la mancanza di logica dei comportamenti, la logorrea è la norma.Tutti i personaggi parlano per pagine e pagine alla minima provocazione: gli argomenti sono la poesia, il sesso, i rapporti tra gli abitanti, la possibilità che un bianco abbia un'anima nera. Quasi  mai qualcuno si chiede come mai la disposizione delle  strade della città cambi in continuazione, o perché ci siano due lune, o come mai tutto bruci senza consumarsi o come mai...ci siamo capiti. 

Da questo la mia deduzione che  Dhalgren non sia neppure un romanzo, ma un saggio letterario, in cui l'avventura è tutta mentale, i personaggi sono simboli è quello che conta sono il linguaggio e  i concetti.

Infatti il linguaggio è molto importante, e per questo motivo il Dhalgren andrebbe letto in lingua originale. Io l'ho fatto, per scoprire che l'autore gioca costantemente colle parole, ma che il gioco è ovvio e, per giunta, abbastanza insopportabile. Delany ama pazzamente certe parole ed espressioni ( 'scab', 'filmed teeth', 'verdigrised', 'he sucked his teeth', 'pencil of blood') e le ripete ad nauseam, senza apparente necessità; è innamorato delle allitterazioni e non ne fa mistero, anzi vi si abbandona senza pudore. Dà ad uno dei personaggi il  cognome Newboy, così il giorno dopo l'arrivo del protagonista (Kidd, che vale tra l'altro 'ragazzo') il giornale locale può titolare 'Newboy in town' ('Nuovoragazzo in città'). Poi scopriremo che Newboy è l'alter ego concettuale di Kidd. Wow. Poi c'è un blocco note, scritto solo sulla facciata destra delle pagine (Kidd scrive poesie sulla facciata sinistra), che contiene lacerti del testo del romanzo stesso, e  così siamo  a posto anche con il metatesto e l'autoreferenzialità. Dhalgren è uno di quei meccanismi in cui tutti gli ingranaggi sono - fastidiosamente - in vista. Per quello che riguarda i simboli e i concetti, mi limito a dire che non sono riuscito a provare una briciola d'interesse per nessuno dei due - forse quelli buoni si annidano nella parte che non ho letto, ma ne dubito.

La satira sociale è trattata con lo stesso tocco lieve: a Bellona ci sono famiglie borghesi che si comportano come se nulla fosse successo e si invitano reciprocamente a cena, il sesso più diffuso è quello meno - tra virgolette - normale e così via. Capito?

Insomma, nemmeno la curiosità di sapere in cosa consistessero le scene di sesso e violenza che scandalizzarono all'uscita del romanzo è riuscita a portarmi oltre pagina 300, traguardo che ho raggiunto lottando contro una noia spezzata solo da momenti di insofferenza. Dhalgren mi ricorda molto da vicino i romanzi di J.G. Ballard, altro autore molto elogiato che trovo da sempre insopportabile. Quindi forse ho davvero un deficit letterario.

E' ovvio che per apprezzare Dhalgren bisogna, come si dice 'amare il genere'  (e non mi riferisco alla fantascienza). Curiosamente - o forse ovviamente - chi lo apprezza non riesce a dare ragioni specifiche, mentre chi lo detesta dà motivi molto precisi. E tuttavia continuo a ritenerlo un libro sopravvalutato - molte recensioni gli danno le fatidiche tre stelle sulla base di quello che avrebbe potuto essere (e forse sulla base del retropensiero che beh, se è piaciuto a Gibson, un motivo ci sarà)

Io non riesco a non confrontarlo, sfavorevolmente, con un romanzo simile che ho molto amato (e che forse mi ha reso impossibile leggere altri romanzi di SF postapocalittica): La strada di Cormac McCarthy.

Partendo da situazioni simili (una oscura catastrofe ha spopolato l'universo dei protagonisti), La strada è sintetico  dove Dhalgren è prolisso, ha personaggi umani, coinvolgenti, e interessanti dove quelli di Dhalgren sono stereotipati, distaccati e noiosi, ha una prosa stringata, immaginifica e lancinante dove quella di Dhalgren è eccessiva, sfocata e faticosa... potrei continuare.
Alla fine, tutti gli strati di significato e simboli (c'è da qualche parte un subtesto di mitologia romana, pare, con un Caronte da identificare nel guidatore di un camion di carciofi), e le numerose entrate e uscite da Dhalgren, che tanto sono piaciute ai suoi estimatori, mi rimarranno per sempre precluse.

Spero almeno di avere imparato, dalle ore che gli ho dedicato e che nessuno mi renderà, a fidarmi del mio intuito nello scegliere i prossimi libri.

TL;DR: Se non vi piace J.G. Ballard, non vale la pena. Forse non vale la pena comunque.

Wednesday, May 21, 2014

Sendmail and procmail mailer for egress mail filtering.

Ok, this is basically an annotated version of recipe 6.8 from O'Reilly's sendmail cookbook. As a bonus, though, it contains also a useful (if spooky) working example AND the relevant procmail configuration. It takes about a day to setup and test without guidance, so enjoy. If you need to be told how to rebuild sendmail.cf from .mc or what is mailertable, this post will be Tralfamadorian to you - go read the Bat Book.

The italian version is here.

Summary

  • Create the sendmail configuration to use mailertable and the procmail mailer.
/etc/mail/sendmail.mc
dnl Enable support for the mailertable
FEATURE(`mailertable')
dnl Add procmail to the list of available mailers
MAILER(procmail)
  • Ath the bottom, insert local rules to fend off loops (watch out for the TAB between '>' e '$')
/etc/mail/sendmail.mc
LOCAL_CONFIG
# Add .PROCMAIL to the pseudo-domain list
CP.PROCMAIL
LOCAL_RULE_0
# Strip .PROCMAIL and send via esmtp
R$+ < @ $+ .PROCMAIL . >        $#esmtp $@ $2 $: $1<@$2>
  • Set up mailertable to route mail sent to specific domains (or even all mail, as in the last line) through the procmail mailer:
/etc/mail/mailertable
example.com       procmail:/etc/mail/procmailrcs/spam-filter
wrotethebook.net  procmail:/etc/mail/procmailrcs/spam-filter
fake.ora.com      procmail:/etc/mail/procmailrcs/uce-filter
.                 procmail:/etc/mail/procmailrcs/any.rc
  • Create procmail recipe files (owned by root.root, perms 644) in  /etc/mail/procmailrcs (root.root, perms 755). Forwarded mail should extend with the .PROCMAIL pseudo-domain all addresses liable to be rerouted through the procmail mailer.

Discussion and example

The procmail mailer and mailertable

The MAILER(procmail) macro adds the  procmail mailer defintion. This mailer is independent and separate form the local_procmail feature (used to filter incoming local mail).

Using the mailer requires routing mail to it through mailertable:
/etc/mail/mailertable
example.com       procmail:/etc/mail/procmailrcs/spam-filter
.                 procmail:/etc/mail/procmailrcs/any.rc
First rule sends mail going to example.com to the rules defined in spam-filter, the second line sends all mail to any.rc.

# sendmail -bv crooks@example.com
crooks@example.com... deliverable: mailer procmail, host /etc/mail/procmailrcs/spam-filter, user crooks@example.com
# sendmail -bv spammers@spammers.net
spammers@spammers.net... deliverable: mailer procmail, host /etc/mail/procmailrcs/any.rc, user spammers@wrotethebook.net

sendmail invokes procmail as follows:


procmail -Y -m $h $f $u

The -Y flag selects Berkely Unix mailbox format, -m tells procmail that it's being invokde as a general mail filter, $h is set to the full path of the rule file, $f is set to the envelope sender address, $u to the envelope recipient address: these last two can ber referenced in tha rc file as $1 and $2.

Local rules

If, after processing, the message is going to be forwarded again, care must be taken as to avoid mail loop when (if) the message gets back to mailertable processing. The standard technique is to add the pseudo domain .PROCMAIL to the  recipient address within the procmail recipe files, and intercept this domain within sendmai.cf  adding rules to the bottom of  sendmail.mc like this (there must be  a literal  TAB between '<' and '$'):
/etc/mail/sendmail.mc

LOCAL_CONFIG
# Add .PROCMAIL to the pseudo-domain list
CP.PROCMAIL
LOCAL_RULE_0
# Strip .PROCMAIL and send via esmtp
R$+ < @ $+ .PROCMAIL . >        $#esmtp $@ $2 $: $1<@$2>

  • LOCAL_CONFIG starts the section that will be copied to sendmail.cf verbatim;
  • CP.PROMAIL inserts .PROCMAIL in class P: pseudo-domains that sendmail does not look up in the DNS;
  • LOCAL_RULE_0 starts a section whose content is added to  ruleset 0—also called the  parse ruleset. The code is entered in the  ParseLocal ruleset (ruleset 98). The parse ruleset risolvs an addresse in a delivery triplet.
  • The R rule matches addresses of the form user@domain.PROCMAIL, and rewrites them as a triplet with with “esmtp”, as mailer, “domain” as hast and “user@domain” as recipient.
 After regenerating sendmail.cf, we have:

# sendmail -bv crooks@example.com.PROCMAIL
crooks@example.com.PROCMAIL... deliverable: mailer esmtp, host example.com, user 
crooks@example.com

Procmail rule files, and an example


The  (objectionable) purpose of this example is creating a sendmail instance who does a stealth forward of a copy of all transient mail to a set of configured addresses, while also delivering it to the intended address.
  • /etc/mail/sendmail.mc is as above.
  • Mailertable:
/etc/mail/mailertable
.                 procmail:/etc/mail/procmailrcs/any.rc
/etc/mail/procmailrcs has perms 755, owner root.root; the files within, 644, root.root. SELinux users: no doubt SELinux will mess this up, as it does with everything else when it's turned on - I can offer no guidance, suit yourselves as best you can.
  • We use two auxiliary rule files to set-up and tear down tha stage.
/etc/mail/promailrcs/000_setup

# Debugging (use =no and =no to turn off)
VERBOSE=on
LOGABSTRACT=all
#
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
LOGFILE=/var/log/proc_log   #recommended
#this is clearer
OSENDER=$1
ORECIPIENT=$2
#Echoed to logfile at the end
TRAP="echo '---------- End of procmailer ------' "
#
# Antiloop belt+suspender. This should never be triggered.
:0 w
* 1^0 ^X-Our-Anti-Loop: SET
! -f $OSENDER $ORECIPIENT.PROCMAIL
000_setup must be included before any other ruel: besides some standard setting, it copies $1 and $2 to the more mnemonic $OSENDER, $ORECIPIENT and checks wether a header tht we add on exit exists (it should never be present): if it does it shortcircuits the processing with a copy of the final rule. This is also found in the file 999_end:
/etc/mail/promailrcs/999_end
#
# Insert Anti-loop header, add .PROCMAIL to recipient
:0 w
| (formail \
  -A"X-Our-Loop: SET" \
  ) | $SENDMAIL -oi -f $OSENDER $ORECIPIENT.PROCMAIL
the message is sent to the final recipient, after .PROCMAIL has been tacked to the recipient address, to trigger the sendmail.cf rules. This file must be included at the very end.
  • In any.rc is where the meat and potatoes are:
/etc/mail/promailrcs/any.rc

# Setup 
INCLUDERC=/etc/mail/procmailrcs/000_setup
#
#flag 'c' creates a carbon copy for processing
# Avoid sending duplicates
:0 Whc
| formail -D 16384 /tmp/idcache
#
#flag 'c' creates a carbon copy for processing
#flag 'e' executes only if previous command failed.
#espiones must contain addresses that are either local or .PROCMAIL terminated
:0 ec
| (formail -A"X-Our-Processed: SET" ) | $SENDMAIL -oi -f $OSENDER espiones
#clean up and forward
INCLUDERC=/etc/mail/procmailrcs/999_end

After setup, the second rule  checks if the message ID is already in a cache file, and add it there if it isn't. This will avoid sending multiple copies of the message to the  “espiones” when we have several recipients  (in  from:,  cc: or bcc:). Lastly the message gets added a watermark header, for debugging.
  • Since espiones is an aliased adress, non-local addresses in the alias need protection, too (as would literal addresses specified in the rule)
/etc/aliases
      espiones: foo@bar.com.PROCMAIL, baz@sna.fu.PROCMAIL, snafu
snafu, being local, is not  .PROCMAIL protected.

Additional Considerations

No doubt a task like this could be performed with a milter. Usage of the procmail mailer, as everything,  has pros and cons.

Pros

  • You do not need to select, write, or buy a suitable milter
  • Yu do not have to learn the ins and outs of yet another piece of MTA related software
  • You do not have to set up/debug the relevant communication between milter and sendmail
  • You have one less demon (the milter) to take care of

Cons

  • The mail flow becomes more involved and it is now controlled by yet another layer of configuration files (the rule files), and the same message will go through sendmail more than once. 
  • God help you if you come to rely on multiple loops of this machinery (it is tempting, I know).
  • Procmail syntax sucks.

Tuesday, May 20, 2014

Sendmail e procmail mailer per il filtraggio della posta in uscita

Ok, questa è più o meno la ricetta 6.8 dal sendmail cookbook, annotata. Però contiene anche la parte di procmail, è testata e funziona - e farlo senza guida richiede una giornata e giù di lì, quindi... enjoy.

Sommario

  • Creare la configurazione di sendmail per utilizzare mailertable e il mailer procmail, come segue.
/etc/mail/sendmail.mc
dnl Enable support for the mailertable
FEATURE(`mailertable')
dnl Add procmail to the list of available mailers
MAILER(procmail)
  • Inserire regole locali per permettere il reinvio di posta senza loop (attenzione al TAB tra '>' e '$')
/etc/mail/sendmail.mc
LOCAL_CONFIG
# Add .PROCMAIL to the pseudo-domain list
CP.PROCMAIL
LOCAL_RULE_0
# Strip .PROCMAIL and send via esmtp
R$+ < @ $+ .PROCMAIL . >        $#esmtp $@ $2 $: $1<@$2>
  • Usare mailertable per inviare la posta di domini specifici (o tutti i domini) al mailer procmail (l'ultima linea si applica a tutta la posta):
/etc/mail/mailertable
example.com       procmail:/etc/mail/procmailrcs/spam-filter
wrotethebook.net  procmail:/etc/mail/procmailrcs/spam-filter
fake.ora.com      procmail:/etc/mail/procmailrcs/uce-filter
.                 procmail:/etc/mail/procmailrcs/any.rc
  • Nel direttorio /etc/mail/procmailrcs creare i file per filtrare la posta, ricordandosi di estendere gli indirizzi dei destinatari finali con lo pseudodominio .PROCMAIL

Discussione ed esempi

Il mailer procmail e mailertable

La macro MAILER(procmail) aggiunge la definizione del procmail mailer. Questo è completamente separato ed indipendente dalla feature local_procmail (che si può usare per filtrare la posta in ingresso)
La macro MAILER(procmail) non aggiunge codice alla configurazione, e per usare il mailer stesso bisogna usare mailertable o aggiungere regole a sendmail.cf
/etc/mail/mailertable
example.com       procmail:/etc/mail/procmailrcs/spam-filter
.                 procmail:/etc/mail/procmailrcs/any.rc
Delle 2 regole nell' esempio qui sopra, la prima passa lapost diretta ad example.com alle regole contenuti in spam-filter, la seconda passa tutta l'altra posta alle regole in any.rc.

# sendmail -bv crooks@example.com
crooks@example.com... deliverable: mailer procmail, host /etc/mail/procmailrcs/spam-filter, user crooks@example.com
# sendmail -bv spammers@wrotethebook.net
spammers@wrotethebook.net... deliverable: mailer procmail, host /etc/mail/procmailrcs/any.rc, user spammers@wrotethebook.net

sendmail chiama procmail dal mailer mailer nel modo seguente

procmail -Y -m $h $f $u

Il flag -Y selezione il formato Berkeley Unix mailbox; il flag -m invoca procmail come un filtro di posta di uso generale. $h contiene il path del file di regole, $f è il valore dell'envelope sender (mittente) del messaggio, $u quello dell'envelope recipient (destinatario) del messaggio: nel file rc essi possono essere referenziati come le variabili $1 e $2.

Regole locali

Se l'intento è tornare ad inviare la posta dopo il filtraggio, bisogna proteggersi dai loop che si possono provocare rientrando nel mailer procmail inavvertitamente; per fare ciò, aggiungiamo lo pseudodominio .PROCMAIL all'indirizzo del destinatario utilizzando le regole di procmail: in questo modo il messaggio no sarà mai selezionato tra quelli di mailertable. Ecco le regole da aggiungere in fondo a /etc/mail/sendmail.mc (attenzione al TAB tra '>' e '$'):
/etc/mail/sendmail.mc

LOCAL_CONFIG
# Add .PROCMAIL to the pseudo-domain list
CP.PROCMAIL
LOCAL_RULE_0
# Strip .PROCMAIL and send via esmtp
R$+ < @ $+ .PROCMAIL . >        $#esmtp $@ $2 $: $1<@$2>

  • La macro LOCAL_CONFIG delimita una sezione che sarà aggiunta a sendmail.cf verbatim;
  • CP.PROMAIL inserisce .PROCMAIL nell classe P degli pseudodomini che sendmail non cercherà di risolvere via DNS.
  • La macro LOCAL_RULE_0 dà inizio alla sezione di codice da aggiungere al ruleset 0—more - anche detto il parse ruleset; questo codice farà parte del ParseLocal ruleset (anche detto ruleset 98). L'intento del parse ruleset è risolvere l'indirizzo di consegna nella tripla di consegna della posta.
  • Il comando R riconosce indirizzi della forma user@domain.PROCMAIL, riscrivendoli in una tripla con mailer “esmtp”, host uguale a “domain” e destinatario “user@domain”. Dopo aver rigenerato la configurazione, si dovrà vedere:

# sendmail -bv crooks@example.com.PROCMAIL
crooks@example.com.PROCMAIL... deliverable: mailer esmtp, host example.com, user 
crooks@example.com

Regole di procmail


Passiamo ora ad un esempio completo. Lo scopo (discutibile) è la creazione di un'isanza di sendmail che inoltri tutti i messaggi che transitano per la macchina a indirizzi terzi.
  • Il file /etc/mail/sendmail.mc è come sopra
  • Mailertable:
/etc/mail/mailertable
.                 procmail:/etc/mail/procmailrcs/any.rc
il direttorio /etc/mail/procmailrcs ha diritti 755, proprietario root.root; i file in esso contenuti, 644, root.root
  • Utilizziamo regole a carattere generale per organizzare l'ambiente.
/etc/mail/promailrcs/000_setup

# Per debugging (usare =no e =no per spegnerle)
VERBOSE=on
LOGABSTRACT=all
#
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
LOGFILE=/var/log/proc_log   #recommended
#per non confondersi
OSENDER=$1
ORECIPIENT=$2
#Viene scritta nel logfile alla fine.
TRAP="echo '---------- End of procmailer ------' "
#
# Controllo antiloop: usiamo cintura e bretelle - di qui non si dovrebbe passare mai
:0 w
* 1^0 ^X-Our-Anti-Loop: SET
! -f $OSENDER $ORECIPIENT.PROCMAIL
000_setup dev'essere incluso prima di iniziare la manipolazione della posta. Setta alcune direttive standard, assegna le variabili $1 e $2 ad altre due variabili più mnemonice (OSENDER, ORECIPIENT) e controlla l'esistenza di un header che viene settato anche all'uscita - terminando in questo caso il processing replicando quello che avrebbe dovuto fare la regola finale, che nel file 999_end:
/etc/mail/promailrcs/999_end
#
# Controllo antiloop
:0 w
| (formail \
  -A"X-Our-Anti-Loop: SET" \
  ) | $SENDMAIL -oi -f $OSENDER $ORECIPIENT.PROCMAIL
inoltra il messaggio al destinatario finale, dopo aver concatenato lo pseudo dominio .PROCMAIL per attivare le regole inserite poco sopra in sendmail.cf.
  • In any.rc si includono all'inizio e alla fine i file di cui sopra: tra i due si effettua l'inoltro in copia:
/etc/mail/promailrcs/any.rc

# Setup generale
INCLUDERC=/etc/mail/procmailrcs/000_setup
#
#flag 'c' creates a carbon copy for processing
#Evita i duplicati per indirizzi multipli
:0 Whc
| formail -D 16384 /tmp/idcache
#
#flag 'c' creates a carbon copy for processing
#flag 'e' executes only if previous command failed.
#espiones must contain addresses that are either local or .PROCMAIL terminated
:0 ec
| (formail -A"X-Our-Processed: SET" ) | $SENDMAIL -oi -f $OSENDER espiones
#clean up and forward
INCLUDERC=/etc/mail/procmailrcs/999_end
Il file 000_setup (q.v.) sistema l'ambiente; la seconda regola controlla che l'ID del messaggio corrente non sia in un file di cache (e lo aggiunge se manca). Questo server ad evitare di inviare agli “espiones” tante copie del messaggio quanti sono i destinatari (nel from:, o nel cc: o nel bcc:). Infine viene aggiunto un header che consenta l'identificazione di questo passaggio (a fini di debug).
  • I messaggi saranno inviati in copia ad un alias; gli indirizzi non locali vanno essi stessi protetti:
/etc/aliases
      espiones: foo@bar.com.PROCMAIL, baz@sna.fu.PROCMAIL, snafu
L'unico alias non protetto dall'estensione .PROCMAIL è snafu, che viene riconosciuto come locale e quindi non attiva mailertable. 

Wednesday, May 14, 2014

Volevi scrivere un libro, ma è un prodotto cartaceo

Bisogna commiserare l'altra metà del cielo.

Le donne, a quanto pare, sono condannate a stare da sole, o tra di loro, o ad adattarsi a scegliere tra alternative poco attraenti. Consideriamo che il maschio della specie umana:

  • A 20 anni è primitivo
  • A 30 anni è adolescenziale, o mammone, o irresponsabile (tutt'e tre, spesso)
  • A 40 anni è un porco
  • A 50 anni è ridicolo e giovanilista
  • A 60 anni è stanco
  • A 70 anni è depresso
  • A 80 anni è vecchio
  • A 90 anni è spesso morto
Tanto vale allora prendersi un cane, o un gatto.

Se state pensando che questi elenchi non erano già più divertenti quando cominciavano con:
  • A 20 anni l'uomo è come il locale: ferma a tutte le stazioni
o, simmetricamente, con:
  • A 20 anni, la donna è come l'Africa: lussureggiante e inesplorata
e si compravano (e tuttora si comprano) nelle tabaccherie assieme ad altre insegne di pari arguzia, avete ragione.

Allora qualcuno mi spieghi come mai si pubblicano e trovano un pubblico - quantomeno giornalistico, però ci sono anche 1600 like su FB -   prodotti cartacei, ché chiamarli libri è indebito, di questo tipo. Nelle tabaccherie non si vendono, per leggerli ci vuol più impegno che a leggere gli elenchi sopra citati (penso che invece, a scriverli, ce ne voglia un po' meno: non bisogna sforzarsi di essere concisi). 

Sicuramente, da ultracinquantenne, sono ipersensibile, ma immaginiamo il caso, simmetrico, di un prodotto cartaceo dal titolo "Le ragazzone", che se la prende con le donne ultracinquantenni, le insicurezze premenopausa. la paura d'invecchiare etc. Sarebbe correttamente sotterrato da una montagna di guano. Mi auguro che non sarebbe pubblicato. Sono quasi certo che non sarebbe recensito da quotidiani trendy.

Forse sono troppo ottimista, però.  
Sessismo? Non credo. Stupidità? E' una buona ipotesi di lavoro. 

La metto assieme agli altri stereotipi age-based quae quello, abbastanza popolare su twitter (twitter: che medium del cazzo. Ecco, l'ho detto, ora sto meglio) e in blog assortiti "Ah, questi ultraXXenni che vogliono usare internet, ma se andassero nel parco".  In questo caso:

XX=10+età dello scrivente

Lo scrivente, dopo aver twittato la sua irritazione contro i matusa (sì, sono datato) posta poi la foto di un micetto, o un like di Justin Bieber, così, per il gusto di mostrare un po' di internet prowess.

Nota a me stesso: Ricordarsi di questo post, quando si stanno per dire cose matusa del tipo "I ragazzi adesso, mamma mia, che disastro".


Wednesday, May 7, 2014

Lampo di genio

Un fisico stava cercando di dimostrare una sua teoria sociologica secondo la quale, sottoponendo ad un matematico ed un fisico un problema che abbia sia  una soluzione laboriosa e diretta sia una semplice, ma meno evidente, il matematico opterà per la prima, il fisico per la seconda.

Per questo sottopose a  John Von Neumann (la cui capacità di calcolo era leggendaria, così come la sua distrazione), il seguente problema:

"Due treni, sullo stesso binario, si muovono uno verso l'altro, in direzioni opposte, a una velocità rispettiva  di 30 e 50 Km/h. Un uccello parte dalla motrice di uno dei due volando a 120 Km/h, quando i treni distano 100 Km uno dall'altro, fino a incontrare il secondo treno, poi torna indietro alla stessa velocità e continua allo stesso modo finchè i due treni si scontrano. Che distanza percorre l'uccello?"

Von Neumann rispose quasi istantaneamente: "240 Km".
Il collega allora gli disse piuttosto deluso: "Ecco, ci sei arrivato subito e hai scompigliato la mia teoria. Avrei scommesso che tu, essendo un matematico, avresti preso la strada lunga, quella con la somma della serie infinita."
E Von Neumann, imbarazzato: "Ah, lo sapevo che c'era anche una soluzione facile!"

La soluzione è qui

sotto...

sotto...

sotto..

sotto..

sotto..

sotto..

sotto..

sotto..

sotto..

sotto..

sotto...

sotto...

sotto..

sotto..

sotto..

sotto..

sotto..

sotto..

sotto..

sotto..

Soluzione semplice

I treni collidono due ore dopo che l'uccello ha spiccato il volo:
Tt= D0/(V1+V2) = 100/50 dove 50 è la velocità relativa dei due treni.
Per tutto questo tempo l'uccello vola a 120 Km/h, e quindi percorre St=Vb*D0/(V1+V2) = 240 Km.

Soluzione complessa

La soluzione complessa segue il dettaglio del volo dell'uccello e riduce il problema alla somma di una serie geometrica.

Per abbozzare questa soluzione e svolgere i calcoli c'ho messo circa venti minuti. Ma siccome avevo commesso un errore concettuale, poi l'ho cercato per due giorni, senza vederlo, finchè una domanda su  math.stackexchange.com no mi ha messo sulla strada giusta. Lo sapevo che tra me e Von Neumann c'era una certa distanza...

All'inizio i treni sono separati dalla distanza D0  che l'uccello copre in tempoe T0=D0/(Vb+V2) e percorrendo la distanza S0=Vb*T0

Al ritorno, con analoga notazione:

D1 = D0-T0 * (V1+V2) = D0 * (Vb-V1)/(Vb+V2);
T1=D0 * (V1-Vb)/((V1+Vb)*(V2+Vb))=T0 * (Vb-V1)/(Vb+V1)
S1=VB*T1

Al terzo viaggio, ripetendo i calcoli di cui sopra, emerge una ricorrenza:

D2 = D0 * ((V1-Vb)*(V2-Vb))/((V1+Vb)*(V2+Vb))
T2 = T0 * ((V1-Vb)*(V2-Vb))/((V1+Vb)*(V2+Vb))
S2 = S0 * ((V1-Vb)*(V2-Vb))/((V1+Vb)*(V2+Vb)) = Vb*T2

Ricorrenza che vale anche per D3 e D1, T3 e  T1 e S3 e S1

Ponendo

R=(V1-Vb)*(V2-Vb))/((V1+Vb)*(V2+Vb))

La somma che dà il totale del tempo impiegato (o distanza percorsa):

Tt=T0+T1+T2+T3...=(T0+T1)+(T0+T1)*R+(T0+T1)*R^2....

Siccome R< 1 la somma converge a:

Tt=(T0+T1)/(1-R)
St=Vb*Tt

Effettuando il calcolo con la sostituzione di R si ha , come prima:

Tt= D0/(V1+V2) = 100/50 =2 
St=Vb*D0/(V1+V2)= 240


Tuesday, May 6, 2014