moved into main for pisi 2.0

This commit is contained in:
2015-07-04 15:10:56 +03:00
parent a421b3e735
commit 44aa282132
76 changed files with 10675 additions and 0 deletions
@@ -0,0 +1,36 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt
from pisi.actionsapi import autotools
from pisi.actionsapi import pisitools
from pisi.actionsapi import shelltools
from pisi.actionsapi import get
def build():
shelltools.cd("wpa_supplicant")
#Enable syslog output
cflags = get.CFLAGS() + " -DCONFIG_DEBUG_SYSLOG"
shelltools.export("CFLAGS", cflags)
autotools.make("V=1")
autotools.make("eapol_test")
def install():
shelltools.cd("wpa_supplicant")
for bin in ["wpa_supplicant", "wpa_cli", "wpa_passphrase", "eapol_test"]:
pisitools.dosbin(bin)
# Install dbus files
pisitools.insinto("/usr/share/dbus-1/system-services", "dbus/*.service")
pisitools.insinto("/etc/dbus-1/system.d", "dbus/dbus-wpa_supplicant.conf", "wpa_supplicant.conf")
pisitools.doman("doc/docbook/*.5")
pisitools.doman("doc/docbook/*.8")
pisitools.newdoc("wpa_supplicant.conf", "wpa_supplicant.conf.example")
pisitools.dodoc("ChangeLog", "../COPYING", "eap_testing.txt", "../README", "todo.txt")
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from comar.service import *
serviceType = "local"
serviceDefault = "off" #NM starts wpa_supp automatically. Use at your own risk if you start manually
serviceDesc = _({"en": "WPA Daemon",
"tr": "WPA Hizmeti"})
PIDFILE = "/run/wpa_supplicant.pid"
@synchronized
def start():
startService(command="/usr/sbin/wpa_supplicant",
args="-WuB -P%s %s" % (PIDFILE, config.get("OPTS", "")),
pidfile=PIDFILE,
donotify=True)
@synchronized
def stop():
stopService(pidfile=PIDFILE,
donotify=True)
def status():
return isServiceRunning(PIDFILE)
@@ -0,0 +1,52 @@
From dea50507861b79f522c70500fe978072f143af8f Mon Sep 17 00:00:00 2001
From: Jouni Malinen <jouni.malinen@atheros.com>
Date: Fri, 12 Nov 2010 18:31:56 +0200
Subject: [PATCH 1/3] AP: Verify that HT40 secondary channel is supported
Refuse to enable HT40 mode AP unless both the primary and secondary
channels are enabled for AP use.
(cherry picked from commit 8ea3dd21d2e8b760612af0c7b6a3bb5b89ba7304)
---
src/ap/hw_features.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index 0159c72..7fc5b83 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -642,6 +642,32 @@ int hostapd_select_hw_mode(struct hostapd_iface *iface)
break;
}
}
+ if (ok && iface->conf->secondary_channel) {
+ int sec_ok = 0;
+ int sec_chan = iface->conf->channel +
+ iface->conf->secondary_channel * 4;
+ for (j = 0; j < iface->current_mode->num_channels; j++) {
+ struct hostapd_channel_data *chan =
+ &iface->current_mode->channels[j];
+ if (!(chan->flag & HOSTAPD_CHAN_DISABLED) &&
+ (chan->chan == sec_chan)) {
+ sec_ok = 1;
+ break;
+ }
+ }
+ if (!sec_ok) {
+ hostapd_logger(iface->bss[0], NULL,
+ HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_WARNING,
+ "Configured HT40 secondary channel "
+ "(%d) not found from the channel list "
+ "of current mode (%d) %s",
+ sec_chan, iface->current_mode->mode,
+ hostapd_hw_mode_txt(
+ iface->current_mode->mode));
+ ok = 0;
+ }
+ }
if (iface->conf->channel == 0) {
/* TODO: could request a scan of neighboring BSSes and select
* the channel automatically */
--
1.7.3.4
@@ -0,0 +1,16 @@
diff -up wpa_supplicant-0.7.3/wpa_supplicant/wpa_supplicant.c.assoc-timeout wpa_supplicant-0.7.3/wpa_supplicant/wpa_supplicant.c
--- wpa_supplicant-0.7.3/wpa_supplicant/wpa_supplicant.c.assoc-timeout 2010-09-07 10:43:39.000000000 -0500
+++ wpa_supplicant-0.7.3/wpa_supplicant/wpa_supplicant.c 2010-12-07 18:57:45.163457000 -0600
@@ -1262,10 +1262,10 @@ void wpa_supplicant_associate(struct wpa
if (assoc_failed) {
/* give IBSS a bit more time */
- timeout = ssid->mode == WPAS_MODE_IBSS ? 10 : 5;
+ timeout = ssid->mode == WPAS_MODE_IBSS ? 20 : 10;
} else if (wpa_s->conf->ap_scan == 1) {
/* give IBSS a bit more time */
- timeout = ssid->mode == WPAS_MODE_IBSS ? 20 : 10;
+ timeout = ssid->mode == WPAS_MODE_IBSS ? 20 : 20;
}
wpa_supplicant_req_auth_timeout(wpa_s, timeout, 0);
}
@@ -0,0 +1,49 @@
--- wpa_supplicant-0.6.3/src/utils/wpa_debug.c.flush-debug 2007-07-30 23:15:34.000000000 -0400
+++ wpa_supplicant-0.6.3/src/utils/wpa_debug.c 2007-07-30 23:17:06.000000000 -0400
@@ -157,6 +157,7 @@ void wpa_debug_print_timestamp(void)
if (out_file) {
fprintf(out_file, "%ld.%06u: ", (long) tv.sec,
(unsigned int) tv.usec);
+ fflush(out_file);
} else
#endif /* CONFIG_DEBUG_FILE */
printf("%ld.%06u: ", (long) tv.sec, (unsigned int) tv.usec);
@@ -185,6 +186,7 @@ void wpa_printf(int level, char *fmt, ..
if (out_file) {
vfprintf(out_file, fmt, ap);
fprintf(out_file, "\n");
+ fflush(out_file);
} else {
#endif /* CONFIG_DEBUG_FILE */
vprintf(fmt, ap);
@@ -217,6 +219,7 @@ static void _wpa_hexdump(int level, cons
fprintf(out_file, " [REMOVED]");
}
fprintf(out_file, "\n");
+ fflush(out_file);
} else {
#endif /* CONFIG_DEBUG_FILE */
printf("%s - hexdump(len=%lu):", title, (unsigned long) len);
@@ -262,12 +265,14 @@ static void _wpa_hexdump_ascii(int level
fprintf(out_file,
"%s - hexdump_ascii(len=%lu): [REMOVED]\n",
title, (unsigned long) len);
+ fflush(out_file);
return;
}
if (buf == NULL) {
fprintf(out_file,
"%s - hexdump_ascii(len=%lu): [NULL]\n",
title, (unsigned long) len);
+ fflush(out_file);
return;
}
fprintf(out_file, "%s - hexdump_ascii(len=%lu):\n",
@@ -292,6 +297,7 @@ static void _wpa_hexdump_ascii(int level
pos += llen;
len -= llen;
}
+ fflush(out_file);
} else {
#endif /* CONFIG_DEBUG_FILE */
if (!show) {
@@ -0,0 +1,15 @@
diff -up wpa_supplicant-0.7.3/src/crypto/tls_openssl.c.more-openssl-algs wpa_supplicant-0.7.3/src/crypto/tls_openssl.c
--- wpa_supplicant-0.7.3/src/crypto/tls_openssl.c.more-openssl-algs 2010-09-07 10:43:39.000000000 -0500
+++ wpa_supplicant-0.7.3/src/crypto/tls_openssl.c 2010-12-08 10:01:02.967664004 -0600
@@ -710,6 +710,11 @@ void * tls_init(const struct tls_config
#endif /* OPENSSL_FIPS */
#endif /* CONFIG_FIPS */
SSL_load_error_strings();
+ /* Only add potentially weak hashes and encryption algorithms
+ * when FIPS mode is not enabled.
+ */
+ if (!conf || !conf->fips_mode)
+ OpenSSL_add_all_algorithms();
SSL_library_init();
#ifndef OPENSSL_NO_SHA256
EVP_add_digest(EVP_sha256());
@@ -0,0 +1,12 @@
diff -up wpa_supplicant-0.6.7/wpa_supplicant/events.c.scan-results-msg wpa_supplicant-0.6.7/wpa_supplicant/events.c
--- wpa_supplicant-0.6.7/wpa_supplicant/events.c.scan-results-msg 2009-01-30 12:08:34.000000000 -0500
+++ wpa_supplicant-0.6.7/wpa_supplicant/events.c 2009-01-30 12:08:37.000000000 -0500
@@ -911,7 +911,7 @@ static void wpa_supplicant_event_scan_re
}
wpa_dbg(wpa_s, MSG_DEBUG, "New scan results available");
- wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_SCAN_RESULTS);
+ wpa_msg_ctrl(wpa_s, MSG_DEBUG, WPA_EVENT_SCAN_RESULTS);
wpas_notify_scan_results(wpa_s);
wpas_notify_scan_done(wpa_s, 1);
@@ -0,0 +1,12 @@
diff -p -up wpa_supplicant-0.6.3/wpa_supplicant/config_ssid.h.WEP232 wpa_supplicant-0.6.3/wpa_supplicant/config_ssid.h
--- wpa_supplicant-0.6.3/wpa_supplicant/config_ssid.h.WEP232 2008-02-23 03:45:24.000000000 +0100
+++ wpa_supplicant-0.6.3/wpa_supplicant/config_ssid.h 2008-03-31 22:28:29.000000000 +0200
@@ -189,7 +189,7 @@ struct wpa_ssid {
#endif /* IEEE8021X_EAPOL */
#define NUM_WEP_KEYS 4
-#define MAX_WEP_KEY_LEN 16
+#define MAX_WEP_KEY_LEN 32
/**
* wep_key - WEP keys
*/
@@ -0,0 +1,143 @@
Index: src/drivers/driver_wext.c
===================================================================
--- src/drivers/driver_wext.c.orig
+++ src/drivers/driver_wext.c
@@ -1901,19 +1901,26 @@ int wpa_driver_wext_associate(void *priv
* SIOCSIWENCODE here.
*/
if (drv->auth_alg_fallback &&
- wpa_driver_wext_auth_alg_fallback(drv, params) < 0)
+ wpa_driver_wext_auth_alg_fallback(drv, params) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because auth_alg_fallback failed", __FUNCTION__);
ret = -1;
+ }
if (!params->bssid &&
- wpa_driver_wext_set_bssid(drv, NULL) < 0)
+ wpa_driver_wext_set_bssid(drv, NULL) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_bssid failed", __FUNCTION__);
ret = -1;
+ }
/* TODO: should consider getting wpa version and cipher/key_mgmt suites
* from configuration, not from here, where only the selected suite is
* available */
if (wpa_driver_wext_set_gen_ie(drv, params->wpa_ie, params->wpa_ie_len)
- < 0)
+ < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_gen_ie failed", __FUNCTION__);
ret = -1;
+ }
+
if (params->wpa_ie == NULL || params->wpa_ie_len == 0)
value = IW_AUTH_WPA_VERSION_DISABLED;
else if (params->wpa_ie[0] == WLAN_EID_RSN)
@@ -1921,27 +1928,41 @@ int wpa_driver_wext_associate(void *priv
else
value = IW_AUTH_WPA_VERSION_WPA;
if (wpa_driver_wext_set_auth_param(drv,
- IW_AUTH_WPA_VERSION, value) < 0)
+ IW_AUTH_WPA_VERSION, value) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(WPA_VERSION) failed", __FUNCTION__);
ret = -1;
+ }
+
value = wpa_driver_wext_cipher2wext(params->pairwise_suite);
if (wpa_driver_wext_set_auth_param(drv,
- IW_AUTH_CIPHER_PAIRWISE, value) < 0)
+ IW_AUTH_CIPHER_PAIRWISE, value) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(CIPHER_PAIRWISE) failed", __FUNCTION__);
ret = -1;
+ }
+
value = wpa_driver_wext_cipher2wext(params->group_suite);
if (wpa_driver_wext_set_auth_param(drv,
- IW_AUTH_CIPHER_GROUP, value) < 0)
+ IW_AUTH_CIPHER_GROUP, value) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(CIPHER_GROUP) failed", __FUNCTION__);
ret = -1;
+ }
+
value = wpa_driver_wext_keymgmt2wext(params->key_mgmt_suite);
if (wpa_driver_wext_set_auth_param(drv,
- IW_AUTH_KEY_MGMT, value) < 0)
+ IW_AUTH_KEY_MGMT, value) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(KEY_MGMT) failed", __FUNCTION__);
ret = -1;
+ }
+
value = params->key_mgmt_suite != KEY_MGMT_NONE ||
params->pairwise_suite != CIPHER_NONE ||
params->group_suite != CIPHER_NONE ||
params->wpa_ie_len;
if (wpa_driver_wext_set_auth_param(drv,
- IW_AUTH_PRIVACY_INVOKED, value) < 0)
+ IW_AUTH_PRIVACY_INVOKED, value) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(PRIVACY_INVOKED) failed", __FUNCTION__);
ret = -1;
+ }
/* Allow unencrypted EAPOL messages even if pairwise keys are set when
* not using WPA. IEEE 802.1X specifies that these frames are not
@@ -1952,12 +1973,18 @@ int wpa_driver_wext_associate(void *priv
else
allow_unencrypted_eapol = 1;
- if (wpa_driver_wext_set_psk(drv, params->psk) < 0)
+ if (wpa_driver_wext_set_psk(drv, params->psk) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_psk failed", __FUNCTION__);
ret = -1;
+ }
+
if (wpa_driver_wext_set_auth_param(drv,
IW_AUTH_RX_UNENCRYPTED_EAPOL,
- allow_unencrypted_eapol) < 0)
+ allow_unencrypted_eapol) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(RX_UNENCRYPTED_EAPOL) failed", __FUNCTION__);
ret = -1;
+ }
+
#ifdef CONFIG_IEEE80211W
switch (params->mgmt_frame_protection) {
case NO_MGMT_FRAME_PROTECTION:
@@ -1970,17 +1997,25 @@ int wpa_driver_wext_associate(void *priv
value = IW_AUTH_MFP_REQUIRED;
break;
};
- if (wpa_driver_wext_set_auth_param(drv, IW_AUTH_MFP, value) < 0)
+ if (wpa_driver_wext_set_auth_param(drv, IW_AUTH_MFP, value) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_auth_param(IW_AUTH_MFP) failed", __FUNCTION__);
ret = -1;
+ }
#endif /* CONFIG_IEEE80211W */
- if (params->freq && wpa_driver_wext_set_freq(drv, params->freq) < 0)
+ if (params->freq && wpa_driver_wext_set_freq(drv, params->freq) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_freq failed", __FUNCTION__);
ret = -1;
+ }
if (!drv->cfg80211 &&
- wpa_driver_wext_set_ssid(drv, params->ssid, params->ssid_len) < 0)
+ wpa_driver_wext_set_ssid(drv, params->ssid, params->ssid_len) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_ssid failed", __FUNCTION__);
ret = -1;
+ }
if (params->bssid &&
- wpa_driver_wext_set_bssid(drv, params->bssid) < 0)
+ wpa_driver_wext_set_bssid(drv, params->bssid) < 0) {
+ wpa_printf(MSG_DEBUG, "%s: assoc failed because set_bssid failed", __FUNCTION__);
ret = -1;
+ }
if (drv->cfg80211 &&
wpa_driver_wext_set_ssid(drv, params->ssid, params->ssid_len) < 0)
ret = -1;
@@ -2008,6 +2043,10 @@ static int wpa_driver_wext_set_auth_alg(
res = wpa_driver_wext_set_auth_param(drv, IW_AUTH_80211_AUTH_ALG,
algs);
drv->auth_alg_fallback = res == -2;
+
+ if (res == -2)
+ wpa_printf(MSG_DEBUG, "%s: falling back to ENCODE for AUTH", __FUNCTION__);
+
return res;
}
@@ -0,0 +1,19 @@
Index: src/drivers/driver_wext.c
===================================================================
--- src/drivers/driver_wext.c.orig
+++ src/drivers/driver_wext.c
@@ -54,12 +54,13 @@ int wpa_driver_wext_set_auth_param(struc
iwr.u.param.value = value;
if (ioctl(drv->ioctl_sock, SIOCSIWAUTH, &iwr) < 0) {
+ int saved_errno = errno;
if (errno != EOPNOTSUPP) {
wpa_printf(MSG_DEBUG, "WEXT: SIOCSIWAUTH(param %d "
"value 0x%x) failed: %s)",
idx, value, strerror(errno));
}
- ret = errno == EOPNOTSUPP ? -2 : -1;
+ ret = saved_errno == EOPNOTSUPP ? -2 : -1;
}
return ret;
@@ -0,0 +1,17 @@
From: Reinhard Tartler <siretart@tauware.de>
References: none
Description: Use pkg-config for libpcsclite linkage flags
At least in debian, we can rely on pkg-config being available and
returning more accurate ldflags.
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -691,7 +691,7 @@ ifdef CONFIG_NATIVE_WINDOWS
#dynamic symbol loading that is now used in pcsc_funcs.c
#LIBS += -lwinscard
else
-LIBS += -lpcsclite -lpthread
+LIBS += $(shell pkg-config --libs libpcsclite)
endif
endif
@@ -0,0 +1,20 @@
diff -aurp a/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in b/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in
--- a/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in 2012-05-15 09:00:03.048545044 +0000
+++ b/wpa_supplicant/dbus/fi.epitest.hostap.WPASupplicant.service.in 2012-05-15 09:01:19.759550509 +0000
@@ -1,5 +1,5 @@
[D-BUS Service]
Name=fi.epitest.hostap.WPASupplicant
-Exec=@BINDIR@/wpa_supplicant -u
+Exec=/usr/sbin/wpa_supplicant -u
User=root
SystemdService=wpa_supplicant.service
diff -aurp a/wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in b/wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in
--- a/wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in 2012-05-15 09:00:03.048545044 +0000
+++ b/wpa_supplicant/dbus/fi.w1.wpa_supplicant1.service.in 2012-05-15 09:01:28.727551913 +0000
@@ -1,5 +1,5 @@
[D-BUS Service]
Name=fi.w1.wpa_supplicant1
-Exec=@BINDIR@/wpa_supplicant -u
+Exec=/usr/sbin/wpa_supplicant -u
User=root
SystemdService=wpa_supplicant.service
@@ -0,0 +1,60 @@
diff -aurp a/wpa_supplicant/dbus/dbus_new_helpers.c b/wpa_supplicant/dbus/dbus_new_helpers.c
--- a/wpa_supplicant/dbus/dbus_new_helpers.c 2012-05-15 07:28:37.616150164 +0000
+++ b/wpa_supplicant/dbus/dbus_new_helpers.c 2012-05-15 07:30:21.904157611 +0000
@@ -882,7 +882,7 @@ void wpa_dbus_mark_property_changed(stru
const struct wpa_dbus_property_desc *dsc;
int i = 0;
- if (iface == NULL)
+ if (iface == NULL || path == NULL)
return;
dbus_connection_get_object_path_data(iface->con, path,
diff -aurp a/wpa_supplicant/dbus/dbus_old.c b/wpa_supplicant/dbus/dbus_old.c
--- a/wpa_supplicant/dbus/dbus_old.c 2012-05-15 07:28:29.502149373 +0000
+++ b/wpa_supplicant/dbus/dbus_old.c 2012-05-15 07:30:48.859162441 +0000
@@ -379,7 +379,7 @@ void wpa_supplicant_dbus_notify_scan_res
DBusMessage *_signal;
/* Do nothing if the control interface is not turned on */
- if (iface == NULL)
+ if (iface == NULL || wpa_s->dbus_path == NULL)
return;
_signal = dbus_message_new_signal(wpa_s->dbus_path,
@@ -419,7 +419,7 @@ void wpa_supplicant_dbus_notify_state_ch
if (wpa_s->global == NULL)
return;
iface = wpa_s->global->dbus;
- if (iface == NULL)
+ if (iface == NULL || wpa_s->dbus_path == NULL)
return;
/* Only send signal if state really changed */
@@ -478,7 +478,7 @@ void wpa_supplicant_dbus_notify_scanning
dbus_bool_t scanning = wpa_s->scanning ? TRUE : FALSE;
/* Do nothing if the control interface is not turned on */
- if (iface == NULL)
+ if (iface == NULL || wpa_s->dbus_path == NULL)
return;
_signal = dbus_message_new_signal(wpa_s->dbus_path,
@@ -513,7 +513,7 @@ void wpa_supplicant_dbus_notify_wps_cred
if (wpa_s->global == NULL)
return;
iface = wpa_s->global->dbus;
- if (iface == NULL)
+ if (iface == NULL || wpa_s->dbus_path == NULL)
return;
_signal = dbus_message_new_signal(wpa_s->dbus_path,
@@ -564,7 +564,7 @@ void wpa_supplicant_dbus_notify_certific
if (wpa_s->global == NULL)
return;
iface = wpa_s->global->dbus;
- if (iface == NULL)
+ if (iface == NULL || wpa_s->dbus_path == NULL)
return;
_signal = dbus_message_new_signal(wpa_s->dbus_path,
@@ -0,0 +1,347 @@
diff -Naurp a/src/eap_peer/eap_methods.c b/src/eap_peer/eap_methods.c
--- a/src/eap_peer/eap_methods.c 2012-05-15 08:23:17.151386999 +0000
+++ b/src/eap_peer/eap_methods.c 2012-05-15 08:23:57.403389760 +0000
@@ -342,6 +342,120 @@ int eap_peer_method_register(struct eap_
/**
+ * eap_peer_register_methods - Register all known EAP peer methods
+ *
+ * This function is called at program start to register all compiled
+ * in EAP peer methods.
+ */
+int eap_peer_register_methods(void)
+{
+ int ret = 0;
+
+#ifdef EAP_MD5
+ if (ret == 0)
+ ret = eap_peer_md5_register();
+#endif /* EAP_MD5 */
+
+#ifdef EAP_TLS
+ if (ret == 0)
+ ret = eap_peer_tls_register();
+#endif /* EAP_TLS */
+
+#ifdef EAP_MSCHAPv2
+ if (ret == 0)
+ ret = eap_peer_mschapv2_register();
+#endif /* EAP_MSCHAPv2 */
+
+#ifdef EAP_PEAP
+ if (ret == 0)
+ ret = eap_peer_peap_register();
+#endif /* EAP_PEAP */
+
+#ifdef EAP_TTLS
+ if (ret == 0)
+ ret = eap_peer_ttls_register();
+#endif /* EAP_TTLS */
+
+#ifdef EAP_GTC
+ if (ret == 0)
+ ret = eap_peer_gtc_register();
+#endif /* EAP_GTC */
+
+#ifdef EAP_OTP
+ if (ret == 0)
+ ret = eap_peer_otp_register();
+#endif /* EAP_OTP */
+
+#ifdef EAP_SIM
+ if (ret == 0)
+ ret = eap_peer_sim_register();
+#endif /* EAP_SIM */
+
+#ifdef EAP_LEAP
+ if (ret == 0)
+ ret = eap_peer_leap_register();
+#endif /* EAP_LEAP */
+
+#ifdef EAP_PSK
+ if (ret == 0)
+ ret = eap_peer_psk_register();
+#endif /* EAP_PSK */
+
+#ifdef EAP_AKA
+ if (ret == 0)
+ ret = eap_peer_aka_register();
+#endif /* EAP_AKA */
+
+#ifdef EAP_AKA_PRIME
+ if (ret == 0)
+ ret = eap_peer_aka_prime_register();
+#endif /* EAP_AKA_PRIME */
+
+#ifdef EAP_FAST
+ if (ret == 0)
+ ret = eap_peer_fast_register();
+#endif /* EAP_FAST */
+
+#ifdef EAP_PAX
+ if (ret == 0)
+ ret = eap_peer_pax_register();
+#endif /* EAP_PAX */
+
+#ifdef EAP_SAKE
+ if (ret == 0)
+ ret = eap_peer_sake_register();
+#endif /* EAP_SAKE */
+
+#ifdef EAP_GPSK
+ if (ret == 0)
+ ret = eap_peer_gpsk_register();
+#endif /* EAP_GPSK */
+
+#ifdef EAP_WSC
+ if (ret == 0)
+ ret = eap_peer_wsc_register();
+#endif /* EAP_WSC */
+
+#ifdef EAP_IKEV2
+ if (ret == 0)
+ ret = eap_peer_ikev2_register();
+#endif /* EAP_IKEV2 */
+
+#ifdef EAP_VENDOR_TEST
+ if (ret == 0)
+ ret = eap_peer_vendor_test_register();
+#endif /* EAP_VENDOR_TEST */
+
+#ifdef EAP_TNC
+ if (ret == 0)
+ ret = eap_peer_tnc_register();
+#endif /* EAP_TNC */
+
+ return ret;
+}
+
+
+/**
* eap_peer_unregister_methods - Unregister EAP peer methods
*
* This function is called at program termination to unregister all EAP peer
diff -Naurp a/src/eap_peer/eap_methods.h b/src/eap_peer/eap_methods.h
--- a/src/eap_peer/eap_methods.h 2012-05-15 08:23:17.151386999 +0000
+++ b/src/eap_peer/eap_methods.h 2012-05-15 08:23:57.404389735 +0000
@@ -32,6 +32,7 @@ EapType eap_peer_get_type(const char *na
const char * eap_get_name(int vendor, EapType type);
size_t eap_get_names(char *buf, size_t buflen);
char ** eap_get_names_as_string_array(size_t *num);
+int eap_peer_register_methods(void);
void eap_peer_unregister_methods(void);
#else /* IEEE8021X_EAPOL */
diff -Naurp a/src/eap_peer/libeap0.pc b/src/eap_peer/libeap0.pc
--- a/src/eap_peer/libeap0.pc 1970-01-01 00:00:00.000000000 +0000
+++ b/src/eap_peer/libeap0.pc 2012-05-15 08:23:57.404389735 +0000
@@ -0,0 +1,10 @@
+prefix=/usr
+exec_prefix=/usr
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include/eap_peer
+
+Name: libeap0
+Description: EAP Peer Library API
+Version: 0.7.2
+Libs: -L${libdir} -leap
+Cflags: -I${includedir}
diff -Naurp a/src/eap_peer/Makefile b/src/eap_peer/Makefile
--- a/src/eap_peer/Makefile 2012-05-15 08:23:17.152386964 +0000
+++ b/src/eap_peer/Makefile 2012-05-15 08:23:57.403389760 +0000
@@ -1,11 +1,186 @@
-all:
- @echo Nothing to be made.
+LIBEAP_NAME = libeap
+LIBEAP_CURRENT = 0
+LIBEAP_REVISION = 0
+LIBEAP_AGE = 0
+
+LIBEAP = $(LIBEAP_NAME).so.$(LIBEAP_CURRENT).$(LIBEAP_REVISION).$(LIBEAP_AGE)
+LIBEAP_SO = $(LIBEAP_NAME).so.$(LIBEAP_CURRENT)
+
+.PHONY: all clean install uninstall
+
+all: $(LIBEAP)
+
+ifndef CC
+CC=gcc
+endif
+
+ifndef CFLAGS
+CFLAGS = -MMD -O0 -Wall -g
+endif
+
+CONFIG_TLS=openssl
+
+INCLUDE_INSTALL_DIR=/usr/include/eap_peer
+
+# Got to use override all across the board, otherwise a 'make
+# CFLAGS=XX' will kill us because the command line's CFLAGS will
+# overwrite Make's and we'll loose all the infrastructure it sets.
+override CFLAGS += -I. -I.. -I../crypto -I../utils -I../common
+
+# at least for now, need to include config_ssid.h and config_blob.h from
+# wpa_supplicant directory
+override CFLAGS += -I ../../wpa_supplicant
+
+OBJS_both += ../utils/common.o
+OBJS_both += ../utils/os_unix.o
+OBJS_both += ../utils/wpa_debug.o
+OBJS_both += ../utils/base64.o
+OBJS_both += ../utils/wpabuf.o
+OBJS_both += ../crypto/md5.o
+OBJS_both += ../crypto/sha1.o
+OBJS_both += ../crypto/sha1-tlsprf.o
+OBJS_both += ../crypto/aes-encblock.o
+OBJS_both += ../crypto/aes-wrap.o
+OBJS_both += ../crypto/aes-ctr.o
+OBJS_both += ../crypto/aes-eax.o
+OBJS_both += ../crypto/aes-omac1.o
+OBJS_both += ../crypto/ms_funcs.o
+OBJS_both += ../crypto/sha256.o
+
+
+OBJS_both += ../eap_common/eap_peap_common.o
+OBJS_both += ../eap_common/eap_psk_common.o
+OBJS_both += ../eap_common/eap_pax_common.o
+OBJS_both += ../eap_common/eap_sake_common.o
+OBJS_both += ../eap_common/eap_gpsk_common.o
+OBJS_both += ../eap_common/chap.o
+
+OBJS_peer += ../eap_peer/eap_tls.o
+OBJS_peer += ../eap_peer/eap_peap.o
+OBJS_peer += ../eap_peer/eap_ttls.o
+OBJS_peer += ../eap_peer/eap_md5.o
+OBJS_peer += ../eap_peer/eap_mschapv2.o
+OBJS_peer += ../eap_peer/mschapv2.o
+OBJS_peer += ../eap_peer/eap_otp.o
+OBJS_peer += ../eap_peer/eap_gtc.o
+OBJS_peer += ../eap_peer/eap_leap.o
+OBJS_peer += ../eap_peer/eap_psk.o
+OBJS_peer += ../eap_peer/eap_pax.o
+OBJS_peer += ../eap_peer/eap_sake.o
+OBJS_peer += ../eap_peer/eap_gpsk.o
+OBJS_peer += ../eap_peer/eap.o
+OBJS_peer += ../eap_common/eap_common.o
+OBJS_peer += ../eap_peer/eap_methods.o
+OBJS_peer += ../eap_peer/eap_tls_common.o
+
+override CFLAGS += -DEAP_TLS
+override CFLAGS += -DEAP_PEAP
+override CFLAGS += -DEAP_TTLS
+override CFLAGS += -DEAP_MD5
+override CFLAGS += -DEAP_MSCHAPv2
+override CFLAGS += -DEAP_GTC
+override CFLAGS += -DEAP_OTP
+override CFLAGS += -DEAP_LEAP
+override CFLAGS += -DEAP_PSK
+override CFLAGS += -DEAP_PAX
+override CFLAGS += -DEAP_SAKE
+override CFLAGS += -DEAP_GPSK -DEAP_GPSK_SHA256
+override CFLAGS += -DEAP_TLS_FUNCS
+
+override CFLAGS += -DIEEE8021X_EAPOL
+
+ifeq ($(CONFIG_TLS), openssl)
+override CFLAGS += -DEAP_TLS_OPENSSL
+OBJS_both += ../crypto/tls_openssl.o
+OBJS_both += ../crypto/crypto_openssl.o
+LIBS += -lssl -lcrypto
+override CFLAGS += -DINTERNAL_SHA256
+endif
+
+ifeq ($(CONFIG_TLS), internal)
+OBJS_both += ../crypto/tls_internal.o
+OBJS_both += ../tls/tlsv1_common.o ../../tls/tlsv1_record.o
+OBJS_both += ../tls/tlsv1_cred.o
+OBJS_both += ../tls/asn1.o ../../tls/x509v3.o
+OBJS_both += ../crypto/crypto_internal.o ../../tls/rsa.o ../../tls/bignum.o
+
+OBJS_peer += ../tls/tlsv1_client.o
+OBJS_peer += ../tls/tlsv1_client_write.o ../../tls/tlsv1_client_read.o
+override CFLAGS += -DCONFIG_TLS_INTERNAL_CLIENT
+
+OBJS_server += ../tls/tlsv1_server.o
+OBJS_server += ../tls/tlsv1_server_write.o ../../tls/tlsv1_server_read.o
+override CFLAGS += -DCONFIG_TLS_INTERNAL_SERVER
+
+override CFLAGS += -DCONFIG_TLS_INTERNAL
+override CFLAGS += -DCONFIG_CRYPTO_INTERNAL
+override CFLAGS += -DCONFIG_INTERNAL_X509
+override CFLAGS += -DINTERNAL_AES
+override CFLAGS += -DINTERNAL_SHA1
+override CFLAGS += -DINTERNAL_SHA256
+override CFLAGS += -DINTERNAL_MD5
+override CFLAGS += -DINTERNAL_MD4
+override CFLAGS += -DINTERNAL_DES
+ifdef CONFIG_INTERNAL_LIBTOMMATH
+override CFLAGS += -DCONFIG_INTERNAL_LIBTOMMATH
+else
+LIBS += -ltommath
+endif
+endif
+
+ifndef LDO
+LDO=$(CC)
+endif
+
+
+OBJS_lib=$(OBJS_both) $(OBJS_peer)
+
+ #$(OBJS_server)
+
+override CFLAGS += -fPIC -DPIC
+LDFLAGS += -shared
+
+$(LIBEAP): $(OBJS_lib)
+ $(LDO) $(LDFLAGS) $(OBJS_lib) -Wl,-soname -Wl,$(LIBEAP_SO) -o $(LIBEAP) $(LIBS)
+
+
+UTIL_HEADERS = ../utils/includes.h ../utils/common.h \
+ ../utils/wpabuf.h ../utils/build_config.h \
+ ../utils/os.h ../utils/wpa_debug.h
+COMMON_HEADERS = ../common/defs.h
+EAP_COMMON_HEADERS = ../eap_common/eap_defs.h
+MAIN_HEADERS = eap.h eap_methods.h eap_config.h
+CRYPTO_HEADERS = ../crypto/tls.h
+
+install:
+
+ mkdir -p $(DESTDIR)/usr/lib
+# copy the lib file to std lib location
+ cp $(LIBEAP) $(DESTDIR)/usr/lib
+ ln -fs $(LIBEAP_SO) $(DESTDIR)/usr/lib/$(LIBEAP_NAME).so
+ ln -fs $(LIBEAP_NAME).so.0.0.0 $(DESTDIR)/usr/lib/$(LIBEAP_NAME).so.0
+
+# copy the headers reqd by apps using eap peer library in its own subfolder under /usr/include
+ mkdir -p \
+ $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/eap_common \
+ $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/common \
+ $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/util \
+ $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/crypto
+ install -m 0644 $(EAP_COMMON_HEADERS) $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/eap_common
+ install -m 0644 $(COMMON_HEADERS) $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/common
+ install -m 0644 $(CRYPTO_HEADERS) $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/crypto
+ install -m 0644 $(UTIL_HEADERS) $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/util
+ install -m 0644 $(MAIN_HEADERS) $(DESTDIR)/$(INCLUDE_INSTALL_DIR)/
+
+ mkdir -p $(DESTDIR)/usr/lib/pkgconfig
+ cp libeap0.pc $(DESTDIR)/usr/lib/pkgconfig
+
+uninstall:
+
+ rm $(DESTDIR)/usr/lib/$(LIBEAP)
+ rm -fr $(DESTDIR)/$(INCLUDE_INSTALL_DIR)
+ rm -f $(DESTDIR)/usr/lib/pkgconfig/libeap0.pc
clean:
- rm -f *~ *.o *.so *.d
+ rm -f *~ *.o *.so *.d libeap.a $(LIBEAP) $(OBJS_lib)
-install:
- if ls *.so >/dev/null 2>&1; then \
- install -d $(DESTDIR)$(LIBDIR)/wpa_supplicant && \
- cp *.so $(DESTDIR)$(LIBDIR)/wpa_supplicant \
- ; fi
@@ -0,0 +1,35 @@
# wpa_supplicant.conf
# WPA-PSK ile kimlikleme yapılmasını zorunlu kılan kablosuz erişim noktaları ile
# Microsoft IAS Radius sunucu kimliklemesinin wpa_supplicant ile nasıl yapılacağını
# örnekleyen ayar dosyası. İlgili yerleri doldurmanız gerekir.
#
# wpa_supplicant'ın desteklediği diğer ayar işlemleri için:
# /usr/share/doc/wpasupplicant/wpa_supplicant.conf.example dosyasına bakınız.
# Root'un wpa_cli ile bağlantıyı izlemesi için
ctrl_interface=/run/wpa_supplicant
eapol_version=1
ap_scan=1
fast_reauth=1
# WPA-PSK kimlikleme gerektiren kablosuz erişim noktaları için ayarlar
network={
# Erişim noktasının SSID'si
ssid="SSID"
# Erişim cihazının WPA parolası
psk="Parola1234"
# Bu bağlantının önceliğinin 1. sırada olduğu belirtiliyor
priority=1
}
# MS IAS Radius sunucusunda kimlikleme için gereken ayarlar
network={
ssid="SSID"
key_mgmt=WPA-EAP
eap=PEAP
identity="ALAN_ADI\KULLANICI"
password="Parola1234"
phase1="auth=MSCHAPV2"
priority=2
}
@@ -0,0 +1,3 @@
ctrl_interface=/run/wpa_supplicant
ctrl_interface_group=wheel
@@ -0,0 +1,16 @@
# Use the flag "-i" before each of your interfaces, like so:
# INTERFACES="-ieth1 -iwlan0"
INTERFACES=""
# Use the flag "-D" before each driver, like so:
# DRIVERS="-Dwext"
DRIVERS=""
# Other arguments
# -u Enable the D-Bus interface (required for use with NetworkManager)
# -f Log to /var/log/wpa_supplicant.log
# -P Write pid file to /run/wpa_supplicant.pid
# required to return proper codes by init scripts (e.g. double "start" action)
# -B to daemonize that has to be used together with -P is already in wpa_supplicant.init.d
OTHER_ARGS="-u -f /var/log/wpa_supplicant.log -P /run/wpa_supplicant.pid"
@@ -0,0 +1,47 @@
CONFIG_CTRL_IFACE=y
CONFIG_CTRL_IFACE_DBUS=y
CONFIG_CTRL_IFACE_DBUS_NEW=y
CONFIG_CTRL_IFACE_DBUS_INTRO=y
#CONFIG_DRIVER_HOSTAP=y
#CONFIG_DRIVER_HERMES=y
#CONFIG_DRIVER_MADWIFI=y
CONFIG_DRIVER_ATMEL=y
CONFIG_DRIVER_WEXT=y
CONFIG_DRIVER_NL80211=y
CONFIG_DRIVER_NDISWRAPPER=y
#CONFIG_DRIVER_PRISM54=y
CONFIG_DRIVER_WIRED=y
#CONFIG_DRIVER_BROADCOM=y
#CONFIG_DRIVER_IPW=y
#CONFIG_DRIVER_BSD=y
#CONFIG_DRIVER_NDIS=y
CONFIG_WIRELESS_EXTENSION=y
CONFIG_IEEE8021X_EAPOL=y
CONFIG_EAP_MD5=y
CONFIG_EAP_MSCHAPV2=y
CONFIG_EAP_TLS=y
CONFIG_EAP_PEAP=y
CONFIG_EAP_TTLS=y
CONFIG_EAP_FAST=y
CONFIG_EAP_GTC=y
CONFIG_EAP_OTP=y
CONFIG_EAP_SIM=y
CONFIG_EAP_AKA=y
CONFIG_EAP_PSK=y
CONFIG_EAP_PAX=y
CONFIG_EAP_LEAP=y
#CONFIG_PCSC=y
CONFIG_EAP_SAKE=y
CONFIG_EAP_GPSK=y
CONFIG_EAP_GPSK_SHA256=y
CONFIG_EAP_TNC=y
CONFIG_WPS=y
CONFIG_EAP_IKEV2=y
CONFIG_PKCS12=y
CONFIG_SMARTCARD=y
CONFIG_DEBUG_FILE=y
CFLAGS += -I/usr/include/libnl3
CONFIG_IPV6=y
CONFIG_LIBNL32=y
CONFIG_PEERKEY=y
CONFIG_READLINE=y
@@ -0,0 +1,6 @@
/var/log/wpa_supplicant.log {
missingok
notifempty
size 30k
create 0600 root root
}
@@ -0,0 +1,250 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import dbus
WPAS_DBUS_OPATH = "/fi/epitest/hostap/WPASupplicant"
WPAS_DBUS_INTERFACES_OPATH = "/fi/epitest/hostap/WPASupplicant/Interfaces"
WPAS_DBUS_SERVICE = "fi.epitest.hostap.WPASupplicant"
WPAS_DBUS_INTERFACE = "fi.epitest.hostap.WPASupplicant"
WPAS_DBUS_INTERFACES_INTERFACE = "fi.epitest.hostap.WPASupplicant.Interface"
WPAS_DBUS_NETWORK_INTERFACE = "fi.epitest.hostap.WPASupplicant.Network"
WPAS_DBUS_BSSID_INTERFACE = "fi.epitest.hostap.WPASupplicant.BSSID"
TIMEOUT = 60
class PasswordLengthError(Exception):
pass
class WPA_Supplicant_Network:
def __init__(self, bus, path):
self.bus = bus
self.path = path
self.net_obj = self.bus.get_object(WPAS_DBUS_SERVICE, path)
self.net = dbus.Interface(self.net_obj, WPAS_DBUS_NETWORK_INTERFACE)
# dict keys: ssid, bssid, key_mgmt, psk, scan_ssid, pairwise, group, eap, identity,
# anonymous_identity, ca_cert, ca_cert2, client_cert, client_cert2, private_key, private_key2,
# private_key_passwd, private_key2_passwd, phase1, phase2, eapol_flags
#
# Example: setNetwork({"ssid":dbus.String("MySSID", variant_level=1)),
# "psk":dbus.String("MyPassword", variant_level=1))})
def setNetwork(self, options):
self.net.set(options)
def enableNetwork(self):
self.net.enable()
def disableNetwork(self):
self.net.disable()
class WPA_Supplicant_Interface:
def __init__(self, bus, ifname, path):
self.bus = bus
self.ifname = ifname
self.path = path
self.if_obj = self.bus.get_object(WPAS_DBUS_SERVICE, path)
self.iface = dbus.Interface(self. if_obj, WPAS_DBUS_INTERFACES_INTERFACE)
def scan(self):
self.iface.scan()
def scanResults(self):
return self.iface.scanResults()
def addNetwork(self):
path = self.iface.addNetwork()
return self.getNetwork(path)
def removeNetwork(self, network):
self.iface.removeNetwork(network)
def selectNetwork(self, network):
self.iface.selectNetwork(network)
def getNetworkPath(self, network_id):
return "%s/Networks/%d" % (self.path, network_id)
def getNetworkById(self, network_id):
return WPA_Supplicant_Network(self.bus, self.getNetworkPath(network_id))
def getNetwork(self, network):
return WPA_Supplicant_Network(self.bus, network)
# mode should be between 0 and 2
def setAPScan(self, mode):
self.iface.setAPScan(dbus.UInt32(mode))
def disconnect(self):
self.iface.disconnect()
def getState(self):
return self.iface.state()
def getCapabilities(self):
return self.iface.capabilities()
class WPA_Supplicant:
def __init__(self):
self.bus = dbus.SystemBus()
self.wpas_obj = self.bus.get_object(WPAS_DBUS_SERVICE, WPAS_DBUS_OPATH)
self.wpas = dbus.Interface(self.wpas_obj, WPAS_DBUS_INTERFACE)
def getInterface(self, ifname):
path = self.wpas.getInterface(ifname)
return WPA_Supplicant_Interface(self.bus, ifname, path)
# driver=wext, hostap, prism54, madwifi, atmel, ndiswrapper, ipw, wired
def addInterface(self, ifname, driver):
self.wpas.addInterface(ifname, {'driver': dbus.String(driver, variant_level=1)})
return self.getInterface(ifname)
def removeInterface(self, ifname):
try:
iface_path = self.wpas.getInterface(ifname)
except dbus.DBusException:
iface_path = None
if iface_path:
self.wpas.removeInterface(dbus.ObjectPath(iface_path))
def detectWpaDriver(ifname):
import os
import sys
import pardus.netutils
# if device is an ethernet device, driver is "wired"
device = pardus.netutils.IF(ifname)
if (device.isEthernet()) and (not device.isWireless()):
return "wired"
path = os.path.join("/sys/class/net/", ifname, "device/driver/module")
modname = None
if os.path.exists(path):
modname = os.readlink(path).split("/")[-1]
if "hostap" in modname:
return "hostap"
if "prism54" in modname:
return "prism54"
if "atmel" in modname:
return "atmel"
# we fallback to wext
# wext is the generic driver for ipw2100, ipw2200, ndiswrapper > 1.12, madwifi etc...
return "wext"
def getWpaInterface(ifname):
wpa = WPA_Supplicant()
try:
iface = wpa.getInterface(ifname)
except dbus.DBusException:
driver = detectWpaDriver(ifname)
iface = wpa.addInterface(ifname, driver)
return iface
def waitForAuthenticationComplete(iface, timeout, wait = 0.1):
import time
while timeout > 0:
if iface.getState() == "COMPLETED":
return True
else:
timeout -= wait
time.sleep(wait)
return False
def checkServiceState(serviceName):
bus = dbus.SystemBus()
obj = bus.get_object("tr.org.pardus.comar", "/package/%s" % serviceName)
state = obj.info(dbus_interface="tr.org.pardus.comar.System.Service")[2]
return state in ("on", "started")
def isDBusServiceActive():
return True
def isWpaServiceActive():
return checkServiceState("wpa_supplicant")
def isWpaServiceUsable():
return isDBusServiceActive() and isWpaServiceActive()
def startWpaService():
if not isWpaServiceActive():
bus = dbus.SystemBus()
obj = bus.get_object("tr.org.pardus.comar", "/package/wpa_supplicant")
obj.start(dbus_interface="tr.org.pardus.comar.System.Service")
import time
timeout = 10
while timeout > 0:
try:
bus = dbus.SystemBus()
net_obj = bus.get_object(WPAS_DBUS_SERVICE, WPAS_DBUS_OPATH)
net = dbus.Interface(net_obj, WPAS_DBUS_NETWORK_INTERFACE)
except dbus.DBusException:
time.sleep(0.1)
timeout -= 0.2
continue
return True
return False
def setWpaAuthentication(ifname, ssid, password, timeout = TIMEOUT):
password_length = len(password)
if (password_length < 8) or (password_length > 63):
raise PasswordLengthError("Password length should be between 8 and 63")
iface = getWpaInterface(ifname)
network = iface.addNetwork()
network.setNetwork({"ssid": dbus.String(ssid, variant_level=1), "psk": dbus.String(password, variant_level=1)})
iface.selectNetwork(network.path)
authentication = waitForAuthenticationComplete(iface, timeout)
if not authentication:
disableAuthentication(ifname)
return authentication
def disableAuthentication(ifname):
wpa = WPA_Supplicant()
wpa.removeInterface(ifname)
bus = dbus.SystemBus()
obj = bus.get_object("tr.org.pardus.comar", "/package/wpa_supplicant")
obj.stop(dbus_interface="tr.org.pardus.comar.System.Service")
class Wpa_EAP:
ssid = ""
phase1 = ""
phase2 = ""
key_mgmt = "IEEE8021X"
eap = "PEAP"
anonymous_identity = ""
ca_cert = ""
client_cert = ""
private_key = ""
private_key_passwd = ""
def __init__(self, ifname):
self.ifname = ifname
self.iface = getWpaInterface(ifname)
self.network = self.iface.addNetwork()
def authenticate(self, username, password, timeout = TIMEOUT):
basic = {"ssid": dbus.String(self.ssid, variant_level=1),
"key_mgmt": dbus.String(self.key_mgmt, variant_level=1),
"eap": dbus.String(self.eap, variant_level=1),
"identity": dbus.String(username, variant_level=1)}
if self.client_cert:
basic["client_cert"] = dbus.String(self.client_cert, variant_level=1)
if self.ca_cert:
basic["ca_cert"] = dbus.String(self.ca_cert, variant_level=1)
if self.private_key:
basic["private_key"] = dbus.String(self.private_key, variant_level=1)
if self.private_key_passwd:
basic["private_key_passwd"] = dbus.String(self.private_key_passwd, variant_level=1)
if self.phase2:
basic["phase2"] = dbus.String("auth=%s"%self.phase2, variant_level=1)
if password:
basic["password"] = dbus.String(password, variant_level=1)
if self.anonymous_identity:
basic["anonymous_identity"] = dbus.String(self.anonymous_identity, variant_level=1)
self.network.setNetwork(basic)
self.iface.selectNetwork(self.network.path)
authentication = waitForAuthenticationComplete(self.iface, timeout)
if not authentication:
disableAuthentication(self.ifname)
return authentication
+100
View File
@@ -0,0 +1,100 @@
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>wpa_supplicant</Name>
<Homepage>http://hostap.epitest.fi/wpa_supplicant/</Homepage>
<Packager>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Packager>
<License>GPLv2</License>
<License>BSD</License>
<IsA>service</IsA>
<Summary>IEEE 802.1X/WPA supplicant for secure wireless transfers</Summary>
<Description>wpa_supplicant is a WPA supplicant with support for WPA and WPA2.</Description>
<Archive sha1sum="25b9cb997cd9d2e84cf1ab73fac71b717cbb5f65" type="targz">http://hostap.epitest.fi/releases/wpa_supplicant-2.1.tar.gz</Archive>
<AdditionalFiles>
<AdditionalFile target="wpa_supplicant/.config">wpa_supplicant.config</AdditionalFile>
</AdditionalFiles>
<BuildDependencies>
<Dependency>libnl-devel</Dependency>
</BuildDependencies>
<Patches>
<Patch level="1">ubuntu/01_use_pkg-config_for_pcsc-lite_module.patch</Patch>
<!--<Patch level="1">wpa_supplicant-1.0-generate-libeap-peer.patch</Patch>-->
<Patch level="1">wpa_supplicant-1.0-dbus-path-fix.patch</Patch>
<Patch level="1">wpa_supplicant-1.0-do-not-call-dbus-functions-with-NULL-path.patch</Patch>
<Patch level="1">mandriva/wpa_supplicant-0.6.3-WEP232.patch</Patch>
<Patch level="1">fedora/wpa_supplicant-openssl-more-algs.patch</Patch>
<Patch level="1">fedora/wpa_supplicant-flush-debug-output.patch</Patch>
<!--<Patch level="1">fedora/wpa_supplicant-squelch-driver-disconnect-spam.patch</Patch>-->
<!--<Patch level="1">fedora/wpa_supplicant-dbus-service-file-args.patch</Patch>-->
<Patch level="1">fedora/wpa_supplicant-assoc-timeout.patch</Patch>
<!--<Patch level="1">fedora/wpa_supplicant-quiet-scan-results-message.patch</Patch>-->
<!--<Patch>suse/wpa_supplicant-driver-wext-debug.patch</Patch>-->
<Patch>suse/wpa_supplicant-errormsg.patch</Patch>
<!-- Add 3 patches from git://w1.fi/srv/git/hostap-07.git -->
<!--<Patch level="1">0001-AP-Verify-that-HT40-secondary-channel-is-supported.patch</Patch>-->
<!--<Patch level="1">0002-nl80211-Set-cipher-suites-when-using-user-space-SME.patch</Patch>-->
<!--<Patch level="1">0003-dbus-Emit-property-changed-events-when-adding-removi.patch</Patch>-->
</Patches>
</Source>
<Package>
<Name>wpa_supplicant</Name>
<RuntimeDependencies>
<Dependency>libnl</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="config">/etc</Path>
<Path fileType="data">/etc/dbus-1</Path>
<Path fileType="executable">/usr/sbin</Path>
<Path fileType="executable">/usr/bin</Path>
<Path fileType="library">/usr/lib</Path>
<Path fileType="doc">/usr/share/doc</Path>
<Path fileType="man">/usr/share/man</Path>
<Path fileType="data">/usr/share/dbus-1/system-services</Path>
<Path fileType="data">/run</Path>
</Files>
<AdditionalFiles>
<AdditionalFile owner="root" permission="0600" target="/etc/wpa_supplicant.conf">wpa_supplicant.conf</AdditionalFile>
<!-- This is the fedora one
<AdditionalFile owner="root" permission="0600" target="/etc/wpa_supplicant.conf">wpa_supplicant.conf.fedora</AdditionalFile>
-->
<AdditionalFile owner="root" permission="0644" target="/etc/conf.d/wpa_supplicant">wpa_supplicant.confd</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="/etc/logrotate.d/wpa_supplicant">wpa_supplicant.logrotate</AdditionalFile>
<AdditionalFile owner="root" permission="0644" target="/usr/lib/python2.7/site-packages/wpa_supplicant.py">wpa_supplicant.py</AdditionalFile>
</AdditionalFiles>
<!-- This service is not started by default since NM starts it automatically. Keep service for those not using NM and start wpa-supp service manually -->
<Provides>
<COMAR script="service.py">System.Service</COMAR>
</Provides>
</Package>
<History>
<Update release="3">
<Date>2014-06-02</Date>
<Version>2.1</Version>
<Comment>Version Bump.</Comment>
<Name>Aydın Demirel</Name>
<Email>aydin.demirel@pisilinux.org</Email>
</Update>
<Update release="2">
<Date>2013-03-02</Date>
<Version>2.0</Version>
<Comment>V.Bump</Comment>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Update>
<Update release="1">
<Date>2012-10-14</Date>
<Version>1.0</Version>
<Comment>First release</Comment>
<Name>PisiLinux Community</Name>
<Email>admins@pisilinux.org</Email>
</Update>
</History>
</PISI>
@@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<PISI>
<Source>
<Name>wpa_supplicant</Name>
<Summary xml:lang="tr">Güvenli kablosuz erişim için IEEE 802.1X/WPA sağlayıcı</Summary>
<Description xml:lang="tr">WPA ve WPA2 desteği olan ve Linux, BSD ve Windows ortamları için bir WPA istemcisidir.</Description>
</Source>
</PISI>