Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - iosense

#1
Does anyone have a knowledge of it?
#2
Development and Code Review / user limitations
February 10, 2016, 12:50:33 PM
Hi folks, There is a problem associated with user limits in my mind.

How to limit users who connect via LAN port?

I just want 50 people to have access to the internet via Captive Portal (LAN port).

Is there a build-in function to be used for this purpose?
#3
I have only "redirect traffic to proxy" NAT rule and this is not working properly with Captive Portal.
Traffic is not routed to the Captive Portal Login page.

How do I do that?

In addition, HTTPS traffic is not working at all, this is a separate issue!


# Ports     IP          Ports   Description
80 (HTTP)   127.0.0.1   3128    redirect traffic to proxy
#4
I'm having the same problem, "LAN" port can not access the Internet via WAN.

I can not make any custom adjustment, WAN_DHCP is my default gateway and Device can access the Internet but clients can not!

#5
OK, I think I found out what the problem is about.
the installation is not completed when I change the Keymap and Video Font settings during installation, but no problems with default settings.

see: https://db.tt/hgEyKWlM
#6
Hey Franco, thank you for your help.

No, I don't have any bootloader modifications and my OPNsense custom build iso working properly with VirtualBox.

I tried a few different systems to understand what the problem is on Network Board device and I installed the pfSense-memstick-2.2.6-RELEASE-i386 with SATA controller as AHCI and the same problem was also here, a system was starting again in 10 seconds.

So I've set the SATA controller as IDE and installed the pfSense again. Well I managed to boot, pfSense worked properly.

I tried the same thing for my OPNsense custom build but I could not install successfully :( Installation was stuck on 59%


/usr/local/bin/cpdup -vvv -I -o /usr/local /mnt/usr/local


screenshot: https://db.tt/NEzoA4WU

What should I do next?
#7
There is no setting to turn UEFI boot off on BIOS, This is not a comprehensive bios.
I tried the SATA controller as IDE but it did not work out. After these setting did I need to install the system again?

Can I check what the the problems in recovery mode to mount the /dev/ada0 via USB?
#8
yes physical device, This device is a kind of network board with Intel Atom N2600 CPU. Also the OPNsense nano is running smoothly via USB, network board device meets the requirements. I think that the problems associated with Solid State Drive SATADOM-SH.
#9
I think you're right about that, the problem itself vagrant, anyway now I began to work on VirtualBox with FreeBSD 10.1 and I have successfully compiled the everything ( make everything )

but now I have a booting problem! Installation is completed with success but when I start the device again I get a screen that looks like the following and the device restarts after 10 seconds continuously... Do I need a custom setting for SSD's? Disk: Solid State Drive SATADOM-SH TYP (16.0GB)


F1 OPNsense
F6 PXE
Boot: F1



Disk and partitions info as follows:


# gpart show ada0
=>  63  31277169  ada0  MBR (15G)
    63  31277169     1  freebsd [active]  (15G)
#10
Hi Franco,

Yes, All git repositories are updated according to the latest version. I cleaned everything and tried to rebuild. but no luck :(

I have no problem in v15.7.22, I do not understand why it happened.

| Folders | Commit     | Tags / Branches                 |
|---------|------------|---------------------------------|
| src/    | 3b29c333de | tag: 15.7.25 origin/stable/15.7 |
| ports/  | c4125f1109 | origin/master                   |
| tools/  | de44675921 | origin/master                   |


Quote from: azdps on January 25, 2016, 02:02:07 AM
So far I've seen a few users attempt to build OPNsense using vagrant with poor results. Usually spending too much time setting up a build environment. Seems to me that it would be much easier to just install FreeBSD 10.2 into a virtual machine.

Hey azdps,

vagrant is actually doing a good job in this regard, In the beginning, I encountered little issues but now I guess I'm used to, it started to come easier to develop in this way.
#11
I update my packages to the latest version ( 15.7.22 to 15.7.25 ) and I need to rebuild the base and the kernel package but I'm getting an error as follows, creating a base package:



===> usr.bin/tftp (depend)
===> usr.bin/time (depend)
===> usr.bin/tip (depend)
===> usr.bin/tip/tip (depend)
===> usr.bin/top (depend)
Making top.local.h from /vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.H
rm -f .depend
CC='cc ' mkdep -f .depend -a    -DHAVE_GETOPT -DHAVE_STRERROR -DORDER -I/vagrant/opnsense/src/usr.bin/top -I/vagrant/opnsense/src/usr.bin/top/../../contrib/top -I. -DNDEBUG -std=gnu99   /vagrant/opnsense/src/usr.bin/top/../../contrib/top/commands.c /vagrant/opnsense/src/usr.bin/top/../../contrib/top/display.c /vagrant/opnsense/src/usr.bin/top/machine.c /vagrant/opnsense/src/usr.bin/top/../../contrib/top/screen.c /vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.c /vagrant/opnsense/src/usr.bin/top/../../contrib/top/username.c /vagrant/opnsense/src/usr.bin/top/../../contrib/top/utils.c /vagrant/opnsense/src/usr.bin/top/../../contrib/top/version.c
In file included from /vagrant/opnsense/src/usr.bin/top/../../contrib/top/display.c:40:
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:66:5: error: invalid token at start of a preprocessor expression
#if RANDOM_PW == 0
    ^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:65:19: note: expanded from macro 'RANDOM_PW'
#define RANDOM_PW       %random%
                        ^
1 error generated.
In file included from /vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.c:49:
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:66:5: error: invalid token at start of a preprocessor expression
#if RANDOM_PW == 0
    ^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:65:19: note: expanded from macro 'RANDOM_PW'
#define RANDOM_PW       %random%
                        ^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.c:183:5: error: invalid token at start of a preprocessor expression
#if Default_TOPN == Infinity
    ^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:46:22: note: expanded from macro 'Default_TOPN'
#define Default_TOPN    %topn%
                        ^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.c:457:5: error: invalid token at start of a preprocessor expression
#if Default_TOPN == Infinity
    ^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:46:22: note: expanded from macro 'Default_TOPN'
#define Default_TOPN    %topn%
                        ^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.c:550:5: error: invalid token at start of a preprocessor expression
#if Default_TOPN == Infinity
    ^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:46:22: note: expanded from macro 'Default_TOPN'
#define Default_TOPN    %topn%
                        ^
4 errors generated.
In file included from /vagrant/opnsense/src/usr.bin/top/../../contrib/top/username.c:38:
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:66:5: error: invalid token at start of a preprocessor expression
#if RANDOM_PW == 0
    ^
/vagrant/opnsense/src/usr.bin/top/../../contrib/top/top.local.h:65:19: note: expanded from macro 'RANDOM_PW'
#define RANDOM_PW       %random%
                        ^
1 error generated.
mkdep: compile failed
*** [.depend] Error code 1

make[4]: stopped in /vagrant/opnsense/src/usr.bin/top
1 error

make[4]: stopped in /vagrant/opnsense/src/usr.bin/top
*** [depend_subdir_top] Error code 2

make[3]: stopped in /vagrant/opnsense/src/usr.bin
1 error

make[3]: stopped in /vagrant/opnsense/src/usr.bin
*** [usr.bin.depend__D] Error code 2

make[2]: stopped in /vagrant/opnsense/src
1 error

make[2]: stopped in /vagrant/opnsense/src
*** [_depend] Error code 2

make[1]: stopped in /vagrant/opnsense/src
1 error

make[1]: stopped in /vagrant/opnsense/src
*** [buildworld] Error code 2

make: stopped in /vagrant/opnsense/src
1 error

make: stopped in /vagrant/opnsense/src
*** Error code 2

Stop.
make: stopped in /vagrant/opnsense/tools


What could be missing?
#12
Captive Portal and Transparent Proxy works well with HTTP traffic. You can see the rules below.
but unfortunately it does not work with https traffic.

How do I set Captive portal and https traffic with Transparent Proxy ?


Firewall: NAT: Port Forward rules

If  Proto Address Ports Address Ports     IP        Ports Description
LAN TCP   LAN net *     *       80 (HTTP) 127.0.0.1 3128  redirect traffic to proxy
#13
Hey Ad,

Thank you for your help, I realized that the problems associated with description tag. it's all a simple typo error, now everything is fine.

But there is one issue I wondered;

New cron job appear in cron page ( http://localhost/ui/cron/ ) but it can not be automatically activated, I have set this task manually.

I wonder, how can I set this task automatically? There are tasks that I want to run every 15-20 minutes.
and $mdlCron->newDailyJob has only weekdays argument How do I set Minutes for cron ?


/**
* Class Cron
* @package OPNsense\Cron
*/
class Cron extends BaseModel
{
    /**
     * create a new daily job
     * @param string $origin
     * @param string $command
     * @param string $description
     * @param string $weekdays day(s) of the week to run
     * @param string $enabled default add disabled cron jobs, if triggered enabled be sure to call regenerate on cron.
     * @return string
     */
    public function newDailyJob($origin, $command, $description, $weekdays = "*", $enabled = "0")
    {
        $cron = $this->jobs->job->Add();
        $uuid = $cron->getAttributes()['uuid'];
        $cron->origin = $origin;
        $cron->command = $command;
        $cron->description = $description;
        $cron->weekdays = $weekdays ;
        $cron->enabled = $enabled;
        return $uuid;
    }
}


My Cron code


if ((string)$mdlMymodule->general->UpdateCron == "") {
    $mdlCron = new Cron();
    $mdlMymodule->general->UpdateCron = $mdlCron->newDailyJob("Mymodule", "mymodule test", "Mymodule Test cron", "1");
    if ($mdlCron->performValidation()->count() == 0) {
        $mdlCron->serializeToConfig();
        $mdlMymodule->serializeToConfig($validateFullModel = false, $disable_validation = true);
        Config::getInstance()->save();
    }
}
#14

Hey Ad,

thank you for your help,

Quote# configctl mymodule test command works successfully on the command line.



$mdlCron = new Cron();
$mdlCron->newDailyJob("MyModule", "mymodule test", "MyModule test job", "0");
print_r($mdlCron->performValidation()); output as follows:


Phalcon\Validation\Message\Group Object
(
    [_position:protected] =>
    [_messages:protected] => Array
        (
            [0] => Phalcon\Validation\Message Object
                (
                    [_type:protected] => InclusionIn
                    [_message:protected] => Select a command from the list.
                    [_field:protected] => jobs.job.c98659f2-3555-471e-9e0c-e1acf26e791a.command
                    [_code:protected] => 0
                )

        )

)


echo $mdlCron->toXML()->asXML(); output as follows:


<OPNsense>
    <cron>
        <jobs>
            <job uuid="ae473210-e201-4c51-8eb5-0cb70f211101">
                <origin>IDS</origin>
                <enabled>0</enabled>
                <minutes>0</minutes>
                <hours>0</hours>
                <days>*</days>
                <months>*</months>
                <weekdays>0</weekdays>
                <who>root</who>
                <command>ids update</command>
                <parameters/>
                <description>ids rule updates</description>
            </job>
            <job uuid="c98659f2-3555-471e-9e0c-e1acf26e791a">
                <origin>MyModule</origin>
                <enabled>0</enabled>
                <minutes>0</minutes>
                <hours>0</hours>
                <days>*</days>
                <months>*</months>
                <weekdays>0</weekdays>
                <who>root</who>
                <command>mymodule test</command>
                <parameters/>
                <description>MyModule test job</description>
            </job>
        </jobs>
    </cron>
</OPNsense>


Apparently, cron job was created successfully but it does not saved to my model, even it does not appear on http://localhost/ui/cron/ page

#15
Hey Ad,

I'm trying to create a cron job for a while but I think there's something I missed.

I added the UpdateCron to the MyModule model


# MyModule.xml
<model>
  <mount>//OPNsense/MyModule</mount>
  <description>
    MyModule application
  </description>
  <items>
    <general>
    <UpdateCron type="ModelRelationField">
      <Model>
        <queues>
          <source>OPNsense.Cron.Cron</source>
          <items>jobs.job</items>
          <display>description</display>
          <filters>
            <origin>/MyModule/</origin>
          </filters>
        </queues>
      </Model>
      <ValidationMessage>Related cron not found</ValidationMessage>
      <Required>N</Required>
    </UpdateCron>
    </general>
  </items>
</model>




# ServiceController.php

/**
* reconfigure MyModule
*/
public function reloadAction()
{
  $status = "failed";
  if ($this->request->isPost()) {
    $mdlMyModule = new MyModule();

    if ((string)$mdlMyModule->general->UpdateCron == "") {
      $mdlCron = new Cron();
      // update cron relation (if this doesn't break consistency)
      $mdlMyModule->general->UpdateCron = $mdlCron->newDailyJob("MyModule", "mymodule test", "MyModule test job", "0");
      if ($mdlCron->performValidation()->count() == 0) {
        $mdlCron->serializeToConfig();
        // save data to config, do not validate because the current in memory model doesn't know about the
        // cron item just created.
        $mdlMyModule->serializeToConfig($validateFullModel = false, $disable_validation = true);
        Config::getInstance()->save();
      }
    }

    $backend = new Backend();
    $bckresult = trim($backend->configdRun("template reload OPNsense.MyModule"));
    if ($bckresult == "OK") {
        $status = "ok";
    }
  }


  return array("status" => $status);
}



I've updated services accordingly to the UpdateCron but
$mdlCron->performValidation()->count()  return 1
$mdlCron->performValidation() return empty

I can not find what the problem is.