This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
access_restrictions [2021/05/30 19:42] – hogwild | access_restrictions [2023/07/02 01:45] – Incorrect information fixed, thanks to brodrigueznu for reporting techie007 | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Access Restrictions ====== | + | ====== |
- | Access Restriction rules are coded as strings separated by pipe (|) symbols. These are stored in nvram as variables named rrule0, rrule1, rrule2 | + | Access Restriction rules are coded as strings separated by pipe ( | ) symbols. These are stored in NVRAM as variables named //rrule0//, //rrule1//, //rrule2// and so on. |
- | < | + | To see what's in the first rule, we can issue the following command at a FreshTomato shell prompt: |
- | The returned string might look something like: | + | \\ |
- | < | + | < |
+ | nvram get rrule0 | ||
+ | </ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | The returned string might look something like this: | ||
+ | |||
+ | \\ | ||
+ | |||
+ | <code -> | ||
+ | 1|540|1140|62|||block-site.com$|0|New Rule 1 | ||
+ | </ | ||
+ | |||
+ | \\ | ||
- | Let' | + | Let's look more closely |
**Field 1:** indicates whether the rule is currently enabled (1) or disabled (0). | **Field 1:** indicates whether the rule is currently enabled (1) or disabled (0). | ||
- | **Field 2:** specifies the start time, or time to start applying this rule, in minutes elapsed since midnight. | + | **Field 2:** specifies the start time, (time to start applying this rule), in minutes elapsed since midnight. |
- | **Field 3:** is the end time, or the time to stop applying | + | In this case, start time is 5:40 AM, so the router should enforce |
- | **Field | + | **Field |
- | 1 for Sunday | + | |
- | 2 for Monday | + | |
- | 4 for Tuesday and so on. | + | |
- | For multiple days, add the corresponding numbers for each day. In the above example the fourth field is 62 which is equal to 2+4+8+16+32 . This means the rule should | + | Both the second and third fields will be -1 if you select |
- | **Field | + | **Field |
- | **Field 6:** This has the // | + | It is coded in binary: |
- | **Field 7:** | + | |
+ | | ||
+ | | ||
+ | | ||
+ | * 16 = Thursday | ||
+ | * 32 = Friday | ||
+ | * 64 = Sunday | ||
- | **Field 8: | + | \\ |
- | – 1 for ActiveX, 2 for Flash and 4 for Java. And finally the ninth field stores the name that you gave to this rule. | + | |
+ | For multiple days, add the corresponding numbers for each day. | ||
+ | |||
+ | In the above example the fourth field is 62 which is equal to 2+4+8+16+32 . This means the rule should be active on Mon, Tue, Wed., Thu., and Fri. That is, only on weekdays. If you had checked the // | ||
+ | |||
+ | **Field 5:** shows the IP or MAC Address range on your network for which the rule should be applied. | ||
+ | |||
+ | **Field 6:** has the // | ||
+ | |||
+ | **Field 7:** contains the Domains/ | ||
+ | |||
+ | In the example above, domain names ending with " | ||
+ | |||
+ | **Field 8:** stores a binary coded value if ActiveX, Flash or Java are set to be blocked. | ||
+ | |||
+ | * A "1" will block ActiveX. | ||
+ | * A "2" will block Flash. | ||
+ | * A "4" will block Java. | ||
+ | |||
+ | **Field 9: | ||
+ | |||
+ | \\ Now that we have a basic sense of how Access Restriction rules work, we can write shell scripts to control the rules. The script below will enable or disable a rule. Two values are passed on the command line – the rule number and either a " | ||
- | Now that we have a basic understanding about how Access Restriction rules work, we can write shell scripts to control the rules. Below is the script I wrote to enable or disable a rule. Two values are passed on the command line – the rule number and either a " | ||
\\ | \\ | ||
- | < | + | |
+ | < | ||
#!/bin/sh | #!/bin/sh | ||
Line 74: | Line 114: | ||
</ | </ | ||
- | ===== Credits ===== | + | \\ |
+ | \\ | ||
+ | |||
+ | If you have JFFS enabled in FreshTomato, | ||
+ | |||
+ | \\ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | |||
+ | ===== Credits ===== | ||
- | [[http:// | + | [[http:// |