Regole del forum
1) Citare sempre la versione di Slackware usata, la versione del Kernel e magari anche la versione della libreria coinvolta. Questi dati aiutano le persone che possono rispondere.
2) Per evitare confusione prego inserire in questo forum solo topic che riguardano appunto Gnu/Linux in genere, se l'argomento è specifico alla Slackware usate uno dei forum Slackware o Slackware64.
3) Leggere attentamente le risposte ricevute
4) Scrivere i messaggi con il colore di default, evitare altri colori.
5) Scrivere in Italiano o in Inglese, se possibile grammaticalmente corretto, evitate stili di scrittura poco chiari, quindi nessuna abbreviazione tipo telegramma o scrittura stile SMS o CHAT.
6) Appena registrati è consigliato presentarsi nel forum dedicato.
La non osservanza delle regole porta a provvedimenti di vari tipo da parte dello staff, in particolare la non osservanza della regola 5 porta alla cancellazione del post e alla segnalazione dell'utente. In caso di recidività l'utente rischia il ban temporaneo.
spina ha scritto:Io del loopback so solo che è un insieme di indirizzi che fanno riferimento alla macchina stessa, ovvero aprendo un socket verso un indirizzo di loopback in realtà si apre un socket tra due processi che risiedono sulla stessa macchina. Sinceramente questa cosa dello sfruttare il loopback per IPv6 non la sapevo.
Emanuele
:edit: tra l'altro questo che c'entrerebbe con i menu a tendina
La loopback mi veniva segnalata come scheda di rete virtuale quando usavo IPv6 (per questo l'ho indicato),
Per il resto sentivo che non centrava niente con le tendine e che mi stavo letteralmente arrampicando sugli specchi, però a volte le idee astratte portano a dei lumi improvvisi.
connect(31, {sa_family=AF_INET, sin_port=htons(16001), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
l'errore -1 non è dovuto a loopback disattivato, infatti su quella porta non ci trova mai nessuno anche con il loopback attivo, probabilmente però con il loopback disattivato accade qualcosa per cui firefox rimane in attesa per qualche decimo di secondo.
La domanda è, perchè cerca di accedere a quell'indirizzo? Ho trovato che sulla porta 16001 è in ascolto un certo server CCcam, qualcuno di voi ne sa qualcosa? Comunque forse cerca anche qualcos'altro, CCcam è il più gettonato su google ma non è detto che cerchi lui.
Emanuele
Se pensi di essere troppo piccolo per fare la differenza, prova a dormire con una zanzara -- Dalai Lama
connect(31, {sa_family=AF_INET, sin_port=htons(16001), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
l'errore -1 non è dovuto a loopback disattivato, infatti su quella porta non ci trova mai nessuno anche con il loopback attivo, probabilmente però con il loopback disattivato accade qualcosa per cui firefox rimane in attesa per qualche decimo di secondo.
La domanda è, perchè cerca di accedere a quell'indirizzo? Ho trovato che sulla porta 16001 è in ascolto un certo server CCcam, qualcuno di voi ne sa qualcosa? Comunque forse cerca anche qualcos'altro, CCcam è il più gettonato su google ma non è detto che cerchi lui.
Emanuele
Cercando in rete per CCcam server:
Edit:
Spesso capita a chi ha un server che scambia con altri peer che questi ultimi, per vari motivi, siano offline, poco affidabili e di fatto, da eliminare.
Togliendo le rispettive Cline e Fline, può succedere che sul nostro server vengano continuamente fatte richieste di connessione da parte dei peer che non hanno a loro volta tolto le Cline corrispondenti al nostro host-server con conseguente traffico inutile verso la nostra station.
Per questa ragione vi propongo uno script che funziona da firewall disabilitando tutte le richieste di accesso ad eccezione degli host che hanno una C-line valida nel nostro CCcam.cfg.
E' chiaro che questo sistema funziona perfettamente su sistemi di scambio ovvero filtra i client in base al nome host del proprio server corrispondente (pair). quindi i client che non fanno anche da server verranno automaticamente bloccati.
Questo è quanto ho trovato come spiegazione, anche se molto limitata.
poi aprite uno dei menù di firefox e vedrete che tenta di connettersi all'indirizzo 127.0.0.1:16001, tra l'altro la cosa strana è che passano due pacchetti, uno di andata e uno di ritorno, quindi sembra che qualcuno gli risponda pure ... ora se qualcuno non ci da spiegazioni migliori mi sa che andiamo sul paranormale
Emanuele
Se pensi di essere troppo piccolo per fare la differenza, prova a dormire con una zanzara -- Dalai Lama
Noto che la cosa la fà con ogni operazione fatta da firefox e dal suo menu a tendina.
Con tcpdump -i lo mi segna inevitabilmente questi due soli pacchetti, uno in entrata e l'altro in risposta.
La cosa si fà sempre più oscura.
#!/bin/sh
################################################## #############################
#
# Default firewall script for your Linux server
#
# This one is used for allowing peers access to your CCcam configuration. It can
# be used with other sharing protocols as well.
#
# See the examples at the CCCAM section
#
################################################## #############################
#
# Local Settings
#
# iptables Location - adjust if needed
IPT="/usr/sbin/iptables"
# Internet Interface
INET_IFACE="eth0"
# Localhost Interface
LO_IFACE="lo"
LO_IP="127.0.0.1"
flush_existing() {
# Flush Any Existing Rules or Chains
echo "Flushing Tables ..."
# Reset Default Policies
$IPT -P INPUT ACCEPT
$IPT -P FORWARD ACCEPT
$IPT -P OUTPUT ACCEPT
# Flush all rules
$IPT -F
# Erase all non-default chains
$IPT -X
}
create_chains() {
echo "Create custom rule chains ..."
# Create a chain to filter INVALID packets
$IPT -N bad_packets
# Create another chain to filter bad tcp packets
$IPT -N bad_tcp_packets
# Create separate chains for icmp, tcp (incoming and outgoing),
# and incoming udp packets.
$IPT -N icmp_packets
# Used for udp packets inbound from the Internet
$IPT -N udp_inbound
# Used to block outbound udp services from internal network
# Default to allow all
$IPT -N udp_outbound
# Used to allow inbound services if desired
# Default fail except for established sessions
$IPT -N tcp_inbound
# Used to block outbound services from internal network
# Default to allow all
$IPT -N tcp_outbound
# Used to allow CCcam services
# Default fail except for established sessions
$IPT --new cccam
}
populate_chains() {
echo "Populate custom rule chains ..."
# bad_packets chain
# Then check the tcp packets for additional problems
$IPT -A bad_packets -p tcp -j bad_tcp_packets
# All good, so return
$IPT -A bad_packets -p ALL -j RETURN
# bad_tcp_packets chain
#
# All tcp packets will traverse this chain.
# Every new connection attempt should begin with
# a syn packet. If it doesn't, it is likely a
# port scan. This drops packets in state
# NEW that are not flagged as syn packets.
# Stealth scans
$IPT -A bad_tcp_packets -p tcp --tcp-flags ALL NONE -j DROP
$IPT -A bad_tcp_packets -p tcp --tcp-flags ALL ALL -j DROP
$IPT -A bad_tcp_packets -p tcp --tcp-flags ALL FIN,URG,PSH -j DROP
$IPT -A bad_tcp_packets -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP
$IPT -A bad_tcp_packets -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
$IPT -A bad_tcp_packets -p tcp --tcp-flags SYN,FIN SYN,FIN -j DROP
# All good, so return
$IPT -A bad_tcp_packets -p tcp -j RETURN
# icmp_packets chain
#
# This chain is for inbound (from the Internet) icmp packets only.
# Type 8 (echo Request) is accepted by default
# Enable it if you want remote hosts to be able to reach you.
# 11 (Time Exceeded) is the only one accepted
# that would not already be covered by the established
# connection rule. Applied to INPUT on the external interface.
#
# See: http://www.ee.siue.edu/~rwalden/networking/icmp.html
# for more info on ICMP types.
#
# Note that the stateful settings allow replies to ICMP packets.
# These rules allow new packets of the specified types.
# ICMP packets should fit in a Layer 2 frame, thus they should
# never be fragmented. Fragmented ICMP packets are a typical sign
# of a denial of service attack.
#$IPT -A icmp_packets --fragment -p ICMP -j LOG \
#--log-prefix "ICMP Fragment: "
$IPT -A icmp_packets --fragment -p ICMP -j DROP
# Uncomment the LOG command if you want to log PING attempts
# $IPT -A icmp_packets -p ICMP -s 0/0 --icmp-type 8 -j LOG \
# --log-prefix "Ping detected: "
$IPT -A icmp_packets -p ICMP -s 0/0 --icmp-type 8 -j ACCEPT
# comment out above and uncomment below to drop pings without logging.
#$IPT -A icmp_packets -p ICMP -s 0/0 --icmp-type 8 -j DROP
# see ping reply packets
$IPT -A icmp_packets -p ICMP -s 0/0 --icmp-type 0 -j ACCEPT
# Time Exceeded
$IPT -A icmp_packets -p ICMP -s 0/0 --icmp-type 11 -j ACCEPT
# Not matched, so return so it will be logged
$IPT -A icmp_packets -p ICMP -j RETURN
# tcp & udp
# Identify ports at:
# http://www.chebucto.ns.ca/~rakerman/port-table.html
# http://www.iana.org/assignments/port-numbers
#
# ADD udp-based services here
#
# udp_inbound chain
# ports you want to accept udp packets on
# netbios/samba
$IPT -A udp_inbound -p udp -s 0/0 --destination-port 137 -j ACCEPT
$IPT -A udp_inbound -p udp -s 0/0 --destination-port 138 -j ACCEPT
# Network Time Protocol (NTP) Server
$IPT -A udp_inbound -p udp -s 0/0 --destination-port 123 -j ACCEPT
# External DHCP Server
# Allow DHCP client request packets inbound from external network
$IPT -A udp_inbound -p udp -s 0/0 --source-port 68 --destination-port 67 -j ACCEPT
# DNS in
#$IPT -A udp_inbound -p udp -s 0/0 --destination-port 53 -j ACCEPT
$IPT -A udp_inbound -p udp -s 0/0 --source-port 53 -j ACCEPT
# Not matched, so return for logging
$IPT -A udp_inbound -p udp -j RETURN
# udp_outbound chain
# ports you send udp packets to
# netbios/samba
$IPT -A udp_outbound -p udp -s 0/0 --destination-port 137 -j ACCEPT
$IPT -A udp_outbound -p udp -s 0/0 --destination-port 138 -j ACCEPT
# Network Time Protocol (NTP) Server
$IPT -A udp_outbound -p udp -s 0/0 --destination-port 123 -j ACCEPT
# DHCP out
$IPT -A udp_outbound -p udp -s 0/0 --destination-port 68 -j ACCEPT
# DNS out
$IPT -A udp_outbound -p udp -s 0/0 --destination-port 53 -j ACCEPT
# No match, so ACCEPT
# make this DROP if you want to block any other outbound udp traffic
$IPT -A udp_outbound -p udp -s 0/0 -j ACCEPT
# tcp_inbound chain
#
# This chain is used to allow inbound connections to the SLUG
# smb
$IPT -A tcp_inbound -p tcp -s 0/0 --destination-port 137 -j ACCEPT
$IPT -A tcp_inbound -p tcp -s 0/0 --destination-port 139 -j ACCEPT
$IPT -A tcp_inbound -p tcp -s 0/0 --destination-port 445 -j ACCEPT
# HTTP
$IPT -A tcp_inbound -p tcp -s 0/0 --destination-port 80 -j ACCEPT
# FTP
$IPT -A tcp_inbound -p tcp -s 0/0 --destination-port ftp -j ACCEPT
# Passive
$IPT -A tcp_inbound -p tcp -s 0/0 --destination-port 33201:33210 -j ACCEPT
# Ctorrent incoming ports. Uncomment if you use ctorrent.
# $IPT -A tcp_inbound -p tcp -s 0/0 --destination-port 2706:2700 -j ACCEPT
# DNS
$IPT -A tcp_inbound -p tcp -s 0/0 --destination-port 53 -j ACCEPT
# sshd
$IPT -A tcp_inbound -p tcp -s 0/0 --destination-port 22 -j ACCEPT
# If you have 2 ssh daemons running, add the second here
# $IPT -A tcp_inbound -p tcp -s 0/0 --destination-port 999 -j ACCEPT
# telnet (not normally used in Openslug)
# $IPT -A tcp_inbound -p tcp -s 0/0 --destination-port 23 -j ACCEPT
################################################## #############################
# CCCAM SECTION - These are examples!
# Change the portnumbers accordingly to your configuration!
# 12000 = Default CCcam port
# 16001 = Default WEBINFO port
################################################## #############################
# WEBINFO - Allow access to CCcam WEBINFO from the local network:
#
# In this case we use 192.168.1.x with a subnetmask of 255.255.255.0 (/24)
# Change it to your local network configuration
#
$IPT -A cccam -p tcp -s 192.168.1.0/24 --destination-port 16001 -j ACCEPT
# SERVER - Allow acces to the CCcam server
#
# These examples will show how you can allow a hostname, ipaddress or range to connect
# to the CCcam server instance
#
$IPT -A cccam -p tcp -s 192.168.1.0/24 --destination-port 12000 -j ACCEPT
$IPT -A cccam -p tcp -s hostname.dnsname.extension --destination-port 12000 -j ACCEPT
$IPT -A cccam -p tcp -s 83.149.116.40 --destination-port 12000 -j ACCEPT
# SERVER - Disabled peers
#
# With this example you can block a hostname, ipaddress or range to connect to
# your server. After a firewall restart it will happen instanly.
#
$IPT -A cccam -p tcp -s badclient.domainname.extension --destination-port 12000 -j DROP
$IPT -A cccam -p tcp -s 217.148.84.25 --destination-port 12000 -j DROP
# CCcam - Default disabled
#
# Default CCCAM server and webinfo access is disabled.
#
$IPT -A cccam -p tcp -s 0/0 --destination-port 16001 -j DROP
$IPT -A cccam -p tcp -s 0/0 --destination-port 12000 -j DROP
# Not matched, so return so it will be logged
$IPT -A tcp_inbound -p tcp -j RETURN
# tcp_outbound chain
#
# This chain controlls what tcp traffic is allowed out
# http
$IPT -A tcp_outbound -p tcp -s 0/0 --destination-port 80 -j ACCEPT
# DNS
$IPT -A tcp_outbound -p tcp -s 0/0 --destination-port 53 -j ACCEPT
# sshd
$IPT -A tcp_outbound -p tcp -s 0/0 --destination-port 22 -j ACCEPT
# No match, so ACCEPT
# Note, you could make this DROP to block any other outbound traffic
$IPT -A tcp_outbound -p tcp -s 0/0 -j ACCEPT
}
process_input_chain() {
echo "Process INPUT chain ..."
# Allow all on localhost interface
$IPT -A INPUT -p ALL -i $LO_IFACE -j ACCEPT
# Drop bad packets
$IPT -A INPUT -p ALL -j bad_packets
# ******************************
# Inbound Internet Packet Rules
# packet filter accepts inbound packets that are replies to an outbound connection
# this blocks all new connection attempts except to those allowed below
$IPT -A INPUT -p tcp -i $INET_IFACE ! --syn -j ACCEPT
# Route the rest to the appropriate user chain
$IPT -A INPUT -p tcp -i $INET_IFACE -j tcp_inbound
$IPT -A INPUT -p tcp -i $INET_IFACE -j cccam
$IPT -A INPUT -p udp -i $INET_IFACE -j udp_inbound
$IPT -A INPUT -p ICMP -i $INET_IFACE -j icmp_packets
# Drop without logging broadcasts that get this far.
# Comment this line if testing new rules that impact
# broadcast protocols.
#$IPT -A INPUT -m pkttype --pkt-type broadcast -j DROP
}
process_output_chain() {
echo "Process OUTPUT chain ..."
# Generally trust the firewall on output
# Localhost
$IPT -A OUTPUT -p ALL -s $LO_IP -j ACCEPT
$IPT -A OUTPUT -p ALL -o $LO_IFACE -j ACCEPT
# If you want to block outbound connections, uncomment first section below, comment
# out second section, and add rules to tcp_outbound/udp_outbound
# To internet - filtered
#$IPT -A OUTPUT -p tcp -o $INET_IFACE -j tcp_outbound
#$IPT -A OUTPUT -p udp -o $INET_IFACE -j udp_outbound
# To internet - unfiltered
$IPT -A OUTPUT -p ALL -o $INET_IFACE -j ACCEPT
}
case "$1" in
start)
echo "Starting iptables firewall"
# Only needed on NSLU2 - Disable them on regular Linux installations:
modprobe ip_tables
modprobe iptable_filter
flush_existing
create_chains
populate_chains
process_input_chain
process_output_chain
;;
stop)
echo "Stopping iptables firewall"
flush_existing
rmmod ip_tables
rmmod iptable_filter
echo "Firewall rules flushed"
;;
reload|force-reload)
echo "Reloading iptables firewall"
flush_existing
create_chains
populate_chains
process_input_chain
process_output_chain
;;
restart)
echo "Restarting iptables firewall"
flush_existing
create_chains
populate_chains
process_input_chain
process_output_chain
;;
*)
echo "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart}"
exit 1
esac
exit 0
Nel frattempo continuo a cercare per vedere con più precisione di cosa si tratta, mi ha davvero incuriosito questa cosa.
poi aprite uno dei menù di firefox e vedrete che tenta di connettersi all'indirizzo 127.0.0.1:16001, tra l'altro la cosa strana è che passano due pacchetti, uno di andata e uno di ritorno, quindi sembra che qualcuno gli risponda pure ... ora se qualcuno non ci da spiegazioni migliori mi sa che andiamo sul paranormale
Emanuele
Il pacchetto di risposta è la 'connection refused' che indica che la porta è chiusa.
Puoi verificarlo provando un telnet a localhost su una qualunque porta (chiusa) e guardando l'output (identico) di tcpdump.