Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Covenant Crashes When BindAdress for Listener Unavailable #363

Open
er4z0r opened this issue Jul 11, 2022 · 3 comments
Open

[Bug] Covenant Crashes When BindAdress for Listener Unavailable #363

er4z0r opened this issue Jul 11, 2022 · 3 comments
Assignees

Comments

@er4z0r
Copy link

er4z0r commented Jul 11, 2022

Feature Request or Bug
Bug

Describe the feature request or bug
When a covenant listener was previously configured to start on a specific IP (e.g. the one of a tun0 interface of a VPN connection) that is not available during startup covenant will fail to start.

To Reproduce
Steps to reproduce the behavior:

  1. Confiugre a Listener bound to a specific IP
  2. Stop Covenant
  3. Down the interface
  4. Start Covenant again

Expected behavior
Covenant warns about the IP not being available, but starts correctly.

Observed behavior
Covenant crashes with the following stacktrace:

Unhandled exception. System.AggregateException: One or more errors occurred. (BadRequest - Listener with id: 2 did not start due to exception: One or more errors occurred. (Cannot assign requested address))    
 ---> Covenant.Core.ControllerBadRequestException: BadRequest - Listener with id: 2 did not start due to exception: One or more errors occurred. (Cannot assign requested address)                                
   at Covenant.Core.CovenantService.StartListener(Int32 listenerId) in /home/user/Covenant/Covenant/Core/CovenantService.cs:line 4532                                                                             
   at Covenant.Core.DbInitializer.InitializeListeners(ICovenantService service, CovenantContext context, CovenantUser user) in /home/user/Covenant/Covenant/Core/DbInitializer.cs:line 103                        
   at Covenant.Core.DbInitializer.Initialize(ICovenantService service, CovenantContext context, RoleManager`1 roleManager, UserManager`1 userManager, String username, String password) in /home/user/Covenant/Cov
enant/Core/DbInitializer.cs:line 30                                                                                                                                                                               
   --- End of inner exception stack trace ---                                                                                                                                                                     
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)                                                                                                            
   at System.Threading.Tasks.Task.Wait()                                                                                                                                                                          
   at Covenant.Program.<>c__DisplayClass0_0.<Main>b__0() in /home/user/Covenant/Covenant/Covenant.cs:line 114                                                                                                     
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass146_0.<OnExecute>b__0(CancellationToken _)                                                                                     
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)                                                                                
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)                                                                                                                          
   at Covenant.Program.Main(String[] args) in /home/user/Covenant/Covenant/Covenant.cs:line 136                      

Covenant Server Information:

  • OS: Kali GNU/Linux Rolling
  • Native
@er4z0r
Copy link
Author

er4z0r commented Jul 11, 2022

Workaround for anyone facing this issue (tooling may vary depending on your OS):

  1. Go to Covenant/Covenant folder
  2. Create backup of Data/covenant.db: tar cvJf covenant.db.tar.xz Data/covenant.db
  3. Open the database using sqlite3: sudo sqlite3 Data/covenant.db
  4. Check for the problematic listener (the one with the IP that is no longer bound to any of your interfaces): sqlite> select Name,BindAddress,BindPort from Listeners;
  5. Update the listener to bind to any IP: sqlite> Update Listeners SET BindAddress='0.0.0.0' WHERE Name='HTTPListenerStudentVM';
    5a. Alternatively (modifying all listeners): sqlite> Update Listeners SET BindAddress='0.0.0.0';

HTH.

@er4z0r er4z0r closed this as completed Jul 11, 2022
@er4z0r er4z0r reopened this Jul 11, 2022
@rasta-mouse
Copy link
Contributor

Looks like a dup of #348

@er4z0r
Copy link
Author

er4z0r commented Jul 11, 2022

Indeed. Closing as dup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants