Abills для Wi-Fi

Ответить
yava88
Сообщения: 2
Зарегистрирован: Вт авг 06, 2013 3:49 am

Abills для Wi-Fi

Сообщение yava88 » Вт авг 06, 2013 4:44 am

приветсвую!

Делаем тестовую конфигурацию с целью что-есть-такое Abills. Возникли вопросы, буду благодарен за ответы.
Имеется:

Код: Выделить всё

#uname -a
Linux ubuntu-abills 3.5.0-36-generic #57~precise1-Ubuntu SMP Thu Jun 20 18:21:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

# freeradius -v
freeradius: FreeRADIUS Version 2.2.0, for host x86_64-pc-linux-gnu, built on Jul 26 2013 at 12:12:09
abills 0.54
настроен PPPoE-server - клиенты логинится, все ок.
1. Есть некоторые клиенты которые будут работать по Wi-Fi. Приемлемым вариантом является 802.1x. Аутентификатор - точка Asus Wl500gpv2. У него в настройках есть кроме прочих(WEP/WPA2-PSK/...) два пункта: "WPA2-Enterprise" и "Radius with 802.1X". Разве это разные на практике вещи? Насколько я понял, WPA2-Enterprise(WPA2-EAP) без RADIUS'а быть не может. Причем если выбрать "Radius with 802.1X" - то ничего работать не будет (asus не будет отправлять request'ы).

2. Ок, используем "WPA2-Enterprise". Далее привожу конфиги.
radiusd.conf

Код: Выделить всё

#Freeradius version 2.x.x
prefix = /usr/local
exec_prefix = ${prefix}
sysconfdir = ${prefix}/etc
localstatedir = /var
sbindir = ${exec_prefix}/sbin
logdir = /var/log
raddbdir = ${sysconfdir}/raddb
radacctdir = ${logdir}/radacct
name = radiusd

#  Location of config and logfiles.
confdir = ${raddbdir}
run_dir = ${localstatedir}/run/${name}

# Should likely be ${localstatedir}/lib/radiusd
db_dir = ${raddbdir}

libdir = /usr/local/lib/freeradius-2.1.6
pidfile = ${run_dir}/${name}.pid

#chroot = /path/to/chroot/directory

user = freerad
group = freerad

max_request_time = 30

cleanup_delay = 5

max_requests = 512000

listen {
	type = auth
	ipaddr = *
	port = 0
#	interface = eth0
#	clients = per_socket_clients
}

listen {
	ipaddr = *
#	ipv6addr = ::
	port = 0
	type = acct
#	interface = eth0
#	clients = per_socket_clients
}

hostname_lookups = no
allow_core_dumps = no
regular_expressions	= yes
extended_expressions	= yes
log {
	#
	destination = files
	file = ${logdir}/radius.log

	syslog_facility = daemon

	stripped_names = no

	auth = yes
	auth_badpass = yes
	auth_goodpass = yes
}

checkrad = ${sbindir}/checkrad

security {
	max_attributes = 200
	reject_delay = 1
	status_server = yes
}

proxy_requests  = no
#$INCLUDE proxy.conf


$INCLUDE clients.conf


thread pool {
	start_servers = 5
	max_servers = 128
	min_spare_servers = 3
	max_spare_servers = 10
	max_requests_per_server = 0
}


#-----------------------------MODULES------------------------
modules {
	$INCLUDE ${confdir}/modules/

	$INCLUDE eap.conf
#	$INCLUDE sql.conf
#	$INCLUDE sql/mysql/counter.conf
#	$INCLUDE sqlippool.conf


mschap {
    authtype = MS-CHAP
    use_mppe = yes
   require_encryption = yes
    require_strong = yes
}


#abills_preauth 
exec abills_preauth { 
  program = "/usr/abills/libexec/rauth.pl pre_auth" 
  wait = yes 
  input_pairs = request 
  shell_escape = yes 
  #output = no 
  output_pairs = config 
} 

#abills_postauth 
exec abills_postauth { 
  program = "/usr/abills/libexec/rauth.pl post_auth" 
  wait = yes 
  input_pairs = request 
  shell_escape = yes 
  #output = no 
  output_pairs = config 
} 

#abills_auth 
exec abills_auth { 
  program = "/usr/abills/libexec/rauth.pl" 
  wait = yes 
  input_pairs = request 
  shell_escape = yes 
  output = no 
  output_pairs = reply 
} 

#abills_acc 
  exec abills_acc { 
  program = "/usr/abills/libexec/racct.pl" 
  wait = yes 
  input_pairs = request 
  shell_escape = yes 
  output = no 
  output_pairs = reply 
}

exec pre_auth { 
  wait = yes 
  program = "/usr/abills/libexec/rauth.pl pre_auth" 
  input_pairs = request 
  output_pairs = config 
}

exec post_auth {
  wait = yes
  program = "/usr/abills/libexec/rauth.pl post_auth"
  input_pairs = request
  output_pairs = config
}

}
#-----------------------------MODULES FINISHED --------------

