Service lifecycle with non blocking start and stop

So the basic scenario is I have a class that starts/stops service objects with the methods start(String serviceid)/stop(String serviceid). It is designed to then forward various execution tasks to the appropriate service.

What I am trying to achieve is for the start/stop methods to be non-blocking. Hence if you start you may stop immediately afterwards.

However your services may not have been initialised yet if you try to stop them after you request a start – so you want to cancel the startup process reliably. I also have methods to start/stop all defined services. The startup of a service is also bound to a timeout parameter so if it fails to start in that time it is again stopped.

Currently I have an implementation mostly based around the Executor classes. When starting a new initialisation task is created in a single thread executor. Within this is another timeout single thread executor. The initialisation task is submitted there. So in essence:

Runnable failedTask; Runnable initialisedTask; Callable<Exception> serviceInitialisationTask; ExecutorService initialisationExecutor = Executors.newSingleThreadExecutor(); ExecutorService timeoutExecutor = Executors.newSingleThreadExecutor(); timeoutExecutor.execute(() -> {     Future<Exception> future = initialisationExecutor.submit(serviceInitialisationTask);     Exception futureException;     try {         futureException = future.get(timeout, timeunit);     } catch (Exception e) {         futureException = e;     } finally {         initialisationExecutor.shutdownNow();     }     // Call back to the class that started the service initialisation     // This tells it whether or not the task failed and take action     if (futureException != null) {          failedTask.run();     } else {         initialisedTask.run();     }      timeoutExecutor.shutdownNow(); }); 

The initialisation task essentially creates a thread pool for the Service to execute tasks on. Failure attempts to use the same stop method as called externally. A concurrent map stores references to the servers by id. Sometimes the thread pools for the Service remain – presumably because the new service was created before the reference to the old one was used.

If that is clear does anyone know of anything that uses this sort of pattern? I have not been able to find anything that matches this but I cannot be the first person to attempt a system like this. I’m not tied to any particular way of doing this – the only thing I would like is to not have to block starting and stopping to the caller.

Country Blocking

I use a Meraki firewall and want to block outside attack attempts. Is there a list of countries that are known to be malicious? I want to load them into the system and GEO block them. I know that some legitimate sites have hosting in another country. Can this pose an issue? Any suggestions would be highly appreciated. I want to ensure we have a secure outside perimeter.

Reroute or blocking ip addresse

So i have been reading answers from this site for years now never signed up cause i always found the answer to my questions Today i signed up and i need you experts help There is an ip that connects to my phone (galaxy note 5 running android 7.0) and collects too much data i don’t like it but blocking it with host or router doesn’t work I need to block or at least reroute it so it won’t collect my data Any advice? The ip is 182.254.116.117

Blocking recurring meetings for Room Mailbox

we’d like to block users from scheduling recurring meeting a room mailbox. All of our room/equipment mailboxes are locked down to 1080 days already.

room mailbox is configured with the following settings:

PSShowComputerName                  : False AutomateProcessing                  : AutoAccept AllowConflicts                      : False BookingWindowInDays                 : 1080 MaximumDurationInMinutes            : 1440 AllowRecurringMeetings              : True EnforceSchedulingHorizon            : True ScheduleOnlyDuringWorkHours         : True ConflictPercentageAllowed           : 0 MaximumConflictInstances            : 0 ForwardRequestsToDelegates          : True DeleteAttachments                   : True DeleteComments                      : True RemovePrivateProperty               : True DeleteSubject                       : False AddOrganizerToSubject               : False DeleteNonCalendarItems              : True TentativePendingApproval            : True EnableResponseDetails               : True OrganizerInfo                       : True ResourceDelegates                   :  RequestOutOfPolicy                  : {} AllRequestOutOfPolicy               : False BookInPolicy                        : {} AllBookInPolicy                     : True RequestInPolicy                     : {} AllRequestInPolicy                  : False AddAdditionalResponse               : False AdditionalResponse                  : RemoveOldMeetingMessages            : True AddNewRequestsTentatively           : True ProcessExternalMeetingMessages      : False RemoveForwardedMeetingNotifications : False 

Modsecurity blocking WordPress

Hey i am getting 403 Forbidden when i go to plugin options. Server : Apache2 (Ondrej) PHP : 7.3-fpm

Error :

Forbidden You don’t have permission to access /wp-admin/options-general.php on this server.

VH Config :

ServerAdmin mail@mywebsite.com DocumentRoot /var/www/mywebsite.com/html ServerName mywebsite.com ServerAlias http://www.mywebsite.com  <Directory /var/www/mywebsite.com/html/> Options +FollowSymlinks AllowOverride All Require all granted </Directory>  ErrorLog $  {APACHE_LOG_DIR}/error.log CustomLog $  {APACHE_LOG_DIR}/access.log combined 

Followed tutorial : Link

Postfix – blocking by From rather than sender

I have a ton of incoming spam that masquerades as being sent by me, but has a sender at some arbitrary spammer domain. e.g.

Return-Path: <admin@aiuw.com> ... (stuff elided, etc.) Received: from [static-93.0.72.177-ttvi.com.br] (unknown [177.72.0.158])     (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))     (No client certificate requested)     (Authenticated sender: admin@aiuw.com)     by Server22.lejj.com (Postfix) with ESMTPSA id B527943151 ... To: iain@example.com From: <iain@example.com> 

The sender to postfix is admin@aiuw.com, but by the time it’s handed off to Cyrus-IMAP, it appears to be sent by me, and that means it’s deposited into my recognized sender inbox.

I’d like to block all incoming mail from my domain (outgoing uses TLS + SMTP AUTH, and bypasses the checks, so I’m not worried about blocking myself), but since the sender address is not from my domain, I can’t do that using sender rejection rules or SPF – these act on aiuw.com, not example.com.

I’m guessing there’s no way to make Postfix handle the From line as part of the envelope information. Is that right, or am I missing something?

If not, what about a filter between Postfix and Cyrus-IMAP that could capture both the sender and From addresses and reject mismatches? Or, finally, a way of checking the sender address in a Sieve script, though I think that would get ugly quickly.

Apologies if this is a duplicate. I found several hits, but everything I saw was based on envelope sender, not From.

Netflix Blocking VPN

It is a bad news for all Netflix users that Netflix is blocking VPN. Netflix US has richer library than other Netflix. Now users from outside US can't access Netflix. One of my friends suggest me to use https://www.hide-my-ip.com/ VPN. He told me that it is working perfectly. Anyone using this VPN?

Snort – blocking websites with a specific string

I have the following snort rule based on my PCAP file in Wireshark. I want to block everything to and from any URL that has a specific string in it. In this case, the string is ABC123DEF456

drop udp any any <> any any (msg:"No access"; pcre:"/\bABC123DEF456\b"; sid: 100003; rev:3;) 

Also tried

drop udp any any <> any any (msg:"No access"; pcre:"(.*ABC123DEF456.*)"; sid: 100003; rev:3;) 

Wireshark tells me the protocol is DNS. However, it doesn’t seem to drop anything.

Is the rule written properly?

Thanks

OpenVPN Tunnel blocking inbound web connections

I have a server running a OpenVPN client to route all internet traffic via the VPN.

I have excluded the local subnet from the tunnel and this is all working well so far.

The server also has a webserver running, which is publicly accessible using port forwarding from my router.

The web server is only working when the VPN client is stopped. I assume when the vpn is open the packets to respond are being sent back over the VPN link, rather than back to the router.

Question: is it possible to prevent this?

I’m running Ubuntu Server 18.04.

Thanks