Firewall – ce am eu si ce vreti voi?

Evident cand configuram un server vrem sa-l facem de la A la Z si totul sa fie super OK, corect? In cazul asta trebuie sa ne gandim si la securitate, de aici putem incepe capitolul Firewall.

Mai intai, ne hotaram pentru ce vrem sa folosim serverul respectiv, ce este serverul respectiv, ce servicii ne va oferi el noua (si altora), daca face sau nu si NAT, retea locala cu / fara acces la Internet… ma rog, intelegeti voi ideea.

Eu, personal, mi-am facut un server local folosit drept firewall pentru reteaua locala (calculatoarele & laptopurile din casa), pe care mi-am instalat si serviciile apache, mysql, ftp, mail server, torrent server, si inca cateva. Inclusiv si cateva port forward-uri catre calculatoarele din casa, care nu sunt vizibile in Internet (cei care cunosc stiu despre ce vorbesc).

Am incercat o gramada de firewall-uri, si de fiecare data am avut probleme cu ele, la inceput eram un incepator, acum sa zicem ca ma pricep mai mult, nu-s un Zeu, dar… ma descurc.

Ideea principala ar fi ca si voi ar trebui sa studiati man iptables la fel ca restul, la fel ca mine, si astfel veti intelege exact ce realizati si ce trebuie sa faceti ca sa fie totul ok si smooth. Uneori nu e suficient sa iei un tutorial de pe net si sa stai sa-l modifici, bucatele de la X, alte bucatele de la Y si gata firewall-ul. Retineti ca aici greselile conteaza, sa nu va mirati daca va merge incet netul, sau ca nu vi se conecteaza nu stiu ce odc sau mai stiu eu ce… man iptables.

Totusi va voi oferi un firewall care e testat de mine si pe care il folosesc in prezent pe serverul de acasa! Mie imi merge perfect… cel putin pana acum mi-a mers super ok, deci nu ma plang.

Mai jos aveti link-ul de unde puteti descarca acest script (rc.firewall), dupa care dati comenzile chmod +x rc.firewall, chmod 777 rc.firewall (ca oricum nu il editeaza nimeni, dar sa fie) il puneti si in rc.local (linia /etc/rc.d/rc.firewall) ca sa fie aplicat la fiecare restartare a serverului si va fi totul perfect!

Scriptul il puteti descarca de aici.

Am uitat sa va specific ca asta e un script de firewall pentru serverele cu IP dinamic evident!
Daca vreti pentru ip fix schimbati acolo din ppp0 in eth0 (pe care se presupune ca aveti conexiunea internet), in rest… adaptati si voi.

Daca va uitati unpic va veti da seama ce si cum… :D

Server apache, mysql & ftp cu… ip dinamic

Exact ce se intelege si din titlu: apache, mysql & ftp pe un server cu IP dinamic! Se poate asa ceva? Ei bine, raspunsul este unul ferm si anume, DA!

Care este diferenta dintre un server cu IP fix si unul cu IP dinamic?
Simplu, diferenta ar fi ca serverul cu IP-ul fix isi pastreaza aceeasi adresa IP alocata de catre ISP-ul sau anytime, everytime, pe cand celui cu IP dinamic i se aloca unul la fiecare conectare / reconectare la Internet.

Adresele IP dinamice le gasim la fiecare pas, daca putem spune asa, fie ca e vorba de RDS, Clicknet sau reteaua locala a vecinului de bloc… intr-adevar, la RDS pentru un abonament Business de doar 100 EUR putem beneficia de un IP fix, la fel si la Clicknet, insa acestia sunt mai diplomati si cer doar 1 EUR in plus la abonamentul lunar.

Ok, bun… si cu ce ne ajuta asta daca noi nu ne permitem asa ceva, sa zicem, si vrem totusi un server numai al nostru, cu MySQL , cu Apache, sa punem un site, doua pe el si FTP pentru cateva transferuri cand suntem la job sau prin alta parte a tarii? Nu e o foarte mare dilema… facem serverul si gata, nu?
:)