authorize {
    preprocess
    #abills_preauth 
    perl
    #mschap
    #eap
    #files
    #abills_auth 
  }


authenticate {
        Auth-Type PAP {
                pap
        }
        Auth-Type CHAP {
                chap
        }
        Auth-Type MS-CHAP {
                mschap
        }
	eap
	perl
}

post-auth {
  Post-Auth-Type REJECT {
	#post-auth 
	#abills_postauth
	perl
  }
}


preacct { 
  preprocess 
  perl
  abills_acc
} 

accounting {
# don't use simultaneously 'perl' and files
   detail
   perl
}


instantiate {
	exec
#	expr
#	daily
	expiration
	logintime

	#redundant redundant_sql {
	#	sql1
	#	sql2
	#}
}


$INCLUDE policy.conf

#$INCLUDE sites-enabled/abills_default
В различных wiki-статьях разделы (например authorize) выглядят по разному. Если в приведенном конфиге что-либо некорректно - прошу указать.

eap.conf

Код: Выделить всё

	eap {

		default_eap_type = md5
		timer_expire     = 60
		ignore_unknown_eap_types = no
		cisco_accounting_username_bug = no
		max_sessions = 4096
		md5 {
		}
		leap {
		}
		gtc {
			#challenge = "Password: "
			auth_type = PAP
		}

		tls {
			certdir = ${confdir}/certs
			cadir = ${confdir}/certs
			private_key_password = whatever
			private_key_file = ${certdir}/server.key
			certificate_file = ${certdir}/server.pem
			CA_file = ${cadir}/ca.pem
			dh_file = ${certdir}/dh
			random_file = /dev/urandom
			fragment_size = 1024
			include_length = yes
			CA_path = ${cadir}
		#       check_cert_issuer = "/C=GB/ST=Berkshire/L=Newbury/O=My Company Ltd"
		#	check_cert_cn = %{User-Name}
		#
			cipher_list = "DEFAULT"
			make_cert_command = "${certdir}/bootstrap"
		##	ecdh_curve = "prime256v1"
			cache {
			      enable = no
			      lifetime = 24 # hours
			      max_entries = 255
			}
			verify {
		#		tmpdir = /tmp/radiusd
		#		client = "/path/to/openssl verify -CApath ${..CA_path} %{TLS-Client-Cert-Filename}"
			}

			ocsp {
			      enable = no
			      override_cert_url = yes
			      url = "http://127.0.0.1/ocsp/"
			}
		}
	#	ttls {
	#		default_eap_type = md5
	#		copy_request_to_tunnel = no
	#		use_tunneled_reply = no
	#		virtual_server = "inner-tunnel"
	#		include_length = yes
	#	}

		peap {
			default_eap_type = mschapv2
			copy_request_to_tunnel = no
			use_tunneled_reply = no
			proxy_tunneled_request_as_eap = yes
			virtual_server = "inner-tunnel"
			soh = no
			soh_virtual_server = "soh-server"
		}

		mschapv2 {
	#		send_error = no
		}
	}
clients.conf

Код: Выделить всё

#######################################################################
client localhost {
	ipaddr = 127.0.0.1
	secret = testing123
	shortname = test
}

client Asus {
	ipaddr = 192.168.105.2
	secret = testing123
}
в web-интерфейсе "Сервер доступа" параметры

Код: Выделить всё

Acct-Interim-Interval=120,
Tunnel-Medium-Type=IEEE-802,
Tunnel-Private-Group-Id=20,
Tunnel-Type=VLAN
3. запуск:

