Skip to content

Commit 7d1079a

Browse files
committed
Merge branch 'develop'
2 parents 3e7bb78 + 5564f4a commit 7d1079a

22 files changed

+1682
-5
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ TOUGHRADIUS uses advanced Golang technology to develop the system core, providin
1818

1919
[quick Start](https://github.com/talkincode/toughradius/wiki/quickstart)
2020

21+
## QABOT
22+
23+
ToughRadius provides an AI-based technical service bot that we hope can help you solve some technical problems.
24+
25+
[QABOT Link](https://qa.toughradius.net/)
26+
2127
## System structure
2228

2329
![architecture](assets/architecture.png)

assets/buildinfo.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
BuildVersion=latest v8.0.4 2023-12-31 03:36:45
1+
BuildVersion=latest v8.0.4 2024-01-02 02:00:12
22
ReleaseVersion=v8.0.4
3-
BuildTime=2023-12-31 03:36:45
3+
BuildTime=2024-01-02 02:00:12
44
BuildName=toughradius
5-
CommitID=f871aea6d9c0c3eda4f50423d44c241822bf3154
6-
CommitDate=Sun, 31 Dec 2023 03:11:03 +0800
5+
CommitID=375ca52501466fefb7007faa08b34611472d4e0a
6+
CommitDate=Tue, 2 Jan 2024 02:00:07 +0800
77
CommitUser=jamiesun.net@gmail.com
8-
CommitSubject=2023-12-31 03:10:51 : mschapv2 auth
8+
CommitSubject=aibot add
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
2+
## Node
3+
4+
The management node is a technology solution used to logically group network devices for unified management and control. By grouping network devices, the administrator can more easily manage the network devices and also facilitate maintenance and management of the network devices.
5+
6+
## CPE
7+
8+
CPE (Customer Premises Equipment) refers to network hardware located at the customer's location, such as a residence or business, used to provide a connection to the service provider's network. These devices include modems, routers, switches and other network equipment used to provide internet and other communication services to customers. In TeamsACS, CPE functions as the TR069 protocol client and communicates with TeamsACS.
9+
10+
Mikrotik's RouterOS router, produced by Mikrotik, is a good example and a commonly used CPE device that provides Internet and other communication services. By communicating with TeamsACS through the TR069 protocol, administrators can manage and control CPE devices more easily.
11+
12+
## TR069 Config
13+
14+
In TeamsACS, TR069 Config is mainly Configuration data of Configuration Change (3 Vendor Configuration File) type, which is sent to CPE through 'Download RPC method'
15+
16+
Mikrotik devices are more flexible in dealing with Configuration Change (3 Vendor Configuration File) configuration data. The configuration it receives is the RouterOS script, through which more operations can be performed, such as configuring the router, setting up the firewall, etc. Mikrotik devices are a good choice to use because of their flexibility.
17+
18+
The following is a description quoting the official [Mikrotik Wiki](https://help.mikrotik.com/docs/display/ROS/TR-069)
19+
20+
`Configuration Change (3 Vendor Configuration File)`
21+
22+
> The same Download RPC can be used to perform complete configuration overwrite (as intended by standard) OR configuration alteration (when URL's filename extension is ".alter").
23+
24+
`Alter configuration`
25+
26+
> RouterOS has a lot of configuration attributes and not everything can be ported to CWMP Parameters, that's why RouterOS provides a possibility to execute its powerful scripting language to configure any attribute. A configuration alteration (which is really a regular script execution) can be performed using Download RPC FileType="3 Vendor Configuration File" with downloadable file extension ".alter". This powerful feature can be used to configure any ROS attributes which are not available through CWMP Parameters.
27+
28+
`Overwrite all configurations`
29+
30+
> Full ROS configuration overwrite can be performed using Download RPC FileType="3 Vendor Configuration File" with any URL file name (except with ".alter" extension).
31+
32+
### TR069 config session
33+
34+
The TR069 config can be triggered manually at any time in the TeamsACS system. A full execution log is recorded for each release so that the user can view the status of the release at any time. This increases the transparency and traceability of the system and allows managers to monitor and manage the issuance of TR069 configs more effectively.
35+
36+
37+
## Firmware config
38+
39+
In TeamsACS, Firmware config is mainly configuration data of type (1 Firmware Upgrade Image), which is sent to CPE through "download RPC method"
40+
41+
The following is a description quoting the official [Mikrotik Wiki](https://help.mikrotik.com/docs/display/ROS/TR-069)
42+
43+
44+
`RouterOS Update (1 Firmware Upgrade Image)`
45+
46+
> CWMP standard defines that CPE's firmware can be updated using Download RPC with FileType="1 Firmware Upgrade Image" and single URL of a downloadable file (HTTP and HTTPS are supported). Standard also states that downloaded file can be any type and vendor specific process can be applied to finish firmware update. Because MikroTik's update is package based (and also for extra flexibility), an XML file is used to describe firmware upgrade/downgrade. For now, XML configuration supports providing multiple URLs of files, which will be downloaded and applied similarly as regular RouterOS update through firmware/package file upload.
47+
48+
> An example of RouterOS bundle package and tr069-client package update (don't forget to also update tr069-client package). An XML file should be put on some HTTP server, which is accessible from CPE for download. Also, downloadable RouterOS package files should be accessible the same way (can be on any HTTP server). Using ACS execute Download RPC with URL pointing to XML file (e.g. "https://example.com/path/upgrade.xml") with contents:
49+
50+
```
51+
<upgrade version="1" type="links">
52+
<config/>
53+
<links>
54+
<link>
55+
<url>https://example.com/routeros-mipsbe-X.Y.Z.npk</url>
56+
</link>
57+
<link>
58+
<url>https://example.com/tr069-client-X.Y.Z-mipsbe.npk</url>
59+
</link>
60+
</links>
61+
</upgrade>
62+
```
63+
64+
> CPE will download XML, parse/validate its contents, download files from provided URLs and try to upgrade. The result will be reported with TransferComplete RPC.
65+
66+
67+
## Factoryreset config
68+
69+
70+
The following is a description quoting the official [Mikrotik Wiki](https://help.mikrotik.com/docs/display/ROS/TR-069)
71+
72+
73+
`RouterOS default configuration change (X MIKROTIK Factory Configuration File)`
74+
75+
> This vendor specific FileType allows the change of the RouterOS default configuration script that is executed when /system reset-configuration command is executed (or the other means when router configuration is beeing reset).
76+
77+
## TR069 preset
78+
79+
In TeamsACS, a Tr069 preset is a pre-configured TR069 RPC operation described in a yaml format file, which includes the RPC method to be executed, parameters, error handling methods, etc. Tr069 presets can be executed manually or triggered by TR069 specific events such as a boot event, or by a backend timed task in TeamsACS.
80+
81+
### TR069 preset task
82+
83+
When the TR069 preset execution is triggered, the TeamsACS system creates a task to track the execution of the TR069 preset. During execution, the system records the content and status of the execution, making it easy for managers to monitor and evaluate the execution process. This helps managers to have a better understanding of the status of the configuration being issued and to be able to address any issues in a timely manner.
84+
85+
86+
87+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
## Mikrotik TR069 Client Setup for ToughRADIUS
2+
3+
Here is the guide to configure ROUTEROS to integrate with TOUGHRADIUS:
4+
5+
Firstly, we need to execute the following commands on ROUTEROS:
6+
7+
```
8+
# Create address pool
9+
/ip pool
10+
add name=dhcp ranges=192.168.1.100-192.168.1.200
11+
12+
# Create profile
13+
/ppp profile
14+
add name=radius local-address=192.168.1.1 remote-address=dhcp
15+
16+
# Configure RADIUS server
17+
/radius
18+
add service=ppp,hotspot address=Radius_Server_IP secret=Radius_Secret authentication-port=1812 accounting-port=1813
19+
20+
# Configure accounting interval
21+
/radius incoming
22+
set accept=yes port=3799
23+
24+
# Configure PPP
25+
/ppp aaa
26+
set accounting=yes interim-update=2m use-radius=yes
27+
28+
```
29+
30+
Next, we need to create a corresponding VPE device on toughradius:
31+
32+
```json
33+
{
34+
"ID": 1,
35+
"NodeId": 1,
36+
"LdapId": 0,
37+
"Name": "RouterOS",
38+
"Identifier": "RouterOS",
39+
"Hostname": "RouterOS Host",
40+
"Ipaddr": "RouterOS IP",
41+
"Secret": "Radius Secret",
42+
"CoaPort": 3799,
43+
"Model": "RouterOS",
44+
"VendorCode": "14988",
45+
"Status": "enabled",
46+
"Tags": "",
47+
"Remark": "",
48+
"CreatedAt": "2022-06-01T08:00:00.000Z",
49+
"UpdatedAt": "2022-06-01T08:00:00.000Z"
50+
}
51+
```
52+
53+
Lastly, we carry out testing:
54+
55+
> you also need to create the user account on the TOUGHRADIUS system
56+
57+
Execute the following command on ROUTEROS to create a new PPP user:
58+
59+
```
60+
/ppp secret
61+
add name=testuser password=testpass profile=radius service=pppoe
62+
63+
```
64+
65+
Configure a PPPoE connection on your client device, with the username testuser and the password testpass.
66+
67+
Connect to the PPPoE, check the ROUTEROS and toughradius logs to confirm that the user's authentication and accounting information are being transmitted correctly.
68+
69+
If the connection is successful, you should see the online status and usage of the user on the toughradius admin interface.
70+
71+
You may also try to change the bandwidth limit for the user or disconnect the user on toughradius and check if the CoA (Change of Authorization) feature takes effect on ROUTEROS.
72+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
## ToughRADIUS 定义的 TR069 预置模板
2+
3+
The description format of presets is the standard YAML format, which can facilitate the use of various data structures. For example, online automatic initialization of new devices can be done using a set of presets
4+
5+
- oid Can be set in scripts, factory settings, firmware configuration
6+
- enabled Indicates whether to enable this task
7+
- delay For download tasks, the CPE can be delayed
8+
- onfail If it is defined as cancel, when the task fails, all unexecuted tasks defined by the description file will be canceled; when defined as ignore, unexecuted tasks will continue to be executed
9+
10+
The order of execution is FactoryresetConfig -> FirmwareConfig -> Downloads ->Uploads -> SetParameterValues -> GetParameterNames,
11+
12+
In a set of preset tasks, only some operations can be set, if the preset is executed by the system scheduled task,factoryreset, firmwareconfig will be ignored
13+
14+
If the preset is performed by a scheduled system task (the time policy is set to `sys_scheduled`), then factoryreset, firmwareconfig are ignored in the set of preset tasks.
15+
16+
17+
```yaml
18+
# TR069 The default description format is the standard YAML format, which can facilitate the use of various data structures. For example, a set of presets can be used to complete the automatic initialization of new devices online
19+
20+
# - oid Can be set in scripts, factory settings, firmware configuration
21+
# - enabled Indicates whether to enable this task
22+
# - delay For download tasks, the CPE can be delayed
23+
# - onfail If it is defined as cancel, when the task fails, all unexecuted tasks defined by the description file will be canceled; when defined as ignore, unexecuted tasks will continue to be executed
24+
25+
# The order of execution is FactoryresetConfig -> FirmwareConfig -> Downloads ->Uploads -> SetParameterValues -> GetParameterNames,
26+
27+
# If the preset is performed by a scheduled system task (the time policy is set to `sys_scheduled`), then factoryreset, firmwareconfig are ignored in the set of preset tasks.
28+
29+
# Factory settings script description, single definition
30+
FactoryResetConfig:
31+
oid: "test_factory_reset_cfg"
32+
enabled: false
33+
delay: 0
34+
onfail: "ignore"
35+
36+
# Firmware configuration description
37+
FirmwareConfig:
38+
oid: "test_firmware_cfg"
39+
enabled: false
40+
delay: 0
41+
onfail: "ignore"
42+
43+
# Regular download script, supports multiple sequential execution
44+
Downloads:
45+
- oid: "test_download"
46+
enabled: true
47+
delay: 0
48+
onfail: "ignore"
49+
- oid: "test_download2"
50+
enabled: true
51+
delay: 0
52+
onfail: "ignore"
53+
54+
# Regular upload tasks that support multiple sequential executions
55+
Uploads:
56+
- filetype: "2 VendorLog File"
57+
enabled: false
58+
onfail: "ignore"
59+
60+
# Set parameters, send multiple sets of parameters at one time
61+
SetParameterValues:
62+
- name: "Device.DeviceInfo.X_MIKROTIK_SystemIdentity"
63+
type: "string"
64+
value: "TestRos"
65+
66+
# Get parameters, support multiple sequential execution
67+
GetParameterValues:
68+
- "Device.DeviceInfo."
69+
70+
```

docs/documents/bras.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
## Introduction to BRAS
2+
3+
Broadband Remote Access Server (BRAS) is a high-capacity network device typically located in a service provider's (ISP's) network. It plays a crucial role in delivering high-speed internet access services, particularly in DSL or cable internet services.
4+
5+
## Role of BRAS
6+
7+
A BRAS is primarily used to manage user sessions and routing information, enabling users to access the internet. It serves as an intermediary between the user access network (like DSL or cable) and the service provider's core network. Upon connection of a user device (like a personal computer or a router) to the network, the BRAS carries out authentication, assigns IP addresses, and facilitates network access.
8+
9+
In the ToughRADIUS system, a VPE device assumes the role of a BRAS, delivering these critical functionalities.
10+
11+
### Functions of BRAS
12+
13+
Here are some of the primary functions of a BRAS:
14+
15+
User Authentication: The BRAS uses protocols like RADIUS or DIAMETER to verify the credentials of users and determine whether they should be allowed access to the network.
16+
17+
IP Address Management: Once a user is authenticated, the BRAS assigns one or more IP addresses to the user, enabling them to communicate within the network.
18+
19+
Session Management: The BRAS keeps track of each user's session, including the start and end times of the session, the amount of data transmitted, etc. This data can be used for billing, traffic management, and troubleshooting purposes.
20+
21+
Routing: The BRAS also handles the routing of user traffic, ensuring that data packets are accurately delivered from their source to their destination.
22+
23+
Quality of Service (QoS) Management: The BRAS can set and enforce QoS policies to ensure fair use of network resources and to meet the performance needs of different users and applications.
24+
25+
From the above, it is clear that the VPE, acting as a BRAS device in the ToughRADIUS system, is a key device for users to access the network and engage in network communication.
26+
27+
28+
## VPE Model Definition
29+
30+
The VPE model is a Go language struct, defined as follows:
31+
32+
```golang
33+
type NetVpe struct {
34+
ID int64 `json:"id,string" form:"id"` // Primary ID
35+
NodeId int64 `json:"node_id,string" form:"node_id"` // Node ID
36+
LdapId int64 `json:"ldap_id,string" form:"ldap_id"` // LDAP ID
37+
Name string `json:"name" form:"name"` // Device name
38+
Identifier string `json:"identifier" form:"identifier"` // Device Identifier - RADIUS
39+
Hostname string `json:"hostname" form:"hostname"` // Device host address
40+
Ipaddr string `json:"ipaddr" form:"ipaddr"` // Device IP
41+
Secret string `json:"secret" form:"secret"` // Device RADIUS Secret
42+
CoaPort int `json:"coa_port" form:"coa_port"` // Device RADIUS COA port
43+
Model string `json:"model" form:"model"` // Device model
44+
VendorCode string `json:"vendor_code" form:"vendor_code"` // Device vendor code
45+
Status string `json:"status" form:"status"` // Device status
46+
Tags string `json:"tags" form:"tags"` // Tags
47+
Remark string `json:"remark" form:"remark"` // Remark
48+
CreatedAt time.Time `json:"created_at"` // Created at
49+
UpdatedAt time.Time `json:"updated_at"` // Updated at
50+
}
51+
52+
```
53+
54+
55+
## Field explanations:
56+
57+
* ID: Unique identifier of the VPE device
58+
* NodeId: Node ID
59+
* LdapId: LDAP ID
60+
* Name: Name of the VPE device
61+
* Identifier: RADIUS identifier of the device
62+
* Hostname: Host address of the device
63+
* Ipaddr: IP address of the device
64+
* Secret: RADIUS Secret of the device
65+
* CoaPort: RADIUS COA port of the device
66+
* Model: Model of the device
67+
* VendorCode: Vendor code of the device
68+
* Status: Status of the device
69+
* Tags: Tags of the device
70+
* Remark: Remarks about the device
71+
* CreatedAt: When the device entry was created
72+
* UpdatedAt: When the device entry was last updated
73+
74+
75+
## VPE Creation
76+
77+
The creation of a VPE device primarily involves:
78+
79+
* Submit a form containing device information
80+
* Validate necessary fields are not empty (e.g., name, VendorCode, and Identifier)
81+
* Create the new VPE device in the database
82+
83+
<img width="1262" alt="image" src="https://github.com/talkincode/toughradius/assets/377938/e37804e4-e047-481e-a3b6-12d8f4d4c092">
84+

0 commit comments

Comments
 (0)