By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
A hyper-practical, zero-fluff guide for real projects and certifications
You’re the Salesforce Admin for a global fintech company. Your CEO just got a call from the CISO: "We had a breach—someone logged in from Russia at 3 AM using a stolen password. Why wasn’t MFA enforced? Why wasn’t the login blocked?"
This guide covers three critical security controls in Salesforce: 1. Login Hours – Restrict when users can access Salesforce.2. IP Ranges – Block or allow logins from specific networks.3. Multi-Factor Authentication (MFA) – Add a second layer of authentication beyond passwords.
Why this matters in production:- Compliance: SOC 2, GDPR, and PCI DSS require MFA and IP restrictions.- Security: 80% of breaches involve stolen credentials (Verizon DBIR). MFA blocks 99.9% of automated attacks.- Operational control: Prevent after-hours data exfiltration or unauthorized access from high-risk regions.- Audit readiness: If you can’t prove who logged in, when, and from where, you fail audits.
Real-world scenario:You inherit a Salesforce org with 500 users. The CFO complains that employees are logging in at 2 AM to export reports. The security team flags logins from Tor exit nodes. You need to: - Block logins outside business hours (9 AM–6 PM local time).- Restrict logins to corporate VPN IP ranges.- Enforce MFA for all users (including admins).
If you ignore this, you risk: - Data leaks (e.g., a disgruntled employee downloading leads at midnight).- Failed audits (e.g., "Why was MFA not enforced for admins?").- Ransomware (e.g., attackers brute-forcing passwords from a coffee shop Wi-Fi).
✅ You have System Administrator access to a Salesforce org (sandbox or production).✅ You have at least 2 test users (one for testing allowed access, one for testing blocked access).✅ You know your corporate VPN IP range (e.g., 203.0.113.0/24).
203.0.113.0/24
Goal: Require MFA for all users (including admins).
MFA Enforcement
MFA_Enforcement
Enforces MFA for all users.
Click Save.
Assign the "Multi-Factor Authentication for User Interface Logins" permission:
Assign the permission set to all users:
Select all users → Assign.
Test MFA enforcement:
✅ Verification:- If MFA is enforced, users cannot log in without setting up a second factor.- Check Setup → Identity Verification to see which users have registered MFA methods.
Goal: Block logins outside business hours.
Standard User
Test login hours:
Your login attempt was unsuccessful. You are not allowed to log in at this time.
✅ Verification:- Check Setup → Login History to confirm blocked logins show "Login Hours Restriction".
Goal: Allow logins only from corporate VPN or office network.
203.0.113.0
203.0.113.255
Corporate VPN
Test IP restrictions:
Your login attempt was unsuccessful. You are not allowed to log in from this IP address.
✅ Verification:- Check Setup → Login History to confirm blocked logins show "IP Restriction".
Goal: Allow users to skip MFA when logging in from the office or VPN.
Corporate Office
Test trusted IP bypass:
✅ Verification:- Check Setup → Identity Verification to confirm MFA is not required for trusted IPs.
Goal: Block logins from known Tor exit nodes (common in attacks).
Get Login IP Details
Login History
UserId = {!$User.Id}
LoginTime DESC
latestLogin
Is Tor Exit Node?
{!latestLogin.SourceIp} contains "tor-exit"
Block Tor Login
Your login attempt was blocked because you are using a Tor exit node.
✅ Verification:- Try logging in from a Tor browser (or a known Tor exit IP).- You should see the block message.
✅ Enforce MFA for all users (including admins). Salesforce now requires this.✅ Use permission sets for MFA (not profiles) for flexibility.✅ Restrict login hours for sensitive profiles (e.g., finance, HR).✅ Block high-risk countries (e.g., Russia, China) via IP restrictions or login flows.✅ Monitor failed logins (Setup → Login History) and set up alerts for suspicious activity.
⚠️ MFA is free (no additional cost for Salesforce Authenticator or TOTP apps).⚠️ Avoid SMS MFA (carrier fees apply for some regions).⚠️ Use trusted IPs to reduce MFA prompts (improves user experience).
✅ Document IP ranges (e.g., "Corporate VPN: 203.0.113.0/24").✅ Use naming conventions for permission sets (e.g., MFA_Enforcement, Finance_Login_Hours).✅ Test changes in a sandbox first (especially login flows).✅ Set up a "Break Glass" admin account (exempt from IP/login hour restrictions for emergencies).
Finance_Login_Hours
✅ Monitor Login History (Setup → Login History) for: - Failed logins (possible brute-force attacks). - Logins from unusual locations (e.g., new country). - Logins outside business hours.✅ Set up alerts for: - 5+ failed logins in 1 hour (possible attack). - Logins from Tor exit nodes. - Logins outside trusted IPs.
❌ Session Settings (controls session duration, not login times).
"How do you bypass MFA for corporate VPN users?"
❌ Permission Sets (can enforce MFA, but not bypass it).
"What’s the most secure MFA method?"
❌ SMS (vulnerable to SIM swapping).
"A user complains they’re locked out after 5 PM. What’s the issue?"
"Your company wants to block logins from Russia and China. What’s the best approach?"- ✅ Use a login flow (check IP geolocation and block).- ⚠️ IP Restrictions (works, but hard to maintain a list of all Russian/Chinese IPs).- ❌ Login Hours (doesn’t block by country).
"A user reports they can log in at 3 AM from their home IP. You need to: 1. Block logins outside 9 AM–6 PM (Monday–Friday). 2. Allow logins only from the corporate VPN (203.0.113.0/24). 3. Enforce MFA for all users, but bypass it for the corporate VPN.
How do you configure this?"
✅ Why it works:- Login hours block after-hours access.- IP restrictions block non-VPN logins.- MFA is enforced everywhere except the trusted VPN.
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.