Linux dokumentacija

  • Kontrola pristupa: hosts_access

    Jedan od načina da se ograniči daljinski pristup na Linux-ovom serveru koristeći usluge mrežnih protokola se može regulisati konfigurisanjem dveju skripti i to: hosts.allow i hosts.deny. Obe pomenute skripte se nalaze na lokaciji /etc/.

    Za editovanje zabrane pristupa svim servisima treba uneti:

    sudo nano /etc/hosts.deny

    # /etc/hosts.deny: list of hosts that are _not_ allowed to access the system.
    #                  See the manual pages hosts_access(5) and hosts_options(5).
    #
    # Example:    ALL: some.host.name, .some.domain
    #             ALL EXCEPT in.fingerd: other.host.name, .other.domain
    #
    # If you're going to protect the portmapper use the name "portmap" for the
    # daemon name. Remember that you can only use the keyword "ALL" and IP
    # addresses (NOT host or domain names) for the portmapper, as well as for
    # rpc.mountd (the NFS mount daemon). See portmap(8) and rpc.mountd(8)
    # for further information.
    #
    # The PARANOID wildcard matches any host whose name does not match its
    # address.
    #
    # You may wish to enable this to ensure any programs that don't
    # validate looked up hostnames still leave understandable logs. In past
    # versions of Debian this has been the default.
    # ALL: PARANOID
    ALL:ALL

    Zadavanjem vrednosti ALL:ALL, Web server će automatski zabraniti pristup svim unutrašnjim servisima kojima daljinski sistemi mogu pristupati. Međutim, ovo treba primenjivati sa velikim oprezom ukoliko se radi u okruženju Putty klijenta npr., jer ako ovo nameravamo da sprovedemo na daljinskom Web serveru, naredbom ALL:ALL nalažemo serveru da ni mi sami preko mrežnog priključka 22 ne možemo ponovo pristupati.

    Zato, pre nego što se izvrše izmene unutar fajla hosts.deny - treba editovati fajl hosts.allow:

    sshd: UNETI_STATIČKU_IP_ADRESU_SA_KOJE_ĆEMO_PRISTUPATI

    sendmail: ALL

    Uneta su dva servisa koja su podešena različito. Za prvi servis (sshd), u cilju postizanja višeg novoa zaštite, koristi se statička IP adresa klijenta koji će pristupati ovom serveru, dok u slučaju sendmail-a, upotreba ovih usluga je dozvoljena globalno sa svih IP adresa.

    Publikovano je:  24. 01. 2015.