/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to plugins.d/mandos-client.c

  • Committer: Teddy Hogeborn
  • Date: 2017-08-20 14:14:14 UTC
  • Revision ID: teddy@recompile.se-20170820141414-m034xuebg7ccaeui
Add some more restrictions to the systemd service file.

* mandos.service ([Service]/ProtectKernelTunables): New; set to "yes".
  ([Service]/ProtectControlGroups): - '' -

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
 * "browse_callback", and parts of "main".
10
10
 * 
11
11
 * Everything else is
12
 
 * Copyright © 2008-2016 Teddy Hogeborn
13
 
 * Copyright © 2008-2016 Björn Påhlsson
 
12
 * Copyright © 2008-2017 Teddy Hogeborn
 
13
 * Copyright © 2008-2017 Björn Påhlsson
14
14
 * 
15
15
 * This program is free software: you can redistribute it and/or
16
16
 * modify it under the terms of the GNU General Public License as
47
47
                                   strtof(), abort() */
48
48
#include <stdbool.h>            /* bool, false, true */
49
49
#include <string.h>             /* strcmp(), strlen(), strerror(),
50
 
                                   asprintf(), strncpy() */
 
50
                                   asprintf(), strncpy(), strsignal()
 
51
                                */
51
52
#include <sys/ioctl.h>          /* ioctl */
52
53
#include <sys/types.h>          /* socket(), inet_pton(), sockaddr,
53
54
                                   sockaddr_in6, PF_INET6,
625
626
                     safer_gnutls_strerror(ret));
626
627
        dhparamsfilename = NULL;
627
628
      }
 
629
      free(params.data);
628
630
    } while(false);
629
631
  }
630
632
  if(dhparamsfilename == NULL){
1077
1079
    bool match = false;
1078
1080
    {
1079
1081
      char *interface = NULL;
1080
 
      while((interface=argz_next(mc->interfaces, mc->interfaces_size,
1081
 
                                 interface))){
 
1082
      while((interface = argz_next(mc->interfaces,
 
1083
                                   mc->interfaces_size,
 
1084
                                   interface))){
1082
1085
        if(if_nametoindex(interface) == (unsigned int)if_index){
1083
1086
          match = true;
1084
1087
          break;
1491
1494
  return retval;
1492
1495
}
1493
1496
 
1494
 
__attribute__((nonnull))
1495
1497
static void resolve_callback(AvahiSServiceResolver *r,
1496
1498
                             AvahiIfIndex interface,
1497
1499
                             AvahiProtocol proto,
2194
2196
  
2195
2197
  /* Sleep checking until interface is running.
2196
2198
     Check every 0.25s, up to total time of delay */
2197
 
  for(int i=0; i < delay * 4; i++){
 
2199
  for(int i = 0; i < delay * 4; i++){
2198
2200
    if(interface_is_running(interface)){
2199
2201
      break;
2200
2202
    }
2957
2959
 end:
2958
2960
  
2959
2961
  if(debug){
2960
 
    fprintf_plus(stderr, "%s exiting\n", argv[0]);
 
2962
    if(signal_received){
 
2963
      fprintf_plus(stderr, "%s exiting due to signal %d: %s\n",
 
2964
                   argv[0], signal_received,
 
2965
                   strsignal(signal_received));
 
2966
    } else {
 
2967
      fprintf_plus(stderr, "%s exiting\n", argv[0]);
 
2968
    }
2961
2969
  }
2962
2970
  
2963
2971
  /* Cleanup things */
3015
3023
      /* Take down the network interfaces which were brought up */
3016
3024
      {
3017
3025
        char *interface = NULL;
3018
 
        while((interface=argz_next(interfaces_to_take_down,
3019
 
                                   interfaces_to_take_down_size,
3020
 
                                   interface))){
 
3026
        while((interface = argz_next(interfaces_to_take_down,
 
3027
                                     interfaces_to_take_down_size,
 
3028
                                     interface))){
3021
3029
          ret = take_down_interface(interface);
3022
3030
          if(ret != 0){
3023
3031
            errno = ret;