Worth it? Auto start/stop services and change iptables rules

I have recently set up a crontab to start/stop services based on my schedule, such as when I'll be home or away. I intend to only have a service running when I'll probably use it.
I also integrated rules for iptables into the start/stop of the services (systemd), so they automatically modify rules to accept/reject on their ports when the services start/stop.
I am behind a router, so I only forward outside ports I use like ssh (which is not on port 22). I manually forward ports, but am looking at UPnP. This is my home network so I should be able to trust the devices on it.
Now, to my question. Is it worth the time and effort to set this up? Would it be fine to just enable the services I use, let them run and always have firewall ports open for them? I feel like it's good to limit the time that ssh is running, but what about services not open to the Internet? Resources aren't really an issue. What do you guys think?
I enjoyed learning about systemd, iptables, and cron in the process of setting it up. I'd just like to also learn about how much benefit there actually is, or if anyone has other ideas. Or if it's something that could go on the wiki (not really cron, but maybe the iptables/systemd stuff).

I'd say, if resources aren't an issue; why limit the time ssh is reachable from the outside? You should have PasswordAuthentication and RootLogin disabled anyway so your vulnerability doesn't really decrease by updating iptables? This script probably works fine until you forget about it and it makes a boo-boo; making your machine unreachable.

Similar Messages

  • Problem with auto start-stop script

    Hi to All,
    Logged as root. I have create in /etc/rc.d/init.d this file and saved as dbora (Oracle Linux 5.4):
    +#!/bin/sh+
    +# chkconfig: 345 99 10+
    +# description: Oracle auto start-stop script.+
    +#+
    +# Set ORA_HOME to be equivalent to the $ORACLE_HOME+
    +# from which you wish to execute dbstart and dbshut;+
    +#+
    +# Set ORA_OWNER to the user id of the owner of the+
    +# Oracle database in ORA_HOME.+
    ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
    ORA_OWNER=oracle
    +if [ ! -f $ORA_HOME/bin/dbstart ]+
    then
    echo "Oracle startup: cannot start"
    exit
    fi
    case "$1" in
    +'start')+
    +# Start the Oracle databases:+
    +# The following command assumes that the oracle login+
    +# will not prompt the user for any values+
    su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"
    touch /var/lock/subsys/dbora
    +;;+
    +'stop')+
    +# Stop the Oracle databases:+
    +# The following command assumes that the oracle login+
    +# will not prompt the user for any values+
    su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"
    rm -f /var/lock/subsys/dbora
    +;;+
    esac
    After creation I have execute:
    *#chmod 750 /etc/rc.d/init.d/dbora*
    *#chkconfig --add /etc/rc.d/init.d/dbora*
    The last command return this message:
    +"service dbora does not support chkconfig"+.
    Can You help me? Have You an idea ?
    Thank You and best regards
    Gaetano

    sb92075 wrote:
    Oracle RDBMS needs to be started by process running at OS level as owner of Oracle software; typically OS user "oracle" & not as ROOT!Ok,
    But I have founded this script at [http://www.oracle-base.com/articles/linux/AutomatingDatabaseStartupAndShutdownOnLinux.php].
    The article report:
    Article
    When using RAC or ASM under Oracle 10g Release 2 or above, the Oracle Clusterware automatically starts and stops the Oracle database instances, so the following procedures are not necessary. For all other cases, you can use the methods described below.I must suppose, that the author has written an incorrect article?
    Best Regards
    Gaetano

  • Auto Start/Stop Oracle Database Lintener DBConslone on Linux

    Dear all
    I have install oracle 10.2.0 on redhat 4.7 every time i have to start manualy.
    it try with following scrip / process but database not starting automatically.
    Please any one can provide steps for auto start and stop oracel services on RedHat 4.7
    Once the instance is created, edit the "/etc/oratab" file setting the restart flag for each instance to 'Y'.
    TSH1:/u01/app/oracle/product/10.2.0:Y
    Next, create a file called "/etc/init.d/dbora" as the root user, containing the following.
    #!/bin/bash
    #chkconfig: 345 95 10
    #description: init script to start/stop oracle database 10g, TNS listener, EMS and isqlplus
    case $1 in
         start)
         su - oracle -c 'lsnrctl start'
         su - oracle -c 'dbstart'
    su - ora10g -c 'isqlplusctl start'
         su - oracle -c 'emctl start dbconsole'
         stop)
    su - oracle -c 'emctl stop dbconsole'
         su - oracle -c 'isqlplusctl stop'
    su - oracle -c 'dbshut'
    su - oracle -c 'lsnrctl stop'
         restart)
    su - oracle -c 'emctl stop dbconsole'
         su - oracle -c 'isqlplusctl stop'
    su - oracle -c 'dbshut'
    su - oracle -c 'lsnrctl stop'
         su - oracle -c 'lsnrctl start'
         su - oracle -c 'dbstart'
    su - ora10g -c 'isqlplusctl start'
         su - oracle -c 'emctl start dbconsole'
    esac
    create service on linux
    Actions >> System Settings >> Server Settings >> Services Then
    Actions >> Add Service Then
    Service Name = dbora Then Press Ok
    chmod a+x /etc/init.d/dbora
    Check is it running this service properly
    service dbora stop
    service dbora start
    showing error
    :bad interperter : no such file or directory
    Please forward me process/steps for auto start/stop oracel services

    :bad interperter : no such file or directorymeans that it could not find the interpreter which should be used to interpret the script.
    most probably this is caused by the shebang (#!/bin/bash)
    the default location of bash on RHEL (OEL/CentOS) is /bin/bash, which means that the shebang looks correct.
    can you make the shebang:
    #!/bin/bash -xso shelltracing is put on and execute script again?
    this will make clear if it is the shebang in your script, or in another script.

  • Auto start-stop script

    Hi to All,
    I have create as root in /etc/init.d the file dbora:
    +#!/bin/sh+
    +# chkconfig: 345 99 10+
    +# description: Oracle auto start-stop script.+
    +#+
    +# Set ORA_HOME to be equivalent to the $ORACLE_HOME+
    +# from which you wish to execute dbstart and dbshut;+
    +#+
    +# Set ORA_OWNER to the user id of the owner of the+
    +# Oracle database in ORA_HOME.+
    ORA_HOME=/u01/app/oracle/product/10.2.0/db_1
    ORA_OWNER=oracle
    +if [ ! -f $ORA_HOME/bin/dbstart ]+
    then
    echo "Oracle startup: cannot start"
    exit
    fi
    case "$1" in
    +'start')+
    +# Start the Oracle databases:+
    +# The following command assumes that the oracle login+
    +# will not prompt the user for any values+
    su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart $ORA_HOME"
    touch /var/lock/subsys/dbora
    +;;+
    +'stop')+
    +# Stop the Oracle databases:+
    +# The following command assumes that the oracle login+
    +# will not prompt the user for any values+
    su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut $ORA_HOME"
    rm -f /var/lock/subsys/dbora
    +;;+
    esac
    After I have execute:
    *#chmod 750 /etc/init.d/dbora*
    *# ln -s /etc/init.d/dbora /etc/rc.d/rc0.d/K01dbora*
    *# ln -s /etc/init.d/dbora /etc/rc.d/rc3.d/S99dbora*
    *# ln -s /etc/init.d/dbora /etc/rc.d/rc4.d/S99dbora*
    *# ln -s /etc/init.d/dbora /etc/rc.d/rc5.d/S99dbora*
    At last
    *#chkconfig --add /etc/init.d/dbora*
    This message is returned
    dbora service don't support chkconfig.+
    Have You an idea ?
    Thank You and best regards
    Gaetano

    Solved !
    I have inserted a space before chkconfig and description in the script:
    Incorrect Code:
    #!/bin/sh
    # chkconfig: 345 99 10
    # description: Oracle auto start-stop script.
    This is the correct code
    #!/bin/sh
    #chkconfig: 345 99 10
    #description: Oracle auto start-stop script.Bye
    Gaetano

  • BI server start/stop services

    Hi,
    We have OBIEE installed on a unix server. Previoulsy I worked on OBIEE on windows server and would go to services and start/stop services. My question is if we modify the rpd and ftp it to unix server, do we have to stop and start the BI server for the modified rpd to work. Is it mandatory to stop the BI server, ftp the rpd and then start BI server again. Or if we do not stop the BI server and just do Refresh matadata from Answers..will this work? Thanks.

    Hi User,
    You should restart the services if u ftping the rpd to unix means deploying the rpd to effect the changes
    When comes to refresh metadata this ll work in case when the rpd opened in online mode and some one has made changes to get the available changes u have to do "Refresh Metadata"
    Thanks,
    Saichand.v

  • Auto start bi services on reboot

    Any suggestions on the best way to auto start the BI services like OC4J, SAW, SA, Scheduler using scripting when the server is reboot? Maybe include a delay between each and check each service is up.
    /apps/OracleBI/setup/
    nohup ./oc4j -start > nohup_oc4j_start.out &
    ./run-sa.sh start
    ./run-saw.sh start
    ./run-sch.sh start
    Thanks for the help!!

    Hi,
    Have a look at the following threads.
    Autostart of Services
    Re: Autostart of Services
    Auto Start Oracle Services didn't work
    Re: Auto Start Oracle Services didn't work
    Regards,
    Hussein

  • I can browse the web but when I go to play video or you tube it will start stop over and over almost like it is buffering could this be the router all other non iPad devices work

    I can browse the web but when I go to play video or you tube it will start stop over and over almost like it is buffering could this be the router all other non iPad devices work

    How are you trying to play them, in the iTunes store or the Music and Videos apps ? Downloaded and synced music and videos should be in the Music and Videos apps, and you can stop content that is only in the cloud from showing in them via Settings > iTunes & App Store > Music and Videos 'off' (under the 'show all' heading).
    If you don't have your music and films/TV shows in those two apps then you should be able to download them into those apps via the Purchased tab in the iTunes store app.

  • Auto start BI Services for OBIEE 11G

    Hi,
    We have installed OBIEE 11.1.1.7 on Windows 2008 64 bit operating system and we have restarted the server after successful install.
    Now the issue is OBIEE is not accessible after reboot,it is running only if i run the Start BI Services under All Programs --> Oracle Business Intelligence --> Start BI Services and
    this not accessible once i log off from the server.
    I don't want very time login and start the obiee using all programs,instead i want to install a Windows service that will all run the BI Services,so that Users can access the OBIEE independent of
    my login.
    I tried many times installing the services for  Admin and BI Server but even though the services are install/running successfully,but still not able to access the OBIEE URL.
    https://blogs.oracle.com/pa/entry/obiee_11_1_1_how3
    http://gerardnico.com/wiki/dat/obiee/windows_service_11g
    Service have been installed but not able to access the OBIEE..
    What i am missing ....
    Thanks in advance...

    Hey Archie,
    Refer to these threads once:
    regarding the coreapplication_obips1  service OBIEE 11g
    Re: OBIEE 11g Cluster Controller Failed to start
    Re: getting OPMN error while starting Oracle SOA Suite ( This is not related to OBIEE, but you still might find something useful )
    Regards,
    -Amith.

  • How we can control auto start/stop of db/listener on Unix/linux?

    How we can control auto start/stop of db/listener on Unix/linux?

    http://download-uk.oracle.com/docs/html/B10812_01/chapter2.htm#BABGDGHF

  • Service start stop scripts and Nagios scripts

    Hello. Are there some "official" service start stop scripts somewhere? And: Has somebody already written a Nagios monitoring script for Oracle NoSQL? Thanks, Jesus.

    Hi. Yes, but I mean something like service kvclient start / stop / restart / status, and using e.g. daemon without nohup. Of course one can be written, e.g. I have a simple one based on a script I found in internet long time ago for Cassandra, but then by Murphy's Law you will probably have an "official" one in the .124 version : - ).

  • Windows Server 2008 - Group policy for domain client to start/stop services installed on it

    Hello Experts
    I am a newbie to windows server administration , though did a Google  , but ended up with these question with my requirements
    I have created a new domain and 2 client/computer (A & B namely) to domain . Now A & B has tomcat server running with port 8080 , 9090 which i have installed
    domain ADMIN account .
    && now i am want to start/stop/restart services enabled for domain users  !! How do i achieve this !!
    basic question : How can i access A & B tomcat services on DOMAIN CONTROLLER server to create a GPO and that are on (A & B)
    what is the easiest way to achieve the same , (if not using GPO)???
    similarly I am looking for many features : where I want to control the permission to user on (A & B ) like : If the binaries of tomcat is available on machine say : A , if the user can install (now
    it ask for ADMIN credentials) 
    Thanks
    Mike~Ed

    Controlling services with Group Policy is done under Computer Configuration\Policies\Windows Settings\Security Settings\System Services.
    The limitation is that system services can only see the services the computer running the Group Policy management console. To access other services, you will either need to create the services on your computer (install the software the adds the service)
    or install the remote server administration toolkit (RSAT) on the computer with the service already on it.
    If my answer helped you, check out my blog:
    Deploy Happiness

  • Using non-administrator user to start/stop services

    We have Crystal Report Server (BOE XI) running on Windows platform.
    Our customer's policy dictates that operator ID are to be use to manage starting/stopping of Crytal Report Server. The operator ID has no administrator rights and it has no access to the Microsoft Management Console.
    Would it be possible to use non-administrator ID to start/stop Crystal Report Server services? Appreciate if anyone could share on the configuration.
    Thank you.

    salafrance wrote:A simple way would be to write a small C program to run systemctl setuid root.
    So perhaps like this?
    #include <stdlib.h>
    #include <unistd.h>
    int main(void)
    execl("/usr/bin/systemctl", "systemctl", "start", "calibre", NULL);
    return(EXIT_SUCCESS);
    compiled it, then "chown root:root test", "chmod u+s test" and it worked.
    But is this safe? I have absolutely no knowledge about potential security issues...
    I also have thought about periodically restarting calibre, but on the Raspberry Pi, with it's slow ARM, the start takes ages and the processor is completely busy with that task for some minutes.
    And that's the reason why I also want to avoid starting an entire second systemd session... Or is this not that resource intensive?

  • Start/stop service log for workgoup server

    customer would like to know who start or stop the service on workgroup server.
    But we could not find such log. Is there any way to see this information?

    This one may help.
    http://windowsitpro.com/systems-management/access-denied-auditing-users-who-might-be-starting-and-stopping-services
    Regards, Dave Patrick ....
    Microsoft Certified Professional
    Microsoft MVP [Windows]
    Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.

  • Start/Stop Buttons and infinite loop exit

    I am trying to make a GUI with a Start/Stop and an Exit button. Initially the button will have the label "Start". When i push it, its label should become "Stop" and an infinite loop function will begin. I want the loop to run until i press the Stop or Exit button.
    The problem is that when the loop starts i can't press neither of the buttons. The "Start" button changes its label into "Stop" only if i make the loop finite and it ends.
    Here is the source:
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    public class StartStopButtons extends JFrame{
        Component visualComponent = null;
        JPanel panel = null;
        JLabel statusBar = null;
         public StartStopButtons() {
              setSize(160, 70);
              getContentPane().setLayout(new BorderLayout());
            panel = new JPanel();
            panel.setLayout(new BorderLayout());
            getContentPane().add(panel, BorderLayout.CENTER);
            final JPanel panel_1 = new JPanel();
            panel.add(panel_1, BorderLayout.CENTER);
            final JButton startButton = new JButton();
            startButton.addActionListener(new ActionListener() {
                 public void actionPerformed(final ActionEvent e) {
                    String action = e.getActionCommand();
                    if (action.equals("Start")) {
                         System.out.println("Start Loop");
                         startButton.setText("Stop");
                         myLoop ();
                    if (action.equals("Stop")) {
                         System.out.println("Stop Loop");
                         System.exit(0);
            startButton.setText("Start");
            panel_1.add(startButton);
            final JButton exitButton = new JButton();
            exitButton.addActionListener(new ActionListener() {
                 public void actionPerformed(final ActionEvent e) {
                    String action = e.getActionCommand();
                    if (action.equals("Exit")) {
                        System.exit(0);
            panel_1.add(exitButton);
            exitButton.setText("Exit");
         public void myLoop() {
              for (int i = 0; ; i++)
                   System.out.println(i);
         public static void main(String[] args) {
              StartStopButtons ssB = new StartStopButtons();
              ssB.setVisible(true);
    }

    I works just fine. Here is the source and thanks for the help.
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.UIManager;
    public class StartStopButtons extends JFrame implements ActionListener, Runnable{
        Component visualComponent = null;
        JPanel panel = null;
        JLabel statusBar = null;
        Thread thread;
        JButton startButton;
         public StartStopButtons() {
            try {
                UIManager.setLookAndFeel(
                    UIManager.getSystemLookAndFeelClassName());
            } catch(Exception e) {}
              setSize(160, 70);
              getContentPane().setLayout(new BorderLayout());
            panel = new JPanel();
            panel.setLayout(new BorderLayout());
            getContentPane().add(panel, BorderLayout.CENTER);
            final JPanel panel_1 = new JPanel();
            panel.add(panel_1, BorderLayout.CENTER);
            startButton = new JButton();
            startButton.addActionListener(this);
            startButton.setText("Start");
            panel_1.add(startButton);
            final JButton exitButton = new JButton();
            exitButton.addActionListener(new ActionListener() {
                 public void actionPerformed(final ActionEvent e) {
                    String action = e.getActionCommand();
                    if (action.equals("Exit")) {
                        System.exit(0);
            panel_1.add(exitButton);
            exitButton.setText("Exit");
         public void actionPerformed(ActionEvent e) {
              String action = e.getActionCommand();
              if (action.equals("Start")) {
                   startButton.setText("Stop");
                   thread = new Thread( this );
                   thread.start();
              if (action.equals("Stop")) {
                System.exit(0);
         public void run() {
              myLoop();
         public void myLoop() {
              for (int i = 0; ; i++)
                   System.out.println(i);
         public static void main(String[] args) {
              StartStopButtons ssB = new StartStopButtons();
              ssB.setVisible(true);
    }

  • Starting/Stopping iAS and OC4J containers

    I created the following two batch files to start and stop my iAS Infrastructure. I found that if I used the services settings of automatic all did not go well.
    start.bat:
    @ECHO OFF
    cls
    ECHO About to start the listener
    net start Oracle9ias_InfraTNSListener
    ECHO About to start the database
    net start OracleServiceIASDB
    ECHO About to start the OID monitor
    e:\ora9iasinfra\bin\oidmon start
    ECHO About to start the OID server
    e:\ora9iasinfra\bin\oidctl server=oidldapd configset=0 instance=1 start
    ECHO About to start the website
    net start Oracle9ias_infraEMWebsite
    ECHO About to start opmn and OC4j
    e:\ora9iasinfra\dcm\bin\dcmctl start -ct ohs
    e:\ora9iasinfra\dcm\bin\dcmctl start -co OC4J_DAS
    stop.bat:
    @echo off
    ECHO About to stop the website
    net stop Oracle9ias_infraEMWebsite
    ECHO About to stop opmn and OC4j
    e:\ora9iasinfra\dcm\bin\dcmctl shutdown
    ECHO About to stop the OID server
    e:\ora9iasinfra\bin\oidctl server=oidldapd configset=0 instance=1 stop
    ECHO About to stop the OID monitor
    e:\ora9iasinfra\bin\oidmon stop
    ECHO About to stop the database
    net stop OracleServiceIASDB
    ECHO About to stop the listener
    net stop Oracle9ias_InfraTNSListener
    When I execute the batch files sometimes they work and sometimes they don't, for example after starting occasionally the Apache process has not been created, and sometimes processes won't stop.
    However if I enter each command seperatly all works OK. Can anyone suggest a reason for this. Also after starting the website manager the process manager for both the infra and ias are started (I have both installed on the same machine - this works fine apart from this batch file problem.
    Terry Bennett

    Terry -- You will probably have better luck on the General Oracle9iAS forum at:
    http://forums.oracle.com/forums/forum.jsp?id=466592
    Thanks -- Jeff

Maybe you are looking for

  • Trouble upgrading to gtk2-2.6.0

    Hallo, i had just upgraded libglade and gtk2, during the installation i've had this error: Targets: gtk2-2.6.0-1 Total Package Size: 6.7 MB Proceed with upgrade? [Y/n] checking package integrity... done. loading package data... done. checking for fil

  • Windows 7 64-bit: Switchable graphics and Ricoh card reader problem

    Hi guys, Two problems with my laptop. I'm using a T400, previously installed with Windows Vista Business 32-bit. Switchable graphics worked well until I formatted and installed Windows 7 Pro 64-bit (I got the RTM through MSDNAA). Now, Windows can onl

  • How to edit cell in a Data Grid

    Hai     I have pasted the mxml below.    I need how to edit a cell in a datagrid.   1. Run the mxml, enter the values in the textbox and click add button.   2. then click AND button, now u can see the values displayed in the grid. 3. Then again chang

  • Crash when opening Yosemite OSx installer and Adobe Bridge and Photoshop CS6

    Hi, I'm having increasing problems with my Mac Book Pro. It crashes when opening Adobe Bridge CS6, Photoshop CS6 and now when trying to install the Yosemite operating system.  There is no error code associated with the crash but the error report is b

  • Problem calling webservice through Webdynpro

    Hi, I have created a webservice model for BAPI_ALM_CONF_CREATE in webdynpro. The execution of the webservice is working fine and the confirmation is done, but the response from the webservice is coming blank. I need the confirmation number and count