Forums

Todd
Todd
Offline
Resolved
0 votes
I made an update to the wireless app if any experienced users want to try it out.

To get it to work, You need to Install the base clearos wireless app first
yum install app-wireless

You can grab the files from
https://gitlab.com/gs_clearos/app-wireless/tree/gs1/
Then copy over the new web files from git lab. ( sorry, I don't have anywhere to host the rpm's right now)
It also requires an updated version of hostapd. The file hostapd_build_rpm.sh, will compile a new rpm for hostapd.

The app supports multiple wifi cards, 2.4 / 5.0Ghz, and automatic provisioning of the wifi cards ht_capab and vht_capab options.
Hopefully I included a good enough frame work where others can fill in the missing parts.


I'll submit the code to the main tree when I finish.
Monday, June 03 2019, 06:44 AM
Share this post:
Responses (31)
  • Accepted Answer

    Friday, July 19 2019, 02:47 PM - #Permalink
    Resolved
    0 votes
    For your file watcher (reloading the service after any change), create a file, /etc/clearsync.d/filewatch-hostapd-multi.conf and in it put something like:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!-- ClearSync Hostapd Configuration Watch -->
    <plugin name="HostapdConfigurationWatch" library="libcsplugin-filewatch.so" stack-size="65536">
    <action-group name="HostapdRestart" delay="3">
    <action>sudo /usr/bin/systemctl condrestart hostapd-multi</action>
    </action-group>

    <on-modify type="pattern" path="/etc/hostapd" action-group="HostapdRestart">^hostapd-.*\.conf</on-modify>
    <on-modify type="pattern" path="/etc/hostapd" action-group="HostapdRestart">^hostapd-.*\.conf</on-create>
    <on-modify type="pattern" path="/etc/hostapd" action-group="HostapdRestart">^hostapd-.*\.conf</on-delete>
    </plugin>
    <!--
    vi: syntax=xml expandtab shiftwidth=2 softtabstop=2 tabstop=2
    -->

    Remember to add it to info.php. In Gitlab it needs to go under /packaging. Check the filename regex that you are watching is right. I'd also think about reducing the 3 second delay. This is all based on cribbing without full knowledge so some of my modding of /etc/clearsync.d/filewatch-firewall.conf may be wrong and it has not been tested. You can test by modifying the action to perhaps do a "logger" message (if the sudoers permit it) then touching and deleting files and so on

    I can't help with the start/stop button.

    You also need a deploy/upgrade script to do your daemon-reload and a deploy/uninstall to remove your own conf files in /etc/hostapd, but leave hostapd.conf there.
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Thursday, July 18 2019, 10:10 PM - #Permalink
    Resolved
    0 votes
    I made the changes.

    Only thing left is to get the start and stop button working. Right now, clicking it does nothing.
    I also need to reload the service after any file change.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, July 16 2019, 08:33 AM - #Permalink
    Resolved
    0 votes
    I've just been looking at the systemctl documentation, and it looks like you can do a "systemctl is-active hostapd" in your /usr/bin/hostapd-multi, or even "systemctl is-active hostapd --quiet" if you just wanted to test the return code. Either will save your grepping and sed bits.

    Looking at your RPM's, there is no deploy/upgrade. Create a really simple one:
    #!/bin/sh

    # Do a daemon-reload for a new unit file
    #---------------------------------------

    /usr/bin/systemctl daemon-reload
    This should get packaged automatically when you run the "clearos spec" command, but remember to give it 0755 permissions before you commit it.

    You also need to package your daemon monitor, if this is what you mean by the configlet which watches for changes to the hostapd-*.conf files. Assuming you have called it filewatch-hostapd-multi.conf, you need to put it in your packaging folder. Then try changing info.php from:
    $app['core_file_manifest'] = array(
    'hostapd-multi.php'=> array('target' => '/var/clearos/base/daemon/hostapd.php'),
    'hostapd-multi.service'=> array(
    'target' => '/usr/lib/systemd/system/hostapd-multi.service',
    'mode' => '0755'
    ),
    'hostapd-multi'=> array(
    'target' => '/usr/sbin/hostapd-multi',
    'mode' => '0755'
    ),
    );
    to:
    $app['core_file_manifest'] = array(
    'hostapd-multi.php'=> array('target' => '/var/clearos/base/daemon/hostapd.php'),
    'hostapd-multi.service'=> array(
    'target' => '/usr/lib/systemd/system/hostapd-multi.service',
    'mode' => '0755'
    ),
    'hostapd-multi'=> array(
    'target' => '/usr/sbin/hostapd-multi',
    'mode' => '0755'
    ),
    'filewatch-hostapd-multi.conf'=> array('target' => '/etc/clearsync.d/filewatch-hostapd-multi.conf'),
    );
    I don't think permissions (mode) are important in this case as I think they default to 0644 which is what you want. Once you've done this, you'll need to run "clearos spec" to regenerate your spec file.

    Note I don't think your change to:
        'hostapd-multi.service'=> array(
    'target' => '/usr/lib/systemd/system/hostapd-multi.service',
    'mode' => '0755'
    ),
    is correct. Systemd will complain if the unit file has any execute permissions. They are best left as 0644, so you can revert the line to mine.

    BTW, you can change /nextcloud/ in .gitignore file to /app-wireless/. That was a c&p error of mine.
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Monday, July 15 2019, 10:11 PM - #Permalink
    Resolved
    0 votes
    I uploaded the files to dropbox
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Monday, July 15 2019, 10:08 PM - #Permalink
    Resolved
    0 votes
    I've attached the rpm files.
    The reply is currently minimized Show
  • Accepted Answer

    Monday, July 15 2019, 09:37 PM - #Permalink
    Resolved
    0 votes
    1 - What do you mean by daemon-monitor
    2 - put the daemon-reload command in a deploy/upgrade script and remember to give it 0755 permissions before you package it.

    Can you share your RPM? I know we have TZ problem so I won't be able to look at it until tomorrow.
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Monday, July 15 2019, 08:28 PM - #Permalink
    Resolved
    0 votes
    I installed the clearos dev environment and created the rpms. I worked out some of the package install bugs.
    The 2 issues I have with install rpm is
    1. The daemon monitor no longer works.
    2. I have to manually type " systemctl daemon-reload" to get the new hostapd-multi service to start working.

    [edit]
    .... or push your changes to your repo so I can then pick them up.
    [/edit]
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, July 13 2019, 09:17 AM - #Permalink
    Resolved
    0 votes
    For development work in ClearOS, have a look at ClearOS Developer, especially the "Step 4 - Create Your Development Environment" section. Put your app under /home/{your_development_username}/aps/your_app_name. If the app you are developing is app-wireless, your_app_name is just "wireless". This keeps all your PHP code (really, anything which installs under /usr/clearos/apps) isolated from the original code. Where it won't help is with things like your listener or conf files which fall outside the folder structure.
    The reply is currently minimized Show
  • Accepted Answer

    Saturday, July 13 2019, 09:09 AM - #Permalink
    Resolved
    0 votes
    For the SSID, a google of "SSID regex" turned up this. You'd have to convert it to PHP, but there are quite a few regex testing sites that you could check your regex with such as Regex101.com
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Friday, July 12 2019, 09:52 PM - #Permalink
    Resolved
    0 votes
    thanks for all the help.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, July 12 2019, 09:22 PM - #Permalink
    Resolved
    0 votes
    It is late now so I'll reply more tomorrow. For 1, you could use a listener. Have a look at /etc/clearsync.d/filewatch-firewall.conf, for example, or the other files in that folder. You'll want an on-create, on-change and on-delete event and probably watch for files named /etc/hostapd/hostapd*.conf. Rather than do a "service hostapd-multi restart" to a "service hostapd-multi condrestart". I also recently modified the sudoers file for everyone to allow the systemctl command as well as the service command.

    I'll look at the regex tomorrow, but I suggest split into character1, character 2-whatever and the last character.
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Friday, July 12 2019, 08:42 PM - #Permalink
    Resolved
    0 votes
    I'm currently not using any development environment. I'm editing the files in the /usr/clearos/wifi directory using visual studio core, and sometimes vi.
    I'm not a developer, I was just forced into this because I needed it, my friends program in .NET, and javascript. No one want to touch php.


    I modified the files with your suggestions.
    The landing page now display a message if no wireless controllers are found.
    I did some minor bug fixes to support DFS. ( dfs works, I'm testing it right now. )


    I need some help.

    1. I don't know the proper way to restart the service after a change has been made, or a configuration deleted.

    2. I also need to modify the ssid regular expression. It need to allow - , _ in the middle of the ssid string.
    according to the spec.
    The SSID can consist of up to 32 alphanumeric, case-sensitive, characters. The first character cannot be the !, #, or ; character. The +, ], /, ", TAB, and trailing spaces are invalid characters for SSIDs.

    public function validate_ssid($ssid)
    {
    clearos_profile(__METHOD__, __LINE__);

    // REGEX match for UTF8 (See http://standards.ieee.org/getieee802/download/802.11-2012.pdf)
    if (!preg_match("/^[\\s,\\d,\\p{L}]{0,32}$/u", $ssid))
    return lang('wireless_ssid_invalid');
    }
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, July 10 2019, 09:41 AM - #Permalink
    Resolved
    0 votes
    Hmm. Using the 1501 interface and without any Wireless nics installed I am seeing:
    Attachments:
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, July 10 2019, 09:37 AM - #Permalink
    Resolved
    0 votes
    I've had a look this morning and got the app to compile. Can I suggest you do the following:
    Rename ReadME.MD to README.md or readme.md so the spec file generator can cope with it
    add a .gitgnore with the following contents:
    /Makefile
    *.src.rpm
    *.tar.gz
    *.tar.bz2
    .build-*.log
    /noarch/
    /nextcloud/

    Change the permissions on hostapd-multi to 0755, but the info.php will pick this up for you.
    Change your info.php to something like:
    <?php

    /////////////////////////////////////////////////////////////////////////////
    // General information
    /////////////////////////////////////////////////////////////////////////////

    $app['basename'] = 'wireless';
    $app['version'] = '2.3.1';
    $app['release'] = '1';
    $app['vendor'] = 'ClearFoundation';
    $app['packager'] = 'ClearFoundation';
    $app['license'] = 'GPLv3';
    $app['license_core'] = 'LGPLv3';
    $app['description'] = lang('wireless_app_description');

    /////////////////////////////////////////////////////////////////////////////
    // App name and categories
    /////////////////////////////////////////////////////////////////////////////

    $app['name'] = lang('wireless_app_name');
    $app['category'] = lang('base_category_network');
    $app['subcategory'] = lang('base_subcategory_settings');

    /////////////////////////////////////////////////////////////////////////////
    // Controllers
    /////////////////////////////////////////////////////////////////////////////

    $app['controllers']['wireless']['title'] = $app['name'];
    $app['controllers']['settings']['title'] = lang('base_settings');
    $app['controllers']['policy']['title'] = lang('base_app_policy');

    /////////////////////////////////////////////////////////////////////////////
    // Packaging
    /////////////////////////////////////////////////////////////////////////////

    $app['requires'] = array(
    'app-accounts',
    'app-incoming-firewall',
    'app-groups',
    'app-users',
    'app-network',
    );

    $app['core_requires'] = array(
    'app-events-core >= 1:2.3.0',
    'app-network-core',
    'app-incoming-firewall-core',
    'app-radius-core',
    'hostapd',
    'openssl',
    );

    $app['core_directory_manifest'] = array(
    '/var/clearos/wireless/backup' => array(),
    );

    $app['core_file_manifest'] = array(
    'hostapd-multi.php'=> array('target' => '/var/clearos/base/daemon/hostapd.php'),
    'hostapd-multi.service'=> array('target' => '/usr/lib/systemd/system',),
    'hostapd-multi'=> array(
    'target' => '/usr/sbin/hostapd-multi',
    'mode' => '0755'
    ),
    );

    $app['delete_dependency'] = array(
    'hostapd',
    'app-wireless-core',
    );

    Note this will install your hostapd-multi.php as hostapd-multi.php which is which your original spec file did. You'll need to confirm that that is still what you want.

    You can then run "clearos spec" to generate the spec file. Looking at the "clearos spec" code, it can handle sysv init files but not systemd unit files, so you probably need to add a "systemctl daemon-reload" in a deploy/upgrade script, but remember to set its permissions to 0755.

    What is happening in your app in /var/clearos/wireless/backup? I have not looked at the app yet, but if you don't use it, you may want to get rid of it from the info.php which will remove it from the spec file when it is regenerated. If you do use it, you may want a deploy/uninstall file to remove the contents of it but not it (I think! Using the logic that a yum uninstall or rpm -e will remove the folder, if empty, but not the contents, but it may complain if the folder does not exist when it tries to remove it. This needs to be tested).

    I am not sure how you have your development environment set up, but is you have a folder /home/{development_user}/apps under which you have your app-wireless app development, from the apps folder you can do a git@gitlab.com:clearos/common.git. This will create a folder structure apps/common. Create a symlink from your app root folder to apps/common/Makefile. For me, I have /home/devel/apps/app-wireless/Makefile synlinking to /home/devel/apps/common/Makefile. Then, from the /home/devel/apps/app-wireless folder I can run "make srpm" to make the source rpm and "make local" to make the installable rpm. If you are using the development webconfig on port 1501, you folder project folder name should be /home/devel/apps/wireless and not /home/devel/apps/app-wireless as I have.
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Wednesday, July 10 2019, 03:57 AM - #Permalink
    Resolved
    0 votes
    I did almost zero work on the spec file. I'll take a look.
    I was downloading the source as a zip file and copying to the directory for testing. I learned Unix on openbsd, I'm kind of used to doing things the hardware way.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, July 09 2019, 06:34 PM - #Permalink
    Resolved
    0 votes
    Hi Todd,
    I clicked on your link which goes to the spec file and it looks a bit odd. It excludes everything in packaging except hostapd-multi.php, so how does it install hostapd-multi and hostapd-multi.service. If you're following the ClearOS process to generate the spec file, these files get specified in deploy/info.php, and running "clearos-spec" then generates the spec file for you. However, if you've been creating your spec file manually, your manual entries will get stomped on.

    You may want an uninstall script to remove your conf files and the install script may need a "systemctl daemon-reload" or it may be better placed in an upgrade script.

    Please not that I am not a developer but I do do basic bug fixes and a bit of scripting so I do build packages but I am not totally familiar with the process or standards and I'm still learning. I'll have a bigger look tomorrow.
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Tuesday, July 09 2019, 02:41 PM - #Permalink
    Resolved
    0 votes
    I have an updated version available now.
    https://gitlab.com/gs_clearos/app-wireless/blob/gs/packaging/app-wireless.spec

    I think its good enough for a testing.

    I had to remove the HT40 option from ht_capab, it requires more logic to get it working properly.
    here are the notes for HT40
    [HT40-] = both 20 MHz and 40 MHz with secondary below the primary channel;
    [HT40+] = both 20 MHz and 40 MHz with secondary channel above the primary channel
    (20 MHz only if neither is set)

    Note: There are limits on which channels can be used with HT40- and HT40+.
    Following table shows the channels that may be available for
    2.4 GHz, HT40- channels [5-13] , HT40+ channels [ 1-7 (1-9 in Europe/Japan)
    5 GHz, HT40- , channels[40,48,56,64], HT40+ channels[ 36,44,52,60]
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, June 18 2019, 07:12 AM - #Permalink
    Resolved
    0 votes
    Minor typo on my side. Remove the "$":
    ExecStartPost=-/usr/bin/systemctl unset-environment HOSTAPD_CONFIGS
    It is only a clean-up line and, as long as you don't append to HOSTAPD_CONFIGS elsewhere (which I why I left your original script building CONFIGS before assigning it to HOSTAPD_CONFIGS, rather than building HOSTAPD_CONFIGS directly), it **may** be OK to leave out the line.
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Tuesday, June 18 2019, 04:09 AM - #Permalink
    Resolved
    0 votes
    I made the updates and it works.

    I do get some errors in systemd. Its doesn't seem to effect anything.
    process: 18421 ExecStartPost=/usr/bin/systemctl unset-environment $HOSTAPD_CONFIGS (code=exited, status=1/FAILURE)
    Failed to set environment: Invalid environment variable names or assignments
    The reply is currently minimized Show
  • Accepted Answer

    Monday, June 17 2019, 08:01 PM - #Permalink
    Resolved
    0 votes
    Ouch. I am not so sure about recompiling the kernel. That would bring a few issues. Can you make your code work without DFS support as well as with?

    If you do recompile the kernel, I suggest you switch to the Centos kernel. With the recent app-qos release, ClearOS should now be compatible with the stock Centos kernel. As it is now compatible, it is, or, at least, should be, compatible compatible with the ElRepo kernels so it may be worth checking if they have been compiled with DFS support. If everything goes as planned, the current kernel may well be the last ClearOS specific kernel.
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Monday, June 17 2019, 06:21 PM - #Permalink
    Resolved
    0 votes
    most of what i hacked together was just my best guess. I'm not familiar with systemd,and I never wrote batch scripts before. The on boot even was copied from the previous clearos wifi app. I actually have no idea what it does.

    You service script is better. I'll make the modifications and test it out.

    My plan is to get enough testing to make sure this initial release is stable.

    Then I am then going to add multiple country support. Should be easy, you just have to run, iw reg set COUNTY_CODE. ( The only issue I have with the country code is that you have to reboot for the change to take effect.

    Then, i'm going to add back in radius support. ( support the radius server on clearos, and external radius servers)

    Then I'm going to recompile the kernel to add DFS support, and test DFS. To do this correctly I'll gave to pass the radar channels to the javascript. I'll have to come up with some better logic to hand the the radar channels.
    The reply is currently minimized Show
  • Accepted Answer

    Monday, June 17 2019, 05:30 PM - #Permalink
    Resolved
    0 votes
    Hello Todd,
    Why not model your start script similar to mine:
    [Unit]
    Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
    After=network.target

    [Service]
    Type=forking
    ExecStartPre=-/usr/sbin/hostapd-multi
    ExecStart=/usr/sbin/hostapd $HOSTAPD_CONFIGS -P /run/hostapd.pid -B
    ExecStartPost=-/usr/bin/systemctl unset-environment $HOSTAPD_CONFIGS

    [Install]
    WantedBy=multi-user.target
    Note I am trying to change the pid file to block any user from starting hostapd.

    Then for your hostapd-mult script, try (completely untested, just hacking yours) and using psuedo-code:
    #!/bin/sh

    if [ $(systemctl status hostapd) == "running_or_whatever" ]; then
    systemctl stop hostapd
    fi

    DEVICES=$(cat /etc/sysconfig/network-scripts/ifcfg-wl* |grep -oP '(?<=DEVICE=).*' | sed 's/"//g')
    CONFIG=''
    for d in $DEVICES; do
    if ifconfig -a | grep $d; then
    FILE=/etc/hostapd/hostapd-$d.conf
    if test -f "$FILE"; then
    RESULT=$(grep -r -H ^interface=$d $FILE | awk -F : ' { print $1 } ')
    CONFIG="$CONFIG $RESULT"
    fi
    fi
    done
    systemctl set-environment HOSTAPD_CONFIGS="$CONFIG"
    fi
    If you do this then the unit file controls the stopping and starting rather than hand it off to another process. I am hoping (so untested) that you can use the same pid file as the native hostapd service and than if you then try to start hostapd, it will see the pid file is in use and refuse to start.

    What is the purpose of your onboot-event? Also will anything like that work or could you hit a race condition?
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Sunday, June 16 2019, 10:40 PM - #Permalink
    Resolved
    0 votes
    ok. I made some changes. I made service called hostapd-mult , it will stop the default hostapd service, and disable it from starting.

    The new code is at
    https://gitlab.com/gs_clearos/app-wireless

    I install these apps before I install the wireless app

    yum install -y \
    app-wireless-core \
    wireless-tools \
    m2crypto \
    python2-future \
    libntlm \
    wpa_supplicant
    The reply is currently minimized Show
  • Accepted Answer

    Monday, June 03 2019, 07:46 PM - #Permalink
    Resolved
    0 votes
    It is not such an easy search, but it sounds like you're right, you only run a single instance of hostapd which makes like a little harder. I'd suggest it is not a good idea to modify the hostapd unit file either as any hostapd update will overwrite your changes. Perhaps it would be better to write your own unit file with a different name (but perhaps the same pid?). For miniupnpd I had to write my own unit file:
    [Unit]
    Description=UPnP device server.
    Documentation=man:miniupnpd(8)
    After=network.target firewall.service

    [Service]
    Type=forking
    ExecStartPre=-/etc/miniupnpd/iptables_init.sh
    ExecStartPre=-/etc/miniupnpd/init_clearos.sh
    ExecStart=/usr/sbin/miniupnpd -f /etc/miniupnpd/miniupnpd.conf $MINIUPNPD_START_OPTIONS
    ExecStartPost=-/usr/bin/systemctl unset-environment MINIUPNPD_START_OPTIONS
    ExecStopPost=-/etc/miniupnpd/iptables_removeall.sh

    Restart=always
    RestartSec=1
    TimeoutSec=5

    [Install]
    WantedBy=multi-user.target
    You could use your /usr/sbin/wireless-ap like my /etc/miniupnpd/init_clearos.sh just to write a variable like my $MINIUPNPD_START_OPTIONS using the "systemctl set-environment MINIUPNPD_START_OPTIONS="your_conf_file_list"
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Monday, June 03 2019, 06:37 PM - #Permalink
    Resolved
    0 votes
    you have to launch hostapd with all the config files at one time.

    I could have the web app modify the hostapd service. That way you can keep the hostapd from the repos.
    I'll have it check to if ExecStart=/usr/sbin/wireless-ap
    I'll also place the wireless-ap in the app-wireless rpm.
    The reply is currently minimized Show
  • Accepted Answer

    Monday, June 03 2019, 05:11 PM - #Permalink
    Resolved
    0 votes
    That means my instructions are no good. It also forces us to maintain our own version of hostapd (and block the epel one from our repos) which may be problematic. Is it worth looking at the openvpn unit file, /usr/lib/systemd/system/openvpn@.service and the openvpn app? To start our openvpn services (2 of them), you do a:
    systemctl start openvpn@clients
    systemctl start openvpn@clients-tcp
    Presumably the webconfig then does something to loop through the different conf files.

    Arpwatch does something similar so you do a "systemctl start arpwatch@enp5s0".
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Monday, June 03 2019, 04:33 PM - #Permalink
    Resolved
    0 votes
    I hard coded it into the
    https://gitlab.com/gs_clearos/app-wireless/blob/gs1/hostapd_build_rpm.sh

    Here are the modified service files

    cat > ~/rpmbuild/SOURCES/hostapd.service << EOT
    [Unit]
    Description=Hostapd IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
    After=network.target

    [Service]
    Type=forking
    PIDFile=/run/hostapd.pid
    ExecStart=/usr/sbin/wireless-ap

    [Install]
    WantedBy=multi-user.target
    EOT

    #######################################################################################################
    cat > ~/rpmbuild/SOURCES/wireless-ap << EOT
    #!/bin/sh
    DEVICES=$(cat /etc/sysconfig/network-scripts/ifcfg-wl* |grep -oP '(?<=DEVICE=).*' | sed 's/"//g')
    CONFIG=''
    for d in $DEVICES
    do
    if ifconfig -a | grep $d; then
    FILE=/etc/hostapd/hostapd-$d.conf
    if test -f "$FILE"; then
    RESULT=$(grep -r -H ^interface=$d $FILE | awk -F : ' { print $1 } ')
    CONFIG="$CONFIG $RESULT"
    fi
    fi
    done
    /usr/sbin/hostapd $CONFIG -P /run/hostapd.pid -B
    EOT
    The reply is currently minimized Show
  • Accepted Answer

    Monday, June 03 2019, 04:00 PM - #Permalink
    Resolved
    0 votes
    From the EPEL 2.8 srpm:
    cat defconfig | sed \
    -e '/^#CONFIG_DRIVER_NL80211=y/s/^#//' \
    -e '/^#CONFIG_RADIUS_SERVER=y/s/^#//' \
    -e '/^#CONFIG_DRIVER_WIRED=y/s/^#//' \
    -e '/^#CONFIG_DRIVER_NONE=y/s/^#//' \
    -e '/^#CONFIG_IEEE80211N=y/s/^#//' \
    -e '/^#CONFIG_IEEE80211R=y/s/^#//' \
    -e '/^#CONFIG_IEEE80211AC=y/s/^#//' \
    -e '/^#CONFIG_FULL_DYNAMIC_VLAN=y/s/^#//' \
    -e '/^#CONFIG_LIBNL32=y/s/^#//' \
    -e '/^#CONFIG_ACS=y/s/^#//' \
    > .config
    So that looks good.

    I don't see anything about /usr/sbin/wireless-ap in any of the rpms. I thought it could be possible to write and install a separate unit file to allow you to start hostapd with differemt conf files, say one for each NIC so you'd do something like "systemctl start hostapd@wlan01" and so on for each device. You could then maintain separate conf files for each device. I don't know what you are doing yet. I need to have a look.

    It also looks like you did a version bump so I didn't need to bump the Release. I'll revert mine then amend my instructions.
    The reply is currently minimized Show
  • Accepted Answer

    Todd
    Todd
    Offline
    Monday, June 03 2019, 01:14 PM - #Permalink
    Resolved
    0 votes
    Thanks for making the rpm's available for testing.

    It doesn't require the latest version of hostapd but the code does assume hostapd is compiled with the following options
    CONFIG_DRIVER_NL80211=y
    CONFIG_RADIUS_SERVER=y
    CONFIG_DRIVER_WIRED=y
    CONFIG_DRIVER_NONE=y
    CONFIG_IEEE80211N=y
    CONFIG_IEEE80211R=y
    CONFIG_IEEE80211AC=y
    CONFIG_FULL_DYNAMIC_VLAN=y
    CONFIG_LIBNL32=y
    CONFIG_ACS=y

    The rpm also installs a new service script and start up script.
    The startup script
    /usr/sbin/wireless-ap
    Finds all hostapd files and adds them to the startup.

    If the wifi device device doesn't isn't configure ( static, bridged, dhcp, etc). You won't be able to configure the interface.

    Things that need to be done:

    1. Need to add a notification to tell the user to configure the interface it its not configured.
    2. Need to detect if the device is single band or dual band. ( can probably just parse iw_info for how many times band appears)
    If single band, detect it its 2.4GHz or 5.0 GHz. If its 2.4Ghz , remove vht options. If its 5.0Ghz, change get_ht_capab, ( no need to run getBetween to shorten iw_info)
    3. Right now the DFS in channels are hard coded in javascript. I'm already passing the DFS channels to the wireless_edit page. Need to more the DFS channels into the java script variables.
    4. Need ability to set different country codes. set country codes by running
    echo "REGDOMAIN=US" > /etc/default/crda
    echo "COUNTRY=US" > /etc/sysconfig/regdomain
    iw reg set US
    All supported channels, and DFS channels are pulled using ( iw wlanX info ). Once the country code is set, the supported channels will automatically be pulled.
    5. Add Radius Support. This shouldn't be hard.
    6. Add multiple SSID Support. Query $iw_info, pull number of supported SSID. parse this thing from $iw_info ( #{ AP, mesh point } <= 8, #{ managed } <= 1,total <= 8 )
    will have to add the option use_driver_iface_addr to support Multiple SSID. Otherwise the interface will have to be masked using. ifconfig wlan0 hw ether <MAC addr>
    7: Get Supported Channel Width: ( It would be probably better to parse the hex code to get the supported features. )
    8. If setting 2 radios to the same ssid , set no_auth_if_seen_on=X on one of the interfaces. ( or allow it as an option)
    9. Add Radius Support.
    10. Add Vlan Support.
    The reply is currently minimized Show
  • Accepted Answer

    Monday, June 03 2019, 10:44 AM - #Permalink
    Resolved
    0 votes
    Hi Todd,
    I've compiled the packages for you and you should be able to install everything with a:
    yum install hostapd --enablerepo=epel-testing-unverified
    wget https://www.howitts.co.uk/clearos/ClearOS_7.x/app-wireless-2.3.1-1.clearos7.njh.noarch.rpm
    wget https://www.howitts.co.uk/clearos/ClearOS_7.x/app-wireless-core-2.3.1-1.clearos7.njh.noarch.rpm
    yum install app-wireless-*.rpm
    My bandwidth in not fantastic but the packages are small so should download quickly.

    To produce the build, I bumped the Release to 2, I added:
    %exclude /usr/clearos/apps/wireless/unify.json
    to the "%files core" section of the spec file and removed hostapd_build_rpm.sh from the package.

    I have not yet tried the package as my test box has another issue we are troubleshooting and I'd like to leave it clean for that.

    I am sure I had somewhere instructions to add a wireless interface but I can't find them for the moment. It may be on a forum post somewhere, but if you have some, it would be great if you could share them.
    The reply is currently minimized Show
  • Accepted Answer

    Monday, June 03 2019, 07:16 AM - #Permalink
    Resolved
    0 votes
    Hi Todd,
    Many thanks for that. I'll have a look when I get the chance. Is it an absolute requirement to have hostapd-2.8? I've checked and it is currently available in epel-testing-unverified so it can be installed with a:
    yum update hostapd --enablerepo=epel-testing-unverified
    I believe EPEL leave packages in testing for a couple of weeks before promoting them so it may hit the main repo's quite soon.
    The reply is currently minimized Show
Your Reply