MikroTik RouterOS
This page covers the built-in MikroTik template: RouterOS administrator login and PPP (L2TP) VPN through OkYouIn. For RADIUS concepts see RADIUS.
Verified on
Section titled “Verified on”| Platform | Software | Modes | What was verified |
|---|---|---|---|
| MikroTik CHR | RouterOS 7.5 | password, password + MFA | Admin login over SSH and the API port (MS-CHAPv2) with local and Active Directory users; L2TP PPP with PAP and MS-CHAPv2; e-mail Approve link as second factor; accounting Start / Interim / Stop; Mikrotik-Group, Framed-IP-Address, Mikrotik-Rate-Limit, Mikrotik-Address-List, Session-Timeout (PPP) |
Not verified: WebFig and WinBox logins, SSTP and OVPN, and Telegram / Web Push approvals (they work the same way as the e-mail link on the OkYouIn side, but were not exercised on this device).
What works
Section titled “What works”| First factor | OkYouIn checks the password only; MFA only is not available. |
| Second factor | Approval only: Telegram, Web Push (without number matching) or the Approve link of an e-mail. MS-CHAPv2 and PAP carry no code and RouterOS shows no Access-Challenge, so users with TOTP are refused (reason incompatible_method). |
| Prompts | None — the login waits while the user approves. |
| Accounting | Admin logins and PPP; PPP with tunnel address, session time and counters. |
| Client IP | Calling-Station-Id is the SSH / API client or the PPP caller. |
The e-mail Approve link needs the public base URL of OkYouIn to be set. See MFA methods.
Before you start
Section titled “Before you start”-
Passwords for MS-CHAPv2. The admin login (
/user aaa) uses MS-CHAPv2. OkYouIn local users work once their password has been set (OkYouIn keeps the NT hash from then on). Directory users need Active Directory with the domain joined, or FreeIPA publishing the NT hash — see Directories. -
In OkYouIn, open Access ▸ Applications ▸ Add application and pick MikroTik. The Connect tab shows the commands below with real values.
-
Identify the router by its address. RouterOS 7.5 sends no Message-Authenticator in Access-Request, so OkYouIn must recognise the router by its source address: add it under Sources. If the Settings tab warns that the application is selected by NAS-Identifier, its requests are dropped — give it a source of its own.
-
NAS-Identifier. RouterOS sends its system identity (
/system identity print) as NAS-Identifier in every request. Either set the application’s NAS-Identifier to that value, or leave it empty and identify by source. Change the identity with/system identity set name=<value>.
Configure the device
Section titled “Configure the device”The example uses 192.0.2.10 for OkYouIn. RouterOS needs IP addresses: replace <ROUTER-IP> with the router
address OkYouIn receives the requests from.
/radius add address=192.0.2.10 secret="<SHARED-SECRET>" service=login \ authentication-port=1812 accounting-port=1813 timeout=60s \ src-address=<ROUTER-IP> comment="OkYouIn"/user aaa set use-radius=yes accounting=yes interim-update=0s default-group=readFor PPP (L2TP) as well:
/radius set [find comment="OkYouIn"] service=login,ppp/ppp aaa set use-radius=yes accounting=yes interim-update=0sNotes:
timeout=60s: RouterOS sends one request and waits that long without retrying, so the approval must come within about 55 seconds. For PPP RouterOS warns that a timeout above 3 s may make PPP authentication time out; a Linux pppd client still connected after a 44-second approval, other VPN clients may give up sooner.default-group=read: users without aMikrotik-Groupreply attribute, or with a group that does not exist, get the default group. Keep itreadso a missing or mistyped group never grantsfull.- Local users (
/user) are checked before RADIUS. With several RADIUS servers forservice=login, RouterOS asks the next one only when a server does not answer — a reject is final — so OkYouIn must be the only login server.
Reply attributes
Section titled “Reply attributes”Set these in the application’s Rules tab.
| Attribute | Applies to | Effect |
|---|---|---|
Mikrotik-Group | Admin login | RouterOS user group (read, write, full or your own). |
Framed-IP-Address | PPP | The client’s tunnel address (instead of the PPP profile’s pool). |
Mikrotik-Rate-Limit | PPP | Speed limit rx/tx as seen by the router, e.g. 1M/2M — a dynamic simple queue. |
Mikrotik-Address-List | PPP | Firewall address list the client’s address is added to while connected. |
Session-Timeout | PPP | Ends the connection after N seconds. Admin logins ignore it. |
Class | Both | Echoed in accounting. A Class from a rule replaces OkYouIn’s own Class token. |
Accounting
Section titled “Accounting”/user aaa accounting=yes sends Start and Stop for admin logins, /ppp aaa accounting=yes for PPP — both are the
defaults. Every Accounting-Request carries NAS-Identifier, User-Name, Calling-Station-Id and Class; PPP adds
Framed-IP-Address, session time and byte / packet counters, and the Stop the terminate cause.
With interim-update=0s RouterOS sends Interim-Update at the application’s Interim interval (seconds)
(300 by default for this template); leave it empty for none.
RouterOS sends Accounting-On the first time it uses the server: OkYouIn then closes that router’s open sessions. This is expected at set-up.
BlastRADIUS
Section titled “BlastRADIUS”Keep Protection mode (CVE-2024-3596) at Standard, the default. Strict breaks this router: RouterOS 7.5 never sends Message-Authenticator, so every request would be dropped.
Verify
Section titled “Verify”-
Open a new SSH session as an OkYouIn user and approve the push or e-mail link.
-
In Logging ▸ RADIUS log you will see one reject with reason
empty_password_probeper SSH login, followed by the real request: RouterOS tries an empty password before every SSH login. This is expected. -
Check the application’s Sessions tab for the session.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Likely cause |
|---|---|
Reject incompatible_method | The user’s MFA method is TOTP or an e-mail code; give them a push method or the e-mail link. |
| No answer, request missing from the log | Check Logging ▸ RADIUS log ▸ Dropped packets: no Message-Authenticator (Strict mode, or the application is selected by NAS-Identifier), or an unknown source. |
| MS-CHAPv2 reject such as “No NT hash for the account” | A local user whose password was never set in OkYouIn, or a directory without domain join / NT hash. |
User lands in the read group | No Mikrotik-Group in the matching rule, or the group name does not exist on the router. |