Код: Выделить всё

# /usr/sbin/freeradius -X
FreeRADIUS Version 2.2.0, for host x86_64-pc-linux-gnu, built on Jul 26 2013 at 12:12:09
Copyright (C) 1999-2012 The FreeRADIUS server project and contributors. 
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A 
PARTICULAR PURPOSE. 
You may redistribute copies of FreeRADIUS under the terms of the 
GNU General Public License v2. 
Starting - reading configuration files ...
including configuration file /etc/freeradius/radiusd.conf
including configuration file /etc/freeradius/clients.conf
including files in directory /etc/freeradius/modules/
including configuration file /etc/freeradius/modules/smbpasswd
including configuration file /etc/freeradius/modules/pam
including configuration file /etc/freeradius/modules/always
including configuration file /etc/freeradius/modules/files
including configuration file /etc/freeradius/modules/wimax
including configuration file /etc/freeradius/modules/cui
including configuration file /etc/freeradius/modules/detail.example.com
including configuration file /etc/freeradius/modules/detail.log
including configuration file /etc/freeradius/modules/dhcp_sqlippool
including configuration file /etc/freeradius/modules/redis
including configuration file /etc/freeradius/modules/unix
including configuration file /etc/freeradius/modules/mac2ip
including configuration file /etc/freeradius/modules/digest
including configuration file /etc/freeradius/modules/linelog
including configuration file /etc/freeradius/modules/chap
including configuration file /etc/freeradius/modules/etc_group
including configuration file /etc/freeradius/modules/rediswho
including configuration file /etc/freeradius/modules/ippool
including configuration file /etc/freeradius/modules/sradutmp
including configuration file /etc/freeradius/modules/otp
including configuration file /etc/freeradius/modules/replicate
including configuration file /etc/freeradius/modules/ldap
including configuration file /etc/freeradius/modules/echo
including configuration file /etc/freeradius/modules/attr_filter
including configuration file /etc/freeradius/modules/radutmp
including configuration file /etc/freeradius/modules/expiration
including configuration file /etc/freeradius/modules/perl
including configuration file /etc/freeradius/modules/attr_rewrite
including configuration file /etc/freeradius/modules/detail
including configuration file /etc/freeradius/modules/ntlm_auth
including configuration file /etc/freeradius/modules/mschap
including configuration file /etc/freeradius/modules/inner-eap
including configuration file /etc/freeradius/modules/dynamic_clients
including configuration file /etc/freeradius/modules/opendirectory
including configuration file /etc/freeradius/modules/exec
including configuration file /etc/freeradius/modules/acct_unique
including configuration file /etc/freeradius/modules/preprocess
including configuration file /etc/freeradius/modules/soh
including configuration file /etc/freeradius/modules/pap
including configuration file /etc/freeradius/modules/counter
including configuration file /etc/freeradius/modules/krb5
including configuration file /etc/freeradius/modules/smsotp
including configuration file /etc/freeradius/modules/sqlcounter_expire_on_login
including configuration file /etc/freeradius/modules/mac2vlan
including configuration file /etc/freeradius/modules/radrelay
including configuration file /etc/freeradius/modules/realm
including configuration file /etc/freeradius/modules/passwd
including configuration file /etc/freeradius/modules/policy
including configuration file /etc/freeradius/modules/sql_log
including configuration file /etc/freeradius/modules/checkval
including configuration file /etc/freeradius/modules/logintime
including configuration file /etc/freeradius/modules/cache
including configuration file /etc/freeradius/modules/expr
including configuration file /etc/freeradius/eap.conf
including configuration file /etc/freeradius/policy.conf
main {
	user = "freerad"
	group = "freerad"
	allow_core_dumps = no
}
including dictionary file /etc/freeradius/dictionary
main {
	name = "radiusd"
	prefix = "/usr/local"
	localstatedir = "/var"
	sbindir = "/usr/local/sbin"
	logdir = "/var/log"
	run_dir = "/var/run/radiusd"
	libdir = "/usr/local/lib/freeradius-2.1.6"
	radacctdir = "/var/log/radacct"
	hostname_lookups = no
	max_request_time = 30
	cleanup_delay = 5
	max_requests = 512000
	pidfile = "/var/run/radiusd/radiusd.pid"
	checkrad = "/usr/local/sbin/checkrad"
	debug_level = 0
	proxy_requests = no
 log {
	stripped_names = no
	auth = yes
	auth_badpass = yes
	auth_goodpass = yes
 }
 security {
	max_attributes = 200
	reject_delay = 1
	status_server = yes
 }
}
radiusd: #### Loading Realms and Home Servers ####
radiusd: #### Loading Clients ####
 client localhost {
	ipaddr = 127.0.0.1
	require_message_authenticator = no
	secret = "testing123"
	shortname = "test"
 }

 client Asus {
	ipaddr = 192.168.105.2
	require_message_authenticator = no
	secret = "testing123"
 }
