diff --git a/README.md b/README.md
index ccab302..0952f44 100644
--- a/README.md
+++ b/README.md
@@ -64,8 +64,8 @@ Additional information
TODO (wish list)
----------------
-* add helper polkit-qt integration
-* security notes / project architecture
+* add helper polkit-qt integration ?
+* update to show error messages if debug=true
* autotests
Links
diff --git a/sources/gui/docs/netctl-gui-security-notes.html b/sources/gui/docs/netctl-gui-security-notes.html
index a76781e..5c3c418 100644
--- a/sources/gui/docs/netctl-gui-security-notes.html
+++ b/sources/gui/docs/netctl-gui-security-notes.html
@@ -10,11 +10,10 @@
- Description
- Architecture
- - KDE components security
- - Graphical interface security
- Library security
- Helper security
-
+ - Graphical interface security
+ - KDE components security
- External links
@@ -26,33 +25,8 @@
Architecture
-KDE components security
-There are two netctl-based commands which are run from the DataEngine
-
- <cmd> list
- netctl is-enabled <profile>
-
-Both of them do not require any additional privileges normally. Also DataEngine has two other command which will be run from; they should define external IP. According to the idea that user can set any command to run, this module is not secure. But running commands will not do more than user can do from console himself.
-
-The widget gets information from DataEngine, thus it does not require any additional permissions to show information. But netctl calls with root privileges are used to control netctl. In this case used commands are
-
- netctl enable <profile>
- netctl disable <profile>
- netctl restart <profile>
- netctl start <profile>
- netctl stop <profile>
- netctl switch-to <profile>
- netctl-auto switch-to <profile>
-
-All netctl-based commands requires root privileges and sudo
(and any other alternatives) is used normally as prefix to the commands. The netctl-auto command does not require additional permissions.
-
-The other way is to use DBus communication with the helper. In this case user should have rights to start the helper.
-
-Graphical interface security
-Graphical interface may interact with netctl over DBus (the helper) and over the library. Please refer to their notes to any additional information. If user uses helper he should have permissions to run it.
-
-Library security
-According to the scheme library gets information from netctl and can control it. Also it provides some additional functions such as a profile creation and removal and access to wpa_supplicant functions. Some function does not require additional permissions, but other ones do it. All dynamic arguments including profile names and paths are in double quotes to avoid white spaces problem. The functions which requires root privileges are:
+Library security
+According to the scheme the library gets information from netctl and can control it. Also it provides some additional functions such as a profile creation and removal and access to wpa_supplicant functions. Some functions do not require additional permissions, but other ones do it. All dynamic arguments including profile names and paths are in double quotes to avoid white spaces problem. The functions which require root privileges are:
- Netctl control module
- WiFi module
- - This module require root privileges to start wpa_supplicant only. For the futher interaction user must be in
CTRL_GROUP
.
+ - This module require root privileges to start
wpa_supplicant
only. For the futher interaction user must be in CTRL_GROUP
.
+If library will be initialized with FORCE_SUDO=true
than it will use sudo
command (which can be transferred to the library by SUDO_PATH
option). Otherwise it will try to set UID of children processes to 0. Please note that sudo
command and UID setting will be used only for those commands which require it.
+
+Helper security
+First of all the helper does not interact with netctl directly, it uses the library to do it. So all library security notes are applicable here. To start the helper and to create DBus services user must be in netcwork
group by default (or must be root). But you may change it by editing $DBUS_SYSTEMCONF_PATH/org.netctlgui.helper.conf
policy file (/etc/dbus-1/system.d/org.netctlgui.helper.conf
by default). Please refer to DBus documentation to do it.
+
+There are two binaries netctgui-helper
and netctlgui-helper-suid
. They are the same, but the second one has SUID bit, so it can be running by normal user without any password. Please note that it is dangerous and recommended way is to use systemd daemon. In this case you may not install netctlgui-helper-suid
binary.
+
+There are two configuration files $HOME/.config/netctl-gui.conf
and /etc/netctl-gui.conf
. The first one is a user configuration and the second one is a system-wide. Please note that by default user configuration has higher priority than system-wide, but running with --system
flag user configuration will not be reading. The helper and GUI configurations are the same (although some keys aren't needed).
+
+Graphical interface security
+Graphical interface may interact with netctl over DBus (the helper) and over the library. Please refer to their notes to any additional information. If user uses helper he should have permissions to run it.
+
+KDE components security
+There are two netctl-based commands which are run from the DataEngine
+
+ <cmd> list
+ netctl is-enabled <profile>
+
+Both of them do not require any additional privileges normally. Also DataEngine has two other command which will be run from; they should define external IP. According to the idea that user can set any command to run, this module is not secure. But running commands will not do more than user can do from console himself.
+
+The widget gets information from DataEngine, thus it does not require any additional permissions to show information. But netctl calls are used to control netctl. In this case used commands are
+
+ netctl enable <profile>
+ netctl disable <profile>
+ netctl restart <profile>
+ netctl start <profile>
+ netctl stop <profile>
+ netctl switch-to <profile>
+ netctl-auto switch-to <profile>
+
+All netctl-based commands require root privileges and sudo
(and any other alternatives) is used normally as prefix to the commands. The netctl-auto command does not require additional permissions.
+
+The other way is to use DBus communication with the helper. In this case user should have rights to start the helper.
+
External links
- Homepage
diff --git a/sources/gui/docs/netctl-gui-security-notes.html~ b/sources/gui/docs/netctl-gui-security-notes.html~
deleted file mode 100644
index 866453a..0000000
--- a/sources/gui/docs/netctl-gui-security-notes.html~
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-
- netctl-gui secutiry notes
-
- netctl-gui security notes
- Project version : @PROJECT_VERSION@
-
- - Description
- - Architecture
- - KDE components security
- - Graphical interface security
- - Library security
- - Helper security
-
- - External links
-
-
-
-
-Description
-
-
-Architecture
-
-
-KDE components security
-There are two netctl-based commands which are run from the DataEngine
-
- <cmd> list
- netctl is-enabled <profile>
-
-Both of them do not require any additional privileges normally. Also DataEngine has two other command which will be run from; they should define external IP. According to the idea that user can set any command to run, this module is not secure. But running commands will not do more than user can do from console himself.
-
-The widget gets information from DataEngine, thus it does not require any additional permissions to show information. But netctl calls with root privileges are used to control netctl. In this case used commands are
-
- netctl enable <profile>
- netctl disable <profile>
- netctl restart <profile>
- netctl start <profile>
- netctl stop <profile>
- netctl switch-to <profile>
- netctl-auto switch-to <profile>
-
-All netctl-based commands requires root privileges and sudo
(and any other alternatives) is used normally as prefix to the commands. The netctl-auto command does not require additional permissions.
-
-The other way is to use DBus communication with the helper. In this case user should have rights to start the helper.
-
-Graphical interface security
-Graphical interface may interact with netctl over DBus (the helper) and over the library. Please refer to their notes to any additional information. If user uses helper he should have permissions to run it.
-
-Library security
-According to the scheme library gets information from netctl and can control it. Also it provides some additional functions such as a profile creation and removal and access to wpa_supplicant functions. Some function does not require additional permissions, but other ones do it. All dynamic arguments including profile names and paths are in double quotes to avoid white spaces problem. The functions which requires root privileges are:
-
- - Netctl control module
-
- netctl start|stop|restart|switch-to|enable|disable <profile>
. They are commands which provide a general control to netctl.
- systemctl start|restart|enable <netctl-auto@service>
. They are commands which provide ability to control netctl-auto systemd service.
-
- - Netctl profiles module
-
- - Copying of a temporary profile from home directory to netctl profiles directory.
cp
command is used for it.
- - Removal of a profile.
rm
command is used for it.
-
- - WiFi module
-
- - This module require root privileges to start wpa_supplicant only. For the futher interaction user must be in
CTRL_GROUP
.
-
-
-
-
-
-External links
-
-
-
- © 2014-@CURRENT_YEAR@ @PROJECT_AUTHOR@
- This software is licensed under @PROJECT_LICENSE@
-
-
-
-
\ No newline at end of file
diff --git a/sources/gui/docs/rawscheme.ppt b/sources/gui/docs/rawscheme.ppt
new file mode 100644
index 0000000..c510125
Binary files /dev/null and b/sources/gui/docs/rawscheme.ppt differ
diff --git a/sources/helper/CMakeLists.txt b/sources/helper/CMakeLists.txt
index 1478a45..8da671c 100644
--- a/sources/helper/CMakeLists.txt
+++ b/sources/helper/CMakeLists.txt
@@ -21,6 +21,7 @@ file (RELATIVE_PATH SUBPROJECT_MAN ${CMAKE_SOURCE_DIR} ${SUBPROJECT_MAN_IN})
configure_file (${SUBPROJECT_MAN_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN})
install (FILES org.netctlgui.helper.conf DESTINATION ${DBUS_SYSTEMCONF_PATH})
+install (FILES netctlgui-helper.conf DESTINATION /etc)
install (FILES netctlgui-helper.service DESTINATION ${SYSTEMD_SERVICE_PATH})
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_MAN} DESTINATION share/man/man1/)
install (FILES bash-completions DESTINATION share/bash-completion/completions/ RENAME ${SUBPROJECT})
diff --git a/sources/helper/bash-completions b/sources/helper/bash-completions
index 0a2ffb8..19b06d8 100644
--- a/sources/helper/bash-completions
+++ b/sources/helper/bash-completions
@@ -25,6 +25,7 @@ _netctlgui_helper_arglist=(
'--nodaemon'
'--replace'
'--restore'
+ '--system'
'-v'
'--version'
'-i'
diff --git a/sources/helper/netctlgui-helper.1 b/sources/helper/netctlgui-helper.1
index 2b9efc1..2d11b24 100644
--- a/sources/helper/netctlgui-helper.1
+++ b/sources/helper/netctlgui-helper.1
@@ -22,6 +22,8 @@ do not run as daemon
force replace the existing session
.IP "--restore"
force restore the existing session
+.IP "--system"
+do not read user configuration
.IP "-v, --version"
show version and exit
.IP "-i, --info"
diff --git a/sources/helper/netctlgui-helper.conf b/sources/helper/netctlgui-helper.conf
new file mode 100644
index 0000000..ee902a2
--- /dev/null
+++ b/sources/helper/netctlgui-helper.conf
@@ -0,0 +1,24 @@
+CLOSETOTRAY=true
+CLOSE_HELPER=false
+CTRL_DIR=/run/wpa_supplicant_netctl-gui
+CTRL_GROUP=users
+FORCE_SUDO=false
+HELPER_PATH=/usr/bin/netctlgui-helper
+HELPER_SERVICE=netctlgui-helper.service
+IFACE_DIR=/sys/class/net/
+LANGUAGE=en
+NETCTLAUTO_PATH=/usr/bin/netctl-auto
+NETCTLAUTO_SERVICE=netctl-auto
+NETCTL_PATH=/usr/bin/netctl
+PID_FILE=/run/wpa_supplicant_netctl-gui.pid
+PREFERED_IFACE=
+PROFILE_DIR=/etc/netctl/
+RFKILL_DIR=/sys/class/rfkill/
+STARTTOTRAY=false
+SUDO_PATH=/usr/bin/sudo
+SYSTEMCTL_PATH=/usr/bin/systemctl
+SYSTRAY=true
+USE_HELPER=true
+WPACLI_PATH=/usr/bin/wpa_cli
+WPASUP_PATH=/usr/bin/wpa_supplicant
+WPA_DRIVERS=nl80211,wext
diff --git a/sources/helper/netctlgui-helper.service b/sources/helper/netctlgui-helper.service
index 99b16a8..454b01b 100644
--- a/sources/helper/netctlgui-helper.service
+++ b/sources/helper/netctlgui-helper.service
@@ -3,7 +3,7 @@ Description=netctlgui-helper daemon
[Service]
Type=forking
-ExecStart=/usr/bin/netctlgui-helper
+ExecStart=/usr/bin/netctlgui-helper --system
[Install]
WantedBy=multi-user.target
diff --git a/sources/helper/src/main.cpp b/sources/helper/src/main.cpp
index 1c125ef..179c5b8 100644
--- a/sources/helper/src/main.cpp
+++ b/sources/helper/src/main.cpp
@@ -67,6 +67,9 @@ int main(int argc, char *argv[])
} else if (QString(argv[i]) == QString("--restore")) {
// restore
args[QString("state")] = (int) 2;
+ } else if (QString(argv[i]) == QString("--system")) {
+ // system
+ args[QString("system")] = true;
} else if ((QString(argv[i]) == QString("-h")) || (QString(argv[i]) == QString("--help"))) {
// help message
args[QString("help")] = true;
diff --git a/sources/helper/src/messages.cpp b/sources/helper/src/messages.cpp
index 714f984..8c17ed4 100644
--- a/sources/helper/src/messages.cpp
+++ b/sources/helper/src/messages.cpp
@@ -38,6 +38,7 @@ QMap getArgs()
args[QString("debug")] = false;
args[QString("nodaemon")] = false;
args[QString("state")] = (int) 0;
+ args[QString("system")] = false;
args[QString("help")] = false;
args[QString("info")] = false;
args[QString("version")] = false;
@@ -64,6 +65,8 @@ QString helpMessage()
.arg(QCoreApplication::translate("NetctlHelper", "force replace the existing session"));
helpMessage += QString(" --restore - %1\n")
.arg(QCoreApplication::translate("NetctlHelper", "force restore the existing session"));
+ helpMessage += QString(" --system - %1\n")
+ .arg(QCoreApplication::translate("NetctlHelper", "do not read user configuration, system-wide only"));
helpMessage += QString(" %1\n").arg(QCoreApplication::translate("NetctlHelper", "Show messages:"));
helpMessage += QString(" -v, --version - %1\n")
.arg(QCoreApplication::translate("NetctlHelper", "show version and exit"));
diff --git a/sources/helper/src/netctlhelper.cpp b/sources/helper/src/netctlhelper.cpp
index 70e844d..95f18d2 100644
--- a/sources/helper/src/netctlhelper.cpp
+++ b/sources/helper/src/netctlhelper.cpp
@@ -33,7 +33,8 @@
NetctlHelper::NetctlHelper(QObject *parent, QMap args)
: QObject(parent),
configPath(args[QString("config")].toString()),
- debug(args[QString("debug")].toBool())
+ debug(args[QString("debug")].toBool()),
+ system(args[QString("system")].toBool())
{
updateConfiguration();
if (!args[QString("nodaemon")].toBool())
@@ -136,12 +137,16 @@ QMap NetctlHelper::getDefault()
}
-QMap NetctlHelper::getSettings()
+QMap NetctlHelper::getSettings(const QString file, const QMap existing)
{
if (debug) qDebug() << "[NetctlHelper]" << "[getSettings]";
- QMap settings = getDefault();
- QFile configFile(configPath);
+ QMap settings;
+ if (existing.isEmpty())
+ settings = getDefault();
+ else
+ settings = existing;
+ QFile configFile(file);
QString fileStr;
if (!configFile.open(QIODevice::ReadOnly))
return settings;
@@ -168,7 +173,9 @@ void NetctlHelper::updateConfiguration()
if (debug) qDebug() << "[NetctlHelper]" << "[updateConfiguration]";
deleteInterface();
- configuration = getSettings();
+ configuration = getSettings(QString("/etc/netctlgui-helper.conf"));
+ if (!system)
+ configuration = getSettings(configPath, configuration);
createInterface();
}
diff --git a/sources/helper/src/netctlhelper.h b/sources/helper/src/netctlhelper.h
index 3cb4bc4..17af67c 100644
--- a/sources/helper/src/netctlhelper.h
+++ b/sources/helper/src/netctlhelper.h
@@ -41,10 +41,12 @@ private:
QString configPath;
QMap configuration;
bool debug;
+ bool system;
void createInterface();
void deleteInterface();
QMap getDefault();
- QMap getSettings();
+ QMap getSettings(const QString file,
+ const QMap existing = QMap());
};
diff --git a/sources/helper/zsh-completions b/sources/helper/zsh-completions
index 5eea1ea..f97df91 100644
--- a/sources/helper/zsh-completions
+++ b/sources/helper/zsh-completions
@@ -24,6 +24,7 @@ _netctlgui_helper_arglist=(
{'--nodaemon','--nodaemon'}'[do not start as daemon]'
{'--replace','--replace'}'[force replace the existing session]'
{'--restore','--restore'}'[force restore the existing session]'
+ {'--system','--system'}'[do not read user configuration]'
{'(--version)-v','(-v)--version'}'[show version and exit]'
{'(--info)-i','(-i)--info'}'[show build information and exit]'
{'(--help)-h','(-h)--help'}'[show help and exit]'