Eee… problema ar fi in momentul unei reconectari sau in cazul unei intreruperi de curent ce facem? Cum mai putem accesa serverul nostru daca noi nu-i mai stim adresa IP, aceasta fiind dinamica… v-ati prins voi nu?

Eu, personal, m-am izbit de problema asta si am gasit si o solutie temporara, care acum ma ajuta si pe care voi continua sa o dezvolt. M-am gandit ca poate v-as face un pustiu de bine sa o impartasesc si cu voi, sa nu ziceti ca sunt egoist.

Aaaa, pentru asta trebuie sa aveti acces ca root pe serverul vostru (culmea ar fi sa nu aveti acces tocmai pe serverul vostru, nu?) si totodata sa va functioneze SMTP-ul. So… here we go!
:D

Downloadati fisierul asta.

Ok, acum facem fisierul executabil, comanda: chmod +x ifconfig.php si dam si un: chmod 777 ifconfig.php sa nu avem vreo surpriza. Punem fisierul unde vrem noi pe server (chiar nu conteaza unde) numai sa nu fie accesibil web sau clientilor FTP.

Acum cream un cron, care din ora in ora sa lanseze comanda:
wget -O /dev/null /adresa/fisierului/ifconfig.php

In acest mod veti primi pe adresa de e-mail specificata IP-urile setate pe serverul Dvs. de la toate interfetele active si pe langa asta, date ce tin de spatiul de pe hard-disk-ul vostru (output-ul comenzilor df si ifconfig, mai exact).

Sper sa va descurcati… in rest v-ati pus si voi apache, mysql si ftp, si restul pe server, da?
;)

Why did SPF cause my mail to be rejected?

What is SPF?

SPF is an extension to Internet e-mail. It prevents unauthorized people from forging your e-mail address. But for it to work, your own or your e-mail service provider’s setup may need to be adjusted. Otherwise, the system may mistake you for an unauthorized sender.

Note that there is no central institution that enforces SPF. If a message of yours gets blocked due to SPF, this is because (1) your domain has declared an SPF policy that forbids you to send through the mail server through which you sent the message, and (2) the recipient’s mail server detected this and blocked the message.

sub.domain.com rejected a message that claimed an envelope sender address of user@otherdomain.com.

sub.domain.com received a message from otherdomain.com (10.0.0.1) that claimed an envelope sender address of user@otherdomain.com.

However, the domain otherdomain.com has declared using SPF that it does not send mail through otherdomain.com (10.0.0.1). That is why the message was rejected.

If you are user@otherdomain.com:

otherdomain.com should have given you a way to send mail through an authorized server.

If you are using a mail program as opposed to web-mail, you may need to update the “SMTP server” configuration setting according to your ISP’s instructions. You may also need to turn on authentication, and enter your username and password in your mail program’s options. Please contact your ISP for assistance.

If you run your own MTA, you may have to set a “smarthost” or “relayhost”. If you are mailing from outside your ISP’s network, you may also have to make your MTA use authenticated SMTP. Ideally your server should listen on port 587 as well as port 25.

If your mail was correctly sent, but was rejected because it passed through a forwarding service, as an interim solution you can mail the final destination address directly (it should be shown in the bounce message).

If you are confident that your message did go through an authorized server:

The administrator of the domain otherdomain.com may have incorrectly configured its SPF record. This is a common cause of mistakes.

Here’s what you can do: Contact the otherdomain.com postmaster and tell them that they need to change otherdomain.com‘s SPF record so that it authorizes otherdomain.com. For example, they could change the record to something like

v=spf1 a mx a:otherdomain.com -all

or

v=spf1 a mx ip4:10.0.0.1 mx: mail.otherdomain.com -all

If you refer your postmaster to this web page, they should be able to solve the problem.

If you did not send the message:

SPF successfully blocked a forgery attempt; someone tried to send mail pretending to be from user@otherdomain.com, but the message was rejected before anybody saw it. This means SPF is working as designed.

;)

Copyright 2007 - 2010 Lucian Beleuzu. Toate drepturile rezervate.