radiusd: #### Instantiating modules ####
 instantiate {
 Module: Linked to module rlm_exec
 Module: Instantiating module "exec" from file /etc/freeradius/modules/exec
  exec {
	wait = no
	input_pairs = "request"
	shell_escape = yes
  }
 Module: Linked to module rlm_expiration
 Module: Instantiating module "expiration" from file /etc/freeradius/modules/expiration
  expiration {
	reply-message = "Password Has Expired  "
  }
 Module: Linked to module rlm_logintime
 Module: Instantiating module "logintime" from file /etc/freeradius/modules/logintime
  logintime {
	reply-message = "You are calling outside your allowed timespan  "
	minimum-timeout = 60
  }
 }
radiusd: #### Loading Virtual Servers ####
server { # from file /etc/freeradius/radiusd.conf
 modules {
  Module: Creating Auth-Type = perl
  Module: Creating Post-Auth-Type = REJECT
 Module: Checking authenticate {...} for more modules to load
 Module: Linked to module rlm_pap
 Module: Instantiating module "pap" from file /etc/freeradius/modules/pap
  pap {
	encryption_scheme = "auto"
	auto_header = no
  }
 Module: Linked to module rlm_chap
 Module: Instantiating module "chap" from file /etc/freeradius/modules/chap
 Module: Linked to module rlm_mschap
 Module: Instantiating module "mschap" from file /etc/freeradius/modules/mschap
  mschap {
	use_mppe = yes
	require_encryption = yes
	require_strong = yes
	with_ntdomain_hack = no
	allow_retry = yes
  }
 Module: Linked to module rlm_eap
 Module: Instantiating module "eap" from file /etc/freeradius/eap.conf
  eap {
	default_eap_type = "md5"
	timer_expire = 60
	ignore_unknown_eap_types = no
	cisco_accounting_username_bug = no
	max_sessions = 4096
  }
 Module: Linked to sub-module rlm_eap_md5
 Module: Instantiating eap-md5
 Module: Linked to sub-module rlm_eap_leap
 Module: Instantiating eap-leap
 Module: Linked to sub-module rlm_eap_gtc
 Module: Instantiating eap-gtc
   gtc {
	challenge = "Password: "
	auth_type = "PAP"
   }
 Module: Linked to sub-module rlm_eap_tls
 Module: Instantiating eap-tls
   tls {
	rsa_key_exchange = no
	dh_key_exchange = yes
	rsa_key_length = 512
	dh_key_length = 512
	verify_depth = 0
	CA_path = "/etc/freeradius/certs"
	pem_file_type = yes
	private_key_file = "/etc/freeradius/certs/server.key"
	certificate_file = "/etc/freeradius/certs/server.pem"
	CA_file = "/etc/freeradius/certs/ca.pem"
	private_key_password = "whatever"
	dh_file = "/etc/freeradius/certs/dh"
	random_file = "/dev/urandom"
	fragment_size = 1024
	include_length = yes
	check_crl = no
	cipher_list = "DEFAULT"
	make_cert_command = "/etc/freeradius/certs/bootstrap"
	ecdh_curve = "prime256v1"
    cache {
	enable = no
	lifetime = 24
	max_entries = 255
    }
    verify {
    }
    ocsp {
	enable = no
	override_cert_url = yes
	url = "http://127.0.0.1/ocsp/"
	use_nonce = yes
	timeout = 0
	softfail = no
    }
   }
 Module: Linked to sub-module rlm_eap_peap
 Module: Instantiating eap-peap
   peap {
	default_eap_type = "mschapv2"
	copy_request_to_tunnel = no
	use_tunneled_reply = no
	proxy_tunneled_request_as_eap = yes
	virtual_server = "inner-tunnel"
	soh = no
	soh_virtual_server = "soh-server"
   }
 Module: Linked to sub-module rlm_eap_mschapv2
 Module: Instantiating eap-mschapv2
   mschapv2 {
	with_ntdomain_hack = no
	send_error = no
   }
 Module: Linked to module rlm_perl
 Module: Instantiating module "perl" from file /etc/freeradius/modules/perl
  perl {
	module = "/usr/abills/libexec/rlm_perl.pl"
	func_authorize = "authorize"
	func_authenticate = "authenticate"
	func_accounting = "accounting"
	func_preacct = "preacct"
	func_checksimul = "checksimul"
	func_detach = "detach"
	func_xlat = "xlat"
	func_pre_proxy = "pre_proxy"
	func_post_proxy = "post_proxy"
	func_post_auth = "post_auth"
	func_recv_coa = "recv_coa"
	func_send_coa = "send_coa"
  }
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = "en_US:en",
	LC_ALL = (unset),
	LC_PAPER = "ru_RU.UTF-8",
	LC_ADDRESS = "ru_RU.UTF-8",
	LC_MONETARY = "ru_RU.UTF-8",
	LC_NUMERIC = "ru_RU.UTF-8",
	LC_TELEPHONE = "ru_RU.UTF-8",
	LC_IDENTIFICATION = "ru_RU.UTF-8",
	LC_MEASUREMENT = "ru_RU.UTF-8",
	LC_TIME = "ru_RU.UTF-8",
	LC_NAME = "ru_RU.UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
 Module: Checking authorize {...} for more modules to load
 Module: Linked to module rlm_preprocess
 Module: Instantiating module "preprocess" from file /etc/freeradius/modules/preprocess
  preprocess {
	huntgroups = "/etc/freeradius/huntgroups"
	hints = "/etc/freeradius/hints"
	with_ascend_hack = no
	ascend_channels_per_line = 23
	with_ntdomain_hack = no
	with_specialix_jetstream_hack = no
	with_cisco_vsa_hack = no
	with_alvarion_vsa_hack = no
  }
reading pairlist file /etc/freeradius/huntgroups
reading pairlist file /etc/freeradius/hints
 Module: Checking preacct {...} for more modules to load
 Module: Instantiating module "abills_acc" from file /etc/freeradius/radiusd.conf
  exec abills_acc {
	wait = yes
	program = "/usr/abills/libexec/racct.pl"
	input_pairs = "request"
	output_pairs = "reply"
	shell_escape = yes
  }
 Module: Checking accounting {...} for more modules to load
 Module: Linked to module rlm_detail
 Module: Instantiating module "detail" from file /etc/freeradius/modules/detail
  detail {
	detailfile = "/var/log/radacct/%{%{Packet-Src-IP-Address}:-%{Packet-Src-IPv6-Address}}/detail-%Y%m%d"
	header = "%t"
	detailperm = 384
	dirperm = 493
	locking = no
	log_packet_header = no
  }
 Module: Checking post-auth {...} for more modules to load
 } # modules
} # server
radiusd: #### Opening IP addresses and Ports ####
listen {
	type = "auth"
	ipaddr = *
	port = 0
}
listen {
	type = "acct"
	ipaddr = *
	port = 0
}
Listening on authentication address * port 1812
Listening on accounting address * port 1813
Ready to process requests.

4. Попытка подключения (Android-телефон) - продолжительное время "Connecting..." потом "Disconnected"

Код: Выделить всё

rad_recv: Access-Request packet from host 192.168.105.2 port 1026, id=0, length=123
	User-Name = "vasya"
	NAS-IP-Address = 192.168.105.2
	Called-Station-Id = "002354a782c7"
	Calling-Station-Id = "40fc895e080e"
	NAS-Identifier = "002354a782c7"
	NAS-Port = 24
	Framed-MTU = 1400
	NAS-Port-Type = Wireless-802.11
	EAP-Message = 0x0200000a017661737961
	Message-Authenticator = 0xb89e63734502ce142f600b058c844e8a
# Executing section authorize from file /etc/freeradius/radiusd.conf
+- entering group authorize {...}
++[preprocess] returns ok
rlm_perl: Added pair NAS-Port-Type = Wireless-802.11
rlm_perl: Added pair Calling-Station-Id = 40fc895e080e
rlm_perl: Added pair Called-Station-Id = 002354a782c7
rlm_perl: Added pair Message-Authenticator = 0xb89e63734502ce142f600b058c844e8a
rlm_perl: Added pair User-Name = vasya
rlm_perl: Added pair NAS-Identifier = 002354a782c7
rlm_perl: Added pair EAP-Message = 0x0200000a017661737961
rlm_perl: Added pair NAS-IP-Address = 192.168.105.2
rlm_perl: Added pair NAS-Port = 24
rlm_perl: Added pair Framed-MTU = 1400
rlm_perl: Added pair Acct-Interim-Interval = 120
rlm_perl: Added pair Session-Timeout = 2204644
rlm_perl: Added pair Tunnel-Type = VLAN
rlm_perl: Added pair Tunnel-Medium-Type = IEEE-802
rlm_perl: Added pair Framed-IP-Address = 192.168.105.126
rlm_perl: Added pair Framed-IP-Netmask = 255.255.255.255
rlm_perl: Added pair Tunnel-Private-Group-Id = 20
rlm_perl: Added pair Cleartext-Password = 123456
++[perl] returns ok
WARNING: Please update your configuration, and remove 'Auth-Type = Local'
WARNING: Use the PAP or CHAP modules instead.
No User-Password or CHAP-Password attribute in the request.
Cannot perform authentication.
Failed to authenticate the user.
Login incorrect: [vasya/<no User-Password attribute>] (from client Asus port 24 cli 40fc895e080e)
Using Post-Auth-Type REJECT
# Executing group from file /etc/freeradius/radiusd.conf
+- entering group REJECT {...}
rlm_perl: Added pair NAS-Port-Type = Wireless-802.11
rlm_perl: Added pair Called-Station-Id = 002354a782c7
rlm_perl: Added pair Calling-Station-Id = 40fc895e080e
rlm_perl: Added pair Message-Authenticator = 0xb89e63734502ce142f600b058c844e8a
rlm_perl: Added pair User-Name = vasya
rlm_perl: Added pair NAS-Identifier = 002354a782c7
rlm_perl: Added pair EAP-Message = 0x0200000a017661737961
rlm_perl: Added pair NAS-Port = 24
rlm_perl: Added pair NAS-IP-Address = 192.168.105.2
rlm_perl: Added pair Framed-MTU = 1400
rlm_perl: Added pair Acct-Interim-Interval = 120
rlm_perl: Added pair Session-Timeout = 2204644
rlm_perl: Added pair Framed-IP-Address = 192.168.105.126
rlm_perl: Added pair Tunnel-Medium-Type = IEEE-802
rlm_perl: Added pair Tunnel-Type = VLAN
rlm_perl: Added pair Framed-IP-Netmask = 255.255.255.255
rlm_perl: Added pair Tunnel-Private-Group-Id = 20
rlm_perl: Added pair Cleartext-Password = 123456
rlm_perl: Added pair Post-Auth-Type = REJECT
++[perl] returns ok
Delaying reject of request 0 for 1 seconds
Going to the next request
Waking up in 0.9 seconds.
Sending delayed reject for request 0
Sending Access-Reject of id 0 to 192.168.105.2 port 1026
	Acct-Interim-Interval = 120
	Session-Timeout = 2204644
	Framed-IP-Address = 192.168.105.126
	Tunnel-Medium-Type:0 = IEEE-802
	Tunnel-Type:0 = VLAN
	Framed-IP-Netmask = 255.255.255.255
	Tunnel-Private-Group-Id:0 = "20"
Waking up in 4.9 seconds.
Cleaning up request 0 ID 0 with timestamp +37
Ready to process requests.
Коннекта нету ((( и особенно смущает:

Код: Выделить всё

...
rlm_perl: Added pair Cleartext-Password = 123456
++[perl] returns ok
...
No User-Password or CHAP-Password attribute in the request.
...

Ответить